class Crycco::Document
- Crycco::Document
- Reference
- Object
Overview
Document
A Document takes a path as input and reads the file, parses its contents and is able to generate whatever output is needed.
Defined in:
crycco.crConstructors
-
.new(path : Path, template : String = "sidebyside", mode : String = "docs")
On initialization we read the file and parse it in the correct language.
Instance Method Summary
- #language : Language
- #language=(language : Language)
-
#parse(source : String)
Given a string of source code, parse out each block of prose and the code that follows it — by detecting which is which, line by line — and then create an individual section for it.
- #path : Path
- #path=(path : Path)
-
#save(out_file : Path, extra_context)
Save the document to a file using the desired format and template.
- #sections : Array(Crycco::Section)
- #sections=(sections : Array(Crycco::Section))
Constructor Detail
On initialization we read the file and parse it in the correct
language. Also, if rather than a .yml
file we have a .yml.md
we consider that "literate YAML" and tweak the language
definition a bit.
Instance Method Detail
Given a string of source code, parse out each block of prose
and the code that follows it — by detecting which is which,
line by line — and then create an individual section for it.
Each section is an object with docs
and code
properties,
which can later be converted to HTML.
Save the document to a file using the desired format and template. If you want to learn more about the templates you can check out templates.cr