Sha256: ff3ce07f758ff2f49509604c54610dca055351fb9a743cf1bc8bc6e055d82b82

Contents?: true

Size: 695 Bytes

Versions: 8

Compression:

Stored size: 695 Bytes

Contents

begin
  require 'builder'
rescue LoadError
  gem 'builder'
  require 'builder'
end

module Lucid
  module Formatter
    # Emits attributes ordered alphabetically, so that we can predicatbly test output.
    class OrderedXmlMarkup < Builder::XmlMarkup #:nodoc:
      def _insert_attributes(attrs, order=[])
        return if attrs.nil?
        keys = attrs.keys.map{|k| k.to_s}
        keys.sort!
        keys.reverse! if (attrs.keys - [:version, :encoding] == []) #HACK to ensure the 'version' attribute is first in xml declaration.
        keys.each do |k|
          v = attrs[k.to_sym] || attrs[k]
          @target << %{ #{k}="#{_attr_value(v)}"} if v
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lucid-0.2.0 lib/lucid/formatter/ordered_xml_markup.rb
lucid-0.1.1 lib/lucid/formatter/ordered_xml_markup.rb
lucid-0.1.0 lib/lucid/formatter/ordered_xml_markup.rb
lucid-0.0.9 lib/lucid/formatter/ordered_xml_markup.rb
lucid-0.0.8 lib/lucid/formatter/ordered_xml_markup.rb
lucid-0.0.7 lib/lucid/formatter/ordered_xml_markup.rb
lucid-0.0.6 lib/lucid/formatter/ordered_xml_markup.rb
lucid-0.0.5 lib/lucid/formatter/ordered_xml_markup.rb