class IsoDoc::Xref
Attributes
klass[R]
Public Class Methods
new(lang, script, klass, i18n, options = {})
click to toggle source
# File lib/isodoc/xref.rb, line 16 def initialize(lang, script, klass, i18n, options = {}) @anchors = {} @lang = lang @script = script @klass = klass @options = options @i18n = i18n @labels = @i18n.get @klass.i18n = @i18n end
Public Instance Methods
anchor(ident, lbl, warning = true)
click to toggle source
# File lib/isodoc/xref.rb, line 31 def anchor(ident, lbl, warning = true) return nil if ident.nil? || ident.empty? if warning && !@anchors[ident] @seen ||= Seen_Anchor.instance @seen.seen(ident) or warn "No label has been processed for ID #{ident}" @seen.add(ident) return "[#{ident}]" end @anchors.dig(ident, lbl) end
get()
click to toggle source
# File lib/isodoc/xref.rb, line 27 def get @anchors end
l10n(text, lang = @lang, script = @script)
click to toggle source
# File lib/isodoc/xref.rb, line 61 def l10n(text, lang = @lang, script = @script) @i18n.l10n(text, lang, script) end
ns(xpath)
click to toggle source
# File lib/isodoc/xref.rb, line 57 def ns(xpath) Common::ns(xpath) end
parse(docxml)
click to toggle source
extract names for all anchors, xref and label
# File lib/isodoc/xref.rb, line 44 def parse(docxml) amend_preprocess(docxml) initial_anchor_names(docxml) back_anchor_names(docxml) # preempt clause notes with all other types of note (ISO default) note_anchor_names(docxml.xpath(ns("//table | //figure"))) note_anchor_names(docxml.xpath(ns(SECTIONS_XPATH))) example_anchor_names(docxml.xpath(ns(SECTIONS_XPATH))) list_anchor_names(docxml.xpath(ns(SECTIONS_XPATH))) deflist_anchor_names(docxml.xpath(ns(SECTIONS_XPATH))) bookmark_anchor_names(docxml) end