Sha256: b39eb56de87d30a211e2a8033f5edb966f7b18cb211b83066cc8a9f5037e24a4

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module CSL
  
  class Style < Node
    
    @default = :apa

    @root = File.expand_path('../../../vendor/styles', __FILE__).freeze
        
    @extension = '.csl'.freeze
    @prefix = ''
    
    class << self
      include Loader
      
      attr_accessor :default

      def parse(data)
        node = CSL.parse!(data)
        
        raise ParseError, "root node is not a style: #{node.inspect}" unless
          node.is_a?(self)
        
        node
      end
      
    end
    
    attr_defaults :version => Schema.version, :xmlns => Schema.namespace
    
    attr_struct :xmlns, :version, :'style-class', :'default-locale',
      :'initialize-with-hyphen', :'page-range-format',
      :'demote-non-dropping-particle', *Schema.attr(:name, :names)
    
    attr_children :'style-options', :info, :locale, :macro, :citation,
      :bibliography
    
    alias metadata info
    alias options  style_options
    alias locales  locale
    
    def initialize(attributes = {})
      super(attributes)
      
      children[:locale] = []
      children[:macro]  = []
      
      yield self if block_given?
    end
    
    
  end
    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csl-1.0.0.pre1 lib/csl/style.rb