Sha256: 71aca9d5a4e321628abb9191c0091c6d206cea4036c107f52e646f3f0ad6eb2b

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module CSL
  class Style

    class Names < Node

      attr_struct :variable, *Schema.attr(:names, :delimiter, :affixes, :font)

      attr_children :name, :'et-al', :label, :substitute

      alias labels label

      def initialize(attributes = {})
        super(attributes)
        children[:label] = []

        yield self if block_given?
      end

      def delimiter
        attributes.fetch(:delimiter, '')
      end

      def has_variable?
        attribute?(:variable)
      end

      def variable
        attributes[:variable].to_s
      end

    end


    class Name < Node

      attr_struct :form, *Schema.attr(:name, :affixes, :font, :delimiter)

      attr_children :'name-part'

      alias parts name_part

      def initialize(attributes = {})
        super(attributes)
        children[:'name-part'] = []

        yield self if block_given?
      end

    end

    class NamePart < Node
      has_no_children
      attr_struct :name, :'text-case', *Schema.attr(:affixes, :font)
    end

    class EtAl < Node
      has_no_children
      attr_struct :term, *Schema.attr(:affixes, :font)
    end

    class Substitute < Node
    end


  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
csl-1.0.1 lib/csl/style/names.rb
csl-1.0.0 lib/csl/style/names.rb