10 Module reference
10.1 Cache
10.2 Decode
10.3 File
10.4 Pagetree
10.5 Render
10.6 Template
10.7 Tag
10.8 Top
10.9 World
On this page:
preproc-source?
markup-source?
template-source?
null-source?
scribble-source?
pagetree-source?
has-preproc-source?
has-markup-source?
has-template-source?
has-null-source?
has-scribble-source?
has/  is-preproc-source?
has/  is-markup-source?
has/  is-template-source?
has/  is-null-source?
has/  is-scribble-source?
->preproc-source-path
->markup-source-path
->template-source-path
->null-source-path
->scribble-source-path
->output-path
6.1.0.5

10.3 File

 (require pollen/file) package: pollen

A utility module that provides functions for working with Pollen source and output files. The tests rely on file extensions specified in pollen/world.

Pollen handles six kinds of source files:

Preprocessor, with file extension .pp.

Markup, with file extension .pm.

Template, with file extension .pt.

Null, with file extension .p.

Scribble, with file extension .scrbl.

For each kind of Pollen source file, the corresponding output file is generated by removing the extension from the name of the source file. So the preprocessor source file default.css.pp would become default.css. Scribble files work differently — the corresponding output file is the source file but with an html extension rather than scrbl. So pollen.scrbl would become pollen.html.

procedure

(preproc-source? v)  boolean?

  v : any/c

procedure

(markup-source? v)  boolean?

  v : any/c

procedure

(template-source? v)  boolean?

  v : any/c

procedure

(null-source? v)  boolean?

  v : any/c

procedure

(scribble-source? v)  boolean?

  v : any/c

procedure

(pagetree-source? v)  boolean?

  v : any/c
Test whether v is a path representing a source file of the specified type, based on file extension.

Examples:

> (preproc-source? "main.css.pp")

#t

> (markup-source? "default.html.pm")

#t

> (template-source? "main.html.pt")

#t

> (null-source? "index.html.p")

#t

> (scribble-source? "file.scrbl")

#t

> (pagetree-source? "index.ptree")

#t

procedure

(has-preproc-source? v)  boolean?

  v : any/c

procedure

(has-markup-source? v)  boolean?

  v : any/c

procedure

(has-template-source? v)  boolean?

  v : any/c

procedure

(has-null-source? v)  boolean?

  v : any/c

procedure

(has-scribble-source? v)  boolean?

  v : any/c
Test whether v is the output path for an existing source file of the specified type.

procedure

(has/is-preproc-source? v)  boolean?

  v : any/c

procedure

(has/is-markup-source? v)  boolean?

  v : any/c

procedure

(has/is-template-source? v)  boolean?

  v : any/c

procedure

(has/is-null-source? v)  boolean?

  v : any/c

procedure

(has/is-scribble-source? v)  boolean?

  v : any/c
Test whether v is a path representing a source file of the specified type, or is the output path for an existing source file of the specified type. In other words, has/is-preproc-source? is equivalent to (or (preproc-source? v) (has-preproc-source? v)).

procedure

(->preproc-source-path p)  path?

  p : pathish?

procedure

(->markup-source-path p)  path?

  p : pathish?

procedure

(->template-source-path p)  path?

  p : pathish?

procedure

(->null-source-path p)  path?

  p : pathish?

procedure

(->scribble-source-path p)  path?

  p : pathish?
Convert an output path 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.

Examples:

> (define name "default.html")
> (->preproc-source-path name)

#<path:default.html.pp>

> (->markup-source-path name)

#<path:default.html.pm>

> (->template-source-path name)

#<path:default.html.pt>

> (->scribble-source-path name)

#<path:default.scrbl>

> (->null-source-path name)

#<path:default.html.p>

procedure

(->output-path p)  path?

  p : pathish?
Convert a source path p into its corresponding output path. This function simply generates a path for a file — it does not ask whether the file exists.

Examples:

> (->output-path "main.css.pp")

#<path:main.css>

> (->output-path "default.html.pm")

#<path:default.html>

> (->output-path "index.html.p")

#<path:index.html>

> (->output-path "file.scrbl")

#<path:file.html>