lib/trifle/docs/harvester/markdown.rb in trifle-docs-0.1.0 vs lib/trifle/docs/harvester/markdown.rb in trifle-docs-0.1.1
- old
+ new
@@ -30,24 +30,24 @@
@content ||= Redcarpet::Markdown.new(
Render.new(with_toc_data: true),
fenced_code_blocks: true,
disable_indented_code_blocks: true,
footnotes: true
- ).render(data.gsub(/^---(.*?)---(\s*)/m, ''))
+ ).render(data.sub(/^---(.*?)---(\s*)/m, ''))
end
def meta
- @meta ||= YAML.load_file(file).merge(
+ @meta ||= (YAML.safe_load(data[/^---(.*?)---(\s*)/m].to_s) || {}).merge(
'url' => "/#{url}",
'breadcrumbs' => url.split('/'),
'toc' => toc
)
end
def toc
@toc ||= Redcarpet::Markdown.new(
Redcarpet::Render::HTML_TOC
- ).render(data.gsub(/^---(.*?)---(\s*)/m, ''))
+ ).render(data.sub(/^---(.*?)---(\s*)/m, ''))
end
end
end
end
end