Module: Octopress::Linkblog
- Defined in:
- lib/octopress-linkblog.rb,
lib/octopress-linkblog/version.rb,
lib/octopress-linkblog/configuration.rb
Defined Under Namespace
Classes: PageHook, PostHook, SiteHook
Constant Summary
collapse
- VERSION =
"2.0.1"
- DEFAULT_OPTIONS =
{
'linkblog' => {
'linkpost' => {
'marker' => "→",
'marker_position' => 'after'
},
'post' => {
'marker' => false,
'marker_position' => 'before'
},
'titlecase' => true,
'unorphan' => true,
'permalink_label' => 'Permalink'
}
}
Class Method Summary
collapse
Class Method Details
.config(options = {}) ⇒ Object
23
24
25
26
|
# File 'lib/octopress-linkblog/configuration.rb', line 23
def self.config(options={})
@config ||= Jekyll::Utils.deep_merge_hashes(DEFAULT_OPTIONS, options)
@config['linkblog']
end
|
.post_link(title, url, classnames) ⇒ Object
95
96
97
|
# File 'lib/octopress-linkblog.rb', line 95
def self.post_link(title, url, classnames)
"<a href='#{url}' class='#{classnames}'>#{title}</a>"
end
|
.post_title_html(title, config) ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/octopress-linkblog.rb', line 72
def self.post_title_html(title, config)
title = unorphan(title)
return title if !config['marker']
marker = "<span class='post-marker post-marker-#{config['marker_position']}'>#{config['marker']}</span>"
position = config['marker_position']
if config['marker_position'] == 'before'
title = "#{marker} #{title}"
else
title = "#{title} #{marker}"
end
title
end
|
.post_title_link(data) ⇒ Object
89
90
91
92
93
|
# File 'lib/octopress-linkblog.rb', line 89
def self.post_title_link(data)
classname = "article-link"
classname << " linkpost" if data['linkpost']
post_link(data['title_html'], data['title_url'], classname)
end
|
.post_title_text(title, config) ⇒ Object
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/octopress-linkblog.rb', line 99
def self.post_title_text(title, config)
return title if !config['marker']
position = config['marker_position']
if config['marker_position'] == 'before'
"#{config['marker']} #{title}"
else
"#{title} #{config['marker']}"
end
end
|
.unorphan(title) ⇒ Object
64
65
66
67
68
69
70
|
# File 'lib/octopress-linkblog.rb', line 64
def self.unorphan(title)
if Linkblog.config['unorphan']
title.sub(/\s+(\S+)\s*$/, ' \1')
else
title
end
end
|