summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/xml.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2011-06-11 17:31:28 +0000
committermurphy <murphy@rubychan.de>2011-06-11 17:31:28 +0000
commitc499d778d87d233a22d0a3199594e36546841b62 (patch)
treec26f27fb1279c7def8ba6279bd40ab9c3b1ab107 /lib/coderay/encoders/xml.rb
parent14949dbd45fb61540e2bdc1db281312c98d55cff (diff)
downloadcoderay-c499d778d87d233a22d0a3199594e36546841b62.tar.gz
fix XML encoder (make token methods public)
Diffstat (limited to 'lib/coderay/encoders/xml.rb')
-rw-r--r--lib/coderay/encoders/xml.rb16
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