metanorma-standoc 3.1.10 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/metanorma/standoc/base.rb +2 -2
 - data/lib/metanorma/standoc/blocks.rb +1 -2
 - data/lib/metanorma/standoc/cleanup.rb +6 -6
 - data/lib/metanorma/standoc/cleanup_asciibib.rb +7 -10
 - data/lib/metanorma/standoc/cleanup_attachment.rb +1 -2
 - data/lib/metanorma/standoc/cleanup_bibitem.rb +29 -2
 - data/lib/metanorma/standoc/cleanup_block.rb +1 -2
 - data/lib/metanorma/standoc/cleanup_boilerplate.rb +1 -2
 - data/lib/metanorma/standoc/cleanup_footnotes.rb +1 -2
 - data/lib/metanorma/standoc/cleanup_inline.rb +1 -2
 - data/lib/metanorma/standoc/cleanup_maths.rb +3 -3
 - data/lib/metanorma/standoc/cleanup_terms_boilerplate.rb +1 -3
 - data/lib/metanorma/standoc/cleanup_terms_designations.rb +2 -3
 - data/lib/metanorma/standoc/cleanup_xref.rb +3 -8
 - data/lib/metanorma/standoc/converter.rb +7 -5
 - data/lib/metanorma/standoc/inline.rb +1 -3
 - data/lib/metanorma/standoc/localbib.rb +5 -9
 - data/lib/metanorma/standoc/log.rb +195 -0
 - data/lib/metanorma/standoc/macros_embed.rb +5 -3
 - data/lib/metanorma/standoc/macros_link.rb +2 -3
 - data/lib/metanorma/standoc/ref.rb +1 -2
 - data/lib/metanorma/standoc/ref_queue.rb +4 -6
 - data/lib/metanorma/standoc/ref_sect.rb +3 -6
 - data/lib/metanorma/standoc/ref_utility.rb +2 -7
 - data/lib/metanorma/standoc/spans_to_bibitem.rb +12 -1
 - data/lib/metanorma/standoc/spans_to_bibitem_preprocessing.rb +11 -7
 - data/lib/metanorma/standoc/term_lookup_cleanup.rb +7 -18
 - data/lib/metanorma/standoc/terms.rb +1 -3
 - data/lib/metanorma/standoc/validate.rb +7 -17
 - data/lib/metanorma/standoc/validate_image.rb +3 -9
 - data/lib/metanorma/standoc/validate_schema.rb +3 -2
 - data/lib/metanorma/standoc/validate_section.rb +3 -6
 - data/lib/metanorma/standoc/validate_table.rb +3 -5
 - data/lib/metanorma/standoc/validate_term.rb +4 -14
 - data/lib/metanorma/standoc/version.rb +1 -1
 - data/metanorma-standoc.gemspec +4 -3
 - metadata +22 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b31a7d2190d00f77453583314cf1fd4169b2a7d54c8a9c875c1aee18c0036c83
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7d827880dc836092ed06347a2b008597645416dbd50ecee20000e06f3b245b53
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 667dae14d6d8fa22c20d531cfbadf6a5df8678b6180edcadc021dad25b1b63fdffe71d89d24ba5ed3af90f82f3661b12fcd943b31e611f76e211458c95db4235
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b4eb5852322aab31ba5afe54508c9f3fdcdb6664718667124de3e2031902b2d27511f8459ad64b43267f13f9cb74efb9d3284acec2566a930a4acff5819443bd
         
     | 
| 
         @@ -22,7 +22,7 @@ module Metanorma 
     | 
|
| 
       22 
22 
     | 
    
         
             
              module Standoc
         
     | 
| 
       23 
23 
     | 
    
         
             
                module Base
         
     | 
| 
       24 
24 
     | 
    
         
             
                  include IsolatedConverter
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       26 
26 
     | 
    
         
             
                  # XML_ROOT_TAG = "standard-document".freeze
         
     | 
| 
       27 
27 
     | 
    
         
             
                  # XML_NAMESPACE = "https://www.metanorma.org/ns/standoc".freeze
         
     | 
| 
       28 
28 
     | 
    
         
             
                  FONTS_MANIFEST = "fonts-manifest".freeze
         
     | 
| 
         @@ -44,7 +44,7 @@ module Metanorma 
     | 
|
| 
       44 
44 
     | 
    
         
             
                    clean_exit
         
     | 
| 
       45 
45 
     | 
    
         
             
                    ret
         
     | 
| 
       46 
46 
     | 
    
         
             
                  rescue StandardError => e
         
     | 
| 
       47 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
      
 47 
     | 
    
         
            +
                    @log.add("STANDOC_50", nil, params: [e.message])
         
     | 
| 
       48 
48 
     | 
    
         
             
                    clean_exit
         
     | 
| 
       49 
49 
     | 
    
         
             
                    raise e
         
     | 
| 
       50 
50 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -244,9 +244,8 @@ module Metanorma 
     | 
|
| 
       244 
244 
     | 
    
         
             
                  # as it may be fragment, e.g. unterminated start of element markup
         
     | 
| 
       245 
245 
     | 
    
         
             
                  def passthrough_validate(node, content, encoded_content)
         
     | 
| 
       246 
246 
     | 
    
         
             
                    valid, = validate_document_fragment(content.dup)
         
     | 
| 
       247 
     | 
    
         
            -
                    err = "Invalid passthrough content: #{encoded_content}\n#{PASSTHRU_ERR}"
         
     | 
| 
       248 
247 
     | 
    
         
             
                    !valid and
         
     | 
| 
       249 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
      
 248 
     | 
    
         
            +
                      @log.add("STANDOC_42", node, params: [encoded_content])
         
     | 
| 
       250 
249 
     | 
    
         
             
                  end
         
     | 
| 
       251 
250 
     | 
    
         
             
                end
         
     | 
| 
       252 
251 
     | 
    
         
             
              end
         
     | 
| 
         @@ -83,7 +83,7 @@ module Metanorma 
     | 
|
| 
       83 
83 
     | 
    
         
             
                    ext_contributor_cleanup(xmldoc) # feeds: bibdata_cleanup
         
     | 
| 
       84 
84 
     | 
    
         
             
                    ext_dochistory_cleanup(xmldoc) # feeds: bibdata_cleanup
         
     | 
| 
       85 
85 
     | 
    
         
             
                    bibdata_cleanup(xmldoc) # feeds: boilerplate_cleanup
         
     | 
| 
       86 
     | 
    
         
            -
                    boilerplate_cleanup(xmldoc) # feeds: xref_cleanup for new <<>> 
     | 
| 
      
 86 
     | 
    
         
            +
                    boilerplate_cleanup(xmldoc) # feeds: xref_cleanup for new <<>>
         
     | 
| 
       87 
87 
     | 
    
         
             
                    # introduced, pres_metadata_cleanup
         
     | 
| 
       88 
88 
     | 
    
         
             
                    pres_metadata_cleanup(xmldoc)
         
     | 
| 
       89 
89 
     | 
    
         
             
                    xref_cleanup(xmldoc)
         
     | 
| 
         @@ -106,21 +106,21 @@ module Metanorma 
     | 
|
| 
       106 
106 
     | 
    
         
             
                  def relaton_iev_cleanup(xmldoc)
         
     | 
| 
       107 
107 
     | 
    
         
             
                    _, err = RelatonIev::iev_cleanup(xmldoc, @bibdb)
         
     | 
| 
       108 
108 
     | 
    
         
             
                    err.each do |e|
         
     | 
| 
       109 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
      
 109 
     | 
    
         
            +
                      @log.add("RELATON_5", nil, params: e)
         
     | 
| 
       110 
110 
     | 
    
         
             
                    end
         
     | 
| 
       111 
111 
     | 
    
         
             
                  end
         
     | 
| 
       112 
112 
     | 
    
         | 
| 
       113 
113 
     | 
    
         
             
                  RELATON_SEVERITIES =
         
     | 
| 
       114 
     | 
    
         
            -
                    { "INFO":  
     | 
| 
       115 
     | 
    
         
            -
                      "UNKNOWN":  
     | 
| 
      
 114 
     | 
    
         
            +
                    { "INFO": "RELATON_4", "WARN":  "RELATON_3", "ERROR":  "RELATON_2",
         
     | 
| 
      
 115 
     | 
    
         
            +
                      "FATAL": "RELATON_1", "UNKNOWN":  "RELATON_4" }.freeze
         
     | 
| 
       116 
116 
     | 
    
         | 
| 
       117 
117 
     | 
    
         
             
                  def relaton_log_cleanup(_xmldoc)
         
     | 
| 
       118 
118 
     | 
    
         
             
                    @relaton_log or return
         
     | 
| 
       119 
119 
     | 
    
         
             
                    @relaton_log.rewind
         
     | 
| 
       120 
120 
     | 
    
         
             
                    @relaton_log.string.split(/(?<=})\n(?={)/).each do |l|
         
     | 
| 
       121 
121 
     | 
    
         
             
                      e = JSON.parse(l)
         
     | 
| 
       122 
     | 
    
         
            -
                      @log.add( 
     | 
| 
       123 
     | 
    
         
            -
                                
     | 
| 
      
 122 
     | 
    
         
            +
                      @log.add(RELATON_SEVERITIES[e["severity"].to_sym], e["key"],
         
     | 
| 
      
 123 
     | 
    
         
            +
                               params: [e["message"]])
         
     | 
| 
       124 
124 
     | 
    
         
             
                    end
         
     | 
| 
       125 
125 
     | 
    
         
             
                  end
         
     | 
| 
       126 
126 
     | 
    
         | 
| 
         @@ -26,9 +26,7 @@ module Metanorma 
     | 
|
| 
       26 
26 
     | 
    
         
             
                    id = bib["id"]
         
     | 
| 
       27 
27 
     | 
    
         
             
                    id ||= clause["anchor"] unless /^_/.match?(clause["anchor"])
         
     | 
| 
       28 
28 
     | 
    
         
             
                    unless id
         
     | 
| 
       29 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       30 
     | 
    
         
            -
                               "The following reference is missing an anchor:\n" \
         
     | 
| 
       31 
     | 
    
         
            -
                               "#{clause.to_xml}", severity: 1)
         
     | 
| 
      
 29 
     | 
    
         
            +
                      @log.add("STANDOC_10", clause, params: [clause.to_xml])
         
     | 
| 
       32 
30 
     | 
    
         
             
                      return
         
     | 
| 
       33 
31 
     | 
    
         
             
                    end
         
     | 
| 
       34 
32 
     | 
    
         
             
                    @refids << id
         
     | 
| 
         @@ -36,13 +34,12 @@ module Metanorma 
     | 
|
| 
       36 
34 
     | 
    
         
             
                  end
         
     | 
| 
       37 
35 
     | 
    
         | 
| 
       38 
36 
     | 
    
         
             
                  def validate_ref_dl1(bib, id, clause)
         
     | 
| 
       39 
     | 
    
         
            -
                    bib["title"] 
     | 
| 
       40 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                    bib["docid"] 
     | 
| 
       43 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                               severity: 1)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    if !bib["title"]
         
     | 
| 
      
 38 
     | 
    
         
            +
                      @log.add("STANDOC_11", clause, params: [id])
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                    if !bib["docid"]
         
     | 
| 
      
 41 
     | 
    
         
            +
                      @log.add("STANDOC_12", clause, params: [id])
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
       46 
43 
     | 
    
         
             
                  end
         
     | 
| 
       47 
44 
     | 
    
         | 
| 
       48 
45 
     | 
    
         
             
                  def extract_from_p(tag, bib, key)
         
     | 
| 
         @@ -53,8 +53,7 @@ module Metanorma 
     | 
|
| 
       53 
53 
     | 
    
         
             
                  def valid_attachment?(path, bib)
         
     | 
| 
       54 
54 
     | 
    
         
             
                    File.exist?(path) and return true
         
     | 
| 
       55 
55 
     | 
    
         
             
                    p = Pathname.new(path).cleanpath
         
     | 
| 
       56 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
       57 
     | 
    
         
            -
                             severity: 0)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    @log.add("STANDOC_9", bib, params: [p])
         
     | 
| 
       58 
57 
     | 
    
         
             
                    false
         
     | 
| 
       59 
58 
     | 
    
         
             
                  end
         
     | 
| 
       60 
59 
     | 
    
         | 
| 
         @@ -16,13 +16,14 @@ module Metanorma 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  def new_bibitem_from_formattedref_spans(bib)
         
     | 
| 
       17 
17 
     | 
    
         
             
                    ret = SpansToBibitem.new(bib).convert
         
     | 
