lib/csl/style/names.rb in csl-1.1.0 vs lib/csl/style/names.rb in csl-1.2.0

- old
+ new

@@ -10,19 +10,19 @@ attr_children :name, :'et-al', :label, :substitute inherits :names_options - alias labels label - def initialize(attributes = {}) super(attributes) - children[:label] = [] - yield self if block_given? end + def prefix_label? + has_label? && has_name? && children.index(label) < children.index(name) + end + def delimiter(node = nil, style = nil) attributes.fetch(:delimiter) do inherited_names_options(node, style)[:delimiter] || '' end end @@ -95,10 +95,10 @@ # @param [Enumerable] names # @return [Array] the truncated list of names def truncate(names, subsequent = false) limit = truncate_at(subsequent) - return names if limit.zero? + return [] if limit.zero? names.take limit end def truncate_when(subsequent = false) if subsequent && attribute?(:'et-al-subsequent-min')