Module: Syntropy::Markdown
- Defined in:
- lib/syntropy/markdown.rb
Overview
Markdown parsing.
Defined Under Namespace
Classes: Controller
Constant Summary collapse
- FRONT_MATTER_REGEXP =
/\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m- YAML_OPTS =
{ permitted_classes: [Date], symbolize_names: true }.freeze
Class Method Summary collapse
-
.make_controller(env, atts, md) ⇒ Markdown::Controller
Creates a Markdown file contoroller for the given environment, attributes and markdown.
-
.parse_file(path, env) ⇒ Array
Parses the markdown file at the given path.
-
.parse_md(atts, md) ⇒ Array<atts, md>
Parses the markdown content, returning the attributes and cleaned up markdown.
Class Method Details
.make_controller(env, atts, md) ⇒ Markdown::Controller
Creates a Markdown file contoroller for the given environment, attributes and markdown.
150 151 152 |
# File 'lib/syntropy/markdown.rb', line 150 def make_controller(env, atts, md) Controller.new(env, atts, md).to_proc end |
.parse_file(path, env) ⇒ Array
Parses the markdown file at the given path.
123 124 125 126 127 128 129 130 |
# File 'lib/syntropy/markdown.rb', line 123 def parse_file(path, env) md = IO.read(path) || '' atts = {} atts[:url] = path_to_url(path, env[:app_root]) if env[:app_root] parse_date(atts, path) parse_md(atts, md) end |
.parse_md(atts, md) ⇒ Array<atts, md>
Parses the markdown content, returning the attributes and cleaned up markdown.
138 139 140 141 |
# File 'lib/syntropy/markdown.rb', line 138 def parse_md(atts, md) md = parse_content(atts, md) [atts, md] end |