| 
       18 
18 
     | 
    
         
             
                    ret.err.each do |e|
         
     | 
| 
       19 
     | 
    
         
            -
                      @log.add( 
     | 
| 
      
 19 
     | 
    
         
            +
                      @log.add(e[:fatal] ? "STANDOC_52" : "STANDOC_53",
         
     | 
| 
      
 20 
     | 
    
         
            +
                               bib, params: [e[:msg]])
         
     | 
| 
       20 
21 
     | 
    
         
             
                    end
         
     | 
| 
       21 
22 
     | 
    
         
             
                    ret.out
         
     | 
| 
       22 
23 
     | 
    
         
             
                  end
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
25 
     | 
    
         
             
                  def merge_bibitem_from_formattedref_spans(bib, new)
         
     | 
| 
       25 
     | 
    
         
            -
                     
     | 
| 
      
 26 
     | 
    
         
            +
                    merge_bibitem_from_formattedref_span_attrs(bib, new)
         
     | 
| 
       26 
27 
     | 
    
         
             
                    if bib.at("./title") && bib["amend"]
         
     | 
| 
       27 
28 
     | 
    
         
             
                      # there already is a fetched record here: merge
         
     | 
| 
       28 
29 
     | 
    
         
             
                      bib.children = MergeBibitems
         
     | 
| 
         @@ -33,6 +34,12 @@ module Metanorma 
     | 
|
| 
       33 
34 
     | 
    
         
             
                    end
         
     | 
| 
       34 
35 
     | 
    
         
             
                  end
         
     | 
| 
       35 
36 
     | 
    
         | 
| 
      
 37 
     | 
    
         
            +
                  def merge_bibitem_from_formattedref_span_attrs(bib, new)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    %w(type).each do |k|
         
     | 
| 
      
 39 
     | 
    
         
            +
                      new[k] and bib[k] = new[k]
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       36 
43 
     | 
    
         
             
                  def fold_notes_into_biblio(refs)
         
     | 
| 
       37 
44 
     | 
    
         
             
                    refs.xpath("./bibitem").each do |r|
         
     | 
| 
       38 
45 
     | 
    
         
             
                      while r&.next_element&.name == "note"
         
     | 
| 
         @@ -194,6 +201,25 @@ module Metanorma 
     | 
|
| 
       194 
201 
     | 
    
         
             
                    bibitem.parent["normative"] == "true"
         
     | 
| 
       195 
202 
     | 
    
         
             
                  end
         
     | 
| 
       196 
203 
     | 
    
         | 
| 
      
 204 
     | 
    
         
            +
                  def bibitem_i18n(xmldoc)
         
     | 
| 
      
 205 
     | 
    
         
            +
                    xmldoc.xpath("//references/bibitem").each do |b|
         
     | 
| 
      
 206 
     | 
    
         
            +
                      s = b.at("./script")
         
     | 
| 
      
 207 
     | 
    
         
            +
                      l = b.at("./language")
         
     | 
| 
      
 208 
     | 
    
         
            +
                      s && l and next
         
     | 
| 
      
 209 
     | 
    
         
            +
                      ins = bibitem_i18n_insert(b)
         
     | 
| 
      
 210 
     | 
    
         
            +
                      s or ins.next = "<script>#{@script}</script>"
         
     | 
| 
      
 211 
     | 
    
         
            +
                      l or ins.next = "<language>#{@lang}</language>"
         
     | 
| 
      
 212 
     | 
    
         
            +
                    end
         
     | 
| 
      
 213 
     | 
    
         
            +
                  end
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
                  def bibitem_i18n_insert(bib)
         
     | 
| 
      
 216 
     | 
    
         
            +
                    bib.at("./note[last()]") || bib.at("./version[last()]") ||
         
     | 
| 
      
 217 
     | 
    
         
            +
                      bib.at("./edition[last()]") || bib.at("./contributor[last()]") ||
         
     | 
| 
      
 218 
     | 
    
         
            +
                      bib.at("./date[last()]") || bib.at("./docnumber[last()]") ||
         
     | 
| 
      
 219 
     | 
    
         
            +
                      bib.at("./docidentifier[last()]") || bib.at("./source[last()]") ||
         
     | 
| 
      
 220 
     | 
    
         
            +
                      bib.at("./title[last()]") || bib.children.first
         
     | 
| 
      
 221 
     | 
    
         
            +
                  end
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
       197 
223 
     | 
    
         
             
                  def bibitem_cleanup(xmldoc)
         
     | 
| 
       198 
224 
     | 
    
         
             
                    bibitem_nested_id(xmldoc) # feeds remove_dup_bibtem_id
         
     | 
| 
       199 
225 
     | 
    
         
             
                    ref_dl_cleanup(xmldoc)
         
     | 
| 
         @@ -202,6 +228,7 @@ module Metanorma 
     | 
|
| 
       202 
228 
     | 
    
         
             
                    remove_empty_docid(xmldoc)
         
     | 
| 
       203 
229 
     | 
    
         
             
                    empty_docid_to_title(xmldoc)
         
     | 
| 
       204 
230 
     | 
    
         
             
                    remove_dup_bibtem_id(xmldoc)
         
     | 
| 
      
 231 
     | 
    
         
            +
                    bibitem_i18n(xmldoc)
         
     | 
| 
       205 
232 
     | 
    
         
             
                    attachment_cleanup(xmldoc)
         
     | 
| 
       206 
233 
     | 
    
         
             
                  end
         
     | 
| 
       207 
234 
     | 
    
         
             
                end
         
     | 
| 
         @@ -233,8 +233,7 @@ module Metanorma 
     | 
|
| 
       233 
233 
     | 
    
         
             
                  def ol_cleanup(doc)
         
     | 
| 
       234 
234 
     | 
    
         
             
                    doc.xpath("//ol[@explicit-type]").each do |x|
         
     | 
| 
       235 
235 
     | 
    
         
             
                      x.delete("explicit-type")
         
     | 
| 
       236 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       237 
     | 
    
         
            -
                               "Style override set for ordered list", display: false)
         
     | 
| 
      
 236 
     | 
    
         
            +
                      @log.add("STANDOC_14", x, display: false)
         
     | 
| 
       238 
237 
     | 
    
         
             
                    end
         
     | 
| 
       239 
238 
     | 
    
         
             
                  end
         
     | 
| 
       240 
239 
     | 
    
         | 
| 
         @@ -116,8 +116,7 @@ module Metanorma 
     | 
|
| 
       116 
116 
     | 
    
         
             
                    filename.nil? || filename.empty? and return
         
     | 
| 
       117 
117 
     | 
    
         
             
                    filename = filename.strip
         
     | 
| 
       118 
118 
     | 
    
         
             
                    unless File.exist?(filename)
         
     | 
| 
       119 
     | 
    
         
            -
                       
     | 
| 
       120 
     | 
    
         
            -
                      @log.add("Include", nil, msg, severity: 0)
         
     | 
| 
      
 119 
     | 
    
         
            +
                      @log.add("STANDOC_1", nil, params: [filename])
         
     | 
| 
       121 
120 
     | 
    
         
             
                      return
         
     | 
| 
       122 
121 
     | 
    
         
             
                    end
         
     | 
| 
       123 
122 
     | 
    
         | 
| 
         @@ -112,8 +112,7 @@ module Metanorma 
     | 
|
| 
       112 
112 
     | 
    
         
             
                  end
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
114 
     | 
    
         
             
                  def footnote_block_error(fnote)
         
     | 
| 
       115 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
       116 
     | 
    
         
            -
                             "Could not resolve footnoteblock:[#{fnote.text}]", severity: 1)
         
     | 
| 
      
 115 
     | 
    
         
            +
                    @log.add("STANDOC_15", fnote, params: [fnote.text])
         
     | 
| 
       117 
116 
     | 
    
         
             
                    fnote.children = "[ERROR]"
         
     | 
| 
       118 
117 
     | 
    
         
             
                  end
         
     | 
| 
       119 
118 
     | 
    
         | 
| 
         @@ -174,8 +174,7 @@ module Metanorma 
     | 
|
| 
       174 
174 
     | 
    
         
             
                    xmldoc.xpath("//link[@target]").each do |l|
         
     | 
| 
       175 
175 
     | 
    
         
             
                      l["target"] = Addressable::URI.parse(l["target"]).to_s
         
     | 
| 
       176 
176 
     | 
    
         
             
                    rescue Addressable::URI::InvalidURIError
         
     | 
| 
       177 
     | 
    
         
            -
                       
     | 
| 
       178 
     | 
    
         
            -
                      @log.add("Anchors", l, err, severity: 0)
         
     | 
| 
      
 177 
     | 
    
         
            +
                      @log.add("STANDOC_8", l, params: [l["target"]])
         
     | 
| 
       179 
178 
     | 
    
         
             
                    end
         
     | 
| 
       180 
179 
     | 
    
         
             
                  end
         
     | 
| 
       181 
180 
     | 
    
         | 
| 
         @@ -39,15 +39,15 @@ module Metanorma 
     | 
|
| 
       39 
39 
     | 
    
         
             
                      expr.strip.empty? and return
         
     | 
| 
       40 
40 
     | 
    
         
             
                      unitsml = if expr.include?("unitsml")
         
     | 
| 
       41 
41 
     | 
    
         
             
                                  { unitsml: { xml: true, multiplier: :space } }
         
     | 
| 
       42 
     | 
    
         
            -
                                else {} 
     | 
| 
      
 42 
     | 
    
         
            +
                                else {}
         
     | 
| 
      
 43 
     | 
    
         
            +
                                end
         
     | 
| 
       43 
44 
     | 
    
         
             
                      Plurimath::Math.parse(expr, "asciimath")
         
     | 
| 
       44 
45 
     | 
    
         
             
                        .to_mathml(**{ display_style: elem["block"] }.merge(unitsml))
         
     | 
| 
       45 
46 
     | 
    
         
             
                    end
         
     | 
| 
       46 
47 
     | 
    
         
             
                  end
         
     | 
| 
       47 
48 
     | 
    
         | 
| 
       48 
49 
     | 
    
         
             
                  def asciimath2mathml_err(text, expr)
         
     | 
| 
       49 
     | 
    
         
            -
                     
     | 
| 
       50 
     | 
    
         
            -
                    @log.add("Maths", nil, err, severity: 0)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    @log.add("STANDOC_6", nil, params: [expr, text])
         
     | 
| 
       51 
51 
     | 
    
         
             
                  end
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                  def asciimath2mathml_wrap(xml)
         
     | 
| 
         @@ -30,9 +30,7 @@ module Metanorma 
     | 
|
| 
       30 
30 
     | 
    
         
             
                  def verify_term_defs_source(source)
         
     | 
| 
       31 
31 
     | 
    
         
             
                    source.each do |s|
         
     | 
| 
       32 
32 
     | 
    
         
             
                      @anchors[s["bibitemid"]] or
         
     | 
| 
       33 
     | 
    
         
            -
                        @log.add(" 
     | 
| 
       34 
     | 
    
         
            -
                                 "term source #{s['bibitemid']} not referenced",
         
     | 
| 
       35 
     | 
    
         
            -
                                 severity: 1)
         
     | 
| 
      
 33 
     | 
    
         
            +
                        @log.add("STANDOC_28", nil, params: [s["bibitemid"]])
         
     | 
| 
       36 
34 
     | 
    
         
             
                    end
         
     | 
| 
       37 
35 
     | 
    
         
             
                  end
         
     | 
| 
       38 
36 
     | 
    
         | 
| 
         @@ -116,8 +116,7 @@ module Metanorma 
     | 
|
| 
       116 
116 
     | 
    
         
             
                  def dl_to_designation(dlist)
         
     | 
| 
       117 
117 
     | 
    
         
             
                    prev = dlist.previous_element
         
     | 
| 
       118 
118 
     | 
    
         
             
                    unless %w(preferred admitted deprecates related).include? prev&.name
         
     | 
| 
       119 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       120 
     | 
    
         
            -
                                                        "not follow a term designation")
         
     | 
| 
      
 119 
     | 
    
         
            +
                      @log.add("STANDOC_20", dlist)
         
     | 
| 
       121 
120 
     | 
    
         
             
                      return nil
         
     | 
| 
       122 
121 
     | 
    
         
             
                    end
         
     | 
| 
       123 
122 
     | 
    
         
             
                    prev
         
     | 
| 
         @@ -182,7 +181,7 @@ module Metanorma 
     | 
|
| 
       182 
181 
     | 
    
         
             
                      DESIGNATOR.each do |n|
         
     | 
| 
       183 
