class Crycco::Document

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

Defined in:

crycco.cr

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(path : Path, template : String = "sidebyside", mode : String = "docs") #

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.


[View source]

Macro Detail

macro event(name, *, to, guard = nil) #

Internal delegating macro


[View source]
macro event(name, *, from, to, guard = nil) #

Internal delegating macro


[View source]
macro event(name, *, except_from, to, guard = nil) #

Internal delegating macro


[View source]
macro guard_code(*, on_fail) #

These are the transitions between states:


macro guard_comment(*, on_fail) #

These are the transitions between states:


macro guard_enclosing_comment_end(*, on_fail) #

These are the transitions between states:


macro guard_enclosing_comment_start(*, on_fail) #

These are the transitions between states:


Instance Method Detail

def code : State | Nil #

Transition State state to #State::CodeBlock if possible; return nil if unable.


def code(&) : State | Nil #

Transition State state to #State::CodeBlock and yield to block if possible; return nil if unable.


def code_block? : Bool #

Check if current State state is CodeBlock


[View source]
def comment : State | Nil #

Transition State state to #State::CommentBlock if possible; return nil if unable.


def comment(&) : State | Nil #

Transition State state to #State::CommentBlock and yield to block if possible; return nil if unable.


def comment_block? : Bool #

Check if current State state is CommentBlock


[View source]
def enclosing_comment_block? : Bool #

Check if current State state is EnclosingCommentBlock


[View source]
def enclosing_comment_end : State | Nil #

Transition State state to #State::CodeBlock if possible; return nil if unable.


def enclosing_comment_end(&) : State | Nil #

Transition State state to #State::CodeBlock and yield to block if possible; return nil if unable.


def enclosing_comment_start : State | Nil #

Transition State state to #State::EnclosingCommentBlock if possible; return nil if unable.


def enclosing_comment_start(&) : State | Nil #

Transition State state to #State::EnclosingCommentBlock and yield to block if possible; return nil if unable.


def language : Language #

[View source]
def language=(language : Language) #

[View source]
def may_code? : Bool #

Check if State state can transition to #State::CodeBlock


def may_comment? : Bool #

Check if State state can transition to #State::CommentBlock


def may_enclosing_comment_end? : Bool #

Check if State state can transition to #State::CodeBlock


def may_enclosing_comment_start? : Bool #

Check if State state can transition to #State::EnclosingCommentBlock


def parse(source : String) #

[View source]
def path : Path #

[View source]
def path=(path : Path) #

[View source]
def save(out_file : Path, extra_context) #

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


[View source]
def sections : Array(Crycco::Section) #

[View source]
def sections=(sections : Array(Crycco::Section)) #

[View source]
def state : State #

The current value of the State state.


[View source]