class CSL::Style::Label
Labels are used for printing the term matching the variable selected with the required variable attribute, which must be set to “locator, ”page“, or one of the number variables.
The term is only rendered if the selected variable is non-empty.
If the {Label} is the child of a {Names} node, the parent’s variable is used instead of the local attribute.
Attributes
@!attribute [r] terms @return [Hash<String, String>] a cache for variable-term mapping
@!attribute [r] variables @return [Array<Symbol>] a list of valid label variable values
Public Instance Methods
Source
# File lib/csl/style/label.rb, line 59 def always_pluralize? attribute?(:plural) && attributes[:plural] =~ /^always$/i end
Source
# File lib/csl/style/label.rb, line 38 def has_variable? attribute?(:variable) end
Source
# File lib/csl/style/label.rb, line 68 def names_label? parent.is_a?(Names) end
@return [Boolean] whether or not the {Label} is inside a {Names} node
Source
# File lib/csl/style/label.rb, line 63 def never_pluralize? attribute?(:plural) && attributes[:plural] =~ /^never$/i end
Source
# File lib/csl/style/label.rb, line 74 def term Label.terms[variable.to_s] end
@return [String] the term name for the label’s variable
Source
# File lib/csl/style/label.rb, line 47 def variable attributes[:variable] end
The value of the node’s variable attribute. If the {Label} is the child of a {Names} node, returns the parent’s variable attribute instead.
@return [String, nil] the value of the node’s variable attribute