Class: Aardi::Post
Instance Attribute Summary
#metadata, #mtime
Attributes inherited from AbstractBlog
#key
Instance Method Summary
collapse
#parse_source, #title
#metadata, #mtime, #render
Constructor Details
#initialize(path) ⇒ Post
Returns a new instance of Post.
7
8
9
10
11
|
# File 'lib/aardi/post.rb', line 7
def initialize(path)
@path = path
parse_source path
raise "#{path}: missing Creation metadata" unless metadata['Creation']
end
|
Instance Method Details
#content ⇒ Object
13
14
15
|
# File 'lib/aardi/post.rb', line 13
def content
"#{@src_content}\n<div><span class=\"bookmark\">[<a href=\"#{url}\">bookmark</a>]</span></div>\n"
end
|
#creation ⇒ Object
17
|
# File 'lib/aardi/post.rb', line 17
def creation = metadata['Creation']
|
#day ⇒ Object
19
|
# File 'lib/aardi/post.rb', line 19
def day = creation.day
|
#feed_snippet ⇒ Object
21
22
23
24
|
# File 'lib/aardi/post.rb', line 21
def feed_snippet
clean_content = @src_content.sub(/\A(### .*\n)?\n+/, '')
render_markup(clean_content).strip
end
|
#month ⇒ Object
26
|
# File 'lib/aardi/post.rb', line 26
def month = creation.month
|
#name ⇒ Object
28
|
# File 'lib/aardi/post.rb', line 28
def name = File.basename(@path, '.*')
|
#report_field_summary ⇒ Object
30
31
32
33
|
# File 'lib/aardi/post.rb', line 30
def report_field_summary
= creation.strftime('%e %b %Y')
puts "#{} | #{@path} | #{title}"
end
|
#target_path ⇒ Object
35
36
37
|
# File 'lib/aardi/post.rb', line 35
def target_path
"./#{short_target}.html"
end
|
#updated ⇒ Object
39
|
# File 'lib/aardi/post.rb', line 39
def updated = metadata['Updated'] || creation
|
#url ⇒ Object
41
|
# File 'lib/aardi/post.rb', line 41
def url = "#{Aardi.config[:site_url]}/#{short_target}"
|
#year ⇒ Object
43
|
# File 'lib/aardi/post.rb', line 43
def year = creation.year
|