diff options
Diffstat (limited to 'lib/coderay/encoders/xml.rb')
-rw-r--r-- | lib/coderay/encoders/xml.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/coderay/encoders/xml.rb b/lib/coderay/encoders/xml.rb index d3e8832..f2e7c02 100644 --- a/lib/coderay/encoders/xml.rb +++ b/lib/coderay/encoders/xml.rb @@ -1,38 +1,38 @@ module CodeRay module Encoders - + # = XML Encoder # # Uses REXML. Very slow. class XML < Encoder - + register_for :xml - + FILE_EXTENSION = 'xml' - + require 'rexml/document' - + DEFAULT_OPTIONS = { :tab_width => 8, :pretty => -1, :transitive => false, } - + protected - def setup options @doc = REXML::Document.new @doc << REXML::XMLDecl.new @tab_width = options[:tab_width] @root = @node = @doc.add_element('coderay-tokens') end - + def finish options @out = '' @doc.write @out, options[:pretty], options[:transitive], true @out end + public def text_token text, kind if kind == :space token = @node |