/usr/lib/ruby/1.9.1/ramaze/contrib/maruku_uv.rb is in libramaze-ruby1.9.1 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # A hack to make MaRuKu use UltraViolet for highlighting
# To specify the style to use use for example:
# uv_style: amy
# html_use_syntax: true
# code_lang: ruby
# In the document header area.
require 'maruku'
module MaRuKu
module Out
module HTML
def uv_highlight(source, lang, style)
require 'uv'
html = Uv.parse(source, 'xhtml', lang, lines = false, style)
# Prepare <code> containing <pre>
code = Document.new(html, :respect_whitespace => :all).root
code.name = 'code'
code.attributes['class'] = lang
code.attributes['lang'] = lang
# Prepare <pre>
pre = Element.new('pre')
pre << code
pre.attributes['class'] = style
pre
rescue => ex
puts ex
to_html_code_using_pre(source)
end
def to_html_code
source = self.raw_code
use_syntax = get_setting(:html_use_syntax)
uv_style = get_setting(:uv_style)
lang = self.attributes[:lang] || @doc.attributes[:code_lang]
lang ||= 'ruby' if attributes[:ruby]
# we always use syntax highlighting, this is a doc wiki
if lang and use_syntax
element = uv_highlight(source, lang, uv_style)
else
element = to_html_code_using_pre(source)
end
color = get_setting(:code_background_color)
if color != Globals[:code_background_color]
element.attributes['style'] = "background-color: #{color};"
end
add_ws element
end
end # HTML
end # Out
end # MaRuKu
|