Sha256: 73b12946e68d9bc839d2bbbd2703285080e6142b129d591d5ed88e3962cc972c
Contents?: true
Size: 1.89 KB
Versions: 16
Compression:
Stored size: 1.89 KB
Contents
require_relative "xref/xref_anchor" require_relative "xref/xref_counter" require_relative "xref/xref_gen_seq" require_relative "xref/xref_gen" require_relative "xref/xref_sect_gen" require_relative "class_utils" require_relative "function/utils" module IsoDoc class Xref include XrefGen::Anchor include XrefGen::Blocks include XrefGen::Sections include Function::Utils attr_reader :klass def initialize(lang, script, klass, i18n, options = {}) @anchors = {} @lang = lang @script = script @klass = klass @options = options @i18n = i18n @labels = @i18n.get @klass.i18n = @i18n @locale = options[:locale] @reqt_models = @klass.requirements_processor .new({ default: "default", lang: lang, script: script, labels: @i18n.get }) @i18n @parse_settings = {} end def get @anchors end # parse only the elements set, if any are set # defined are: clause: true, refs: true def parse_inclusions(options) @parse_settings.merge!(options) self end def anchor(ident, lbl, warning = true) return nil if ident.nil? || ident.empty? if warning && !@anchors[ident] @seen.seen(ident) or warn "No label has been processed for ID #{ident}" @seen.add(ident) return "[#{ident}]" end @anchors.dig(ident, lbl) end # extract names for all anchors, xref and label def parse(docxml) @seen = SeenAnchor.new(docxml) amend_preprocess(docxml) if @parse_settings.empty? initial_anchor_names(docxml) back_anchor_names(docxml) asset_anchor_names(docxml) @parse_settings = {} end def ns(xpath) Common::ns(xpath) end def l10n(text, lang = @lang, script = @script, locale = @locale) @i18n.l10n(text, lang, script, locale) end end end
Version data entries
16 entries across 16 versions & 1 rubygems