66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/devcenter/previewer/web_app.rb', line 66
def parse_article(src_path)
article = OpenStruct.new
src = IO.read(src_path)
metadata_yaml, article.content = src.split(/\r*\n\r*\n/, 2)
article.metadata = OpenStruct.new YAML.load(metadata_yaml)
markdown_flavour = article.metadata.markdown_flavour || :maruku
begin
article.html = ::DevcenterParser.to_html(article.content, markdown_flavour.to_sym)
rescue Exception => e
article.error = e.to_s
end
article
end
|