Do stuff
This commit is contained in:
parent
decb9d8430
commit
c0ca040c2c
19 changed files with 366 additions and 237 deletions
|
@ -5,6 +5,10 @@ RubyPython.start python_exe: 'python2.6' if ENV['RACK_ENV'] == 'production'
|
|||
class MarkdownHTML < Redcarpet::Render::HTML
|
||||
include Redcarpet::Render::SmartyPants
|
||||
|
||||
def initialize(options={})
|
||||
super options.merge(with_toc_data: true)
|
||||
end
|
||||
|
||||
def block_code(code, language)
|
||||
Pygments.highlight(code, lexer: language)
|
||||
end
|
||||
|
|
14
lib/nav.rb
Normal file
14
lib/nav.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
include Nanoc::Helpers::LinkTo
|
||||
|
||||
def nav_link_with_active(text, target, attributes = {})
|
||||
path = target.is_a?(String) ? target : target.path
|
||||
rep_path = @item_rep.path
|
||||
|
||||
active = if path == '/'
|
||||
path == rep_path
|
||||
else
|
||||
/^#{path}/ =~ rep_path
|
||||
end
|
||||
|
||||
"<li #{'class="active"' if active}>" + link_to(text, target, attributes) + "</li>"
|
||||
end
|
4
lib/render_child.rb
Normal file
4
lib/render_child.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
def render_child(name)
|
||||
child = @item.children.find { |child| child.identifier == name }
|
||||
child.reps.find { |rep| rep.name == :default }.content_at_snapshot(:last)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue