Class: Metanorma::Standoc::TermLookupCleanup
- Inherits:
-
Object
- Object
- Metanorma::Standoc::TermLookupCleanup
- 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
Instance Attribute Summary collapse
-
#log ⇒ Object
readonly
Returns the value of attribute log.
-
#lookup ⇒ Object
readonly
Returns the value of attribute lookup.
-
#xmldoc ⇒ Object
readonly
Returns the value of attribute xmldoc.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(xmldoc, log) ⇒ TermLookupCleanup
constructor
A new instance of TermLookupCleanup.
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
#log ⇒ Object (readonly)
Returns the value of attribute log.
9 10 11 |
# File 'lib/metanorma/standoc/term_lookup_cleanup.rb', line 9 def log @log end |
#lookup ⇒ Object (readonly)
Returns the value of attribute lookup.
9 10 11 |
# File 'lib/metanorma/standoc/term_lookup_cleanup.rb', line 9 def lookup @lookup end |
#xmldoc ⇒ Object (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
#call ⇒ Object
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 concept_cleanup remove_missing_refs concept_cleanup2 end |