Skip to content

Commit

Permalink
refactor xref counter to allow overriding of number style: metanorma/…
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Oct 22, 2024
1 parent 28d663b commit e3fbe68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/isodoc/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def l10n(expr, lang = @lang, script = @script, locale = @locale)

def initialize(lang, script, locale, i18n, fonts_options = {})
@metadata = { lang:, script: }
DATETYPES.each { |w| @metadata["#{w.gsub('-', '_')}date".to_sym] = "XXX" }
DATETYPES.each { |w| @metadata["#{w.tr('-', '_')}date".to_sym] = "XXX" }
@lang = lang
@script = script
@locale = locale
Expand Down
6 changes: 5 additions & 1 deletion lib/isodoc/xref/xref_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,15 @@ def increment(node)
self
end

def style_number(num)
@style == :roman && !num.nil? ? RomanNumerals.to_roman(num) : num
end

def print
@unnumbered and return nil
@prefix_override and return @prefix_override
num = @number_override || @num
out = @style == :roman && !num.nil? ? RomanNumerals.to_roman(num) : num
out = style_number(num)
"#{@prefix}#{@base}#{out}#{@letter_override || @letter}"
end

Expand Down

0 comments on commit e3fbe68

Please sign in to comment.