lib/trifle/docs/harvester/markdown.rb in trifle-docs-0.2.0 vs lib/trifle/docs/harvester/markdown.rb in trifle-docs-0.3.0
- old
+ new
@@ -25,26 +25,33 @@
end
end
class Conveyor < Harvester::Conveyor
def content
+ @content = nil unless cache
+
@content ||= Redcarpet::Markdown.new(
Render.new(with_toc_data: true),
fenced_code_blocks: true,
disable_indented_code_blocks: true,
footnotes: true
).render(data.sub(/^---(.*?)---(\s*)/m, ''))
end
def meta
+ @meta = nil unless cache
+
@meta ||= (YAML.safe_load(data[/^---(.*?)---(\s*)/m].to_s) || {}).merge(
'url' => "/#{[namespace, url].compact.join('/')}",
'breadcrumbs' => url.split('/'),
- 'toc' => toc
+ 'toc' => toc,
+ 'updated_at' => ::File.stat(file).mtime
)
end
def toc
+ @toc = nil unless cache
+
@toc ||= Redcarpet::Markdown.new(
Redcarpet::Render::HTML_TOC
).render(data.sub(/^---(.*?)---(\s*)/m, ''))
end
end