Merge tag 'v7.6' into my-changes-rebased

This commit is contained in:
Suzanne Soy 2021-07-06 03:07:11 +01:00
commit a7a8bcd015
32 changed files with 1783 additions and 1669 deletions

10
LICENSE Normal file
View File

@ -0,0 +1,10 @@
This component of Racket is distributed under the under the Apache 2.0
and MIT licenses. The user can choose the license under which they
will be using the software. There may be other licenses within the
distribution with which the user must also comply.
See the files
https://github.com/racket/racket/blob/master/racket/src/LICENSE-APACHE.txt
and
https://github.com/racket/racket/blob/master/racket/src/LICENSE-MIT.txt
for the full text of the licenses.

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# scribble-text-lib
This the source for the Racket packages: "scribble", "scribble-doc", "scribble-html-lib", "scribble-lib", "scribble-test", "scribble-text-lib".
### Contributing
Contribute to Racket by submitting a [pull request], reporting an
[issue], joining the [development mailing list], or visiting the
IRC or Slack channels.
### License
Racket, including these packages, is free software, see [LICENSE]
for more details.
By making a contribution, you are agreeing that your contribution
is licensed under the [Apache 2.0] license and the [MIT] license.
[MIT]: https://github.com/racket/racket/blob/master/racket/src/LICENSE-MIT.txt
[Apache 2.0]: https://www.apache.org/licenses/LICENSE-2.0.txt
[pull request]: https://github.com/racket/scribble-text-lib/pulls
[issue]: https://github.com/racket/scribble-text-lib/issues
[development mailing list]: https://lists.racket-lang.org
[LICENSE]: LICENSE

View File

@ -1,11 +0,0 @@
scribble-doc
Copyright (c) 2010-2014 PLT Design Inc.
This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary
applications, provided you follow the rules stated in the LGPL. You
can also modify this package; if you distribute a modified version,
you must distribute it under the terms of the LGPL, which in
particular means that you must release the source code for the
modified software. See http://www.gnu.org/copyleft/lesser.html
for more information.

View File

