Top Level Namespace
Defined Under Namespace
Modules: Pipin
Classes: HikiDoc, MixiStyle
Constant Summary
collapse
- SRCDIR =
config[:dir][:posts]
- DSTDIR =
config[:dir][:dist]
- SRC_EXTNAMES =
%w(html txt)
- EXTS =
SRC_EXTNAMES.join(',')
- DIARY_SRCS =
FileList["#{SRCDIR}/#{Pipin::Diary_pattern}.{#{EXTS}}"]
- SRCS =
FileList["#{SRCDIR}/#{Pipin::Post_pattern}.{#{EXTS}}"]
- DSTS =
SRCS.pathmap("#{DSTDIR}/%n.html")
- MONTH_DSTS =
Pipin::Post.year_months.map {|year, months|
months.map {|month| dst_html(year + month) }
}.flatten
- OTHER_TASKS =
{
'index' => DIARY_SRCS.sort.reverse[0, 3],
'archives' => DIARY_SRCS,
'sitemap' => SRCS,
}
- OTHER_DSTS =
OTHER_TASKS.keys.map {|page| dst_html(page) }
Instance Method Summary
collapse
Instance Method Details
#amazon(asin, opts = {}) ⇒ Object
2
3
4
5
6
7
8
|
# File 'lib/pipin/templates/plugins/amazon.rb', line 2
def amazon(asin, opts = {})
if opts[:text]
amazon_text(asin, opts[:text])
else
amazon_img(asin)
end
end
|
#amazon_img(asin) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/pipin/templates/plugins/amazon.rb', line 10
def amazon_img(asin)
<<-HTML
<div class="amazon">
<iframe src="http://rcm-jp.amazon.co.jp/e/cm?t=#{config[:amazonid] or 'bilbo-22'}&o=9&p=8&l=as1&asins=#{asin}&fc1=000000&IS2=1<1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
HTML
end
|
#amazon_text(asin, text) ⇒ Object
18
19
20
21
22
|
# File 'lib/pipin/templates/plugins/amazon.rb', line 18
def amazon_text(asin, text)
<<-HTML
<a href="http://www.amazon.co.jp/o/ASIN/#{asin}/#{config[:amazonid] or 'bilbo-22'}">#{text}</a>
HTML
end
|
#dst_html(label) ⇒ Object
4
5
6
|
# File 'lib/pipin/build_tasks.rb', line 4
def dst_html(label)
File.join DSTDIR, "#{label}.html"
end
|
#eval_hiki_plugin(html) ⇒ Object
1
2
3
|
# File 'lib/pipin/templates/plugins/use_hiki_plugin.rb', line 1
def eval_hiki_plugin(html)
html.gsub(/<(div|span) class=\"plugin\">\{\{(.+)\}\}<\/(div|span)>/) { eval($2) }
end
|
#html_extname ⇒ Object
7
|
# File 'lib/pipin.rb', line 7
def html_extname() config[:html_extname] or '.html' end
|
#load_plugins(dir) ⇒ Object
8
|
# File 'lib/pipin.rb', line 8
def load_plugins(dir) Dir.glob("#{dir}/*.rb").sort.each {|e| load e } end
|
#rootdir ⇒ Object
6
|
# File 'lib/pipin.rb', line 6
def rootdir() File.join(File.dirname(File.expand_path(__FILE__)), 'pipin') end
|