Quire class
Quarto scripts parse arguments, then build a Quire
object to do the actual work.
For interactive help, cd
to your project and run:
python3 -m pydoc quarto.quire
This be Mapping, yet there are methods in it.
Quire
inherits several dictionary methods from collections.abc.Mapping:
-
.keys()
are absolute pathlib.Path objects. .values()
are HTML pages as strings..items()
is an iterable view of (key, value) pairs.in
,len()
, andfor x in
act on keys, just like an ordinarydict
.
Quire
values are immutable. Square-bracket [ ]
notation can get, but not set.
Getting makes it so.
Quire
values are lazy:
- Pages do not exist until accessed with
[ ]
or.get()
. - Pages are generated and joined after being accessed.
- Page input files are read only when generating a page.
- Pages are never cached. Getting a page twice generates it twice.
At most one page is stored in RAM at any given time.
I yield, I join, I perish.
Quire
uses several methods to generate HTML:
.links()
and.meta()
generate <head> tags.- HTML <main> elements are read directly from disk.
- Markdown <main> elements are parsed during page generation.
.icons()
,.jump()
, and.klf()
each generate a <section> element.
Lines are joined only after the entire page has been generated.
The <nav> is come full circle: I am home.
- Links in the
#jump
section wrap: the next page after the last page is the first page. Quire
objects do not wrap. Iterating over aQuire
returns each key exactly once.Quire
objects sort pages automatically and retain the sort order.- See docs/relative paths to set the page order manually.