Merge tag 'v7.6' into my-changes-rebased
This commit is contained in:
commit
a7a8bcd015
10
LICENSE
Normal file
10
LICENSE
Normal 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
24
README.md
Normal 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
|
|
@ -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.
|
|
@ -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?]{
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
|
|
|
@ -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].}
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
|
@ -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))])))
|
||||
|
||||
|
|
|
@ -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.
|
|
@ -23,4 +23,4 @@
|
|||
|
||||
(define pkg-authors '(mflatt eli))
|
||||
|
||||
(define version "1.30")
|
||||
(define version "1.32")
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(module bnf racket
|
||||
#lang racket
|
||||
|
||||
(require scribble/decode
|
||||
(except-in scribble/struct
|
||||
element?)
|
||||
|
@ -118,4 +119,4 @@
|
|||
(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))))))))
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(module comment-reader scheme/base
|
||||
#lang scheme/base
|
||||
|
||||
(require (only-in racket/port peeking-input-port))
|
||||
|
||||
(provide (rename-out [*read read]
|
||||
|
@ -80,4 +81,4 @@
|
|||
(append (preserve-space (substring s 0 (caar m)))
|
||||
(list `(hspace ,(- (cdar m) (caar m))))
|
||||
(preserve-space (substring s (cdar m))))
|
||||
(list s)))))
|
||||
(list s))))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
(module config mzscheme
|
||||
#lang mzscheme
|
||||
|
||||
(provide value-color)
|
||||
|
||||
(define value-color "schemevalue"))
|
||||
(define value-color "schemevalue")
|
||||
|
|
|
@ -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"])]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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)))
|
||||
|
||||
|
|
|
@ -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")))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(module racket racket/base
|
||||
#lang racket/base
|
||||
|
||||
(require "core.rkt"
|
||||
"basic.rkt"
|
||||
"search.rkt"
|
||||
|
@ -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))]))
|
||||
|
|
|
@ -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)))]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
(module search racket/base
|
||||
#lang racket/base
|
||||
|
||||
(require "struct.rkt"
|
||||
"basic.rkt"
|
||||
syntax/modcode)
|
||||
|
@ -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))))))]))))))
|
||||
|
|
|
@ -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))]
|
||||
|
|
|
@ -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.
|
|
@ -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))))
|
||||
|
||||
|
|
|
@ -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.
|
|
@ -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.
|
Loading…
Reference in New Issue
Block a user