Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_9_1_378) is shown here.
markup_code(tokens)public
Given a sequence of source tokens, mark up the source code to make it look purty.
# File lib/rdoc/generator.rb, line 1004
def markup_code(tokens)
src = ""
tokens.each do |t|
next unless t
# style = STYLE_MAP[t.class]
style = case t
when RDoc::RubyToken::TkCONSTANT then "ruby-constant"
when RDoc::RubyToken::TkKW then "ruby-keyword kw"
when RDoc::RubyToken::TkIVAR then "ruby-ivar"
when RDoc::RubyToken::TkOp then "ruby-operator"
when RDoc::RubyToken::TkId then "ruby-identifier"
when RDoc::RubyToken::TkNode then "ruby-node"
when RDoc::RubyToken::TkCOMMENT then "ruby-comment cmt"
when RDoc::RubyToken::TkREGEXP then "ruby-regexp re"
when RDoc::RubyToken::TkSTRING then "ruby-value str"
when RDoc::RubyToken::TkVal then "ruby-value"
else
nil
end
text = CGI.escapeHTML(t.text)
if style
src << "<span class=\"#{style}\">#{text}</span>"
else
src << text
end
end
add_line_numbers(src) if @options.include_line_numbers
src
end Related methods
- Instance methods
- <=>
- add_line_numbers
- aliases
- aref
- as_href
- call_seq
- create_source_code_file
- description
- document_self
- find_symbol
- formatter
- index_name
- inspect
- markup_code
- name
- params
- parent_name
- path
- section
- singleton
- visibility
- Class methods
- all_methods
- new
- reset