[Nitro] getting spark to hightlight syntax...
manveru
ulmo at valaraan.de
Tue Sep 6 00:47:58 EDT 2005
hi list...
now, after freeing my mind a bit and drinking some coffee - the world
has cleared up :)
the problem was in the template/view.xhtml
i have replaced
------------
#|@page.body|
---------------------
with
----------------
<?r
body = @page.body.dup
body = RedCloth.new(body.dup).to_html
body.gsub!(/\{\{(.*?)\}\}/, '<a href="/view/\1">\1</a>')
body.gsub!(/href="(.*?)"/) { $&.gsub(/ /, '_') }
body = body.gsub(/(\[code\])(.*?)(\[\/code\])/m) { |c|
puts c.inspect
c.gsub!('[code]', '')
c.gsub!('[/code]', '')
c.strip!
c = CodeRay.scan(c, 'ruby').encode(:html, :bold_every => 10, :wrap
=> :div)
}
render_text(body)
?>
-----------------------
and it works perfect for me...
and i stripped the entry in the run.rb down to
-------------------
Markup.setup_markup_transform do |text|
String.sanitize(text)
end
-------------------
i assume it checks that all closing-tags are set and like, but haven't
checked that yet.
now i've got ruby-code-highlighting in rdog and a simple hack for
everyone who wants his spark doing that! :)
hope i didn't waste your time, but all the
templating/parsing/rendering/modeling/controlling/data-storing/checking
has eaten up my mind for a while...
one last question: what does #|somevar| exactly do? it reminds me of
#{somevar} but seems to have some connection to Markup...
PS: one can find coderay at http://rd.cycnus.de/coderay/
so long...
manveru
More information about the Nitro-general
mailing list