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))]))
|
||||
(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)
|
||||
null
|
||||
(begin
|
||||
(when wrap-each? (printf "{"))
|
||||
(render-block (car p) part ri starting-item?)
|
||||
(when wrap-each? (printf "}"))
|
||||
(for ([b (in-list (cdr p))])
|
||||
(printf "\n\n")
|
||||
(render-block b part ri #f))
|
||||
(if wrap-each?
|
||||
(printf "%\n{")
|
||||
(printf "\n\n"))
|
||||
(render-block b part ri #f)
|
||||
(when wrap-each? (printf "}")))
|
||||
null)))
|
||||
|
||||
(define/override (render-table t part ri starting-item?)
|
||||
|
@ -540,22 +545,26 @@
|
|||
null))
|
||||
|
||||
(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)
|
||||
(and (eq? s 'inset) "quote")))
|
||||
"Subflow")]
|
||||
[command? (memq 'command (style-properties (nested-flow-style t)))])
|
||||
(if command?
|
||||
(printf "\\~a{" kind)
|
||||
(printf "\\begin{~a}" kind))
|
||||
[props (style-properties (nested-flow-style t))]
|
||||
[command? (memq 'command props)]
|
||||
[multicommand? (memq 'multicommand props)])
|
||||
(cond
|
||||
[command? (printf "\\~a{" kind)]
|
||||
[multicommand? (printf "\\~a" kind)]
|
||||
[else (printf "\\begin{~a}" kind)])
|
||||
(parameterize ([current-table-mode (if (or single-column?
|
||||
(not (current-table-mode)))
|
||||
(current-table-mode)
|
||||
(list "nested-flow" t))])
|
||||
(render-flow (nested-flow-blocks t) part ri #f))
|
||||
(if command?
|
||||
(printf "}")
|
||||
(printf "\\end{~a}" kind))
|
||||
(render-flow (nested-flow-blocks t) part ri #f multicommand?))
|
||||
(cond
|
||||
[command? (printf "}")]
|
||||
[multicommand? (void)]
|
||||
[else (printf "\\end{~a}" kind)])
|
||||
null))
|
||||
|
||||
(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,
|
||||
the string is used as a command name for a @racket[paragraph]
|
||||
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
|
||||
@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
|
||||
macro name to use for the itemization's items (in place of @tt{item}
|
||||
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.}
|
||||
|
||||
@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
|
||||
attributes for the @tt{<blockquote>} tag.}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user