Class: Zine::Post
Overview
A post - content comes from the markdown, and the destination from the date
Instance Attribute Summary
Attributes inherited from Page
#dest_path, #formatted_data, #source_file, #template_bundle
Instance Method Summary collapse
-
#initialize(md_file_name, templates, site_options) ⇒ Post
constructor
A new instance of Post.
- #process(string_or_file_writer) ⇒ Object
- #process_without_writing ⇒ Object
Methods inherited from Page
Constructor Details
#initialize(md_file_name, templates, site_options) ⇒ Post
Returns a new instance of Post.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/zine/post.rb', line 8 def initialize(md_file_name, templates, ) @source_file = md_file_name file_parts = File.read(md_file_name).split('---', 3) @formatted_data = FormattedData.new(parse_yaml(file_parts[1], md_file_name), ) @raw_text = file_parts[2] init_templates(templates) option_dir = ['directories'] @build_dir = option_dir['build'] # for tags @dest_path = make_path_from_date option_dir['blog'] end |
Instance Method Details
#process(string_or_file_writer) ⇒ Object
21 22 23 24 25 |
# File 'lib/zine/post.rb', line 21 def process(string_or_file_writer) FileUtils.mkdir_p @dest_dir super string_or_file_writer tag_and_uri_subprocess end |
#process_without_writing ⇒ Object
27 28 29 30 |
# File 'lib/zine/post.rb', line 27 def process_without_writing parse_markdown tag_and_uri_subprocess end |