@ -467,7 +467,9 @@ gets progressively smaller.}
gets progressively larger.}
@defproc[(emph [pre-content pre-content?] ...) element?]{
The same as @racket[italic].}
Like @racket[elem], but emphasised. Typically, italics are used for
emphasis. Uses of @racket[emph] can be nested; typically this causes
the text to alternate between italic and upright.}
@defproc[(literal [str string?] ...+) element?]{

View File

@ -332,7 +332,7 @@ The style classes:
[@css{versionbox} @elem{Outer wrapper for version}]
[@css{version} @elem{Inner wrapper for version in the case of search box and/or navigation.}]
[@css{versionNoNav} @elem{Inner wrapper for version in the acse of no search box and navigation.}]
[@css{versionNoNav} @elem{Inner wrapper for version in the case of no search box and navigation.}]
[@spacer @spacer]

View File

@ -441,6 +441,14 @@ The recognized @tech{style properties} are as follows:
listing except when those sub-parts are top-level entries in
the listing.}
@item{@indexed-racket['no-toc+aux] --- As a @tech{style property} for
the main part of a rendered page, causes the HTML output to not
include a margin box for the main table of contents, ``on this
page'', or tables with the @racket['aux] style property. The
@racket['no-toc+aux] property effectively implies
@racket['no-toc] and @racket['no-sidebar], but also suppresses
@racket['aux] tables.}
@item{@indexed-racket['no-toc] --- As a @tech{style property} for the main part of a
rendered page, causes the HTML output to not include a margin box
for the main table of contents; the ``on this page'' box that
@ -541,7 +549,8 @@ sub-parts).
The @racket[parts] field contains sub-parts.
@history[#:changed "1.25" @elem{Added @racket['no-index] support.}
#:changed "1.26" @elem{Added @racket[link-render-style] support.}]}
#:changed "1.26" @elem{Added @racket[link-render-style] support.}
#:changed "1.27" @elem{Added @racket['no-toc+aux] support.}]}
@defstruct[paragraph ([style style?] [content content?])]{
@ -590,10 +599,6 @@ The currently recognized @tech{style properties} are as follows:
@item{@racket[attributes] structure --- Provides additional HTML
attributes for the @tt{<p>}, @tt{<div>}, or alternate tag.}
@item{@racket[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<p>}, @tt{<div>}, or
alternate tag.}
@item{@indexed-racket['never-indents] --- For Latex and @tech{compound
paragraphs}; see @racket[compound-paragraph].}
@ -649,9 +654,6 @@ The following @tech{style properties} are currently recognized:
@item{@racket[attributes] structure --- Provides additional HTML
attributes for the @tt{<table>} tag.}
@item{@racket[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<table>} tag.}
@item{@indexed-racket['aux] --- For HTML, include the table in the
table-of-contents display for the enclosing part.}
@ -698,9 +700,6 @@ The following @tech{style properties} are currently recognized:
@item{@racket[attributes] structure --- Provides additional HTML
attributes for the @tt{<ul>} or @tt{<ol>} tag.}
@item{@racket[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<ul>} or @tt{<ol>} tag.}
@item{@indexed-racket['never-indents] --- For Latex and @tech{compound
paragraphs}; see @racket[compound-paragraph].}
@ -749,9 +748,6 @@ The following @tech{style properties} are currently recognized:
@item{@racket[attributes] structure --- Provides additional HTML
attributes for the @tt{<blockquote>} tag.}
@item{@racket[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<blockquote>} tag.}
@item{@indexed-racket['never-indents] --- For Latex and @tech{compound
paragraphs}; see @racket[compound-paragraph].}
@ -802,9 +798,6 @@ for Latex output (see @secref["extra-style"]). The following
@item{@racket[attributes] structure --- Provides additional HTML
attributes for the @tt{<p>} or alternate tag.}
@item{@racket[body-id] structure --- For HTML, uses the given string
as an @tt{id} attribute of the @tt{<p>} or alternate tag.}
@item{@indexed-racket['never-indents] --- For Latex within another
@tech{compound paragraph}; see above.}
@ -914,9 +907,6 @@ The following @tech{style properties} are currently recognized:
@item{@racket[xexpr-property] structure --- For HTML, supplies literal
HTML to render before and after @racket[content].}
@item{@racket[body-id] structure --- For HTML uses the given
string as an @tt{id} attribute of the @tt{<span>} tag.}
@item{@indexed-racket['aux] --- Intended for use in titles, where the
auxiliary part of the title can be omitted in hyperlinks. See,
for example, @racket[secref].}
@ -1818,7 +1808,7 @@ Like @racket[css-style-addition], but for a JavaScript file instead of a CSS fil
@defstruct[body-id ([value string?])]{
Used as a @tech{style property} to associate an @tt{id} attribute with
an HTML tag.}
an HTML tag within a main @racket[part].}
@defstruct[document-source ([module-path module-path?])]{
@ -1958,7 +1948,7 @@ arguments to the element's command in Latex output.}
@defstruct[command-optional ([arguments (listof string?)])]{
Used as a @tech{style property} on a @racket[element] to add
a optional arguments to the element's command in Latex output.
optional arguments to the element's command in Latex output.
@history[#:added "1.20"]
}

View File

@ -1714,9 +1714,8 @@ Typesets the given combination of a GUI's menu and item name.}
@tech{decode}d @racket[pre-content] as a file name (e.g., in
typewriter font and in quotes).}
@defproc[(exec [pre-content pre-content?] ...) element?]{Typesets the
@tech{decode}d @racket[pre-content] as a command line (e.g., in
typewriter font).}
@defproc[(exec [content content?] ...) element?]{Typesets the
@racket[content] as a command line (e.g., in typewriter font).}
@defproc[(envvar [pre-content pre-content?] ...) element?]{Typesets the given
@tech{decode}d @racket[pre-content] as an environment variable (e.g.,
@ -2028,7 +2027,7 @@ that is hyperlinked to an explanation.}
@defthing[undefined-const element?]{Returns an element for @|undefined-const|.}
@defproc[(commandline [pre-content pre-content?] ...) paragraph?]{Produces
@defproc[(commandline [content content?] ...) paragraph?]{Produces
an inset command-line example (e.g., in typewriter font).}
@defproc[(inset-flow [pre-flow pre-flow?] ...) nested-flow?]{
@ -2201,7 +2200,7 @@ For HTML rendering:
@filepath{manual-style.css} from the @filepath{scribble}
collection in @racket[html-defaults].}
@item{The file @filepath{manual-files.css} from the
@item{The file @filepath{manual-fonts.css} from the
@filepath{scribble} collection is designated as an additional
accompanying file in @racket[html-defaults].}

View File

@ -607,6 +607,13 @@ Code blocks are marked using the
"Github convention"] @verbatim{```racket} so that they are lexed and
formatted as Racket code.}}
@defboolparam[current-markdown-link-sections enabled?]{
Determines whether section links within an output document are
rendered as a section link. The default is @racket[#f].
@history[#:added "1.31"]}
@; ----------------------------------------
@section{HTML Renderer}

View File

@ -1,5 +1,6 @@
#lang scribble/manual
@(require (for-label scribble/struct
@(require (for-label (only-in scribble/core content?)
scribble/struct
scriblib/autobib
scheme/base
scheme/contract))
@ -228,7 +229,7 @@ Both arguments are optional, but at least one must be supplied.}
Combines elements to generate an element that is suitable for
describing a technical report's location.}
@defproc[(dissertation-location [#:institution institution edition any/c]
@defproc[(dissertation-location [#:institution institution any/c]
[#:degree degree any/c "PhD"])
element?]{
@ -264,7 +265,7 @@ alphabetized appropriately. Any of @racket[name] or @racket[names]
that are strings are
parsed in the same way as by @racket[make-bib].}
@defproc[(org-author-name [name any/c]) element?]{
@defproc[(org-author-name [name (or/c element? string?)]) element?]{
Converts an element for an organization name to one suitable for use
as a bib-value author.}
@ -275,7 +276,7 @@ Generates an element that is suitable for use as a ``others'' author.
When combined with another author element via @racket[authors], the
one created by @racket[other-authors] renders as ``et al.''}
@defproc[(editor [name name/c]) element?]{
@defproc[(editor [name (or/c element? string?)]) element?]{
Takes an author-name element and create one that represents the editor
of a collection. If a @racket[name] is a string, it is parsed in the

View File

@ -1,11 +0,0 @@
scribble-text-lib
Copyright (c) 2010-2014 PLT Design Inc.
This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary
applications, provided you follow the rules stated in the LGPL. You
can also modify this package; if you distribute a modified version,
you must distribute it under the terms of the LGPL, which in
particular means that you must release the source code for the
modified software. See http://www.gnu.org/copyleft/lesser.html
for more information.

View File

@ -33,7 +33,7 @@
(let loop ([xs xs] [as '()])
(define a (and (pair? xs) (attribute->symbol (car xs))))
(cond [(not a) (values (reverse as) xs)]
[(null? (cdr xs)) (error 'attriubtes+body
[(null? (cdr xs)) (error 'attributes+body
"missing attribute value for `~s:'" a)]
[else (loop (cddr xs) (cons (cons a (cadr xs)) as))])))

View File

@ -1,11 +0,0 @@
scribble-lib
Copyright (c) 2010-2014 PLT Design Inc.
This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary
applications, provided you follow the rules stated in the LGPL. You
can also modify this package; if you distribute a modified version,
you must distribute it under the terms of the LGPL, which in
particular means that you must release the source code for the
modified software. See http://www.gnu.org/copyleft/lesser.html
for more information.

View File

@ -23,4 +23,4 @@
(define pkg-authors '(mflatt eli))
(define version "1.30")
(define version "1.32")

View File

@ -258,7 +258,7 @@
(make-element 'larger (decode-content str)))
(define (emph . str)
(make-element 'italic (decode-content str)))
(make-element 'emph (decode-content str)))
(define (tt . str)
(let* ([l (decode-content str)]

View File

@ -1,5 +1,6 @@
(module bnf racket
(require scribble/decode
#lang racket
(require scribble/decode
(except-in scribble/struct
element?)
(only-in scribble/core
@ -9,7 +10,7 @@
make-table-columns)
)
(provide (contract-out
(provide (contract-out
[BNF (-> (cons/c (or/c block? content?)
(non-empty-listof (or/c block? content?)))
...
@ -40,18 +41,18 @@
))
(define spacer (make-element 'hspace (list " ")))
(define equals (make-element 'tt (list spacer "::=" spacer)))
(define alt (make-element 'tt (list spacer spacer "|" spacer spacer)))
(define spacer (make-element 'hspace (list " ")))
(define equals (make-element 'tt (list spacer "::=" spacer)))
(define alt (make-element 'tt (list spacer spacer "|" spacer spacer)))
(define (as-flow i) (make-flow (list (if (block? i)
(define (as-flow i) (make-flow (list (if (block? i)
i
(make-paragraph (list i))))))
(define baseline (make-style #f '(baseline)))
(define baseline (make-style #f '(baseline)))
(define (BNF . defns)
(define (BNF . defns)
(make-table
(make-style #f
(list
@ -68,54 +69,54 @@
more-rhs))])
defns))))
;; interleave : (listof content?) element? -> element?
(define (interleave l spacer)
;; interleave : (listof content?) element? -> element?
(define (interleave l spacer)
(make-element #f (cons (car l)
(apply append
(map (lambda (i)
(list spacer i))
(cdr l))))))
(define (BNF-seq . l)
(define (BNF-seq . l)
(if (null? l)
""
(interleave l spacer)))
(define (BNF-seq-lines . l)
(define (BNF-seq-lines . l)
(make-table #f (map (lambda (row) (list (as-flow (apply BNF-seq row))))
l)))
(define (BNF-alt . l)
(define (BNF-alt . l)
(interleave l alt))
(define (BNF-alt/close . l)
(define (BNF-alt/close . l)
(interleave l (make-element 'roman " | ")))
(define BNF-etc (make-element 'roman "..."))
(define BNF-etc (make-element 'roman "..."))
(define (nonterm . s)
(define (nonterm . s)
(make-element 'roman (append (list 'lang)
(list (make-element 'italic (decode-content s)))
(list 'rang))))
(define (optional . s)
(define (optional . s)
(make-element #f (append (list (make-element 'roman "["))
(decode-content s)
(list (make-element 'roman "]")))))
(define (BNF-group . s)
(define (BNF-group . s)
(make-element #f (append (list (make-element 'roman "{"))
(list (apply BNF-seq (decode-content s)))
(list (make-element 'roman "}")))))
(define (kleenestar . s)
(define (kleenestar . s)
(make-element #f (append (decode-content s) (list (make-element 'roman "*")))))
(define (kleeneplus . s)
(define (kleeneplus . s)
(make-element #f (append (decode-content s) (list (make-element 'superscript (list "+"))))))
(define (kleenerange a b . s)
(define (kleenerange a b . s)
(make-element #f (append (decode-content s)
(list (make-element 'roman
(make-element 'superscript
(list (format "{~a,~a}" a b)))))))))
(list (format "{~a,~a}" a b))))))))

View File

@ -38,7 +38,7 @@
\renewcommand{\Ssubsubsubsectiongrouperstar}[1]{\setcounter{GrouperTemp}{\value{subsubsection}}\Ssubsubsectionstar{#1}\setcounter{subsubsection}{\value{GrouperTemp}}}
\renewcommand{\Ssubsubsubsubsectiongrouperstar}[1]{\Ssubsubsubsubsectionstar{#1}}
% To increments section numbers:
% To increment section numbers:
\renewcommand{\Sincpart}{\stepcounter{part}}
\renewcommand{\Sincsection}{\stepcounter{chapter}}
\renewcommand{\Sincsubsection}{\stepcounter{section}}

View File

@ -1,29 +1,30 @@
(module comment-reader scheme/base
(require (only-in racket/port peeking-input-port))
#lang scheme/base
(provide (rename-out [*read read]
(require (only-in racket/port peeking-input-port))
(provide (rename-out [*read read]
[*read-syntax read-syntax])
make-comment-readtable)
(define unsyntaxer (make-parameter 'unsyntax))
(define unsyntaxer (make-parameter 'unsyntax))
(define (*read [inp (current-input-port)])
(define (*read [inp (current-input-port)])
(parameterize ([unsyntaxer (read-unsyntaxer inp)]
[current-readtable (make-comment-readtable)])
(read/recursive inp)))
(define (*read-syntax src [port (current-input-port)])
(define (*read-syntax src [port (current-input-port)])
(parameterize ([unsyntaxer (read-unsyntaxer port)]
[current-readtable (make-comment-readtable)])
(read-syntax/recursive src port)))
(define (read-unsyntaxer port)
(define (read-unsyntaxer port)
(let ([p (peeking-input-port port)])
(if (eq? (read p) '#:escape-id)
(begin (read port) (read port))
'unsyntax)))
(define (make-comment-readtable #:readtable [rt (current-readtable)])
(define (make-comment-readtable #:readtable [rt (current-readtable)])
(make-readtable rt
#\; 'terminating-macro
(case-lambda
@ -37,7 +38,7 @@
v
(list src line col pos (and pos epos (- epos pos))))))])))
(define (do-comment port recur)
(define (do-comment port recur)
(let loop ()
(when (equal? #\; (peek-char port))
(read-char port)
@ -60,7 +61,7 @@
(cons (string c)
(loop))]))))))))
(define (append-strings l)
(define (append-strings l)
(let loop ([l l][s null])
(cond
[(null? l) (if (null? s)
@ -74,10 +75,10 @@
(car l)
(loop (cdr l) null)))])))
(define (preserve-space s)
(define (preserve-space s)
(let ([m (regexp-match-positions #rx" +" s)])
(if m
(append (preserve-space (substring s 0 (caar m)))
(list `(hspace ,(- (cdar m) (caar m))))
(preserve-space (substring s (cdar m))))
(list s)))))
(list s))))

View File

@ -1,6 +1,5 @@
#lang mzscheme
(module config mzscheme
(provide value-color)
(provide value-color)
(define value-color "schemevalue"))
(define value-color "schemevalue")

View File

@ -226,6 +226,7 @@
([class "searchbox"]
[style ,(sa "color: "dimcolor";")]
[type "text"]
[tabindex "1"]
[value ,emptylabel]
[title "Enter a search string to search the manuals"]
[onkeypress ,(format "return DoSearchKey(event, this, ~s, ~s);"
@ -905,7 +906,9 @@
(head-extra-xexpr p)))
(body ([id ,(or (extract-part-body-id d ri)
"scribble-racket-lang-org")])
,@(render-toc-view d ri)
,@(if (part-style? d 'no-toc+aux)
null
(render-toc-view d ri))
(div ([class "maincolumn"])
(div ([class "main"])
,@(parameterize ([current-version (extract-version d)])
@ -1607,6 +1610,7 @@
(cond
[(symbol? name)
(case name
[(emph) '([class "emph"])]
[(italic) '([style "font-style: italic"])]
[(bold) '([style "font-weight: bold"])]
[(tt) '([class "stt"])]

View File

@ -151,7 +151,9 @@
(install-file style-file))))
(when whole-doc?
(printf "\\begin{document}\n\\preDoc\n")
(when (part-title-content d)
(when (and (part-title-content d)
(not (and (part-style? d 'hidden)
(equal? "" (content->string (part-title-content d))))))
(let ([vers (extract-version d)]
[date (extract-date d)]
[pres (extract-pretitle-content d)]
@ -166,7 +168,6 @@
(do-render-nested-flow pre d ri #t #f #t)]))
(when date (printf "\\date{~a}\n" date))
(printf "\\titleAnd~aVersionAnd~aAuthors~a{"
(if (equal? vers "") "Empty" "")
(if (null? auths) "Empty" "")
(if short "AndShort" ""))
@ -471,6 +472,7 @@
(cond
[(symbol? style-name)
(case style-name
[(emph) (wrap e "emph" tt?)]
[(italic) (wrap e "textit" tt?)]
[(bold) (wrap e "textbf" tt?)]
[(tt) (wrap e "Scribtexttt" #t)]

View File

@ -4,7 +4,10 @@
"private/render-utils.rkt"
racket/class racket/port racket/list racket/string racket/match
scribble/text/wrap)
(provide render-mixin)
(provide render-mixin
current-markdown-link-sections)
(define current-markdown-link-sections (make-parameter #f))
(define current-indent (make-parameter 0))
(define (make-indent amt)
@ -17,6 +20,9 @@
(indent))
(define note-depth (make-parameter 0))
(define in-toc (make-parameter #f))
(define markdown-part-tag 'markdown-section)
(define (render-mixin %)
(class %
@ -37,6 +43,16 @@
format-number
number-depth)
(define/override (collect-part-tags d ci number)
(for ([t (part-tags d)])
(let ([t (generate-tag t ci)])
(collect-put! ci
t
(vector (or (part-title-content d) '("???"))
(add-current-tag-prefix t)
number
markdown-part-tag)))))
(define/override (render-part d ht)
(let ([number (collected-info-number (part-collected-info d ht))])
(unless (part-style? d 'hidden)
@ -153,6 +169,13 @@
(write-string (make-string (note-depth) #\>))
(unless (zero? (note-depth))
(write-string " ")))
(cond
[(in-toc)
(write-note)
(super render-paragraph p part ri)
;; two spaces at a line end creates a line break:
(write-string " ")]
[else
(define o (open-output-string))
(parameterize ([current-output-port o])
(super render-paragraph p part ri))
@ -171,7 +194,7 @@
(write-note)
(write-string (car lines))
(for ([line (in-list (cdr lines))])
(newline) (indent) (write-note) (write-string line))
(newline) (indent) (write-note) (write-string line))])
(newline)
null)
@ -193,6 +216,9 @@
(define (italic? i)
(and (element? i) (eq? (element-style i) 'italic)))
(define (emph? i)
(and (element? i) (eq? (element-style i) 'emph)))
(define (code? i)
(and (element? i)
(let ([s (element-style i)])
@ -230,12 +256,18 @@
[(and (code? i) (not (in-code?)))
(recurse-wrapped "`" in-code?)]
[(and (bold? i) (not (in-bold?)))
[(and (bold? i) (not (in-bold?)) (not (in-code?)))
(recurse-wrapped "**" in-bold?)]
[(and (italic? i) (not (in-italic?)))
[(and (italic? i) (not (in-italic?)) (not (in-code?)))
(recurse-wrapped "_" in-italic?)]
[(and (emph? i) (not (in-code?)))
(display "_") ;; zero-width space, underscore
(begin0
(super render-content i part ri)
(display "_"))] ;; underscore, zero-width space
[(and (preserve-spaces? i) (not (preserving-spaces?)))
(parameterize ([preserving-spaces? #t])
(render-content i part ri))]
@ -248,15 +280,45 @@
(render-content i part ri))
(printf "](~a)" (sanitize-parens link))))]
[(and (link-element? i)
(current-markdown-link-sections)
(not (in-link?))
;; Link to a part within this document?
(let ([vec (resolve-get part ri (link-element-tag i))])
(and (vector? vec)
(= 4 (vector-length vec))
(eq? markdown-part-tag (vector-ref vec 3))
vec)))
=> (lambda (vec)
(define s (string-append
(let ([s (if (vector-ref vec 2)
(format-number (vector-ref vec 2) '() #t)
'())])
(if (null? s)
""
(string-append (car s) " ")))
(content->string (vector-ref vec 0))))
(display "[")
(begin0
(parameterize ([in-link? #t])
(super render-content i part ri))
(display "](#")
(display (regexp-replace* #" "
(regexp-replace* #rx"[^a-zA-Z0-9_ -]" (string-downcase s) "")
#"-"))
(display ")")))]
[else (super render-content i part ri)]))
(define/override (render-nested-flow i part ri starting-item?)
(define s (nested-flow-style i))
(unless (memq 'decorative (style-properties s))
(define note? (equal? (style-name s) "refcontent"))
(define toc? (equal? (style-name s) 'table-of-contents))
(when note?
(note-depth (add1 (note-depth))))
(begin0 (super render-nested-flow i part ri starting-item?)
(begin0 (parameterize ([in-toc (or toc? (in-toc))])
(super render-nested-flow i part ri starting-item?))
(when note?
(note-depth (sub1 (note-depth)))))))
@ -270,8 +332,8 @@
[(rdquo) "\U201D"]
[(lsquo) "\U2018"]
[(rsquo) "\U2019"]
[(lang) ">"]
[(rang) "<"]
[(lang) "<"]
[(rang) ">"]
[(rarr) "->"]
[(nbsp) "\uA0"]
[(prime) "'"]
@ -280,10 +342,17 @@
[else (error 'markdown-render "unknown element symbol: ~e"
i)]))]
[(string? i)
(let* ([i (if (in-code?)
(let* ([i (cond
[(in-code?)
(regexp-replace** i '([#rx"``" . "\U201C"]
[#rx"''" . "\U201D"]))
(regexp-replace* #px"([#_*`\\[\\(\\]\\)]{1})" i "\\\\\\1"))]
[#rx"''" . "\U201D"]))]
[(or (in-link?)
(regexp-match? #rx"^[(]" i)
(regexp-match? #rx"[]][(]" i))
(regexp-replace* #px"([#_*`\\[\\(\\]\\)]{1})" i "\\\\\\1")]
[else
;; Avoid escaping parentheses
(regexp-replace* #px"([#_*`\\[\\]]{1})" i "\\\\\\1")])]
[i (if (preserving-spaces?)
(regexp-replace* #rx" " i "\uA0")
i)])
@ -291,6 +360,26 @@
[else (write i)])
null)
(define/override (table-of-contents part ri)
(define t (super table-of-contents part ri))
(cond
[(current-markdown-link-sections)
;; Table generated by `table-of-contents` always has one
;; column, and each row has one paragraph that starts
;; with a 'hspace element to indent
(nested-flow
(style 'table-of-contents null)
(for/list ([p (map car (table-blockss t))])
(define c (paragraph-content p))
(define keep-c (cdr c))
(define (spaces->depth n)
(add1 (quotient (- n 4) 2)))
(for/fold ([p (paragraph plain keep-c)]) ([s (in-range
(spaces->depth
(string-length (car (element-content (car c))))))])
(nested-flow (style "refcontent" null) (list p)))))]
[else t]))
(super-new)))
(define (regexp-replace** str ptns&reps)
@ -298,4 +387,3 @@
([ptn (map car ptns&reps)]
[rep (map cdr ptns&reps)])
(regexp-replace* ptn str rep)))

View File

@ -4,7 +4,7 @@
"../base.rkt"
(only-in "../basic.rkt" aux-elem itemize)
"../scheme.rkt"
(only-in "../core.rkt" make-style plain
(only-in "../core.rkt" content? make-style plain
make-nested-flow nested-flow? box-mode box-mode*
[element? core:element?])
"manual-utils.rkt"
@ -31,7 +31,7 @@
(provide-styling racketmodfont racketoutput
racketerror racketfont racketplainfont racketvalfont racketidfont racketvarfont
racketcommentfont racketparenfont racketkeywordfont racketmetafont
onscreen defterm filepath exec envvar Flag DFlag PFlag DPFlag math
onscreen defterm filepath envvar Flag DFlag PFlag DPFlag math
procedure
indexed-file indexed-envvar idefterm pidefterm)
(provide
@ -59,7 +59,8 @@
[inset-flow (() () #:rest (listof pre-content?) . ->* . nested-flow?)]
[litchar (() () #:rest (listof string?) . ->* . element?)]
[t (() () #:rest (listof pre-content?) . ->* . paragraph?)]
[commandline (() () #:rest (listof pre-content?) . ->* . paragraph?)]
[exec (() () #:rest (listof content?) . ->* . element?)]
[commandline (() () #:rest (listof content?) . ->* . paragraph?)]
[menuitem (string? string? . -> . element?)])
(define PLaneT (make-element "planetName" '("PLaneT")))

View File

@ -1,5 +1,6 @@
(module racket racket/base
(require "core.rkt"
#lang racket/base
(require "core.rkt"
"basic.rkt"
"search.rkt"
"private/manual-sprop.rkt"
@ -9,7 +10,7 @@
racket/extflonum
(for-syntax racket/base))
(provide define-code
(provide define-code
to-element
to-element/no-color
to-paragraph
@ -55,7 +56,7 @@
make-element-id-transformer
element-id-transformer?))
(define (make-racket-style s
(define (make-racket-style s
#:tt? [tt? #t]
#:extras [extras null])
(make-style s (if tt?
@ -65,51 +66,51 @@
(append extras
scheme-properties))))
(define-on-demand output-color (make-racket-style "RktOut"))
(define-on-demand input-color (make-racket-style "RktIn"))
(define-on-demand input-background-color (make-racket-style "RktInBG"))
(define-on-demand no-color (make-racket-style "RktPlain"))
(define-on-demand reader-color (make-racket-style "RktRdr"))
(define-on-demand result-color (make-racket-style "RktRes"))
(define-on-demand keyword-color (make-racket-style "RktKw"))
(define-on-demand comment-color (make-racket-style "RktCmt"))
(define-on-demand paren-color (make-racket-style "RktPn"))
(define-on-demand meta-color (make-racket-style "RktMeta"))
(define-on-demand value-color (make-racket-style "RktVal"))
(define-on-demand symbol-color (make-racket-style "RktSym"))
(define-on-demand symbol-def-color (make-racket-style "RktSymDef"
(define-on-demand output-color (make-racket-style "RktOut"))
(define-on-demand input-color (make-racket-style "RktIn"))
(define-on-demand input-background-color (make-racket-style "RktInBG"))
(define-on-demand no-color (make-racket-style "RktPlain"))
(define-on-demand reader-color (make-racket-style "RktRdr"))
(define-on-demand result-color (make-racket-style "RktRes"))
(define-on-demand keyword-color (make-racket-style "RktKw"))
(define-on-demand comment-color (make-racket-style "RktCmt"))
(define-on-demand paren-color (make-racket-style "RktPn"))
(define-on-demand meta-color (make-racket-style "RktMeta"))
(define-on-demand value-color (make-racket-style "RktVal"))
(define-on-demand symbol-color (make-racket-style "RktSym"))
(define-on-demand symbol-def-color (make-racket-style "RktSymDef"
#:extras (list (attributes '((class . "RktSym"))))))
(define-on-demand variable-color (make-racket-style "RktVar"))
(define-on-demand opt-color (make-racket-style "RktOpt"))
(define-on-demand error-color (make-racket-style "RktErr" #:tt? #f))
(define-on-demand syntax-link-color (make-racket-style "RktStxLink"))
(define-on-demand value-link-color (make-racket-style "RktValLink"))
(define-on-demand syntax-def-color (make-racket-style "RktStxDef"
(define-on-demand variable-color (make-racket-style "RktVar"))
(define-on-demand opt-color (make-racket-style "RktOpt"))
(define-on-demand error-color (make-racket-style "RktErr" #:tt? #f))
(define-on-demand syntax-link-color (make-racket-style "RktStxLink"))
(define-on-demand value-link-color (make-racket-style "RktValLink"))
(define-on-demand syntax-def-color (make-racket-style "RktStxDef"
#:extras (list (attributes '((class . "RktStxLink"))))))
(define-on-demand value-def-color (make-racket-style "RktValDef"
(define-on-demand value-def-color (make-racket-style "RktValDef"
#:extras (list (attributes '((class . "RktValLink"))))))
(define-on-demand module-color (make-racket-style "RktMod"))
(define-on-demand module-link-color (make-racket-style "RktModLink"))
(define-on-demand block-color (make-racket-style "RktBlk"))
(define-on-demand highlighted-color (make-racket-style "highlighted" #:tt? #f))
(define-on-demand module-color (make-racket-style "RktMod"))
(define-on-demand module-link-color (make-racket-style "RktModLink"))
(define-on-demand block-color (make-racket-style "RktBlk"))
(define-on-demand highlighted-color (make-racket-style "highlighted" #:tt? #f))
(define current-keyword-list
(define current-keyword-list
(make-parameter null))
(define current-variable-list
(define current-variable-list
(make-parameter null))
(define current-meta-list
(define current-meta-list
(make-parameter null))
(define defined-names (make-hasheq))
(define defined-names (make-hasheq))
(define-struct (sized-element element) (length))
(define-struct (sized-element element) (length))
(define-struct (spaces element) (cnt))
(define-struct (spaces element) (cnt))
;; We really don't want leading hypens (or minus signs) to
;; create a line break after the hyphen. For interior hyphens,
;; line breaking is usually fine.
(define (nonbreak-leading-hyphens s)
;; We really don't want leading hypens (or minus signs) to
;; create a line break after the hyphen. For interior hyphens,
;; line breaking is usually fine.
(define (nonbreak-leading-hyphens s)
(let ([m (regexp-match-positions #rx"^-+" s)])
(if m
(if (= (cdar m) (string-length s))
@ -119,7 +120,7 @@
(substring s len)))))
s)))
(define (literalize-spaces i [leading? #f])
(define (literalize-spaces i [leading? #f])
(let ([m (regexp-match-positions #rx" +" i)])
(if m
(let ([cnt (- (cdar m) (caar m))])
@ -134,21 +135,21 @@
i))))
(define line-breakable-space (make-element 'tt " "))
(define line-breakable-space (make-element 'tt " "))
;; These caches intentionally record a key with the value.
;; That way, when the value is no longer used, the key
;; goes away, and the entry is gone.
;; These caches intentionally record a key with the value.
;; That way, when the value is no longer used, the key
;; goes away, and the entry is gone.
(define id-element-cache (make-weak-hash))
(define element-cache (make-weak-hash))
(define id-element-cache (make-weak-hash))
(define element-cache (make-weak-hash))
(define-struct (cached-delayed-element delayed-element) (cache-key))
(define-struct (cached-element element) (cache-key))
(define-struct (cached-delayed-element delayed-element) (cache-key))
(define-struct (cached-element element) (cache-key))
(define qq-ellipses (string->uninterned-symbol "..."))
(define qq-ellipses (string->uninterned-symbol "..."))
(define (make-id-element c s defn?)
(define (make-id-element c s defn?)
(let* ([key (and id-element-cache
(let ([b (identifier-label-binding c)])
(vector (syntax-e c)
@ -190,7 +191,7 @@
(hash-set! id-element-cache key (make-weak-box e)))
e))))
(define (make-element/cache style content)
(define (make-element/cache style content)
(if (and element-cache
(string? content))
(let ([key (vector style content)])
@ -201,7 +202,7 @@
e))))
(make-element style content)))
(define (to-quoted obj expr? quote-depth out color? inc!)
(define (to-quoted obj expr? quote-depth out color? inc!)
(if (and expr?
(zero? quote-depth)
(quotable? obj))
@ -211,7 +212,7 @@
(add1 quote-depth))
quote-depth))
(define (to-unquoted expr? quote-depth out color? inc!)
(define (to-unquoted expr? quote-depth out color? inc!)
(if (or (not expr?) (zero? quote-depth))
quote-depth
(begin
@ -219,12 +220,12 @@
(inc!)
(to-unquoted expr? (sub1 quote-depth) out color? inc!))))
(define iformat
(define iformat
(case-lambda
[(str val) (datum-intern-literal (format str val))]
[(str . vals) (datum-intern-literal (apply format str vals))]))
(define (typeset-atom c out color? quote-depth expr? escapes? defn?)
(define (typeset-atom c out color? quote-depth expr? escapes? defn?)
(if (and (var-id? (syntax-e c))
(zero? quote-depth))
(out (iformat "~s" (let ([v (var-id-sym (syntax-e c))])
@ -317,9 +318,9 @@
[else paren-color])
(string-length s)))))))
(define omitable (make-style #f '(omitable)))
(define omitable (make-style #f '(omitable)))
(define (gen-typeset c multi-line? prefix1 prefix suffix color? expr? escapes? defn? elem-wrap)
(define (gen-typeset c multi-line? prefix1 prefix suffix color? expr? escapes? defn? elem-wrap)
(let* ([c (syntax-ize c 0 #:expr? expr?)]
[content null]
[docs null]
@ -926,7 +927,7 @@
(make-table block-color (map list (reverse docs))))
(make-sized-element #f (reverse content) dest-col))))
(define (typeset c multi-line? prefix1 prefix suffix color? expr? escapes? defn? elem-wrap)
(define (typeset c multi-line? prefix1 prefix suffix color? expr? escapes? defn? elem-wrap)
(let* ([c (syntax-ize c 0 #:expr? expr?)]
[s (syntax-e c)])
(if (or multi-line?
@ -958,32 +959,32 @@
mk)
color? 0 expr? escapes? defn?))))
(define (to-element c
(define (to-element c
#:expr? [expr? #f]
#:escapes? [escapes? #t]
#:defn? [defn? #f])
(typeset c #f "" "" "" #t expr? escapes? defn? values))
(define (to-element/no-color c
(define (to-element/no-color c
#:expr? [expr? #f]
#:escapes? [escapes? #t])
(typeset c #f "" "" "" #f expr? escapes? #f values))
(define (to-paragraph c
(define (to-paragraph c
#:expr? [expr? #f]
#:escapes? [escapes? #t]
#:color? [color? #t]
#:wrap-elem [elem-wrap (lambda (e) e)])
(typeset c #t "" "" "" color? expr? escapes? #f elem-wrap))
(define ((to-paragraph/prefix pfx1 pfx sfx) c
(define ((to-paragraph/prefix pfx1 pfx sfx) c
#:expr? [expr? #f]
#:escapes? [escapes? #t]
#:color? [color? #t]
#:wrap-elem [elem-wrap (lambda (e) e)])
(typeset c #t pfx1 pfx sfx color? expr? escapes? #f elem-wrap))
(begin-for-syntax
(begin-for-syntax
(define-struct variable-id (sym)
#:omit-define-syntaxes
#:property prop:procedure (lambda (self stx)
@ -1003,7 +1004,7 @@
" bound as an code-typesetting element transformer")
stx))))
(define-syntax (define-code stx)
(define-syntax (define-code stx)
(syntax-case stx ()
[(_ code typeset-code uncode d->s stx-prop)
(syntax/loc stx
@ -1083,9 +1084,9 @@
[(_ code typeset-code) #'(define-code code typeset-code unsyntax)]))
(define syntax-ize-hook (make-parameter (lambda (v col) #f)))
(define syntax-ize-hook (make-parameter (lambda (v col) #f)))
(define (vector->short-list v extract)
(define (vector->short-list v extract)
(vector->list v)
#;
(let ([l (vector->list v)])
@ -1100,7 +1101,7 @@
(loop (sub1 i))]
[else (add1 i)])))))))
(define (short-list->vector v l)
(define (short-list->vector v l)
(list->vector
(let ([n (length l)])
(if (n . < . (vector-length v))
@ -1110,29 +1111,29 @@
(loop (cons (car r) r) (sub1 i)))))
l))))
(define-struct var-id (sym))
(define-struct shaped-parens (val shape))
(define-struct long-boolean (val))
(define-struct just-context (val ctx))
(define-struct alternate-display (id string))
(define-struct literal-syntax (stx))
(define-struct struct-proxy (name content))
(define-struct var-id (sym))
(define-struct shaped-parens (val shape))
(define-struct long-boolean (val))
(define-struct just-context (val ctx))
(define-struct alternate-display (id string))
(define-struct literal-syntax (stx))
(define-struct struct-proxy (name content))
(define-struct graph-reference (bx))
(define-struct graph-defn (r bx))
(define-struct graph-reference (bx))
(define-struct graph-defn (r bx))
(define (syntax-ize v col [line 1] #:expr? [expr? #f])
(define (syntax-ize v col [line 1] #:expr? [expr? #f])
(do-syntax-ize v col line (box #hasheq()) #f (and expr? 0) #f))
(define (graph-count ht graph?)
(define (graph-count ht graph?)
(and graph?
(let ([n (hash-ref (unbox ht) '#%graph-count 0)])
(set-box! ht (hash-set (unbox ht) '#%graph-count (add1 n)))
n)))
(define-struct forced-pair (car cdr))
(define-struct forced-pair (car cdr))
(define (quotable? v)
(define (quotable? v)
(define graph (make-hasheq))
(let quotable? ([v v])
(if (hash-ref graph v #f)
@ -1164,7 +1165,7 @@
[(mpair? v) #f]
[else #t])))))
(define (do-syntax-ize v col line ht graph? qq no-cons?)
(define (do-syntax-ize v col line ht graph? qq no-cons?)
(cond
[((syntax-ize-hook) v col)
=> (lambda (r) r)]
@ -1410,4 +1411,4 @@
(max 1 (- (syntax-position pairs) undelta))
(+ (syntax-span pairs) undelta))))]
[else
(datum->syntax #f v (vector #f line col (+ 1 col) 1))])))
(datum->syntax #f v (vector #f line col (+ 1 col) 1))]))

View File

@ -106,6 +106,8 @@
(current-style-file file)]
[("--prefix") file "use given .html/.tex prefix (for doctype/documentclass)"
(current-prefix-file file)]
[("--link-section") "support section links for markdown"
(markdown:current-markdown-link-sections #t)]
#:multi
[("++extra") file "add given file"
(current-extra-files (cons file (current-extra-files)))]

View File

@ -30,6 +30,26 @@
font-weight: bold;
}
/* Emphasis: alternate italics and normal as we nest */
.emph {
font-style: italic;
}
.emph .emph {
font-style: normal;
}
.emph .emph .emph {
font-style: italic;
}
.emph .emph .emph .emph {
font-style: normal;
}
.emph .emph .emph .emph .emph {
font-style: italic;
}
.emph .emph .emph .emph .emph .emph {
font-style: normal;
}
/* ---------------------------------------- */
p, .SIntrapara {

View File

@ -83,8 +83,8 @@
\newcommand{\textsuper}[1]{$^{\hbox{\textsmaller{#1}}}$}
\newcommand{\intextcolor}[2]{\textcolor{#1}{#2}}
\newcommand{\intextrgbcolor}[2]{\textcolor[rgb]{#1}{#2}}
\newcommand{\incolorbox}[2]{{\fboxrule=0pt\fboxsep=0pt\colorbox{#1}{#2}}}
\newcommand{\inrgbcolorbox}[2]{{\fboxrule=0pt\fboxsep=0pt\colorbox[rgb]{#1}{#2}}}
\newcommand{\incolorbox}[2]{{\fboxrule=0pt\fboxsep=0pt\protect\colorbox{#1}{#2}}}
\newcommand{\inrgbcolorbox}[2]{{\fboxrule=0pt\fboxsep=0pt\protect\colorbox[rgb]{#1}{#2}}}
\newcommand{\plainlink}[1]{#1}
\newcommand{\techoutside}[1]{#1}
\newcommand{\techinside}[1]{#1}
@ -112,7 +112,7 @@
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{pltstabular is a modification of stabular}
%% A renamed vsetion of:
%% A renamed version of:
%% stabular.sty
%% Copyright 1998 Sigitas Tolu\v sis
%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
@ -372,7 +372,7 @@
% For hidden parts with an empty title:
\newcommand{\notitlesection}{\vspace{2ex}\phantomsection\noindent}
% To increments section numbers:
% To increment section numbers:
\newcommand{\Sincpart}{\stepcounter{part}}
\newcommand{\Sincsection}{\stepcounter{section}}
\newcommand{\Sincsubsection}{\stepcounter{subsection}}

View File

@ -1,14 +1,15 @@
(module search racket/base
(require "struct.rkt"
#lang racket/base
(require "struct.rkt"
"basic.rkt"
syntax/modcode)
(provide find-racket-tag
(provide find-racket-tag
(rename-out [find-racket-tag find-scheme-tag]))
(define module-info-cache (make-hasheq))
(define module-info-cache (make-hasheq))
(define (module-path-index-rejoin mpi rel-to)
(define (module-path-index-rejoin mpi rel-to)
(let-values ([(name base) (module-path-index-split mpi)])
(cond
[(not name) rel-to]
@ -17,11 +18,11 @@
(module-path-index-join name
(module-path-index-rejoin base rel-to))])))
(define (try thunk fail-thunk)
(define (try thunk fail-thunk)
(with-handlers* ([exn:fail? (lambda (exn) (fail-thunk))])
(thunk)))
(define (find-racket-tag part ri stx/binding phase-level)
(define (find-racket-tag part ri stx/binding phase-level)
;; The phase-level argument is used only when `stx/binding'
;; is an identifier.
;;
@ -184,4 +185,4 @@
;; Can't get the module source, so continue with queue:
(loop queue rqueue need-result?)))])
(or here-result
nest-result))))))])))))))
nest-result))))))]))))))

View File

@ -621,7 +621,7 @@
(define (authors name . names*)
(define names (map parse-author (cons name names*)))
(define slash-names (string-join (map author-element-names names) " / "))
(define slash-names (string-join (map (compose1 content->string author-element-names) names) " / "))
(define cite
(case (length names)
[(1) (author-element-cite (car names))]

View File

@ -1,11 +0,0 @@
scribble-test
Copyright (c) 2010-2014 PLT Design Inc.
This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary
applications, provided you follow the rules stated in the LGPL. You
can also modify this package; if you distribute a modified version,
you must distribute it under the terms of the LGPL, which in
particular means that you must release the source code for the
modified software. See http://www.gnu.org/copyleft/lesser.html
for more information.

View File

@ -55,7 +55,6 @@
(check-equal? (book-location #:edition "4th")
(mk-bookloc-elem/ed "4th")))
(test-case "techrpt-location"
(check-not-exn
(λ () (techrpt-location #:institution "MIT" #:number 'AIM-353)))
@ -71,3 +70,31 @@
(λ () (dissertation-location #:institution "Georgetown University" #:degree "BS")))
(check-exn exn:fail:contract?
(λ () (dissertation-location #:degree "PhD"))))
(test-case "authors"
;; Define authors, make a bibliography
;; https://github.com/racket/scribble/issues/216
(check-not-exn
(lambda ()
(define-cite cite citet gen-bib)
(define x*
(map
cite
(list
(make-bib
#:title "Histoire d'une Montagne"
#:author (authors "Elisée Reclus"))
(make-bib
#:title "The Jeffersonians"
#:author (authors "Richard B. Morris" "James Leslie Woods"))
(make-bib
#:title "Lucifer Magazine"
#:author (authors "H.P. Blavatsky" (other-authors)))
(make-bib
#:title "Dean's Electronics"
#:author (authors (org-author-name "robco") (org-author-name (authors "industries"))
(editor "mister") (editor (authors "crowley"))
(other-authors))))))
(gen-bib))))

View File

@ -1,11 +0,0 @@
scribble-text-lib
Copyright (c) 2010-2014 PLT Design Inc.
This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary
applications, provided you follow the rules stated in the LGPL. You
can also modify this package; if you distribute a modified version,
you must distribute it under the terms of the LGPL, which in
particular means that you must release the source code for the
modified software. See http://www.gnu.org/copyleft/lesser.html
for more information.

View File

@ -1,11 +0,0 @@
scribble
Copyright (c) 2010-2014 PLT Design Inc.
This package is distributed under the GNU Lesser General Public
License (LGPL). This means that you can link this package into proprietary
applications, provided you follow the rules stated in the LGPL. You
can also modify this package; if you distribute a modified version,
you must distribute it under the terms of the LGPL, which in
particular means that you must release the source code for the
modified software. See http://www.gnu.org/copyleft/lesser.html
for more information.