Sha256: b2110edd41b8321187047a77234ef06ec24ae7d889b77efa8f2eb13f1c36861d
Contents?: true
Size: 892 Bytes
Versions: 15
Compression:
Stored size: 892 Bytes
Contents
module YARD module Templates module Helpers module HtmlSyntaxHighlightHelper def html_syntax_highlight_ruby(source) tokenlist = Parser::Ruby::Legacy::TokenList.new(source) tokenlist.map do |s| prettyclass = s.class.class_name.sub(/^Tk/, '').downcase prettysuper = s.class.superclass.class_name.sub(/^Tk/, '').downcase case s when Parser::Ruby::Legacy::RubyToken::TkWhitespace, Parser::Ruby::Legacy::RubyToken::TkUnknownChar h s.text when Parser::Ruby::Legacy::RubyToken::TkId prettyval = h(s.text) "<span class='#{prettyval} #{prettyclass} #{prettysuper}'>#{prettyval}</span>" else "<span class='#{prettyclass} #{prettysuper}'>#{h s.text}</span>" end end.join end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems