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.

Defined in:

crycco.cr

Constructors

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]

Instance Method Detail

def language : Language #

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

[View source]
def 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. Each section is an object with docs and code properties, which can later be converted to HTML.


[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]