A utility module that provides functions for working with Pollen source and output files. The tests rely on file extensions specified in @racket[pollen/world].
Pollen handles six kinds of source files:
Pollen handles seven kinds of source files:
@bold{Preprocessor}, with file extension @code[(format ".~a" world:preproc-source-ext)].
@bold{Markup}, with file extension @code[(format ".~a" world:markup-source-ext)].
@bold{Markdown}, with file extension @code[(format ".~a" world:markdown-source-ext)].
@bold{Template}, with file extension @code[(format ".~a" world:template-source-ext)].
@bold{Null}, with file extension @code[(format ".~a" world:null-source-ext)].
@ -36,6 +38,11 @@ boolean?]
[v any/c])
boolean?]
@defproc[
(markdown-source?
[v any/c])
boolean?]
@defproc[
(template-source?
[v any/c])
@ -61,6 +68,7 @@ Test whether @racket[_v] is a path representing a source file of the specified t
@examples[#:eval my-eval
(preproc-source? "main.css.pp")
(markup-source? "default.html.pm")
(markdown-source? "default.html.pmd")
(template-source? "main.html.pt")
(null-source? "index.html.p")
(scribble-source? "file.scrbl")
@ -80,6 +88,11 @@ boolean?]
[v any/c])
boolean?]
@defproc[
(has-markdown-source?
[v any/c])
boolean?]
@defproc[
(has-template-source?
[v any/c])
@ -112,6 +125,11 @@ boolean?]
[v any/c])
boolean?]
@defproc[
(has/is-markdown-source?
[v any/c])
boolean?]
@defproc[
(has/is-template-source?
[v any/c])
@ -141,6 +159,11 @@ path?]
[p pathish?])
path?]
@defproc[
(->markdown-source-path
[p pathish?])
path?]
@defproc[
(->template-source-path
[p pathish?])
@ -162,12 +185,53 @@ Convert an output path @racket[_p] into the source path of the specified type th
(define name "default.html")
(->preproc-source-path name)
(->markup-source-path name)
(->markdown-source-path name)
(->template-source-path name)
(->scribble-source-path name)
(->null-source-path name)
]
@deftogether[
(@defproc[
(get-preproc-source
[p pathish?])
(or/c #f path?)]
@defproc[
(get-markup-source
[p pathish?])
(or/c #f path?)]
@defproc[
(get-markdown-source
[p pathish?])
(or/c #f path?)]
@defproc[
(get-template-source
[p pathish?])
(or/c #f path?)]
@defproc[
(get-null-source
[p pathish?])
(or/c #f path?)]
@defproc[
(get-scribble-source
[p pathish?])
(or/c #f path?)]
)]
Find an existing source path of the specified type that would produce the output path @racket[_p]. If there is no source of the specified type, return @racket[#f].
@defproc[
(get-source
[p pathish?])
(or/c #f path?)]
Find an existing source path that would produce the output path @racket[_p]. Check source formats in this order: @racket[get-markup-source], @racket[get-markdown-source], @racket[get-preproc-source], @racket[get-null-source], @racket[get-scribble-source]. If there is no corresponding source, return @racket[#f].
@defproc[
@ -181,4 +245,4 @@ Convert a source path @racket[_p] into its corresponding output path. This funct
@ -84,6 +84,29 @@ As the input contract suggests, this function can take either a single @racket[x
]
@defproc[
(get-doc
[doc-source (or/c pagenode? pathish?)])
(or/c txexpr? string?)]
Retrieve the @racket[doc] export from @racket[_doc-source], which can be either a path, path string, or pagenode that can be resolved into a source path. If @racket[_doc-source] cannot be resolved, raise an error.
If @racket[_doc-source] is a relative path or pagenode, it is treated as being relative to @racket[world:current-project-root]. If that's not what you want, you'll need to convert it explicitly to a complete-path (e.g., with @racket[path->complete-path] or @racket[->complete-path]).
If @racket[world:current-main-export] is set to an identifier name other than @racket[doc], then that identifier is retrieved instead.
@defproc[
(get-metas
[meta-source (or/c pagenode? pathish?)])
hash?]
Retrieve the @racket[metas] export from @racket[_meta-source], which can be either a path, path string, or pagenode that can be resolved into a source path. If @racket[_meta-source] cannot be resolved, raise an error.
If @racket[_meta-source] is a relative path or pagenode, it is treated as being relative to @racket[world:current-project-root]. If that's not what you want, you'll need to convert it explicitly to a complete-path (e.g., with @racket[path->complete-path] or @racket[->complete-path]).
If @racket[world:current-meta-export] is set to an identifier name other than @racket[metas], then that identifier is retrieved instead.
@deftogether[(
@defproc[
@ -139,7 +162,6 @@ Note that if @racket[_meta-source] is a relative path or pagenode, it is treated
]
@defproc[
(select-from-doc
[key symbolish?]
@ -160,6 +182,9 @@ Note that if @racket[_doc-source] is a relative path or pagenode, it is treated