5 Module Reference
5.1 Core
(require punct/core) | package: punct-lib |
parameter
(current-metas) → (or/c hash-eq? #f)
(current-metas metas) → void? metas : (or/c hash-eq? #f)
The only key automatically defined in every metadata table is 'here-path, which holds the absolute path to the source file.
If no Punct file is currently being compiled, this parameter will hold #f by default. In particular, this parameter is not automatically set to a Punct file’s metas during the rendering phase (e.g., doc->html).
procedure
key : symbol? val : (not/c procedure?)
syntax
(? key val-expr ...)
#lang punct •?[title "Example Title" author "Me"] ...
5.2 Fetch
(require punct/fetch) | package: punct-lib |
procedure
src : path-string?
procedure
doc : document? key : symbol?
default : failure-result/c = (lambda () (raise (make-exn:fail ....)))
Changed in version 1.1 of package punct-lib: Removed get-doc-ref and replaced with get-meta
5.3 Parse
(require punct/parse) | package: punct-lib |
procedure
(parse-markup-elements metas elements #:extract-inline? extract? #:parse-footnotes? parse-fn?) → (or/c document? (listof xexpr?)) metas : hash-eq? elements : list extract? : #t parse-fn? : #f
If #:extract-inline? is #true, and if the parsed document contains only a single paragraph element at the root level, then the elements inside the paragraph are returned as a list (the paragraph is “shucked”). Otherwise, the entire result is returned as a document.
The #:parse-footnotes? argument determines whether the commonmark parser will parse Markdown-style footnote references and definitions in elements.
> (define elems '("# Title\n\nA paragraph with *italic* text, and " 1 (custom "custom element"))) > (parse-markup-elements (hasheq) elems)
'#s(document
#hasheq()
((heading ((level "1")) "Title")
(paragraph
"A paragraph with "
(italic "italic")
" text, and 1"
(custom "custom element")))
())