182 
     | 
    
         
             
                        t.xpath("./#{n}/expression/name").each_with_object([]) do |d, m|
         
     | 
| 
       184 
183 
     | 
    
         
             
                          if m.include?(d.text)
         
     | 
| 
       185 
     | 
    
         
            -
                            @log.add(" 
     | 
| 
      
 184 
     | 
    
         
            +
                            @log.add("STANDOC_21", t, params: [d.text])
         
     | 
| 
       186 
185 
     | 
    
         
             
                            d.parent.parent.remove
         
     | 
| 
       187 
186 
     | 
    
         
             
                          end
         
     | 
| 
       188 
187 
     | 
    
         
             
                          m << d.text
         
     | 
| 
         @@ -91,9 +91,7 @@ module Metanorma 
     | 
|
| 
       91 
91 
     | 
    
         
             
                  def xref_to_eref1(elem)
         
     | 
| 
       92 
92 
     | 
    
         
             
                    elem["citeas"] = ""
         
     | 
| 
       93 
93 
     | 
    
         
             
                    @internal_eref_namespaces.include?(elem["type"]) or
         
     | 
| 
       94 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       95 
     | 
    
         
            -
                               "#{elem['target']} does not have a corresponding " \
         
     | 
| 
       96 
     | 
    
         
            -
                               "anchor ID in the bibliography!")
         
     | 
| 
      
 94 
     | 
    
         
            +
                      @log.add("STANDOC_30", elem, params: [elem["target"]])
         
     | 
| 
       97 
95 
     | 
    
         
             
                  end
         
     | 
| 
       98 
96 
     | 
    
         | 
| 
       99 
97 
     | 
    
         
             
                  def xref_cleanup(xmldoc)
         
     | 
| 
         @@ -161,8 +159,7 @@ module Metanorma 
     | 
|
| 
       161 
159 
     | 
    
         
             
                      y.size == 1 and
         
     | 
| 
       162 
160 
     | 
    
         
             
                        y.unshift(l.dig(i + 1, 0) == "to" ? "from" : "and")
         
     | 
| 
       163 
161 
     | 
    
         
             
                      %w(and from to or).include?(y[0]) or
         
     | 
| 
       164 
     | 
    
         
            -
                        @log.add(" 
     | 
| 
       165 
     | 
    
         
            -
                                 "Illegal cross-reference connective: #{y[0]}", severity: 0)
         
     | 
| 
      
 162 
     | 
    
         
            +
                        @log.add("STANDOC_31", xref, params: [y[0]])
         
     | 
| 
       166 
163 
     | 
    
         
             
                      y
         
     | 
| 
       167 
164 
     | 
    
         
             
                    end
         
     | 
| 
       168 
165 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -220,9 +217,7 @@ module Metanorma 
     | 
|
| 
       220 
217 
     | 
    
         
             
                    end
         
     | 
| 
       221 
218 
     | 
    
         
             
                    xmldoc.xpath("//origin").each do |x|
         
     | 
| 
       222 
219 
     | 
    
         
             
                      x["citeas"] = @anchors&.dig(x["bibitemid"], :xref) or
         
     | 
| 
       223 
     | 
    
         
            -
                        @log.add(" 
     | 
| 
       224 
     | 
    
         
            -
                                 "#{x['bibitemid']} does not have a corresponding anchor " \
         
     | 
| 
       225 
     | 
    
         
            -
                                 "ID in the bibliography!")
         
     | 
| 
      
 220 
     | 
    
         
            +
                        @log.add("STANDOC_32", x, params: [x["bibitemid"]])
         
     | 
| 
       226 
221 
     | 
    
         
             
                      extract_localities(x)
         
     | 
| 
       227 
222 
     | 
    
         
             
                    end
         
     | 
| 
       228 
223 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -14,6 +14,7 @@ require_relative "utils" 
     | 
|
| 
       14 
14 
     | 
    
         
             
            require_relative "cleanup"
         
     | 
| 
       15 
15 
     | 
    
         
             
            require_relative "reqt"
         
     | 
| 
       16 
16 
     | 
    
         
             
            require_relative "macros"
         
     | 
| 
      
 17 
     | 
    
         
            +
            require_relative "log"
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
            module Metanorma
         
     | 
| 
       19 
20 
     | 
    
         
             
              module Standoc
         
     | 
| 
         @@ -117,9 +118,11 @@ module Metanorma 
     | 
|
| 
       117 
118 
     | 
    
         
             
                  end
         
     | 
| 
       118 
119 
     | 
    
         | 
| 
       119 
120 
     | 
    
         
             
                  def local_log(doc)
         
     | 
| 
       120 
     | 
    
         
            -
                    @log = doc&.options&.dig(:log) 
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
      
 121 
     | 
    
         
            +
                    unless @log = doc&.options&.dig(:log)
         
     | 
| 
      
 122 
     | 
    
         
            +
                      @log = Metanorma::Utils::Log.new
         
     | 
| 
      
 123 
     | 
    
         
            +
                      @local_log = true
         
     | 
| 
      
 124 
     | 
    
         
            +
                    end
         
     | 
| 
      
 125 
     | 
    
         
            +
                    @log.add_msg(log_messages)
         
     | 
| 
       123 
126 
     | 
    
         
             
                  end
         
     | 
| 
       124 
127 
     | 
    
         | 
| 
       125 
128 
     | 
    
         
             
                  class << self
         
     | 
| 
         @@ -141,8 +144,7 @@ module Metanorma 
     | 
|
| 
       141 
144 
     | 
    
         | 
| 
       142 
145 
     | 
    
         
             
                  def skip(node, name = nil)
         
     | 
| 
       143 
146 
     | 
    
         
             
                    name = name || node.node_name
         
     | 
| 
       144 
     | 
    
         
            -
                     
     | 
| 
       145 
     | 
    
         
            -
                    @log.add("AsciiDoc Input", node, w, severity: 1)
         
     | 
| 
      
 147 
     | 
    
         
            +
                    @log.add("STANDOC_29", node, params: [name])
         
     | 
| 
       146 
148 
     | 
    
         
             
                    nil
         
     | 
| 
       147 
149 
     | 
    
         
             
                  end
         
     | 
| 
       148 
150 
     | 
    
         | 
| 
         @@ -34,9 +34,7 @@ module Metanorma 
     | 
|
| 
       34 
34 
     | 
    
         
             
                    results = Plurimath::Math.parse(lxm_input, "latex")
         
     | 
| 
       35 
35 
     | 
    
         
             
                      .to_mathml(display_style: block)
         
     | 
| 
       36 
36 
     | 
    
         
             
                    if results.nil?
         
     | 
| 
       37 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       38 
     | 
    
         
            -
                               "latexmlmath failed to process equation:\n#{lxm_input}",
         
     | 
| 
       39 
     | 
    
         
            -
                               severity: 1)
         
     | 
| 
      
 37 
     | 
    
         
            +
                      @log.add("STANDOC_51", nil, params: [lxm_input])
         
     | 
| 
       40 
38 
     | 
    
         
             
                      return
         
     | 
| 
       41 
39 
     | 
    
         
             
                    end
         
     | 
| 
       42 
40 
     | 
    
         
             
                    results.sub(%r{<math ([^>]+ )?display="block"}, "<math \\1")
         
     | 
| 
         @@ -48,24 +48,20 @@ module Metanorma 
     | 
|
| 
       48 
48 
     | 
    
         
             
                  end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
                  def file_error(config)
         
     | 
| 
       51 
     | 
    
         
            -
                     
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                    @parent.log.add("Bibliography", nil, msg, severity: 0)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    @parent.log.add("STANDOC_54", nil,
         
     | 
| 
      
 52 
     | 
    
         
            +
                                    params: [config["file"], config["key"]])
         
     | 
| 
       54 
53 
     | 
    
         
             
                    ""
         
     | 
| 
       55 
54 
     | 
    
         
             
                  end
         
     | 
| 
       56 
55 
     | 
    
         | 
| 
       57 
56 
     | 
    
         
             
                  def format_error(config)
         
     | 
| 
       58 
     | 
    
         
            -
                     
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                    @parent.log.add("Bibliography", nil, msg, severity: 0)
         
     | 
| 
      
 57 
     | 
    
         
            +
                    @parent.log.add("STANDOC_37", nil,
         
     | 
| 
      
 58 
     | 
    
         
            +
                                    params: [config["format"], config["key"]])
         
     | 
| 
       61 
59 
     | 
    
         
             
                    {}
         
     | 
| 
       62 
60 
     | 
    
         
             
                  end
         
     | 
| 
       63 
61 
     | 
    
         | 
| 
       64 
62 
     | 
    
         
             
                  def get(id, file = default)
         
     | 
| 
       65 
63 
     | 
    
         
             
                    ret = @file_bibdb.dig(file, id) and return ret
         
     | 
| 
       66 
     | 
    
         
            -
                     
     | 
| 
       67 
     | 
    
         
            -
                          "data source #{file}"
         
     | 
| 
       68 
     | 
    
         
            -
                    @parent.log.add("Bibliography", nil, msg, severity: 0)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    @parent.log.add("STANDOC_19", nil, params: [id, file])
         
     | 
| 
       69 
65 
     | 
    
         
             
                    Nokogiri::XML("<bibitem/>")
         
     | 
| 
       70 
66 
     | 
    
         
             
                  end
         
     | 
| 
       71 
67 
     | 
    
         
             
                end
         
     | 
| 
         @@ -0,0 +1,195 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Metanorma
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Standoc
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Converter
         
     | 
| 
      
 4 
     | 
    
         
            +
                  # rubocop:disable Naming/VariableNumber
         
     | 
