Sha256: 7adb45ca694734d0b5a471a22756cfb9677cb6a281170d3334b427b399087b36

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require 'berkeley_library/util/ods/xml/element_node'
require 'berkeley_library/util/ods/xml/office/font_face_decls'
require 'berkeley_library/util/ods/xml/office/styles'

module BerkeleyLibrary
  module Util
    module ODS
      module XML
        module Office
          class DocumentStyles < XML::ElementNode
            REQUIRED_NAMESPACES = %i[office style fo].freeze

            def initialize(doc:)
              super(:office, 'document-styles', doc: doc)

              set_default_attributes!
              add_default_children!
            end

            private

            def required_namespaces
              @required_namespaces ||= REQUIRED_NAMESPACES.map { |p| Namespace.for_prefix(p) }
            end

            def set_default_attributes!
              required_namespaces.each { |ns| set_attribute(:xmlns, ns.prefix, ns.uri) }
            end

            def add_default_children!
              add_child(FontFaceDecls.new(doc: doc))
              add_child(Styles.new(doc: doc))
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.7.1 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.7.0 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.6.0 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.5.1 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.5.0 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.4.3 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.4.2 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.4.1 lib/berkeley_library/util/ods/xml/office/document_styles.rb
berkeley_library-tind-0.4.0 lib/berkeley_library/util/ods/xml/office/document_styles.rb