lib/yarrow/tools/content_utils.rb
# Pass in a source path and get back a parsed representation of the
# content if it is in a known text format. Mostly used as a fallback if
# a custom parser or processing chain is not configured for a content
# type.
#
# Supported formats:
# - HTML template and document partials
# - Markdown documents
# - YAML documents
# - JSON (untested)
#
# Works around meta and content source in multiple files or a single
# file with front matter.
Pass in a source path and get back a parsed representation of the
content if it is in a known text format. Mostly used as a fallback if
a custom parser or processing chain is not configured for a content
type.

Supported formats:
HTML template and document partials
Markdown documents
YAML documents
JSON (untested)

Works around meta and content source in multiple files or a single
file with front matter.
Pass in a source path and get back a parsed representation of the content if it is in a known text format . Mostly used as a fallback if a custom parser or processing chain is not configured for a content type . Supported formats : HTML template and document partials Markdown documents YAML documents JSON ( untested ) Works around meta and content source in multiple files or a single file with front matter .
def write_yfm(name, text, meta)
        File.write(name, [YAML.dump(meta.to_json), "---", text].join("\n"))
      end
def write_yfm ( name , text , meta ) File . write ( name , [ YAML . dump ( meta . to_json ) , "---" , text ] . join ( "\n" ) ) end
Pass in a source path and get back a parsed representation of the
content if it is in a known text format.
Pass in a source path and get back a parsed representation of the content if it is in a known text format .
# Symbolized keys are better to deal with when manipulating data in # Ruby but are an interop nightmare when serialized so here we do a # round-trip through JSON encoding to ensure all keys are string # encoded before dumping them to the front matter format.
name
<not_specific>
text
<not_specific>
meta
<not_specific>