Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (44 sloc) 2.039 kB
# -*- ruby -*-
website.config['website.base_url'] = 'http://kramdown.gettalong.org/'
website.config['sources'] =[['/', :file_system, 'doc']]
website.config['destination'] = [:file_system, 'htmldoc']
website.config['website.tmpdir'] = 'webgen-tmp'
website.config['content_processor.kramdown.options'][:coderay_line_numbers] = nil
####
# tag options
website.config.define_option('tag.options.items', [])
website.ext.tag.register('options', :mandatory => ['items'],
:config_prefix => 'tag.options') do |tag, body, context|
options = context[:config]['tag.options.items']
options = if options == 'all'
Kramdown::Options.definitions.sort.map {|k,v| v}
else
options.collect {|opt| Kramdown::Options.definitions[opt.intern]}
end
options.collect do |term|
lines = term.desc.split(/\n/)
first = lines.shift
rest = lines[0..-2].collect {|l| " " + l}.join("\n")
"`#{term.name}`\n: #{first}\n#{rest}\n\n"
end.join("\n")
end
####
# tag kdexample
require 'cgi'
website.ext.tag.register('kdexample', :config_prefix => 'tag.kdexample') do |tag, body, context|
body.strip!
result = ::Kramdown::Document.new(body, :auto_ids => false).to_html
before = "<pre class='kdexample-before'><code>#{CGI::escapeHTML(body)}\n</code></pre>"
after = "<pre class='kdexample-after-source'><code>#{CGI::escapeHTML(result)}\n</code></pre>"
afterhtml = "<div class='kdexample-after-live'>#{result}</div>"
"<table class='kdexample'><tr><td>#{before}</td><td>#{after}#{afterhtml}</td></tr></table>"
end
####
# tag kdlink
website.config.define_option('tag.kdlink.oid', nil)
website.config.define_option('tag.kdlink.part', nil)
website.ext.tag.register('kdlink', :mandatory => ['oid', 'part'],
:config_prefix => 'tag.kdlink') do |tag, body, context|
link = "<a href='syntax.html##{context[:config]['tag.kdlink.oid']}'>&rarr; Syntax for #{context[:config]['tag.kdlink.part']}</a>"
"<div class='kdsyntaxlink'>#{link}\n</div>"
end
Jump to Line
Something went wrong with that request. Please try again.