Sha256: dfde91c8088128491a43aea8d5602c2f4de3ace8cbf430d680daf4bef4ecbc3d

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

module CSL
  class Style
    
    # The Group rendering element must contain one or more rendering
    # element (with the exception of {Layout}). Group nodes may carry the
    # delimiter attribute to separate their child elements, as well as
    # affixes and display attributes (applied to the output of the group
    # as a whole).
    #
    # Groups implicitly act as a conditionals: a Group and its child
    # elements are suppressed if a) at least one rendering element in
    # the Group calls a variable (either directly or via a macro), and
    # b) all variables that are called are empty.
    class Group < Node
      attr_struct(*Schema.attr(:formatting, :delimiter))
      
      def delimiter
        attributes.fetch(:delimiter, '')
      end

      # Returns only those formatting options applicable to the Group
      # node itself; not those which are transmitted to the enclosed
      # elements.
      #
      # @return [Hash] the node's formatting options
      def formatting_options
        attributes_for :display, *Schema.attr(:affixes) 
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csl-1.2.2 lib/csl/style/group.rb