Skip to content

Commit

Permalink
subclass ClauseCounter, to allow it to be overridden in flavours: met…
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Oct 22, 2024
1 parent e3fbe68 commit c1cdd9c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/isodoc/xref.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require_relative "xref/xref_anchor"
require_relative "xref/xref_counter"
require_relative "xref/xref_counter_types"
require_relative "xref/xref_gen_seq"
require_relative "xref/xref_gen"
require_relative "xref/xref_sect_gen"
Expand Down
11 changes: 11 additions & 0 deletions lib/isodoc/xref/xref_counter_types.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require_relative "xref_counter"

module IsoDoc
module XrefGen
class ClauseCounter < Counter
def initialize(num = 0, opts = { numerals: :arabic })
super
end
end
end
end
3 changes: 1 addition & 2 deletions lib/isodoc/xref/xref_gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def termnote_label(note)
end

def increment_label(elems, node, counter, increment: true)
return "" if elems.size == 1 && !node["number"]

elems.size == 1 && !node["number"] and return ""
counter.increment(node) if increment
" #{counter.print}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/xref/xref_sect_gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def preface_anchor_names(xml)
end

def main_anchor_names(xml)
n = Counter.new
n = ClauseCounter.new
clause_order_main(xml).each do |a|
xml.xpath(ns(a[:path])).each do |c|
section_names(c, n, 1)
Expand Down

0 comments on commit c1cdd9c

Please sign in to comment.