class Crycco::Collection
- Crycco::Collection
- Reference
- Object
Overview
A Collection is a group of sources that will be processed together and saved to the same output directory while preserving the directory structure of the sources.
This way the logic for path manipulation is centrallized here and the Document class can be simpler.
Defined in:
collection.crConstructors
-
.new(sources : Array(String), out_dir : String, template : String, mode : String, theme : String = "default-dark")
On initialization, we create documents for each source file
Instance Method Summary
-
#common_prefix : String
Find the common prefix of the sources, this is used to preserve the directory structure when saving the documents.
-
#dst_path(doc : Document) : Path
Calculate destionation paths for the documents.
-
#save
Save the documents to the output directory.
Constructor Detail
On initialization, we create documents for each source file
Instance Method Detail
Find the common prefix of the sources, this is used to preserve the directory structure when saving the documents.
Calculate destionation paths for the documents.
If the as_source
option is set, the output should be a source
file, so it will have the language's extension and use the source
template.
If the source is literate (eg: foo.yml.md
), the destination
will have the same name as the source but without the final ".md"
When the output is a document, ".html" is appended to the destination.
Save the documents to the output directory.
As extra context for rendering, we pass links to all the documents in the collection and the theme context which contains a selection of colors from the theme.