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].
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{Preprocessor}, with file extension @code[(format ".~a" world:preproc-source-ext)].
@bold{Markup}, with file extension @code[(format ".~a" world:markup-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{Template}, with file extension @code[(format ".~a" world:template-source-ext)].
@bold{Null}, with file extension @code[(format ".~a" world:null-source-ext)].
@bold{Null}, with file extension @code[(format ".~a" world:null-source-ext)].
@ -36,6 +38,11 @@ boolean?]
[v any/c])
[v any/c])
boolean?]
boolean?]
@defproc[
(markdown-source?
[v any/c])
boolean?]
@defproc[
@defproc[
(template-source?
(template-source?
[v any/c])
[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
@examples[#:eval my-eval
(preproc-source? "main.css.pp")
(preproc-source? "main.css.pp")
(markup-source? "default.html.pm")
(markup-source? "default.html.pm")
(markdown-source? "default.html.pmd")
(template-source? "main.html.pt")
(template-source? "main.html.pt")
(null-source? "index.html.p")
(null-source? "index.html.p")
(scribble-source? "file.scrbl")
(scribble-source? "file.scrbl")
@ -80,6 +88,11 @@ boolean?]
[v any/c])
[v any/c])
boolean?]
boolean?]
@defproc[
(has-markdown-source?
[v any/c])
boolean?]
@defproc[
@defproc[
(has-template-source?
(has-template-source?
[v any/c])
[v any/c])
@ -112,6 +125,11 @@ boolean?]
[v any/c])
[v any/c])
boolean?]
boolean?]
@defproc[
(has/is-markdown-source?
[v any/c])
boolean?]
@defproc[
@defproc[
(has/is-template-source?
(has/is-template-source?
[v any/c])
[v any/c])
@ -141,6 +159,11 @@ path?]
[p pathish?])
[p pathish?])
path?]
path?]
@defproc[
(->markdown-source-path
[p pathish?])
path?]
@defproc[
@defproc[
(->template-source-path
(->template-source-path
[p pathish?])
[p pathish?])
@ -162,13 +185,19 @@ Convert an output path @racket[_p] into the source path of the specified type th
(define name "default.html")
(define name "default.html")
(->preproc-source-path name)
(->preproc-source-path name)
(->markup-source-path name)
(->markup-source-path name)
(->markdown-source-path name)
(->template-source-path name)
(->template-source-path name)
(->scribble-source-path name)
(->scribble-source-path name)
(->null-source-path name)
(->null-source-path name)
]
]
Convert an output path @racket[_p] into the source path of the specified type that would produce this output path. This function simply generates a path for a file — it does not ask whether the file exists.
@defproc[
(->source-path
[p pathish?])
(or/c #f path?)]
Attempt to automatically convert an output path @racket[_p] into its source path. This function checks for the existence of the path with the extensions for markup, markdown, preprocessor, null, and scribble files.