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.
Included Modules
- EnumStateMachine
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.
Macro Summary
-
event(name, *, to, guard = nil)
Internal delegating macro
-
event(name, *, from, to, guard = nil)
Internal delegating macro
-
event(name, *, except_from, to, guard = nil)
Internal delegating macro
-
guard_code(*, on_fail)
These are the transitions between states:
-
guard_comment(*, on_fail)
These are the transitions between states:
-
guard_enclosing_comment_end(*, on_fail)
These are the transitions between states:
-
guard_enclosing_comment_start(*, on_fail)
These are the transitions between states:
Instance Method Summary
-
#code : State | Nil
Transition
State
state to#State::CodeBlock
if possible; return nil if unable. -
#code(&) : State | Nil
Transition
State
state to#State::CodeBlock
and yield to block if possible; return nil if unable. -
#code_block? : Bool
Check if current
State
state isCodeBlock
-
#comment : State | Nil
Transition
State
state to#State::CommentBlock
if possible; return nil if unable. -
#comment(&) : State | Nil
Transition
State
state to#State::CommentBlock
and yield to block if possible; return nil if unable. -
#comment_block? : Bool
Check if current
State
state isCommentBlock
-
#enclosing_comment_block? : Bool
Check if current
State
state isEnclosingCommentBlock
-
#enclosing_comment_end : State | Nil
Transition
State
state to#State::CodeBlock
if possible; return nil if unable. -
#enclosing_comment_end(&) : State | Nil
Transition
State
state to#State::CodeBlock
and yield to block if possible; return nil if unable. -
#enclosing_comment_start : State | Nil
Transition
State
state to#State::EnclosingCommentBlock
if possible; return nil if unable. -
#enclosing_comment_start(&) : State | Nil
Transition
State
state to#State::EnclosingCommentBlock
and yield to block if possible; return nil if unable. - #language : Language
- #language=(language : Language)
-
#may_code? : Bool
Check if
State
state can transition to#State::CodeBlock
-
#may_comment? : Bool
Check if
State
state can transition to#State::CommentBlock
-
#may_enclosing_comment_end? : Bool
Check if
State
state can transition to#State::CodeBlock
-
#may_enclosing_comment_start? : Bool
Check if
State
state can transition to#State::EnclosingCommentBlock
- #parse(source : String)
- #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))
-
#state : State
The current value of the
State
state.
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.
Macro Detail
Instance Method Detail
Transition State
state to #State::CommentBlock
and yield to block if possible; return nil if unable.
Transition State
state to #State::EnclosingCommentBlock
and yield to block if possible; return nil if unable.
Check if State
state can transition to #State::EnclosingCommentBlock
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