Class: Metanorma::Standoc::TermLookupCleanup

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/metanorma/standoc/term_lookup_cleanup.rb

Overview

Intelligent term lookup xml modifier

Constant Summary collapse

AUTO_GEN_ID_REGEXP =
/\A_/

Constants included from Utils

Utils::SUBCLAUSE_XPATH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

adoc2xml, #asciimath_key, #attr_code, #convert, #csv_split, #dl_to_attrs, #dl_to_elems, #document_ns_attributes, #grkletters, #isodoc, #kv_parse, #link_unwrap, #noko, #quoted_csv_split, #refid?, #term_expr, #to_xml, #wrap_in_para, #xml_encode

Constructor Details

#initialize(xmldoc, log) ⇒ TermLookupCleanup

Returns a new instance of TermLookupCleanup.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/metanorma/standoc/term_lookup_cleanup.rb', line 11

def initialize(xmldoc, log)
  @xmldoc = xmldoc
  @log = log
  @lookup = { term: {}, symbol: {}, sec2prim: {} }
  @idhash = {}
  @unique_designs = {}
  @c = HTMLEntities.new
  @terms_tags = xmldoc.xpath("//terms").each_with_object({}) do |t, m|
    m[t["id"]] = true
  end
end

Instance Attribute Details

#logObject (readonly)

Returns the value of attribute log.



9
10
11
# File 'lib/metanorma/standoc/term_lookup_cleanup.rb', line 9

def log
  @log
end

#lookupObject (readonly)

Returns the value of attribute lookup.



9
10
11
# File 'lib/metanorma/standoc/term_lookup_cleanup.rb', line 9

def lookup
  @lookup
end

#xmldocObject (readonly)

Returns the value of attribute xmldoc.



9
10
11
# File 'lib/metanorma/standoc/term_lookup_cleanup.rb', line 9

def xmldoc
  @xmldoc
end

Instance Method Details

#callObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/metanorma/standoc/term_lookup_cleanup.rb', line 23

def call
  @idhash = populate_idhash
  @unique_designs = unique_designators
  @lookup = replace_automatic_generated_ids_terms
  set_termxref_tags_target
  concept_cleanup
  related_cleanup
  remove_missing_refs
  concept_cleanup2
end