Scribble: add 'multicommand support to `nested-flow'
This commit is contained in:
parent
e652546bf5
commit
cbca2f395b
|
@ -357,14 +357,19 @@
|
||||||
[else (format "x~x" (char->integer c))]))
|
[else (format "x~x" (char->integer c))]))
|
||||||
(string->list (format "~s" s)))))
|
(string->list (format "~s" s)))))
|
||||||
|
|
||||||
(define/override (render-flow p part ri starting-item?)
|
(define/override (render-flow p part ri starting-item? [wrap-each? #f])
|
||||||
(if (null? p)
|
(if (null? p)
|
||||||
null
|
null
|
||||||
(begin
|
(begin
|
||||||
|
(when wrap-each? (printf "{"))
|
||||||
(render-block (car p) part ri starting-item?)
|
(render-block (car p) part ri starting-item?)
|
||||||
|
(when wrap-each? (printf "}"))
|
||||||
(for ([b (in-list (cdr p))])
|
(for ([b (in-list (cdr p))])
|
||||||
(printf "\n\n")
|
(if wrap-each?
|
||||||
(render-block b part ri #f))
|
(printf "%\n{")
|
||||||
|
(printf "\n\n"))
|
||||||
|
(render-block b part ri #f)
|
||||||
|
(when wrap-each? (printf "}")))
|
||||||
null)))
|
null)))
|
||||||
|
|
||||||
(define/override (render-table t part ri starting-item?)
|
(define/override (render-table t part ri starting-item?)
|
||||||
|
@ -540,22 +545,26 @@
|
||||||
null))
|
null))
|
||||||
|
|
||||||
(define/private (do-render-nested-flow t part ri single-column?)
|
(define/private (do-render-nested-flow t part ri single-column?)
|
||||||
(let ([kind (or (let ([s (style-name (nested-flow-style t))])
|
(let* ([kind (or (let ([s (style-name (nested-flow-style t))])
|
||||||
(or (and (string? s) s)
|
(or (and (string? s) s)
|
||||||
(and (eq? s 'inset) "quote")))
|
(and (eq? s 'inset) "quote")))
|
||||||
"Subflow")]
|
"Subflow")]
|
||||||
[command? (memq 'command (style-properties (nested-flow-style t)))])
|
[props (style-properties (nested-flow-style t))]
|
||||||
(if command?
|
[command? (memq 'command props)]
|
||||||
(printf "\\~a{" kind)
|
[multicommand? (memq 'multicommand props)])
|
||||||
(printf "\\begin{~a}" kind))
|
(cond
|
||||||
|
[command? (printf "\\~a{" kind)]
|
||||||
|
[multicommand? (printf "\\~a" kind)]
|
||||||
|
[else (printf "\\begin{~a}" kind)])
|
||||||
(parameterize ([current-table-mode (if (or single-column?
|
(parameterize ([current-table-mode (if (or single-column?
|
||||||
(not (current-table-mode)))
|
(not (current-table-mode)))
|
||||||
(current-table-mode)
|
(current-table-mode)
|
||||||
(list "nested-flow" t))])
|
(list "nested-flow" t))])
|
||||||
(render-flow (nested-flow-blocks t) part ri #f))
|
(render-flow (nested-flow-blocks t) part ri #f multicommand?))
|
||||||
(if command?
|
(cond
|
||||||
(printf "}")
|
[command? (printf "}")]
|
||||||
(printf "\\end{~a}" kind))
|
[multicommand? (void)]
|
||||||
|
[else (printf "\\end{~a}" kind)])
|
||||||
null))
|
null))
|
||||||
|
|
||||||
(define/override (render-nested-flow t part ri)
|
(define/override (render-nested-flow t part ri)
|
||||||
|
|
|
@ -49,10 +49,13 @@ a @racket[multiarg-element], @racket[paragraph], @racket[table],
|
||||||
output or a Latex macro/environment for Latex output. In Latex output,
|
output or a Latex macro/environment for Latex output. In Latex output,
|
||||||
the string is used as a command name for a @racket[paragraph]
|
the string is used as a command name for a @racket[paragraph]
|
||||||
and an environment name for a @racket[table], @racket[itemization],
|
and an environment name for a @racket[table], @racket[itemization],
|
||||||
@racket[nested-flow], or @racket[compound-paragraph]; the if style has
|
@racket[nested-flow], or @racket[compound-paragraph]; if the style has
|
||||||
a @racket['command] @tech{style property} for a @racket[nested-flow] or
|
a @racket['command] @tech{style property} for a @racket[nested-flow] or
|
||||||
@racket[compound-paragraph], then the style name is used as a command
|
@racket[compound-paragraph], then the style name is used as a command
|
||||||
instead of an environment. In addition, for an itemization, the style
|
instead of an environment; and if the style has
|
||||||
|
a @racket['multicommand] @tech{style property} for a @racket[nested-flow],
|
||||||
|
then the style name is used as a command with multiple arguments.
|
||||||
|
In addition, for an itemization, the style
|
||||||
string is suffixed with @racket["Item"] and used as a CSS class or Latex
|
string is suffixed with @racket["Item"] and used as a CSS class or Latex
|
||||||
macro name to use for the itemization's items (in place of @tt{item}
|
macro name to use for the itemization's items (in place of @tt{item}
|
||||||
in the case of Latex).
|
in the case of Latex).
|
||||||
|
|
|
@ -550,6 +550,10 @@ The following @tech{style properties} are currently recognized:
|
||||||
name} is used as a command name instead of an environment
|
name} is used as a command name instead of an environment
|
||||||
name.}
|
name.}
|
||||||
|
|
||||||
|
@item{@racket['multicommand] --- For Latex output, a string
|
||||||
|
@tech{style name} is used as a command name with a separate
|
||||||
|
argument for each block in @racket[blocks].}
|
||||||
|
|
||||||
@item{@racket[attributes] structure --- Provides additional HTML
|
@item{@racket[attributes] structure --- Provides additional HTML
|
||||||
attributes for the @tt{<blockquote>} tag.}
|
attributes for the @tt{<blockquote>} tag.}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user