module YARD::Templates::Helpers::HtmlSyntaxHighlightHelper
def html_syntax_highlight_ruby_ripper(source)
def html_syntax_highlight_ruby_ripper(source) resolver = Parser::Ruby::TokenResolver.new(source, object) output = String.new("") resolver.each do |s, token_obj| token_obj = clean_token_object(token_obj) output << "<span class='tstring'>" if [:tstring_beg, :regexp_beg].include?(s[0]) case s.first when :nl, :ignored_nl, :sp output << h(s[1]) when :ident, :const klass = s.first == :ident ? "id identifier rubyid_#{h(s[1])}" : s.first val = token_obj ? link_object(token_obj, s[1]) : h(s[1]) output << "<span class='#{klass}'>#{val}</span>" else output << "<span class='#{s.first}'>#{h(s[1])}</span>" end output << "</span>" if [:tstring_end, :regexp_end].include?(s[0]) end output rescue Parser::ParserSyntaxError source =~ /^<span\s+class=/ ? source : h(source) end