;; use append-map rather than map to permit return of multiple elements
(if(ormapexplicit-or-implicit-paragraph-break?elements); need this condition to prevent infinite recursion
(append-mapwrap-paragraph(filter-splitelementsmy-paragraph-break?)); split into ¶¶
;; use append-map on wrap-paragraph rather than map to permit return of multiple elements
(append-mapwrap-paragraph(append-map(λ(es)(filter-splitesmy-paragraph-break?))(slicefelementsblock-txexpr?))); split into ¶¶, using both implied and explicit paragraph breaks
(ifforce-paragraph
(ifforce-paragraph
(append-mapwrap-paragraph(slicefelementsblock-txexpr?)); upconverts non-block elements to paragraphs
(append-mapwrap-paragraph(slicefelementsblock-txexpr?)); upconverts non-block elements to paragraphs
Find paragraphs within @racket[_elements] (as denoted by @racket[_paragraph-sep]) and wrap them with @racket[_paragraph-tag]. Also handle linebreaks using @racket[detect-linebreaks].
Find paragraphs within @racket[_elements] and wrap them with @racket[_paragraph-tag]. Also handle linebreaks using @racket[detect-linebreaks].
If @racket[_element] is already a @racket[block-txexpr?], it will not be wrapped as a paragraph (because in that case, the wrapping would be superfluous). Thus, as a consequence, if @racket[_paragraph-sep] occurs between two blocks, it will be ignored (as in the example below using two sequential @racket['div] blocks.)
What counts as a paragraph? Any @racket[_elements] that are either a) explicitly set apart with @racket[_paragraph-sep], or b) adjacent to a @racket[block-txexpr?] (in which case the paragraph-ness is implied).
The @racket[_paragraph-tag] argument sets the tag used to wrap paragraphs.
The @racket[#:force?] option will wrap a paragraph tag around @racket[_elements], even if no paragraph break is found. If any @racket[_element] is already a @racket[block-txexpr?], it is skipped, but the remaining sequences of non-block @racket[_elements] are wrapped. The @racket[#:force?] option is useful for when you want to guarantee that you get a list of blocks.
If @racket[_element] is already a block, it will not be wrapped as a paragraph (because in that case, the wrapping would be superfluous). Thus, as a consequence, if @racket[_paragraph-sep] occurs between two blocks, it will be ignored (as in the example below using two sequential @racket[div] blocks.) Likewise, @racket[_paragraph-sep] will also be ignored if it occurs between a block and a non-block (because a paragraph break is already implied).
The @racket[#:force?] option will wrap a paragraph tag around @racket[_elements], even if no explicit or implicit paragraph breaks are found. The @racket[#:force?] option is useful for when you want to guarantee that you always get a list of blocks.
@examples[#:eval my-eval
(detect-paragraphs '("This" (span "will not be") "a paragraph"))
(detect-paragraphs '("But this" (span "will be") "a paragraph") #:force? #t)