| 
      
 5 
     | 
    
         
            +
                  STANDOC_LOG_MESSAGES = {
         
     | 
| 
      
 6 
     | 
    
         
            +
                    "STANDOC_1": { category: "Include",
         
     | 
| 
      
 7 
     | 
    
         
            +
                                   error: "Specified boilerplate file does not exist: %s",
         
     | 
| 
      
 8 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 9 
     | 
    
         
            +
                    "STANDOC_2": { category: "Table", error: "Empty table",
         
     | 
| 
      
 10 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 11 
     | 
    
         
            +
                    "STANDOC_3": { category: "Crossreferences",
         
     | 
| 
      
 12 
     | 
    
         
            +
                                   error: "invalid index \"%s\" cross-reference: " \
         
     | 
| 
      
 13 
     | 
    
         
            +
                                   "wrong number of attributes in `index:%s[%s]`",
         
     | 
| 
      
 14 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 15 
     | 
    
         
            +
                    "STANDOC_4": { category: "Table",
         
     | 
| 
      
 16 
     | 
    
         
            +
                                   error: "Table rows in table %s: check rowspan",
         
     | 
| 
      
 17 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 18 
     | 
    
         
            +
                    "STANDOC_5": { category: "Table",
         
     | 
| 
      
 19 
     | 
    
         
            +
                                   error: "Table exceeds maximum number of columns defined (%s)",
         
     | 
| 
      
 20 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 21 
     | 
    
         
            +
                    "STANDOC_6": { category: "Maths",
         
     | 
| 
      
 22 
     | 
    
         
            +
                                   error: "Malformed MathML: %s\n%s",
         
     | 
| 
      
 23 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 24 
     | 
    
         
            +
                    "STANDOC_7": { category: "Metanorma XML Syntax", error: "%s",
         
     | 
| 
      
 25 
     | 
    
         
            +
                                   severity: 2 },
         
     | 
| 
      
 26 
     | 
    
         
            +
                    "STANDOC_8": { category: "Anchors", error: "Malformed URI: %s",
         
     | 
| 
      
 27 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 28 
     | 
    
         
            +
                    "STANDOC_9": { category: "Bibliography",
         
     | 
| 
      
 29 
     | 
    
         
            +
                                   error: "Attachment %s does not exist",
         
     | 
| 
      
 30 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 31 
     | 
    
         
            +
                    "STANDOC_10": { category: "Anchors",
         
     | 
| 
      
 32 
     | 
    
         
            +
                                    error: "The following reference is missing an anchor:\n%s",
         
     | 
| 
      
 33 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 34 
     | 
    
         
            +
                    "STANDOC_11": { category: "Bibliography",
         
     | 
| 
      
 35 
     | 
    
         
            +
                                    error: "Reference %s is missing a title",
         
     | 
| 
      
 36 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 37 
     | 
    
         
            +
                    "STANDOC_12": { category: "Bibliography",
         
     | 
| 
      
 38 
     | 
    
         
            +
                                    error: "Reference %s is missing a document identifier (docid)",
         
     | 
| 
      
 39 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 40 
     | 
    
         
            +
                    "STANDOC_13": { category: "AsciiDoc Input",
         
     | 
| 
      
 41 
     | 
    
         
            +
                                    error: "term reference not in expected format:%s",
         
     | 
| 
      
 42 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 43 
     | 
    
         
            +
                    "STANDOC_14": { category: "Style",
         
     | 
| 
      
 44 
     | 
    
         
            +
                                    error: "Style override set for ordered list",
         
     | 
| 
      
 45 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 46 
     | 
    
         
            +
                    "STANDOC_15": { category: "Crossreferences",
         
     | 
| 
      
 47 
     | 
    
         
            +
                                    error: "Could not resolve footnoteblock:[%s]",
         
     | 
| 
      
 48 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 49 
     | 
    
         
            +
                    "STANDOC_16": { category: "AsciiDoc Input",
         
     | 
| 
      
 50 
     | 
    
         
            +
                                    error: "Section not marked up as [bibliography]!",
         
     | 
| 
      
 51 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 52 
     | 
    
         
            +
                    "STANDOC_17": { category: "Bibliography",
         
     | 
| 
      
 53 
     | 
    
         
            +
                                    error: "ERROR: No document identifier retrieved for %s",
         
     | 
| 
      
 54 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 55 
     | 
    
         
            +
                    "STANDOC_18": { category: "Bibliography",
         
     | 
| 
      
 56 
     | 
    
         
            +
                                    error: "ERROR: No title retrieved for %s", severity: 2 },
         
     | 
| 
      
 57 
     | 
    
         
            +
                    "STANDOC_19": { category: "Bibliography",
         
     | 
| 
      
 58 
     | 
    
         
            +
                                    error: "Cannot find reference %s for local Relaton " \
         
     | 
| 
      
 59 
     | 
    
         
            +
                                            "data source %s", severity: 0 },
         
     | 
| 
      
 60 
     | 
    
         
            +
                    "STANDOC_20": { category: "AsciiDoc Input",
         
     | 
| 
      
 61 
     | 
    
         
            +
                                    error: "Metadata definition list does not follow a term designation",
         
     | 
| 
      
 62 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 63 
     | 
    
         
            +
                    "STANDOC_21": { category: "Terms",
         
     | 
| 
      
 64 
     | 
    
         
            +
                                    error: "Removed duplicate designation %s",
         
     | 
| 
      
 65 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 66 
     | 
    
         
            +
                    "STANDOC_22": { category: "Bibliography",
         
     | 
| 
      
 67 
     | 
    
         
            +
                                    error: "Term \"%s\" does not match IEV %s \"%s\"",
         
     | 
| 
      
 68 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 69 
     | 
    
         
            +
                    "STANDOC_23": { category: "Anchors",
         
     | 
| 
      
 70 
     | 
    
         
            +
                                    error: "Concept cross-reference error: %s",
         
     | 
| 
      
 71 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 72 
     | 
    
         
            +
                    "STANDOC_24": { category: "Terms",
         
     | 
| 
      
 73 
     | 
    
         
            +
                                    error: "Term %s occurs twice as preferred designation: %s",
         
     | 
| 
      
 74 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 75 
     | 
    
         
            +
                    "STANDOC_25": { category: "Terms", severity: 0,
         
     | 
| 
      
 76 
     | 
    
         
            +
                                    error: <<~ERROR.freeze },
         
     | 
| 
      
 77 
     | 
    
         
            +
                                      Clause not recognised as a term clause, but contains designation markup
         
     | 
| 
      
 78 
     | 
    
         
            +
                                       (<code>preferred:[], admitted:[], alt:[], deprecated:[]</code>):<br/>
         
     | 
| 
      
 79 
     | 
    
         
            +
                                      %s</br>
         
     | 
| 
      
 80 
     | 
    
         
            +
                                      Ensure the parent clause is recognised as a terms clause by inserting <code>[heading=terms and definitions]</code> above the title,
         
     | 
| 
      
 81 
     | 
    
         
            +
                                      in case the heading is not automatically recognised. See also <a href="https://www.metanorma.org/author/topics/sections/concepts/#clause-title">Metanorma documentation</a>.
         
     | 
| 
      
 82 
     | 
    
         
            +
                                    ERROR
         
     | 
| 
      
 83 
     | 
    
         
            +
                    "STANDOC_26": { category: "AsciiDoc Input",
         
     | 
| 
      
 84 
     | 
    
         
            +
                                    error: "Error: Symbol reference in `symbol[%s]` missing: \"%s\" is not defined in document",
         
     | 
| 
      
 85 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 86 
     | 
    
         
            +
                    "STANDOC_27": { category: "AsciiDoc Input",
         
     | 
| 
      
 87 
     | 
    
         
            +
                                    error: "Error: Term reference to `%s` missing: \"%s\" is not defined in document%s",
         
     | 
| 
      
 88 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 89 
     | 
    
         
            +
                    "STANDOC_28": { category: "Crossreferences",
         
     | 
| 
      
 90 
     | 
    
         
            +
                                    error: "term source %s not referenced",
         
     | 
| 
      
 91 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 92 
     | 
    
         
            +
                    "STANDOC_29": { category: "AsciiDoc Input",
         
     | 
| 
      
 93 
     | 
    
         
            +
                                    error: "converter missing for %s node in Metanorma backend",
         
     | 
| 
      
 94 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 95 
     | 
    
         
            +
                    "STANDOC_30": { category: "Crossreferences",
         
     | 
| 
      
 96 
     | 
    
         
            +
                                    error: "%s does not have a corresponding anchor ID in the bibliography!",
         
     | 
| 
      
 97 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 98 
     | 
    
         
            +
                    "STANDOC_31": { category: "Crossreferences",
         
     | 
| 
      
 99 
     | 
    
         
            +
                                    error: "Illegal cross-reference connective: %s",
         
     | 
| 
      
 100 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 101 
     | 
    
         
            +
                    "STANDOC_32": { category: "Crossreferences",
         
     | 
| 
      
 102 
     | 
    
         
            +
                                    error: "%s does not have a corresponding anchor ID in the bibliography!",
         
     | 
| 
      
 103 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 104 
     | 
    
         
            +
                    "STANDOC_33": { category: "Maths",
         
     | 
| 
      
 105 
     | 
    
         
            +
                                    error: "Invalid MathML: %s\n %s%s",
         
     | 
| 
      
 106 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 107 
     | 
    
         
            +
                    "STANDOC_34": { category: "Style",
         
     | 
| 
      
 108 
     | 
    
         
            +
                                    error: "There is an instance of %s nested within %s",
         
     | 
| 
      
 109 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 110 
     | 
    
         
            +
                    "STANDOC_35": { category: "Style",
         
     | 
| 
      
 111 
     | 
    
         
            +
                                    error: "There is a crossreference to an instance of %s nested within %s: %s",
         
     | 
| 
      
 112 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 113 
     | 
    
         
            +
                    "STANDOC_36": { category: "Anchors",
         
     | 
| 
      
 114 
     | 
    
         
            +
                                    error: "ID %s has already been used at line %s",
         
     | 
| 
      
 115 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 116 
     | 
    
         
            +
                    "STANDOC_37": { category: "Bibliography",
         
     | 
| 
      
 117 
     | 
    
         
            +
                                    error: "Cannot process format %s for local Relaton data source %s",
         
     | 
| 
      
 118 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 119 
     | 
    
         
            +
                    "STANDOC_38": { category: "Anchors",
         
     | 
| 
      
 120 
     | 
    
         
            +
                                    error: "Crossreference target %s is undefined",
         
     | 
| 
      
 121 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 122 
     | 
    
         
            +
                    "STANDOC_39": { category: "Blocks",
         
     | 
| 
      
 123 
     | 
    
         
            +
                                    error: "%s is empty",
         
     | 
| 
      
 124 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 125 
     | 
    
         
            +
                    "STANDOC_40": { category: "Bibliography",
         
     | 
| 
      
 126 
     | 
    
         
            +
                                    error: "Could not retrieve %s: no access to online site",
         
     | 
| 
      
 127 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 128 
     | 
    
         
            +
                    "STANDOC_41": { category: "Include",
         
     | 
| 
      
 129 
     | 
    
         
            +
                                    error: "Unresolved directive %s",
         
     | 
| 
      
 130 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 131 
     | 
    
         
            +
                    "STANDOC_42": { category: "Metanorma XML Syntax",
         
     | 
| 
      
 132 
     | 
    
         
            +
                                    error: "Invalid passthrough content: %s\n" \
         
     | 
| 
      
 133 
     | 
    
         
            +
                                  "This is not valid Metanorma XML. If you intended a different format, such as HTML, you need to specify `format=` on the pass markup;\n" \
         
     | 
| 
      
 134 
     | 
    
         
            +
                                  "refer to https://www.metanorma.org/author/topics/blocks/passthroughs/",
         
     | 
| 
      
 135 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 136 
     | 
    
         
            +
                    "STANDOC_43": { category: "AsciiDoc Input",
         
     | 
| 
      
 137 
     | 
    
         
            +
                                    error: <<~REF.freeze, severity: 1 },
         
     | 
| 
      
 138 
     | 
    
         
            +
                                      no anchor on reference, markup may be malformed: see
         
     | 
| 
      
 139 
     | 
    
         
            +
                                      https://www.metanorma.org/author/topics/sections/bibliography/ ,
         
     | 
| 
      
 140 
     | 
    
         
            +
                                      https://www.metanorma.org/author/iso/topics/markup/#bibliographies : %s
         
     | 
| 
      
 141 
     | 
    
         
            +
                                    REF
         
     | 
| 
      
 142 
     | 
    
         
            +
                    "STANDOC_44": { category: "Images", error: "Image not found: %s",
         
     | 
| 
      
 143 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 144 
     | 
    
         
            +
                    "STANDOC_45": { category: "Images",
         
     | 
| 
      
 145 
     | 
    
         
            +
                                    error: "Corrupt PNG image detected: %s",
         
     | 
| 
      
 146 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 147 
     | 
    
         
            +
                    "STANDOC_46": { category: "Images",
         
     | 
| 
      
 148 
     | 
    
         
            +
                                    error: "Image too large for Data URI encoding: disable Data URI encoding (`:data-uri-image: false`), or set `:data-uri-maxsize: 0`",
         
     | 
| 
      
 149 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 150 
     | 
    
         
            +
                    "STANDOC_47": { category: "Crossreferences",
         
     | 
| 
      
 151 
     | 
    
         
            +
                                    error: "mismatch of callouts (%s) and annotations (%s)",
         
     | 
| 
      
 152 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 153 
     | 
    
         
            +
                    "STANDOC_48": { category: "Style", error: "(generic warning) %s",
         
     | 
| 
      
 154 
     | 
    
         
            +
                                    severity: 2 },
         
     | 
| 
      
 155 
     | 
    
         
            +
                    "STANDOC_49": { category: "Bibliography",
         
     | 
| 
      
 156 
     | 
    
         
            +
                                    error: "Numeric reference in normative references",
         
     | 
| 
      
 157 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 158 
     | 
    
         
            +
                    "STANDOC_50": { category: "Fatal Error", error: "%s", severity: 0 },
         
     | 
| 
      
 159 
     | 
    
         
            +
                    "STANDOC_51": { category: "Maths",
         
     | 
| 
      
 160 
     | 
    
         
            +
                                    error: "latexmlmath failed to process equation:\n%s",
         
     | 
| 
      
 161 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 162 
     | 
    
         
            +
                    "STANDOC_52": { category: "Bibliography",
         
     | 
| 
      
 163 
     | 
    
         
            +
                                    error: "Bibliographic spans: %s",
         
     | 
| 
      
 164 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 165 
     | 
    
         
            +
                    "STANDOC_53": { category: "Bibliography",
         
     | 
| 
      
 166 
     | 
    
         
            +
                                    error: "Bibliographic spans: %s",
         
     | 
| 
      
 167 
     | 
    
         
            +
                                    severity: 1 },
         
     | 
| 
      
 168 
     | 
    
         
            +
                    "STANDOC_54": { category: "Bibliography",
         
     | 
| 
      
 169 
     | 
    
         
            +
                                    error: "Cannot process file %s for local Relaton data source %s",
         
     | 
| 
      
 170 
     | 
    
         
            +
                                    severity: 0 },
         
     | 
| 
      
 171 
     | 
    
         
            +
                    "RELATON_1": { category: "Relaton",
         
     | 
| 
      
 172 
     | 
    
         
            +
                                   error: "(Error from Relaton) %s",
         
     | 
| 
      
 173 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 174 
     | 
    
         
            +
                    "RELATON_2": { category: "Relaton",
         
     | 
| 
      
 175 
     | 
    
         
            +
                                   error: "(Error from Relaton) %s",
         
     | 
| 
      
 176 
     | 
    
         
            +
                                   severity: 1 },
         
     | 
| 
      
 177 
     | 
    
         
            +
                    "RELATON_3": { category: "Relaton",
         
     | 
| 
      
 178 
     | 
    
         
            +
                                   error: "(Error from Relaton) %s",
         
     | 
| 
      
 179 
     | 
    
         
            +
                                   severity: 2 },
         
     | 
| 
      
 180 
     | 
    
         
            +
                    "RELATON_4": { category: "Relaton",
         
     | 
| 
      
 181 
     | 
    
         
            +
                                   error: "(Error from Relaton) %s",
         
     | 
| 
      
 182 
     | 
    
         
            +
                                   severity: 3 },
         
     | 
| 
      
 183 
     | 
    
         
            +
                    "RELATON_5": { category: "Relaton",
         
     | 
| 
      
 184 
     | 
    
         
            +
                                   error: "(Error from Relaton IEV) %s",
         
     | 
| 
      
 185 
     | 
    
         
            +
                                   severity: 0 },
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                  }.freeze
         
     | 
| 
      
 188 
     | 
    
         
            +
                  # rubocop:enable Naming/VariableNumber
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
                  def log_messages
         
     | 
| 
      
 191 
     | 
    
         
            +
                    STANDOC_LOG_MESSAGES
         
     | 
| 
      
 192 
     | 
    
         
            +
                  end
         
     | 
| 
      
 193 
     | 
    
         
            +
                end
         
     | 
| 
      
 194 
     | 
    
         
            +
              end
         
     | 
| 
      
 195 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -15,8 +15,9 @@ module Asciidoctor 
     | 
|
| 
       15 
15 
     | 
    
         
             
                    n = peek_line(true)
         
     | 
| 
       16 
16 
     | 
    
         
             
                    /^Unresolved directive in/.match?(n) and
         
     | 
| 
       17 
17 
     | 
    
         
             
                      @document.converter.log
         
     | 
| 
       18 
     | 
    
         
            -
                        &.add(" 
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                        &.add("STANDOC_41", nil, params: [HTMLEntities.new.encode(
         
     | 
| 
      
 19 
     | 
    
         
            +
                          n.sub(/^Unresolved directive /, ""), :basic
         
     | 
| 
      
 20 
     | 
    
         
            +
                        )])
         
     | 
| 
       20 
21 
     | 
    
         
             
                  end
         
     | 
| 
       21 
22 
     | 
    
         
             
                  [inc_path, target_type, relpath]
         
     | 
| 
       22 
23 
     | 
    
         
             
                end
         
     | 
| 
         @@ -86,7 +87,8 @@ module Metanorma 
     | 
|
| 
       86 
87 
     | 
    
         
             
                      if l.is_a?(Hash)
         
     | 
| 
       87 
88 
     | 
    
         
             
                        acc, m = update_embeds(acc, m, emb)
         
     | 
| 
       88 
89 
     | 
    
         
             
                        flatten_embeds(l).each { |x| m << x }
         
     | 
| 
       89 
     | 
    
         
            -
                      else acc << l 
     | 
| 
      
 90 
     | 
    
         
            +
                      else acc << l
         
     | 
| 
      
 91 
     | 
    
         
            +
                      end
         
     | 
| 
       90 
92 
     | 
    
         
             
                    end
         
     | 
| 
       91 
93 
     | 
    
         
             
                    acc, ret = update_embeds(acc, ret, emb)
         
     | 
| 
       92 
94 
     | 
    
         
             
                    ret
         
     | 
| 
         @@ -13,9 +13,8 @@ module Metanorma 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                  def validate(parent, target, attrs)
         
     | 
| 
       15 
15 
     | 
    
         
             
                    attrs.size > 1 && attrs.size < 5 and return true
         
     | 
| 
       16 
     | 
    
         
            -
                     
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                    parent.converter.log.add("Crossreferences", parent, e, severity: 0)
         
     | 
| 
      
 16 
     | 
    
         
            +
                    parent.converter.log.add("STANDOC_3", parent,
         
     | 
| 
      
 17 
     | 
    
         
            +
                                             params: [target, target, attrs.values.join(",")])
         
     | 
| 
       19 
18 
     | 
    
         
             
                    false
         
     | 
| 
       20 
19 
     | 
    
         
             
                  end
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
         @@ -158,8 +158,7 @@ module Metanorma 
     | 
|
| 
       158 
158 
     | 
    
         
             
                  def refitemcode(item, node)
         
     | 
| 
       159 
159 
     | 
    
         
             
                    m = NON_ISO_REF.match(item) and return refitem1code(item, m).compact
         
     | 
| 
       160 
160 
     | 
    
         
             
                    m = NON_ISO_REF1.match(item) and return refitem1code(item, m).compact
         
     | 
| 
       161 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
       162 
     | 
    
         
            -
                             severity: 1)
         
     | 
| 
      
 161 
     | 
    
         
            +
                    @log.add("STANDOC_43", node, params: [item])
         
     | 
| 
       163 
162 
     | 
    
         
             
                    {}
         
     | 
| 
       164 
163 
     | 
    
         
             
                  end
         
     | 
| 
       165 
164 
     | 
    
         | 
| 
         @@ -42,10 +42,9 @@ module Metanorma 
     | 
|
| 
       42 
42 
     | 
    
         
             
                      ref, i, doc = results.pop
         
     | 
| 
       43 
43 
     | 
    
         
             
                      m[i.to_i] = { ref: }
         
     | 
| 
       44 
44 
     | 
    
         
             
                      if doc.is_a?(RelatonBib::RequestError)
         
     | 
| 
       45 
     | 
    
         
            -
                        @log.add(" 
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                      else m[i.to_i][:doc] = doc end
         
     | 
| 
      
 45 
     | 
    
         
            +
                        @log.add("STANDOC_40", nil, params: [ref[:code]])
         
     | 
| 
      
 46 
     | 
    
         
            +
                      else m[i.to_i][:doc] = doc
         
     | 
| 
      
 47 
     | 
    
         
            +
                      end
         
     | 
| 
       49 
48 
     | 
    
         
             
                    end
         
     | 
| 
       50 
49 
     | 
    
         
             
                  end
         
     | 
| 
       51 
50 
     | 
    
         | 
| 
         @@ -136,8 +135,7 @@ module Metanorma 
     | 
|
| 
       136 
135 
     | 
    
         
             
                    xml.parent.add_child(smart_render_xml(hit, code, opts))
         
     | 
| 
       137 
136 
     | 
    
         
             
                    xml
         
     | 
| 
       138 
137 
     | 
    
         
             
                  rescue RelatonBib::RequestError
         
     | 
| 
       139 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
       140 
     | 
    
         
            -
                                                  "no access to online site", severity: 1)
         
     | 
| 
      
 138 
     | 
    
         
            +
                    @log.add("STANDOC_40", nil, params: [code])
         
     | 
| 
       141 
139 
     | 
    
         
             
                    nil
         
     | 
| 
       142 
140 
     | 
    
         
             
                  end
         
     | 
| 
       143 
141 
     | 
    
         | 
| 
         @@ -47,8 +47,7 @@ module Metanorma 
     | 
|
| 
       47 
47 
     | 
    
         
             
                      bibitem_parse(attrs, xml, node)
         
     | 
| 
       48 
48 
     | 
    
         
             
                    else
         
     | 
| 
       49 
49 
     | 
    
         
             
                      node.attr("style") == "bibliography" or
         
     | 
| 
       50 
     | 
    
         
            -
                        @log.add(" 
     | 
| 
       51 
     | 
    
         
            -
                                 "Section not marked up as [bibliography]!")
         
     | 
| 
      
 50 
     | 
    
         
            +
                        @log.add("STANDOC_16", node)
         
     | 
| 
       52 
51 
     | 
    
         
             
                      nil
         
     | 
| 
       53 
52 
     | 
    
         
             
                    end
         
     | 
| 
       54 
53 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -63,8 +62,7 @@ module Metanorma 
     | 
|
| 
       63 
62 
     | 
    
         
             
                  def emend_biblio_id(xml, code)
         
     | 
| 
       64 
63 
     | 
    
         
             
                    unless xml.at("/bibitem/docidentifier[not(@type = 'DOI')][text()]") ||
         
     | 
| 
       65 
64 
     | 
    
         
             
                        /^doi:/.match?(code)
         
     | 
| 
       66 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       67 
     | 
    
         
            -
                               "ERROR: No document identifier retrieved for #{code}")
         
     | 
| 
      
 65 
     | 
    
         
            +
                      @log.add("STANDOC_17", nil, params: [code])
         
     | 
| 
       68 
66 
     | 
    
         
             
                      xml.root << "<docidentifier>#{code}</docidentifier>"
         
     | 
| 
       69 
67 
     | 
    
         
             
                    end
         
     | 
| 
       70 
68 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -74,8 +72,7 @@ module Metanorma 
     | 
|
| 
       74 
72 
     | 
    
         
             
                  def emend_biblio_title(xml, code, title)
         
     | 
| 
       75 
73 
     | 
    
         
             
                    fmt = /<span class=|<fn/.match?(title)
         
     | 
| 
       76 
74 
     | 
    
         
             
                    unless xml.at("/bibitem/title[text()]")
         
     | 
| 
       77 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       78 
     | 
    
         
            -
                               "ERROR: No title retrieved for #{code}")
         
     | 
| 
      
 75 
     | 
    
         
            +
                      @log.add("STANDOC_18", nil, params: [code])
         
     | 
| 
       79 
76 
     | 
    
         
             
                      !fmt and
         
     | 
| 
       80 
77 
     | 
    
         
             
                        xml.root << "<title>#{title || '(MISSING TITLE)'}</title>"
         
     | 
| 
       81 
78 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -80,7 +80,8 @@ module Metanorma 
     | 
|
| 
       80 
80 
     | 
    
         
             
                             if type == :attachment then "(#{ret[type]})"
         
     | 
| 
       81 
81 
     | 
    
         
             
                             else ret[type].sub(%r{^[^/]+/}, "")
         
     | 
| 
       82 
82 
     | 
    
         
             
                             end
         
     | 
| 
       83 
     | 
    
         
            -
                           else ret[:id] 
     | 
| 
      
 83 
     | 
    
         
            +
                           else ret[:id]
         
     | 
| 
      
 84 
     | 
    
         
            +
                           end
         
     | 
| 
       84 
85 
     | 
    
         
             
                      ret.merge!(id: id, type: type.to_s, key: ret[type], nofetch: true)
         
     | 
| 
       85 
86 
     | 
    
         
             
                    end
         
     | 
| 
       86 
87 
     | 
    
         
             
                    ret
         
     | 
| 
         @@ -201,12 +202,6 @@ module Metanorma 
     | 
|
| 
       201 
202 
     | 
    
         
             
                      suppress_identifier: code[:dropid] || nil }
         
     | 
| 
       202 
203 
     | 
    
         
             
                  end
         
     | 
| 
       203 
204 
     | 
    
         | 
| 
       204 
     | 
    
         
            -
                  MALFORMED_REF = <<~REF.freeze
         
     | 
| 
       205 
     | 
    
         
            -
                    no anchor on reference, markup may be malformed: see
         
     | 
| 
       206 
     | 
    
         
            -
                    https://www.metanorma.org/author/topics/sections/bibliography/ ,
         
     | 
| 
       207 
     | 
    
         
            -
                    https://www.metanorma.org/author/iso/topics/markup/#bibliographies
         
     | 
| 
       208 
     | 
    
         
            -
                  REF
         
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
       210 
205 
     | 
    
         
             
                  def ref_normalise(ref)
         
     | 
| 
       211 
206 
     | 
    
         
             
                    ref.gsub("&amp;", "&").gsub(%r{^<em>(.*)</em>}, "\\1")
         
     | 
| 
       212 
207 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -36,7 +36,9 @@ module Metanorma 
     | 
|
| 
       36 
36 
     | 
    
         
             
                    def convert
         
     | 
| 
       37 
37 
     | 
    
         
             
                      ret = spans_to_bibitem(@spans)
         
     | 
| 
       38 
38 
     | 
    
         
             
                      @out = Nokogiri::XML("<bibitem>#{ret}</bibitem>").root
         
     | 
| 
       39 
     | 
    
         
            -
                       
     | 
| 
      
 39 
     | 
    
         
            +
                      %i(type language script locale).each do |k|
         
     | 
| 
      
 40 
     | 
    
         
            +
                        @spans[k] and @out[k.to_s] = @spans[k]
         
     | 
| 
      
 41 
     | 
    
         
            +
                      end
         
     | 
| 
       40 
42 
     | 
    
         
             
                      self
         
     | 
| 
       41 
43 
     | 
    
         
             
                    end
         
     | 
| 
       42 
44 
     | 
    
         | 
| 
         @@ -46,6 +48,7 @@ module Metanorma 
     | 
|
| 
       46 
48 
     | 
    
         
             
                      ret += spans_to_bibitem_docid(spans)
         
     | 
| 
       47 
49 
     | 
    
         
             
                      ret += spans_to_contribs(spans)
         
     | 
| 
       48 
50 
     | 
    
         
             
                      ret += spans_to_bibitem_edn(spans)
         
     | 
| 
      
 51 
     | 
    
         
            +
                      ret += spans_to_bibitem_i18n(spans)
         
     | 
| 
       49 
52 
     | 
    
         
             
                      spans[:abstract] and ret += "<abstract>#{spans[:abstract]}</abstract>"
         
     | 
| 
       50 
53 
     | 
    
         
             
                      ret += spans_to_series(spans)
         
     | 
| 
       51 
54 
     | 
    
         
             
                      spans[:pubplace] and ret += "<place>#{spans[:pubplace]}</place>"
         
     | 
| 
         @@ -63,6 +66,14 @@ module Metanorma 
     | 
|
| 
       63 
66 
     | 
    
         
             
                      ret
         
     | 
| 
       64 
67 
     | 
    
         
             
                    end
         
     | 
| 
       65 
68 
     | 
    
         | 
| 
      
 69 
     | 
    
         
            +
                    def spans_to_bibitem_i18n(spans)
         
     | 
| 
      
 70 
     | 
    
         
            +
                      ret = ""
         
     | 
| 
      
 71 
     | 
    
         
            +
                      spans[:language] and ret += "<language>#{spans[:language]}</language>"
         
     | 
| 
      
 72 
     | 
    
         
            +
                      spans[:script] and ret += "<script>#{spans[:script]}</script>"
         
     | 
| 
      
 73 
     | 
    
         
            +
                      spans[:locale] and ret += "<locale>#{spans[:locale]}</locale>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                      ret
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
       66 
77 
     | 
    
         
             
                    def spans_to_series(spans)
         
     | 
| 
       67 
78 
     | 
    
         
             
                      spans[:series] or return ""
         
     | 
| 
       68 
79 
     | 
    
         
             
                      "<series><title>#{spans[:series]}</title></series>"
         
     | 
| 
         @@ -37,7 +37,7 @@ module Metanorma 
     | 
|
| 
       37 
37 
     | 
    
         
             
                    def spans_preprocess(spans)
         
     | 
| 
       38 
38 
     | 
    
         
             
                      ret = empty_span_hash
         
     | 
| 
       39 
39 
     | 
    
         
             
                      spans.each { |s| span_preprocess1(s, ret) }
         
     | 
| 
       40 
     | 
    
         
            -
                      host_rearrange(ret)
         
     | 
| 
      
 40 
     | 
    
         
            +
                      spans_defaults(host_rearrange(ret))
         
     | 
| 
       41 
41 
     | 
    
         
             
                    end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                    def span_preprocess1(span, ret)
         
     | 
| 
         @@ -52,7 +52,7 @@ module Metanorma 
     | 
|
| 
       52 
52 
     | 
    
         
             
                        ret[:extent][span[:key].to_sym] ||= []
         
     | 
| 
       53 
53 
     | 
    
         
             
                        ret[:extent][span[:key].to_sym] << span[:val]
         
     | 
| 
       54 
54 
     | 
    
         
             
                      when "pubplace", "title", "type", "series", "edition", "version",
         
     | 
| 
       55 
     | 
    
         
            -
                        "abstract"
         
     | 
| 
      
 55 
     | 
    
         
            +
                        "abstract", "language", "script", "locale"
         
     | 
| 
       56 
56 
     | 
    
         
             
                        ret[span[:key].to_sym] = span[:val]
         
     | 
| 
       57 
57 
     | 
    
         
             
                      when "image"
         
     | 
| 
       58 
58 
     | 
    
         
             
                        ret[span[:key].to_sym] << { type: span[:type], val: span[:val] }
         
     | 
| 
         @@ -92,17 +92,21 @@ module Metanorma 
     | 
|
| 
       92 
92 
     | 
    
         
             
                      end
         
     | 
| 
       93 
93 
     | 
    
         
             
                    end
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
      
 95 
     | 
    
         
            +
                    def spans_defaults(spans)
         
     | 
| 
      
 96 
     | 
    
         
            +
                      spans[:language] && !spans[:script] and
         
     | 
| 
      
 97 
     | 
    
         
            +
                        spans[:script] = ::Metanorma::Utils.default_script(spans[:language])
         
     | 
| 
      
 98 
     | 
    
         
            +
                      spans
         
     | 
| 
      
 99 
     | 
    
         
            +
                    end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
       95 
101 
     | 
    
         
             
                    def host_rearrange(ret)
         
     | 
| 
       96 
102 
     | 
    
         
             
                      ret[:in][:title] or return ret
         
     | 
| 
       97 
     | 
    
         
            -
                      ret[:in].merge!(empty_span_hash, { type: "misc" })  
     | 
| 
       98 
     | 
    
         
            -
                        old
         
     | 
| 
       99 
     | 
    
         
            -
                      end
         
     | 
| 
      
 103 
     | 
    
         
            +
                      ret[:in].merge!(empty_span_hash, { type: "misc" }) { |_, o, _| o }
         
     | 
| 
       100 
104 
     | 
    
         
             
                      %i(series).each do |k|
         
     | 
| 
       101 
105 
     | 
    
         
             
                        ret[:in][k] = ret[k]
         
     | 
| 
       102 
106 
     | 
    
         
             
                        ret.delete(k)
         
     | 
| 
       103 
107 
     | 
    
         
             
                      end
         
     | 
| 
       104 
     | 
    
         
            -
                      /^in/.match?(ret[:type]) and 
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
      
 108 
     | 
    
         
            +
                      /^in/.match?(ret[:type]) and
         
     | 
| 
      
 109 
     | 
    
         
            +
                        ret[:in][:type] = ret[:type].sub(/^in/, "")
         
     | 
| 
       106 
110 
     | 
    
         
             
                      ret
         
     | 
| 
       107 
111 
     | 
    
         
             
                    end
         
     | 
| 
       108 
112 
     | 
    
         | 
| 
         @@ -110,33 +110,22 @@ module Metanorma 
     | 
|
| 
       110 
110 
     | 
    
         | 
| 
       111 
111 
     | 
    
         
             
                  def remove_missing_ref(node, target)
         
     | 
| 
       112 
112 
     | 
    
         
             
                    if node.at("./parent::concept[@type = 'symbol']")
         
     | 
| 
       113 
     | 
    
         
            -
                      log.add(" 
     | 
| 
       114 
     | 
    
         
            -
                              remove_missing_ref_msg(node, target, :symbol), severity: 1)
         
     | 
| 
      
 113 
     | 
    
         
            +
                      log.add("STANDOC_26", node, params: [target, target])
         
     | 
| 
       115 
114 
     | 
    
         
             
                      remove_missing_ref_term(node, target, "symbol")
         
     | 
| 
       116 
115 
     | 
    
         
             
                    else
         
     | 
| 
       117 
     | 
    
         
            -
                      log.add(" 
     | 
| 
       118 
     | 
    
         
            -
                               
     | 
| 
      
 116 
     | 
    
         
            +
                      log.add("STANDOC_27", node,
         
     | 
| 
      
 117 
     | 
    
         
            +
                              params: [target, target, remove_missing_ref_msg1(node, target)])
         
     | 
| 
       119 
118 
     | 
    
         
             
                      remove_missing_ref_term(node, target, "term")
         
     | 
| 
       120 
119 
     | 
    
         
             
                    end
         
     | 
| 
       121 
120 
     | 
    
         
             
                  end
         
     | 
| 
       122 
121 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
                  def  
     | 
| 
       124 
     | 
    
         
            -
                    type == :symbol and return <<~LOG
         
     | 
| 
       125 
     | 
    
         
            -
                      Error: Symbol reference in `symbol[#{target}]` missing: "#{target}" is not defined in document
         
     | 
| 
       126 
     | 
    
         
            -
                    LOG
         
     | 
| 
       127 
     | 
    
         
            -
                    ret = <<~LOG
         
     | 
| 
       128 
     | 
    
         
            -
                      Error: Term reference to `#{target}` missing: "#{target}" is not defined in document
         
     | 
| 
       129 
     | 
    
         
            -
                    LOG
         
     | 
| 
       130 
     | 
    
         
            -
                    remove_missing_ref_msg1(node, target, ret)
         
     | 
| 
       131 
     | 
    
         
            -
                  end
         
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
       133 
     | 
    
         
            -
                  def remove_missing_ref_msg1(_node, target, ret)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  def remove_missing_ref_msg1(_node, target)
         
     | 
| 
       134 
123 
     | 
    
         
             
                    target2 = "_#{target.downcase.tr('-', '_')}"
         
     | 
| 
       135 
124 
     | 
    
         
             
                    if @terms_tags[target] || @terms_tags[target2]
         
     | 
| 
       136 
     | 
    
         
            -
                       
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
      
 125 
     | 
    
         
            +
                      ". Did you mean to point to a subterm?"
         
     | 
| 
      
 126 
     | 
    
         
            +
                    else
         
     | 
| 
      
 127 
     | 
    
         
            +
                      ""
         
     | 
| 
       138 
128 
     | 
    
         
             
                    end
         
     | 
| 
       139 
     | 
    
         
            -
                    ret
         
     | 
| 
       140 
129 
     | 
    
         
             
                  end
         
     | 
| 
       141 
130 
     | 
    
         | 
| 
       142 
131 
     | 
    
         
             
                  def remove_missing_ref_term(node, target, type)
         
     | 
| 
         @@ -142,9 +142,7 @@ module Metanorma 
     | 
|
| 
       142 
142 
     | 
    
         | 
| 
       143 
143 
     | 
    
         
             
                  def extract_termsource_refs(text, node)
         
     | 
| 
       144 
144 
     | 
    
         
             
                    matched = TERM_REFERENCE_RE.match text
         
     | 
| 
       145 
     | 
    
         
            -
                    matched.nil? and @log.add(" 
     | 
| 
       146 
     | 
    
         
            -
                                              "term reference not in expected format:" \
         
     | 
| 
       147 
     | 
    
         
            -
                                              "#{text}", severity: 1)
         
     | 
| 
      
 145 
     | 
    
         
            +
                    matched.nil? and @log.add("STANDOC_13", node, params: [text])
         
     | 
| 
       148 
146 
     | 
    
         
             
                    matched
         
     | 
| 
       149 
147 
     | 
    
         
             
                  end
         
     | 
| 
       150 
148 
     | 
    
         | 
| 
         @@ -57,8 +57,7 @@ module Metanorma 
     | 
|
| 
       57 
57 
     | 
    
         
             
                    orig = ""
         
     | 
| 
       58 
58 
     | 
    
         
             
                    a and orig += "\n\tAsciimath original: #{@c.decode(a.children.to_xml)}"
         
     | 
| 
       59 
59 
     | 
    
         
             
                    l and orig += "\n\tLatexmath original: #{@c.decode(l.children.to_xml)}"
         
     | 
| 
       60 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
       61 
     | 
    
         
            -
                             "Invalid MathML: #{math}\n #{error}#{orig}", severity: 0)
         
     | 
| 
      
 60 
     | 
    
         
            +
                    @log.add("STANDOC_33", elem, params: [math, error, orig])
         
     | 
| 
       62 
61 
     | 
    
         
             
                  end
         
     | 
| 
       63 
62 
     | 
    
         | 
| 
       64 
63 
     | 
    
         
             
                  def nested_asset_validate(doc)
         
     | 
| 
         @@ -85,17 +84,13 @@ module Metanorma 
     | 
|
| 
       85 
84 
     | 
    
         | 
| 
       86 
85 
     | 
    
         
             
                  def nested_asset_report(outer, inner, doc)
         
     | 
| 
       87 
86 
     | 
    
         
             
                    outer.name == "figure" && inner.name == "figure" and return
         
     | 
| 
       88 
     | 
    
         
            -
                     
     | 
| 
       89 
     | 
    
         
            -
                      "There is an instance of #{inner.name} nested within #{outer.name}"
         
     | 
| 
       90 
     | 
    
         
            -
                    @log.add("Style", inner, err)
         
     | 
| 
      
 87 
     | 
    
         
            +
                    @log.add("STANDOC_34", inner, params: [inner.name, outer.name])
         
     | 
| 
       91 
88 
     | 
    
         
             
                    nested_asset_xref_report(outer, inner, doc)
         
     | 
| 
       92 
89 
     | 
    
         
             
                  end
         
     | 
| 
       93 
90 
     | 
    
         | 
| 
       94 
91 
     | 
    
         
             
                  def nested_asset_xref_report(outer, inner, _doc)
         
     | 
| 
       95 
92 
     | 
    
         
             
                    i = @doc_xrefs[inner["anchor"]] or return
         
     | 
| 
       96 
     | 
    
         
            -
                     
     | 
| 
       97 
     | 
    
         
            -
                           "nested within #{outer.name}: #{i.to_xml}"
         
     | 
| 
       98 
     | 
    
         
            -
                    @log.add("Style", i, err2)
         
     | 
| 
      
 93 
     | 
    
         
            +
                    @log.add("STANDOC_35", i, params: [inner.name, outer.name, i.to_xml])
         
     | 
| 
       99 
94 
     | 
    
         
             
                  end
         
     | 
| 
       100 
95 
     | 
    
         | 
| 
       101 
96 
     | 
    
         
             
                  def validate(doc)
         
     | 
| 
         @@ -107,9 +102,7 @@ module Metanorma 
     | 
|
| 
       107 
102 
     | 
    
         
             
                  # since consequences are so catastrophic
         
     | 
| 
       108 
103 
     | 
    
         
             
                  def repeat_id_validate1(elem)
         
     | 
| 
       109 
104 
     | 
    
         
             
                    if @doc_ids[elem["id"]]
         
     | 
| 
       110 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       111 
     | 
    
         
            -
                               "ID #{elem['id']} has already been " \
         
     | 
| 
       112 
     | 
    
         
            -
                               "used at line #{@doc_ids[elem['id']][:line]}", severity: 0)
         
     | 
| 
      
 105 
     | 
    
         
            +
                      @log.add("STANDOC_36", elem, params: [elem['id'], @doc_ids[elem['id']][:line]])
         
     | 
| 
       113 
106 
     | 
    
         
             
                    else
         
     | 
| 
       114 
107 
     | 
    
         
             
                      @doc_ids[elem["id"]] =
         
     | 
| 
       115 
108 
     | 
    
         
             
                        { line: elem.line, anchor: elem["anchor"] }.compact
         
     | 
| 
         @@ -118,9 +111,7 @@ module Metanorma 
     | 
|
| 
       118 
111 
     | 
    
         | 
| 
       119 
112 
     | 
    
         
             
                  def repeat_anchor_validate1(elem)
         
     | 
| 
       120 
113 
     | 
    
         
             
                    if @doc_anchors[elem["anchor"]]
         
     | 
| 
       121 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       122 
     | 
    
         
            -
                               "Anchor #{elem['anchor']} has already been used at line " \
         
     | 
| 
       123 
     | 
    
         
            -
                               "#{@doc_anchors[elem['anchor']][:line]}", severity: 0)
         
     | 
| 
      
 114 
     | 
    
         
            +
                      @log.add("STANDOC_36", elem, params: [elem['anchor'], @doc_anchors[elem['anchor']][:line]])
         
     | 
| 
       124 
115 
     | 
    
         
             
                    else
         
     | 
| 
       125 
116 
     | 
    
         
             
                      @doc_anchors[elem["anchor"]] = { line: elem.line, id: elem["id"] }
         
     | 
| 
       126 
117 
     | 
    
         
             
                      @doc_anchor_seq << elem["anchor"]
         
     | 
| 
         @@ -174,8 +165,7 @@ module Metanorma 
     | 
|
| 
       174 
165 
     | 
    
         
             
                      doc.xpath("//#{a[0]}/@#{a[1]}").each do |x|
         
     | 
| 
       175 
166 
     | 
    
         
             
                        @doc_xrefs[x.text] = x.parent
         
     | 
| 
       176 
167 
     | 
    
         
             
                        @doc_anchors[x.text] and next
         
     | 
| 
       177 
     | 
    
         
            -
                        @log.add(" 
     | 
| 
       178 
     | 
    
         
            -
                                 "Crossreference target #{x} is undefined", severity: 1)
         
     | 
| 
      
 168 
     | 
    
         
            +
                        @log.add("STANDOC_38", x.parent, params: [x.text])
         
     | 
| 
       179 
169 
     | 
    
         
             
                      end
         
     | 
| 
       180 
170 
     | 
    
         
             
                    end
         
     | 
| 
       181 
171 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -217,7 +207,7 @@ module Metanorma 
     | 
|
| 
       217 
207 
     | 
    
         
             
                    doc.xpath(tag).each do |t|
         
     | 
| 
       218 
208 
     | 
    
         
             
                      body and t = t.at("./#{body}")
         
     | 
| 
       219 
209 
     | 
    
         
             
                      empty_block?(t) or next
         
     | 
| 
       220 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
      
 210 
     | 
    
         
            +
                      @log.add("STANDOC_39", t, params: [tag.sub(/^\/\//, '')])
         
     | 
| 
       221 
211 
     | 
    
         
             
                    end
         
     | 
| 
       222 
212 
     | 
    
         
             
                  end
         
     | 
| 
       223 
213 
     | 
    
         | 
| 
         @@ -14,8 +14,7 @@ module Metanorma 
     | 
|
| 
       14 
14 
     | 
    
         
             
                      Vectory::Utils::url?(i["src"]) and next
         
     | 
| 
       15 
15 
     | 
    
         
             
                      Vectory::Utils::datauri?(i["src"]) and next
         
     | 
| 
       16 
16 
     | 
    
         
             
                      expand_path(i["src"]) and next
         
     | 
| 
       17 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       18 
     | 
    
         
            -
                               "Image not found: #{i['src']}", severity: 0)
         
     | 
| 
      
 17 
     | 
    
         
            +
                      @log.add("STANDOC_44", i.parent, params: [i["src"]])
         
     | 
| 
       19 
18 
     | 
    
         
             
                    end
         
     | 
| 
       20 
19 
     | 
    
         
             
                  end
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
         @@ -42,19 +41,14 @@ module Metanorma 
     | 
|
| 
       42 
41 
     | 
    
         
             
                  def png_validate1(img, buffer)
         
     | 
| 
       43 
42 
     | 
    
         
             
                    PngCheck.check_buffer(buffer)
         
     | 
| 
       44 
43 
     | 
    
         
             
                  rescue PngCheck::CorruptPngError => e
         
     | 
| 
       45 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
       46 
     | 
    
         
            -
                             "Corrupt PNG image detected: #{e.message}")
         
     | 
| 
      
 44 
     | 
    
         
            +
                    @log.add("STANDOC_45", img.parent, params: [e.message])
         
     | 
| 
       47 
45 
     | 
    
         
             
                  end
         
     | 
| 
       48 
46 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                  TOO_BIG_IMG_ERR = <<~ERR.freeze
         
     | 
| 
       50 
     | 
    
         
            -
                    Image too large for Data URI encoding: disable Data URI encoding (`:data-uri-image: false`), or set `:data-uri-maxsize: 0`
         
     | 
| 
       51 
     | 
    
         
            -
                  ERR
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
47 
     | 
    
         
             
                  def image_toobig(doc)
         
     | 
| 
       54 
48 
     | 
    
         
             
                    @dataurimaxsize.zero? and return
         
     | 
| 
       55 
49 
     | 
    
         
             
                    doc.xpath("//image").each do |i|
         
     | 
| 
       56 
50 
     | 
    
         
             
                      i["src"].size > @dataurimaxsize and
         
     | 
| 
       57 
     | 
    
         
            -
                        @log.add(" 
     | 
| 
      
 51 
     | 
    
         
            +
                        @log.add("STANDOC_46", i.parent)
         
     | 
| 
       58 
52 
     | 
    
         
             
                    end
         
     | 
| 
       59 
53 
     | 
    
         
             
                  end
         
     | 
| 
       60 
54 
     | 
    
         
             
                end
         
     | 
| 
         @@ -30,8 +30,9 @@ module Metanorma 
     | 
|
| 
       30 
30 
     | 
    
         
             
                    errors = Jing.new(schema, encoding: "UTF-8").validate(file.path)
         
     | 
| 
       31 
31 
     | 
    
         
             
                    warn "Syntax Valid!" if errors.none?
         
     | 
| 
       32 
32 
     | 
    
         
             
                    errors.each do |e|
         
     | 
| 
       33 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       34 
     | 
    
         
            -
                               "XML Line #{'%06d' % e[:line]}:#{e[:column]}", 
     | 
| 
      
 33 
     | 
    
         
            +
                      @log.add("STANDOC_7",
         
     | 
| 
      
 34 
     | 
    
         
            +
                               "XML Line #{'%06d' % e[:line]}:#{e[:column]}",
         
     | 
| 
      
 35 
     | 
    
         
            +
                               params: [e[:message]])
         
     | 
| 
       35 
36 
     | 
    
         
             
                    end
         
     | 
| 
       36 
37 
     | 
    
         
             
                  end
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
         @@ -19,16 +19,14 @@ module Metanorma 
     | 
|
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                  def callouts_error(elem, callouts, annotations)
         
     | 
| 
       21 
21 
     | 
    
         
             
                    if callouts.size != annotations.size && !annotations.empty?
         
     | 
| 
       22 
     | 
    
         
            -
                       
     | 
| 
       23 
     | 
    
         
            -
                            "(#{annotations.size})"
         
     | 
| 
       24 
     | 
    
         
            -
                      @log.add("Crossreferences", elem, err, severity: 0)
         
     | 
| 
      
 22 
     | 
    
         
            +
                      @log.add("STANDOC_47", elem, params: [callouts.size, annotations.size])
         
     | 
| 
       25 
23 
     | 
    
         
             
                    end
         
     | 
| 
       26 
24 
     | 
    
         
             
                  end
         
     | 
| 
       27 
25 
     | 
    
         | 
| 
       28 
26 
     | 
    
         
             
                  def style_warning(node, msg, text = nil)
         
     | 
| 
       29 
27 
     | 
    
         
             
                    w = msg
         
     | 
| 
       30 
28 
     | 
    
         
             
                    w += ": #{text}" if text
         
     | 
| 
       31 
     | 
    
         
            -
                    @log.add(" 
     | 
| 
      
 29 
     | 
    
         
            +
                    @log.add("STANDOC_48", node, params: [w])
         
     | 
| 
       32 
30 
     | 
    
         
             
                  end
         
     | 
| 
       33 
31 
     | 
    
         | 
| 
       34 
32 
     | 
    
         
             
                  def reject_metanorma_extension
         
     | 
| 
         @@ -69,8 +67,7 @@ module Metanorma 
     | 
|
| 
       69 
67 
     | 
    
         
             
                    doc.xpath("//references[@normative = 'true']/bibitem").each do |b|
         
     | 
| 
       70 
68 
     | 
    
         
             
                      docid = b.at("./docidentifier[@type = 'metanorma']") or next
         
     | 
| 
       71 
69 
     | 
    
         
             
                      /^\[\d+\]$/.match?(docid.text) or next
         
     | 
| 
       72 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       73 
     | 
    
         
            -
                               "Numeric reference in normative references", severity: 1)
         
     | 
| 
      
 70 
     | 
    
         
            +
                      @log.add("STANDOC_49", b)
         
     | 
| 
       74 
71 
     | 
    
         
             
                    end
         
     | 
| 
       75 
72 
     | 
    
         
             
                  end
         
     | 
| 
       76 
73 
     | 
    
         
             
                end
         
     | 
| 
         @@ -17,7 +17,7 @@ module Metanorma 
     | 
|
| 
       17 
17 
     | 
    
         
             
                  def empty_table_validate(doc)
         
     | 
| 
       18 
18 
     | 
    
         
             
                    doc.xpath("//table[not(.//tr)]").reject(&reject_metanorma_extension)
         
     | 
| 
       19 
19 
     | 
    
         
             
                      .each do |t|
         
     | 
| 
       20 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
      
 20 
     | 
    
         
            +
                      @log.add("STANDOC_2", t)
         
     | 
| 
       21 
21 
     | 
    
         
             
                    end
         
     | 
| 
       22 
22 
     | 
    
         
             
                  end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
         @@ -79,17 +79,15 @@ module Metanorma 
     | 
|
| 
       79 
79 
     | 
    
         
             
                  def maxrows_validate(table, cells2d, tablechild, mode)
         
     | 
| 
       80 
80 
     | 
    
         
             
                    err = "are inconsistent"
         
     | 
| 
       81 
81 
     | 
    
         
             
                    mode == "thead_row" and err = "cannot go outside #{tablechild}"
         
     | 
| 
       82 
     | 
    
         
            -
                    err = "Table rows in table #{err}: check rowspan"
         
     | 
| 
       83 
82 
     | 
    
         
             
                    if cells2d.any? { |x| x.size != cells2d.first.size }
         
     | 
| 
       84 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
      
 83 
     | 
    
         
            +
                      @log.add("STANDOC_4", table, params: [err])
         
     | 
| 
       85 
84 
     | 
    
         
             
                    end
         
     | 
| 
       86 
85 
     | 
    
         
             
                  end
         
     | 
| 
       87 
86 
     | 
    
         | 
| 
       88 
87 
     | 
    
         
             
                  # if maxcols or maxrows negative, do not check them
         
     | 
| 
       89 
88 
     | 
    
         
             
                  def maxcols_check(col, maxcols, tcell)
         
     | 
| 
       90 
89 
     | 
    
         
             
                    if maxcols.positive? && col > maxcols
         
     | 
| 
       91 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       92 
     | 
    
         
            -
                                               "defined (#{maxcols})", severity: 0)
         
     | 
| 
      
 90 
     | 
    
         
            +
                      @log.add("STANDOC_5", tcell, params: [maxcols])
         
     | 
| 
       93 
91 
     | 
    
         
             
                    end
         
     | 
| 
       94 
92 
     | 
    
         
             
                  end
         
     | 
| 
       95 
93 
     | 
    
         
             
                end
         
     | 
| 
         @@ -31,16 +31,14 @@ module Metanorma 
     | 
|
| 
       31 
31 
     | 
    
         
             
                      m << x.text&.downcase
         
     | 
| 
       32 
32 
     | 
    
         
             
                    end
         
     | 
| 
       33 
33 
     | 
    
         
             
                    pref.include?(iev.downcase) or
         
     | 
| 
       34 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       35 
     | 
    
         
            -
                               %(IEV #{loc} "#{iev}"), severity: 1)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      @log.add("STANDOC_22", term, params: [pref[0], loc, iev])
         
     | 
| 
       36 
35 
     | 
    
         
             
                  end
         
     | 
| 
       37 
36 
     | 
    
         | 
| 
       38 
37 
     | 
    
         
             
                  def concept_validate(doc, tag, refterm)
         
     | 
| 
       39 
38 
     | 
    
         
             
                    concept_validate_ids(doc)
         
     | 
| 
       40 
39 
     | 
    
         
             
                    doc.xpath("//#{tag}/xref").each do |x|
         
     | 
| 
       41 
40 
     | 
    
         
             
                      @concept_ids[x["target"]] and next
         
     | 
| 
       42 
     | 
    
         
            -
                      @log.add(" 
     | 
| 
       43 
     | 
    
         
            -
                               severity: 0)
         
     | 
| 
      
 41 
     | 
    
         
            +
                      @log.add("STANDOC_23", x, params: [concept_validate_msg(doc, tag, refterm, x)])
         
     | 
| 
       44 
42 
     | 
    
         
             
                    end
         
     | 
| 
       45 
43 
     | 
    
         
             
                  end
         
     | 
| 
       46 
44 
     | 
    
         | 
| 
         @@ -81,8 +79,7 @@ module Metanorma 
     | 
|
| 
       81 
79 
     | 
    
         
             
                    terms.each do |k, v|
         
     | 
| 
       82 
80 
     | 
    
         
             
                      v.size > 1 or next
         
     | 
| 
       83 
81 
     | 
    
         
             
                      loc = v.map { |x| x["anchor"] }.join(", ")
         
     | 
| 
       84 
     | 
    
         
            -
                       
     | 
| 
       85 
     | 
    
         
            -
                      @log.add("Terms", v.first, err, severity: 1)
         
     | 
| 
      
 82 
     | 
    
         
            +
                      @log.add("STANDOC_24", v.first, params: [k, loc])
         
     | 
| 
       86 
83 
     | 
    
         
             
                    end
         
     | 
| 
       87 
84 
     | 
    
         
             
                  end
         
     | 
| 
       88 
85 
     | 
    
         | 
| 
         @@ -105,14 +102,7 @@ module Metanorma 
     | 
|
| 
       105 
102 
     | 
    
         
             
                      desgns = v[:designations].map do |x|
         
     | 
| 
       106 
103 
     | 
    
         
             
                        @c.encode(x.text.strip,  :basic, :hexadecimal)
         
     | 
| 
       107 
104 
     | 
    
         
             
                      end.join(", ")
         
     | 
| 
       108 
     | 
    
         
            -
                       
     | 
| 
       109 
     | 
    
         
            -
                        Clause not recognised as a term clause, but contains designation markup
         
     | 
| 
       110 
     | 
    
         
            -
                         (<code>preferred:[], admitted:[], alt:[], deprecated:[]</code>):<br/>
         
     | 
| 
       111 
     | 
    
         
            -
                        #{desgns}</br>
         
     | 
| 
       112 
     | 
    
         
            -
                        Ensure the parent clause is recognised as a terms clause by inserting <code>[heading=terms and definitions]</code> above the title,
         
     | 
| 
       113 
     | 
    
         
            -
                        in case the heading is not automatically recognised. See also <a href="https://www.metanorma.org/author/topics/sections/concepts/#clause-title">Metanorma documentation</a>.
         
     | 
| 
       114 
     | 
    
         
            -
                      ERROR
         
     | 
| 
       115 
     | 
    
         
            -
                      @log.add("Terms", v[:clause], err, severity: 0)
         
     | 
| 
      
 105 
     | 
    
         
            +
                      @log.add("STANDOC_25", v[:clause], params: [desgns])
         
     | 
| 
       116 
106 
     | 
    
         
             
                    end
         
     | 
| 
       117 
107 
     | 
    
         
             
                  end
         
     | 
| 
       118 
108 
     | 
    
         
             
                end
         
     | 
    
        data/metanorma-standoc.gemspec
    CHANGED
    
    | 
         @@ -32,12 +32,12 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       32 
32 
     | 
    
         
             
              spec.add_dependency "asciidoctor", "~> 2.0.0"
         
     | 
| 
       33 
33 
     | 
    
         
             
              spec.add_dependency "crass", "~> 1.0.0"
         
     | 
| 
       34 
34 
     | 
    
         
             
              spec.add_dependency "iev", "~> 0.3.5"
         
     | 
| 
       35 
     | 
    
         
            -
              spec.add_dependency "isodoc", "~> 3. 
     | 
| 
      
 35 
     | 
    
         
            +
              spec.add_dependency "isodoc", "~> 3.4.0"
         
     | 
| 
       36 
36 
     | 
    
         
             
              spec.add_dependency "metanorma", ">= 1.6.0"
         
     | 
| 
       37 
37 
     | 
    
         
             
              spec.add_dependency "metanorma-plugin-glossarist", "~> 0.2.3"
         
     | 
| 
       38 
38 
     | 
    
         
             
              spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.31"
         
     | 
| 
       39 
39 
     | 
    
         
             
              spec.add_dependency "metanorma-plugin-plantuml", "~> 1.0.0"
         
     | 
| 
       40 
     | 
    
         
            -
              spec.add_dependency "metanorma-utils", "~>  
     | 
| 
      
 40 
     | 
    
         
            +
              spec.add_dependency "metanorma-utils", "~> 2.0.0"
         
     | 
| 
       41 
41 
     | 
    
         
             
              spec.add_dependency "ruby-jing"
         
     | 
| 
       42 
42 
     | 
    
         
             
              # relaton-cli not just relaton, to avoid circular reference in metanorma
         
     | 
| 
       43 
43 
     | 
    
         
             
              spec.add_dependency "concurrent-ruby"
         
     | 
| 
         @@ -58,6 +58,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       58 
58 
     | 
    
         
             
              spec.add_development_dependency "timecop", "~> 0.9"
         
     | 
| 
       59 
59 
     | 
    
         
             
              spec.add_development_dependency "vcr", "~> 6.1.0"
         
     | 
| 
       60 
60 
     | 
    
         
             
              spec.add_development_dependency "webmock"
         
     | 
| 
       61 
     | 
    
         
            -
              spec.add_development_dependency " 
     | 
| 
      
 61 
     | 
    
         
            +
              spec.add_development_dependency "openssl"
         
     | 
| 
      
 62 
     | 
    
         
            +
              spec.add_development_dependency "canon", "= 0.1.3"
         
     | 
| 
       62 
63 
     | 
    
         
             
              # spec.metadata["rubygems_mfa_required"] = "true"
         
     | 
| 
       63 
64 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: metanorma-standoc
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ribose Inc.
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2025- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-11-03 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: addressable
         
     | 
| 
         @@ -72,14 +72,14 @@ dependencies: 
     | 
|
| 
       72 
72 
     | 
    
         
             
                requirements:
         
     | 
| 
       73 
73 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       74 
74 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       75 
     | 
    
         
            -
                    version: 3. 
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 3.4.0
         
     | 
| 
       76 
76 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       77 
77 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       78 
78 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       79 
79 
     | 
    
         
             
                requirements:
         
     | 
| 
       80 
80 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
     | 
    
         
            -
                    version: 3. 
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 3.4.0
         
     | 
| 
       83 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       84 
84 
     | 
    
         
             
              name: metanorma
         
     | 
| 
       85 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -142,14 +142,14 @@ dependencies: 
     | 
|
| 
       142 
142 
     | 
    
         
             
                requirements:
         
     | 
| 
       143 
143 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       144 
144 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       145 
     | 
    
         
            -
                    version:  
     | 
| 
      
 145 
     | 
    
         
            +
                    version: 2.0.0
         
     | 
| 
       146 
146 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       147 
147 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       148 
148 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       149 
149 
     | 
    
         
             
                requirements:
         
     | 
| 
       150 
150 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       151 
151 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       152 
     | 
    
         
            -
                    version:  
     | 
| 
      
 152 
     | 
    
         
            +
                    version: 2.0.0
         
     | 
| 
       153 
153 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       154 
154 
     | 
    
         
             
              name: ruby-jing
         
     | 
| 
       155 
155 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -403,7 +403,7 @@ dependencies: 
     | 
|
| 
       403 
403 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       404 
404 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       405 
405 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       406 
     | 
    
         
            -
              name:  
     | 
| 
      
 406 
     | 
    
         
            +
              name: openssl
         
     | 
| 
       407 
407 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       408 
408 
     | 
    
         
             
                requirements:
         
     | 
| 
       409 
409 
     | 
    
         
             
                - - ">="
         
     | 
| 
         @@ -416,6 +416,20 @@ dependencies: 
     | 
|
| 
       416 
416 
     | 
    
         
             
                - - ">="
         
     | 
| 
       417 
417 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       418 
418 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 419 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 420 
     | 
    
         
            +
              name: canon
         
     | 
| 
      
 421 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 422 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 423 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 424 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 425 
     | 
    
         
            +
                    version: 0.1.3
         
     | 
| 
      
 426 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 427 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 428 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 429 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 430 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 431 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 432 
     | 
    
         
            +
                    version: 0.1.3
         
     | 
| 
       419 
433 
     | 
    
         
             
            description: |
         
     | 
| 
       420 
434 
     | 
    
         
             
              metanorma-standoc realises standards following the Metanorma standoc model
         
     | 
| 
       421 
435 
     | 
    
         | 
| 
         @@ -538,6 +552,7 @@ files: 
     | 
|
| 
       538 
552 
     | 
    
         
             
            - lib/metanorma/standoc/isolated_converter.rb
         
     | 
| 
       539 
553 
     | 
    
         
             
            - lib/metanorma/standoc/lists.rb
         
     | 
| 
       540 
554 
     | 
    
         
             
            - lib/metanorma/standoc/localbib.rb
         
     | 
| 
      
 555 
     | 
    
         
            +
            - lib/metanorma/standoc/log.rb
         
     | 
| 
       541 
556 
     | 
    
         
             
            - lib/metanorma/standoc/macros.rb
         
     | 
| 
       542 
557 
     | 
    
         
             
            - lib/metanorma/standoc/macros_embed.rb
         
     | 
| 
       543 
558 
     | 
    
         
             
            - lib/metanorma/standoc/macros_form.rb
         
     |