isodoc 2.0.6.1 → 2.0.8.1
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/isodoc.gemspec +2 -1
- data/lib/isodoc/convert.rb +12 -4
- data/lib/isodoc/function/references.rb +2 -2
- data/lib/isodoc/i18n.rb +1 -108
- data/lib/isodoc/presentation_function/bibdata.rb +20 -0
- data/lib/isodoc/presentation_function/image.rb +1 -2
- data/lib/isodoc/presentation_function/section.rb +17 -8
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_counter.rb +1 -1
- data/lib/isodoc/xref/xref_gen_seq.rb +2 -2
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +2 -2
- data/spec/isodoc/blocks_spec.rb +0 -1
- data/spec/isodoc/i18n_spec.rb +2 -2
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/presentation_xml_spec.rb +174 -2
- data/spec/isodoc/ref_spec.rb +144 -0
- data/spec/isodoc/xref_spec.rb +106 -106
- metadata +20 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a736ad455159e993e2c100d8ac3cd67a09c07705dad2fab7f30c8995636a55d8
         | 
| 4 | 
            +
              data.tar.gz: b600c452fe5bac0622c27ab05ca4156c46caaea6f56d0cebc2d76b9377c3ae2a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6e534774023bcb0212a72808f5167633ecce14af71aaa506388385c5e458fd41a87bb927d87546a3b3a709021d41d1592c99cd008caab5f652023543820137ad
         | 
| 7 | 
            +
              data.tar.gz: 9b8dfa80516811e6aa87d0cfc80ac3ad79c26eaf61edf6366b12a89c30b429d0b96e15fc7970c0ada89ce8d94ebbc08a330af41dcb5185baa7245a05f1f1a8d7
         | 
    
        data/isodoc.gemspec
    CHANGED
    
    | @@ -31,9 +31,10 @@ Gem::Specification.new do |spec| | |
| 31 31 | 
             
              spec.add_dependency "asciimath"
         | 
| 32 32 | 
             
              spec.add_dependency "html2doc", "~> 1.3.0"
         | 
| 33 33 | 
             
              spec.add_dependency "htmlentities", "~> 4.3.4"
         | 
| 34 | 
            +
              spec.add_dependency "isodoc-i18n", "~> 1.0.0"
         | 
| 34 35 | 
             
              spec.add_dependency "liquid", "~> 4"
         | 
| 35 36 | 
             
              # spec.add_dependency "metanorma", ">= 1.2.0"
         | 
| 36 | 
            -
              spec.add_dependency "emf2svg", " | 
| 37 | 
            +
              spec.add_dependency "emf2svg", "<= 1.3"
         | 
| 37 38 | 
             
              spec.add_dependency "mathml2asciimath"
         | 
| 38 39 | 
             
              spec.add_dependency "metanorma-utils"
         | 
| 39 40 | 
             
              spec.add_dependency "nokogiri", "~> 1.12.0"
         | 
    
        data/lib/isodoc/convert.rb
    CHANGED
    
    | @@ -43,6 +43,8 @@ module IsoDoc | |
| 43 43 | 
             
                # tocfigures: add ToC for figures
         | 
| 44 44 | 
             
                # toctables: add ToC for tables
         | 
| 45 45 | 
             
                # tocrecommendations: add ToC for rcommendations
         | 
| 46 | 
            +
                # fonts: fontist fonts to install
         | 
| 47 | 
            +
                # fontlicenseagreement: fontist font license agreement
         | 
| 46 48 | 
             
                def initialize(options)
         | 
| 47 49 | 
             
                  @libdir ||= File.dirname(__FILE__) # rubocop:disable Lint/DisjunctiveAssignmentInConstructor
         | 
| 48 50 | 
             
                  options.merge!(default_fonts(options)) do |_, old, new|
         | 
| @@ -57,10 +59,7 @@ module IsoDoc | |
| 57 59 | 
             
                  init_stylesheets(options)
         | 
| 58 60 | 
             
                  init_covers(options)
         | 
| 59 61 | 
             
                  init_toc(options)
         | 
| 60 | 
            -
                   | 
| 61 | 
            -
                  @smallerfontsize = options[:smallerfontsize]
         | 
| 62 | 
            -
                  @monospacefontsize = options[:monospacefontsize]
         | 
| 63 | 
            -
                  @footnotefontsize = options[:footnotefontsize]
         | 
| 62 | 
            +
                  init_fonts(options)
         | 
| 64 63 | 
             
                  @i18nyaml = options[:i18nyaml]
         | 
| 65 64 | 
             
                  @ulstyle = options[:ulstyle]
         | 
| 66 65 | 
             
                  @olstyle = options[:olstyle]
         | 
| @@ -96,6 +95,15 @@ module IsoDoc | |
| 96 95 | 
             
                  @tmpfilesdir_suffix = tmpfilesdir_suffix
         | 
| 97 96 | 
             
                end
         | 
| 98 97 |  | 
| 98 | 
            +
                def init_fonts(options)
         | 
| 99 | 
            +
                  @normalfontsize = options[:normalfontsize]
         | 
| 100 | 
            +
                  @smallerfontsize = options[:smallerfontsize]
         | 
| 101 | 
            +
                  @monospacefontsize = options[:monospacefontsize]
         | 
| 102 | 
            +
                  @footnotefontsize = options[:footnotefontsize]
         | 
| 103 | 
            +
                  @fontist_fonts = options[:fonts]
         | 
| 104 | 
            +
                  @fontlicenseagreement = options[:fontlicenseagreement]
         | 
| 105 | 
            +
                end
         | 
| 106 | 
            +
             | 
| 99 107 | 
             
                def init_covers(options)
         | 
| 100 108 | 
             
                  @header = options[:header]
         | 
| 101 109 | 
             
                  @htmlcoverpage = options[:htmlcoverpage]
         | 
| @@ -171,7 +171,7 @@ module IsoDoc | |
| 171 171 | 
             
                      if b.name == "bibitem"
         | 
| 172 172 | 
             
                        next if implicit_reference(b)
         | 
| 173 173 |  | 
| 174 | 
            -
                        i += 1
         | 
| 174 | 
            +
                        i += 1 unless b["hidden"]
         | 
| 175 175 | 
             
                        if standard?(b) then std_bibitem_entry(div, b, i, biblio)
         | 
| 176 176 | 
             
                        else nonstd_bibitem(div, b, i, biblio)
         | 
| 177 177 | 
             
                        end
         | 
| @@ -190,7 +190,7 @@ module IsoDoc | |
| 190 190 | 
             
                    (f = isoxml.at(ns(norm_ref_xpath)) and f["hidden"] != "true") or
         | 
| 191 191 | 
             
                      return num
         | 
| 192 192 | 
             
                    out.div do |div|
         | 
| 193 | 
            -
                      num  | 
| 193 | 
            +
                      num += 1
         | 
| 194 194 | 
             
                      clause_name(num, f.at(ns("./title")), div, nil)
         | 
| 195 195 | 
             
                      if f.name == "clause"
         | 
| 196 196 | 
             
                        f.elements.each { |e| parse(e, div) unless e.name == "title" }
         | 
    
        data/lib/isodoc/i18n.rb
    CHANGED
    
    | @@ -1,28 +1,9 @@ | |
| 1 1 | 
             
            require "yaml"
         | 
| 2 | 
            +
            require "isodoc-i18n"
         | 
| 2 3 | 
             
            require_relative "function/utils"
         | 
| 3 4 |  | 
| 4 5 | 
             
            module IsoDoc
         | 
| 5 6 | 
             
              class I18n
         | 
| 6 | 
            -
                def load_yaml(lang, script, i18nyaml = nil)
         | 
| 7 | 
            -
                  ret = load_yaml1(lang, script)
         | 
| 8 | 
            -
                  return normalise_hash(ret.merge(YAML.load_file(i18nyaml))) if i18nyaml
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                  normalise_hash(ret)
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                def normalise_hash(ret)
         | 
| 14 | 
            -
                  case ret
         | 
| 15 | 
            -
                  when Hash
         | 
| 16 | 
            -
                    ret.each do |k, v|
         | 
| 17 | 
            -
                      ret[k] = normalise_hash(v)
         | 
| 18 | 
            -
                    end
         | 
| 19 | 
            -
                    ret
         | 
| 20 | 
            -
                  when Array then ret.map { |n| normalise_hash(n) }
         | 
| 21 | 
            -
                  when String then cleanup_entities(ret.unicode_normalize(:nfc))
         | 
| 22 | 
            -
                  else ret
         | 
| 23 | 
            -
                  end
         | 
| 24 | 
            -
                end
         | 
| 25 | 
            -
             | 
| 26 7 | 
             
                def load_yaml1(lang, script)
         | 
| 27 8 | 
             
                  case lang
         | 
| 28 9 | 
             
                  when "en", "fr", "ru", "de", "es", "ar"
         | 
| @@ -40,93 +21,5 @@ module IsoDoc | |
| 40 21 | 
             
                  YAML.load_file(File.join(File.dirname(__FILE__),
         | 
| 41 22 | 
             
                                           "../isodoc-yaml/i18n-#{str}.yaml"))
         | 
| 42 23 | 
             
                end
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                def get
         | 
| 45 | 
            -
                  @labels
         | 
| 46 | 
            -
                end
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                def set(key, val)
         | 
| 49 | 
            -
                  @labels[key] = val
         | 
| 50 | 
            -
                end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                def initialize(lang, script, i18nyaml = nil)
         | 
| 53 | 
            -
                  @lang = lang
         | 
| 54 | 
            -
                  @script = script
         | 
| 55 | 
            -
                  y = load_yaml(lang, script, i18nyaml)
         | 
| 56 | 
            -
                  @labels = y
         | 
| 57 | 
            -
                  @labels["language"] = @lang
         | 
| 58 | 
            -
                  @labels["script"] = @script
         | 
| 59 | 
            -
                  @labels.each do |k, _v|
         | 
| 60 | 
            -
                    self.class.send(:define_method, k.downcase) { get[k] }
         | 
| 61 | 
            -
                  end
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                def self.l10n(text, lang = @lang, script = @script)
         | 
| 65 | 
            -
                  l10n(text, lang, script)
         | 
| 66 | 
            -
                end
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                # TODO: move to localization file
         | 
| 69 | 
            -
                # function localising spaces and punctuation.
         | 
| 70 | 
            -
                # Not clear if period needs to be localised for zh
         | 
| 71 | 
            -
                def l10n(text, lang = @lang, script = @script)
         | 
| 72 | 
            -
                  if lang == "zh" && script == "Hans" then l10n_zh(text)
         | 
| 73 | 
            -
                  else bidiwrap(text, lang, script)
         | 
| 74 | 
            -
                  end
         | 
| 75 | 
            -
                end
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                def bidiwrap(text, lang, script)
         | 
| 78 | 
            -
                  my_script, my_rtl, outer_rtl = bidiwrap_vars(lang, script)
         | 
| 79 | 
            -
                  if my_rtl && !outer_rtl
         | 
| 80 | 
            -
                    mark = %w(Arab Aran).include?(my_script) ? "؜" : "‏"
         | 
| 81 | 
            -
                    "#{mark}#{text}#{mark}"
         | 
| 82 | 
            -
                  elsif !my_rtl && outer_rtl then "‎#{text}‎"
         | 
| 83 | 
            -
                  else text
         | 
| 84 | 
            -
                  end
         | 
| 85 | 
            -
                end
         | 
| 86 | 
            -
             | 
| 87 | 
            -
                def bidiwrap_vars(lang, script)
         | 
| 88 | 
            -
                  my_script = script || Metanorma::Utils.default_script(lang)
         | 
| 89 | 
            -
                  [my_script,
         | 
| 90 | 
            -
                   Metanorma::Utils.rtl_script?(my_script),
         | 
| 91 | 
            -
                   Metanorma::Utils.rtl_script?(@script || Metanorma::Utils
         | 
| 92 | 
            -
                     .default_script(@lang))]
         | 
| 93 | 
            -
                end
         | 
| 94 | 
            -
             | 
| 95 | 
            -
                def l10n_zh(text)
         | 
| 96 | 
            -
                  xml = Nokogiri::HTML::DocumentFragment.parse(text)
         | 
| 97 | 
            -
                  xml.traverse do |n|
         | 
| 98 | 
            -
                    next unless n.text?
         | 
| 99 | 
            -
             | 
| 100 | 
            -
                    n.replace(cleanup_entities(n.text.gsub(/ /, "").gsub(/:/, ":")
         | 
| 101 | 
            -
                      .gsub(/,/, "、").gsub(/\(/, "(").gsub(/\)/, ")")
         | 
| 102 | 
            -
                      .gsub(/\[/, "【").gsub(/\]/, "】"), is_xml: false))
         | 
| 103 | 
            -
                  end
         | 
| 104 | 
            -
                  xml.to_xml.gsub(/<b>/, "").gsub("</b>", "").gsub(/<\?[^>]+>/, "")
         | 
| 105 | 
            -
                end
         | 
| 106 | 
            -
             | 
| 107 | 
            -
                def boolean_conj(list, conn)
         | 
| 108 | 
            -
                  case list.size
         | 
| 109 | 
            -
                  when 0 then ""
         | 
| 110 | 
            -
                  when 1 then list.first
         | 
| 111 | 
            -
                  when 2 then @labels["binary_#{conn}"].sub(/%1/, list[0])
         | 
| 112 | 
            -
                    .sub(/%2/, list[1])
         | 
| 113 | 
            -
                  else
         | 
| 114 | 
            -
                    @labels["multiple_#{conn}"]
         | 
| 115 | 
            -
                      .sub(/%1/, l10n(list[0..-2].join(", "), @lang, @script))
         | 
| 116 | 
            -
                      .sub(/%2/, list[-1])
         | 
| 117 | 
            -
                  end
         | 
| 118 | 
            -
                end
         | 
| 119 | 
            -
             | 
| 120 | 
            -
                #     def multiple_and(names, andword)
         | 
| 121 | 
            -
                #       return "" if names.empty?
         | 
| 122 | 
            -
                #       return names[0] if names.length == 1
         | 
| 123 | 
            -
                #
         | 
| 124 | 
            -
                #       (names.length == 2) &&
         | 
| 125 | 
            -
                #         (return l10n("#{names[0]} #{andword} #{names[1]}", @lang, @script))
         | 
| 126 | 
            -
                #       l10n(names[0..-2].join(", ") + " #{andword} #{names[-1]}", @lang, @script)
         | 
| 127 | 
            -
                #     end
         | 
| 128 | 
            -
             | 
| 129 | 
            -
                include Function::Utils
         | 
| 130 | 
            -
                # module_function :l10n
         | 
| 131 24 | 
             
              end
         | 
| 132 25 | 
             
            end
         | 
| @@ -1,7 +1,10 @@ | |
| 1 | 
            +
            require "csv"
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module IsoDoc
         | 
| 2 4 | 
             
              class PresentationXMLConvert < ::IsoDoc::Convert
         | 
| 3 5 | 
             
                def bibdata(docxml)
         | 
| 4 6 | 
             
                  toc_metadata(docxml)
         | 
| 7 | 
            +
                  fonts_metadata(docxml)
         | 
| 5 8 | 
             
                  docid_prefixes(docxml)
         | 
| 6 9 | 
             
                  a = bibdata_current(docxml) or return
         | 
| 7 10 | 
             
                  address_precompose(a)
         | 
| @@ -34,6 +37,23 @@ module IsoDoc | |
| 34 37 | 
             
                  end
         | 
| 35 38 | 
             
                end
         | 
| 36 39 |  | 
| 40 | 
            +
                def fonts_metadata(xmldoc)
         | 
| 41 | 
            +
                  return unless @fontist_fonts
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  ins = xmldoc.at(ns("//presentation-metadata")) ||
         | 
| 44 | 
            +
                    xmldoc.at(ns("//misc-container")) || xmldoc.at(ns("//bibdata"))
         | 
| 45 | 
            +
                  CSV.parse_line(@fontist_fonts, col_sep: ";").map(&:strip).each do |f|
         | 
| 46 | 
            +
                    ins.next = presmeta("fonts", f)
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
                  @fontlicenseagreement and
         | 
| 49 | 
            +
                    ins.next = presmeta("font-license-agreement", @fontlicenseagreement)
         | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                def presmeta(name, value)
         | 
| 53 | 
            +
                  "<presentation-metadata><name>#{name}</name><value>#{value}</value>"\
         | 
| 54 | 
            +
                    "</presentation-metadata>"
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 37 57 | 
             
                def address_precompose1(addr)
         | 
| 38 58 | 
             
                  ret = []
         | 
| 39 59 | 
             
                  addr.xpath(ns("./street")).each { |s| ret << s.children.to_xml }
         | 
| @@ -29,8 +29,7 @@ module IsoDoc | |
| 29 29 | 
             
                def figure1(elem)
         | 
| 30 30 | 
             
                  return sourcecode1(elem) if elem["class"] == "pseudocode" ||
         | 
| 31 31 | 
             
                    elem["type"] == "pseudocode"
         | 
| 32 | 
            -
                  return if ( | 
| 33 | 
            -
                    (elem.at(ns("./figure")) && !elem.at(ns("./name")))
         | 
| 32 | 
            +
                  return if elem.at(ns("./figure")) && !elem.at(ns("./name"))
         | 
| 34 33 |  | 
| 35 34 | 
             
                  lbl = @xrefs.anchor(elem["id"], :label, false) or return
         | 
| 36 35 | 
             
                  prefix_name(elem, " — ",
         | 
| @@ -69,23 +69,32 @@ module IsoDoc | |
| 69 69 | 
             
                def bibliography_bibitem_number_skip(bibitem)
         | 
| 70 70 | 
             
                  @xrefs.klass.implicit_reference(bibitem) ||
         | 
| 71 71 | 
             
                    bibitem.at(ns(".//docidentifier[@type = 'metanorma']")) ||
         | 
| 72 | 
            -
                    bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']"))
         | 
| 73 | 
            -
             | 
| 72 | 
            +
                    bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']")) ||
         | 
| 73 | 
            +
                    bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
         | 
| 74 74 | 
             
                end
         | 
| 75 75 |  | 
| 76 76 | 
             
                def bibliography_bibitem_number(docxml)
         | 
| 77 77 | 
             
                  i = 0
         | 
| 78 78 | 
             
                  docxml.xpath(ns("//references[@normative = 'false']/bibitem")).each do |b|
         | 
| 79 | 
            -
                     | 
| 80 | 
            -
             | 
| 81 | 
            -
                    i += 1
         | 
| 82 | 
            -
                    id = b.at(ns(".//docidentifier"))
         | 
| 83 | 
            -
                    id.previous =
         | 
| 84 | 
            -
                      "<docidentifier type='metanorma-ordinal'>[#{i}]</docidentifier>"
         | 
| 79 | 
            +
                    i = bibliography_bibitem_number1(b, i)
         | 
| 85 80 | 
             
                  end
         | 
| 86 81 | 
             
                  @xrefs.references docxml
         | 
| 87 82 | 
             
                end
         | 
| 88 83 |  | 
| 84 | 
            +
                def bibliography_bibitem_number1(bibitem, idx)
         | 
| 85 | 
            +
                  if mn = bibitem.at(ns(".//docidentifier[@type = 'metanorma']"))
         | 
| 86 | 
            +
                    /^\[?\d\]?$/.match?(mn&.text) and
         | 
| 87 | 
            +
                      idx = mn.text.sub(/^\[/, "").sub(/\]$/, "").to_i
         | 
| 88 | 
            +
                  end
         | 
| 89 | 
            +
                  unless bibliography_bibitem_number_skip(bibitem)
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                    idx += 1
         | 
| 92 | 
            +
                    bibitem.at(ns(".//docidentifier")).previous =
         | 
| 93 | 
            +
                      "<docidentifier type='metanorma-ordinal'>[#{idx}]</docidentifier>"
         | 
| 94 | 
            +
                  end
         | 
| 95 | 
            +
                  idx
         | 
| 96 | 
            +
                end
         | 
| 97 | 
            +
             | 
| 89 98 | 
             
                def docid_prefixes(docxml)
         | 
| 90 99 | 
             
                  docxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
         | 
| 91 100 | 
             
                    i.children = @xrefs.klass.docid_prefix(i["type"], i.text)
         | 
    
        data/lib/isodoc/version.rb
    CHANGED
    
    
| @@ -25,7 +25,7 @@ module IsoDoc | |
| 25 25 | 
             
                    j = 0
         | 
| 26 26 | 
             
                    clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
         | 
| 27 27 | 
             
                      .each do |t|
         | 
| 28 | 
            -
                      next if labelled_ancestor(t) && t.ancestors("figure").empty?
         | 
| 28 | 
            +
                      # next if labelled_ancestor(t) && t.ancestors("figure").empty?
         | 
| 29 29 |  | 
| 30 30 | 
             
                      j = subfigure_increment(j, c, t)
         | 
| 31 31 | 
             
                      label = c.print + (j.zero? ? "" : "-#{j}")
         | 
| @@ -111,7 +111,7 @@ module IsoDoc | |
| 111 111 | 
             
                    j = 0
         | 
| 112 112 | 
             
                    clause.xpath(ns(".//figure |  .//sourcecode[not(ancestor::example)]"))
         | 
| 113 113 | 
             
                      .each do |t|
         | 
| 114 | 
            -
                      next if labelled_ancestor(t) && t.ancestors("figure").empty?
         | 
| 114 | 
            +
                      # next if labelled_ancestor(t) && t.ancestors("figure").empty?
         | 
| 115 115 |  | 
| 116 116 | 
             
                      j = subfigure_increment(j, c, t)
         | 
| 117 117 | 
             
                      label = "#{num}#{hiersep}#{c.print}" +
         | 
| @@ -34,9 +34,9 @@ internal_external_terms_boilerplate: | | |
| 34 34 | 
             
                      <p>% 界定的以及下列术语和定义适用于本文件。</p>
         | 
| 35 35 | 
             
            term_defined_in: "〖术语于%中定义〗"
         | 
| 36 36 | 
             
            binary_and: "%1和%2"
         | 
| 37 | 
            -
            multiple_and: "%1 | 
| 37 | 
            +
            multiple_and: "%1、和%2"
         | 
| 38 38 | 
             
            binary_or: "%1或%2"
         | 
| 39 | 
            -
            multiple_or: "%1 | 
| 39 | 
            +
            multiple_or: "%1、或%2"
         | 
| 40 40 | 
             
            chain_and: "%1和%2"
         | 
| 41 41 | 
             
            chain_or: "%1或%2"
         | 
| 42 42 | 
             
            chain_from: "%1从%2"
         | 
    
        data/spec/isodoc/blocks_spec.rb
    CHANGED
    
    | @@ -2497,7 +2497,6 @@ RSpec.describe IsoDoc do | |
| 2497 2497 | 
             
                           <bibliography>
         | 
| 2498 2498 | 
             
                             <references hidden='true' normative='false' displayorder="1">
         | 
| 2499 2499 | 
             
                               <bibitem id='express_action_schema' type='internal'>
         | 
| 2500 | 
            -
                                 <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
         | 
| 2501 2500 | 
             
                                 <docidentifier type='repository'>express/action_schema</docidentifier>
         | 
| 2502 2501 | 
             
                               </bibitem>
         | 
| 2503 2502 | 
             
                             </references>
         | 
    
        data/spec/isodoc/i18n_spec.rb
    CHANGED
    
    | @@ -644,7 +644,7 @@ RSpec.describe IsoDoc do | |
| 644 644 | 
             
                         </introduction></preface><sections>
         | 
| 645 645 | 
             
                         <clause id="D" obligation="normative" type="scope" displayorder="3">
         | 
| 646 646 | 
             
                           <title depth="1">1.<tab/>Scope</title>
         | 
| 647 | 
            -
                           <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712&# | 
| 647 | 
            +
                           <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, 第1–1 表</eref></p>
         | 
| 648 648 | 
             
                         </clause>
         | 
| 649 649 | 
             
                         <clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
         | 
| 650 650 | 
             
                           <title depth="2">3.1.<tab/>Normal Terms</title>
         | 
| @@ -722,7 +722,7 @@ RSpec.describe IsoDoc do | |
| 722 722 | 
             
                                 <div id="D">
         | 
| 723 723 | 
             
                                   <h1>1. Scope</h1>
         | 
| 724 724 | 
             
                                   <p id="E">
         | 
| 725 | 
            -
                                   <a href='#ISO712'>ISO 712&# | 
| 725 | 
            +
                                   <a href='#ISO712'>ISO 712, 第1–1 表</a>
         | 
| 726 726 | 
             
                                   </p>
         | 
| 727 727 | 
             
                                 </div>
         | 
| 728 728 | 
             
                                 <div>
         | 
    
        data/spec/isodoc/inline_spec.rb
    CHANGED
    
    | @@ -1603,7 +1603,7 @@ RSpec.describe IsoDoc do | |
| 1603 1603 | 
             
                     <bibliography>
         | 
| 1604 1604 | 
             
                       <references id='_normative_references' obligation='informative' normative='true' displayorder='2' hidden="true">
         | 
| 1605 1605 | 
             
                         <title depth='1'>
         | 
| 1606 | 
            -
                            | 
| 1606 | 
            +
                           0.
         | 
| 1607 1607 | 
             
                           <tab/>
         | 
| 1608 1608 | 
             
                           Normative References
         | 
| 1609 1609 | 
             
                         </title>
         | 
| @@ -1709,7 +1709,7 @@ RSpec.describe IsoDoc do | |
| 1709 1709 | 
             
                OUTPUT
         | 
| 1710 1710 |  | 
| 1711 1711 | 
             
                expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
         | 
| 1712 | 
            -
             | 
| 1712 | 
            +
                  .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
         | 
| 1713 1713 | 
             
                expect(xmlpp(IsoDoc::HtmlConvert.new({})
         | 
| 1714 1714 | 
             
                  .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
         | 
| 1715 1715 | 
             
                expect(xmlpp(IsoDoc::WordConvert.new({})
         | 
| @@ -1158,7 +1158,6 @@ RSpec.describe IsoDoc do | |
| 1158 1158 | 
             
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 1159 1159 | 
             
              end
         | 
| 1160 1160 |  | 
| 1161 | 
            -
             | 
| 1162 1161 | 
             
              it "inserts toc metadata" do
         | 
| 1163 1162 | 
             
                input = <<~INPUT
         | 
| 1164 1163 | 
             
                  <iso-standard xmlns="http://riboseinc.com/isoxml">
         | 
| @@ -1194,7 +1193,7 @@ RSpec.describe IsoDoc do | |
| 1194 1193 | 
             
              end
         | 
| 1195 1194 |  | 
| 1196 1195 | 
             
              it "processes multiple-target xrefs" do
         | 
| 1197 | 
            -
             | 
| 1196 | 
            +
                input = <<~INPUT
         | 
| 1198 1197 | 
             
                  <iso-standard xmlns="http://riboseinc.com/isoxml">
         | 
| 1199 1198 | 
             
                  <bibdata/>
         | 
| 1200 1199 | 
             
                    <sections>
         | 
| @@ -1295,6 +1294,179 @@ RSpec.describe IsoDoc do | |
| 1295 1294 | 
             
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 1296 1295 | 
             
              end
         | 
| 1297 1296 |  | 
| 1297 | 
            +
              it "captions embedded figures" do
         | 
| 1298 | 
            +
                input = <<~INPUT
         | 
| 1299 | 
            +
                  <iso-standard xmlns="http://riboseinc.com/isoxml">
         | 
| 1300 | 
            +
                  <bibdata/>
         | 
| 1301 | 
            +
                    <sections>
         | 
| 1302 | 
            +
                   <clause id="A" inline-header="false" obligation="normative">
         | 
| 1303 | 
            +
                   <title>Section</title>
         | 
| 1304 | 
            +
                   <figure id="B1">
         | 
| 1305 | 
            +
                   <name>First</name>
         | 
| 1306 | 
            +
                   </figure>
         | 
| 1307 | 
            +
                   <example id="C1">
         | 
| 1308 | 
            +
                   <figure id="B2">
         | 
| 1309 | 
            +
                   <name>Second</name>
         | 
| 1310 | 
            +
                   </figure>
         | 
| 1311 | 
            +
                   </example>
         | 
| 1312 | 
            +
                   <example id="C2">
         | 
| 1313 | 
            +
                   <figure id="B4" unnumbered="true">
         | 
| 1314 | 
            +
                   <name>Unnamed</name>
         | 
| 1315 | 
            +
                   </figure>
         | 
| 1316 | 
            +
                   </example>
         | 
| 1317 | 
            +
                   <figure id="B3">
         | 
| 1318 | 
            +
                   <name>Third</name>
         | 
| 1319 | 
            +
                   </figure>
         | 
| 1320 | 
            +
                   </clause>
         | 
| 1321 | 
            +
                     </sections>
         | 
| 1322 | 
            +
                   </iso-standard>
         | 
| 1323 | 
            +
                INPUT
         | 
| 1324 | 
            +
                presxml = <<~OUTPUT
         | 
| 1325 | 
            +
                  <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
         | 
| 1326 | 
            +
                     <bibdata/>
         | 
| 1327 | 
            +
             | 
| 1328 | 
            +
                     <sections>
         | 
| 1329 | 
            +
                       <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
         | 
| 1330 | 
            +
                         <title depth='1'>
         | 
| 1331 | 
            +
                           1.
         | 
| 1332 | 
            +
                           <tab/>
         | 
| 1333 | 
            +
                           Section
         | 
| 1334 | 
            +
                         </title>
         | 
| 1335 | 
            +
                         <figure id='B1'>
         | 
| 1336 | 
            +
                           <name>Figure 1 — First</name>
         | 
| 1337 | 
            +
                         </figure>
         | 
| 1338 | 
            +
                         <example id='C1'>
         | 
| 1339 | 
            +
                           <name>EXAMPLE 1</name>
         | 
| 1340 | 
            +
                           <figure id='B2'>
         | 
| 1341 | 
            +
                             <name>Figure 2 — Second</name>
         | 
| 1342 | 
            +
                           </figure>
         | 
| 1343 | 
            +
                         </example>
         | 
| 1344 | 
            +
                         <example id='C2'>
         | 
| 1345 | 
            +
                            <name>EXAMPLE 2</name>
         | 
| 1346 | 
            +
                            <figure id='B4' unnumbered='true'>
         | 
| 1347 | 
            +
                              <name>Unnamed</name>
         | 
| 1348 | 
            +
                            </figure>
         | 
| 1349 | 
            +
                          </example>
         | 
| 1350 | 
            +
                         <figure id='B3'>
         | 
| 1351 | 
            +
                           <name>Figure 3 — Third</name>
         | 
| 1352 | 
            +
                         </figure>
         | 
| 1353 | 
            +
                       </clause>
         | 
| 1354 | 
            +
                     </sections>
         | 
| 1355 | 
            +
                   </iso-standard>
         | 
| 1356 | 
            +
                OUTPUT
         | 
| 1357 | 
            +
                expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
         | 
| 1358 | 
            +
                  .convert("test", input, true))
         | 
| 1359 | 
            +
                  .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
         | 
| 1360 | 
            +
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 1361 | 
            +
              end
         | 
| 1362 | 
            +
             | 
| 1363 | 
            +
              it "passes font names to Presentation XML" do
         | 
| 1364 | 
            +
                input = <<~INPUT
         | 
| 1365 | 
            +
                  <iso-standard xmlns="http://riboseinc.com/isoxml">
         | 
| 1366 | 
            +
                  <bibdata/>
         | 
| 1367 | 
            +
                  <sections>
         | 
| 1368 | 
            +
                   <clause id="A" inline-header="false" obligation="normative">
         | 
| 1369 | 
            +
                   <title>Section</title>
         | 
| 1370 | 
            +
                   <figure id="B1">
         | 
| 1371 | 
            +
                   <name>First</name>
         | 
| 1372 | 
            +
                   </figure>
         | 
| 1373 | 
            +
                   </clause>
         | 
| 1374 | 
            +
                     </sections>
         | 
| 1375 | 
            +
                   </iso-standard>
         | 
| 1376 | 
            +
                INPUT
         | 
| 1377 | 
            +
                presxml = <<~OUTPUT
         | 
| 1378 | 
            +
                  <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
         | 
| 1379 | 
            +
                    <bibdata/>
         | 
| 1380 | 
            +
                      <presentation-metadata>
         | 
| 1381 | 
            +
                      <name>font-license-agreement</name>
         | 
| 1382 | 
            +
                      <value>no-install-fonts</value>
         | 
| 1383 | 
            +
                    </presentation-metadata>
         | 
| 1384 | 
            +
                    <presentation-metadata>
         | 
| 1385 | 
            +
                      <name>fonts</name>
         | 
| 1386 | 
            +
                      <value>font2</value>
         | 
| 1387 | 
            +
                    </presentation-metadata>
         | 
| 1388 | 
            +
                    <presentation-metadata>
         | 
| 1389 | 
            +
                      <name>fonts</name>
         | 
| 1390 | 
            +
                      <value>font1</value>
         | 
| 1391 | 
            +
                    </presentation-metadata>
         | 
| 1392 | 
            +
                             <sections>
         | 
| 1393 | 
            +
                       <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
         | 
| 1394 | 
            +
                         <title depth='1'>
         | 
| 1395 | 
            +
                           1.
         | 
| 1396 | 
            +
                           <tab/>
         | 
| 1397 | 
            +
                           Section
         | 
| 1398 | 
            +
                         </title>
         | 
| 1399 | 
            +
                         <figure id='B1'>
         | 
| 1400 | 
            +
                           <name>Figure 1 — First</name>
         | 
| 1401 | 
            +
                         </figure>
         | 
| 1402 | 
            +
                       </clause>
         | 
| 1403 | 
            +
                     </sections>
         | 
| 1404 | 
            +
                  </iso-standard>
         | 
| 1405 | 
            +
                OUTPUT
         | 
| 1406 | 
            +
                expect(xmlpp(IsoDoc::PresentationXMLConvert
         | 
| 1407 | 
            +
                  .new({ fonts: "font1; font2", fontlicenseagreement: "no-install-fonts" })
         | 
| 1408 | 
            +
                  .convert("test", input, true))
         | 
| 1409 | 
            +
                  .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
         | 
| 1410 | 
            +
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 1411 | 
            +
              end
         | 
| 1412 | 
            +
             | 
| 1413 | 
            +
              it "skips numbering of hidden sections" do
         | 
| 1414 | 
            +
                input = <<~INPUT
         | 
| 1415 | 
            +
                  <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic">
         | 
| 1416 | 
            +
                  <bibdata/>
         | 
| 1417 | 
            +
                  <sections><clause id="_scope" type="scope" inline-header="false" obligation="normative">
         | 
| 1418 | 
            +
                  <title>Scope</title>
         | 
| 1419 | 
            +
                  <p id="_8d98c053-85d7-e8cc-75bb-183a14209d61">A</p>
         | 
| 1420 | 
            +
             | 
| 1421 | 
            +
                  <p id="_2141c040-93a4-785a-73f0-ffad4fa1779f"><eref type="inline" bibitemid="_607373b1-0cc4-fcdb-c482-fd86ae572bd1" citeas="ISO 639-2"/></p>
         | 
| 1422 | 
            +
                  </clause>
         | 
| 1423 | 
            +
             | 
| 1424 | 
            +
                  <terms id="_terms_and_definitions" obligation="normative">
         | 
| 1425 | 
            +
                  <title>Terms and definitions</title><p id="_36938d4b-05e5-bd0f-a082-0415db50e8f7">No terms and definitions are listed in this document.</p>
         | 
| 1426 | 
            +
             | 
| 1427 | 
            +
                  </terms>
         | 
| 1428 | 
            +
                  </sections><bibliography><references hidden="true" normative="true">
         | 
| 1429 | 
            +
                  <title>Normative references</title>
         | 
| 1430 | 
            +
                  </references>
         | 
| 1431 | 
            +
                  </bibliography></standard-document>
         | 
| 1432 | 
            +
                INPUT
         | 
| 1433 | 
            +
                presxml = <<~OUTPUT
         | 
| 1434 | 
            +
                  <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation">
         | 
| 1435 | 
            +
                  <bibdata/>
         | 
| 1436 | 
            +
                   <sections>
         | 
| 1437 | 
            +
                      <clause id='_scope' type='scope' inline-header='false' obligation='normative' displayorder='1'>
         | 
| 1438 | 
            +
                        <title depth='1'>
         | 
| 1439 | 
            +
                          1.
         | 
| 1440 | 
            +
                          <tab/>
         | 
| 1441 | 
            +
                          Scope
         | 
| 1442 | 
            +
                        </title>
         | 
| 1443 | 
            +
                        <p id='_8d98c053-85d7-e8cc-75bb-183a14209d61'>A</p>
         | 
| 1444 | 
            +
                        <p id='_2141c040-93a4-785a-73f0-ffad4fa1779f'>
         | 
| 1445 | 
            +
                          <eref type='inline' bibitemid='_607373b1-0cc4-fcdb-c482-fd86ae572bd1' citeas='ISO 639-2'>ISO 639-2</eref>
         | 
| 1446 | 
            +
                        </p>
         | 
| 1447 | 
            +
                      </clause>
         | 
| 1448 | 
            +
                      <terms id='_terms_and_definitions' obligation='normative' displayorder='3'>
         | 
| 1449 | 
            +
                        <title depth='1'>
         | 
| 1450 | 
            +
                          2.
         | 
| 1451 | 
            +
                          <tab/>
         | 
| 1452 | 
            +
                          Terms and definitions
         | 
| 1453 | 
            +
                        </title>
         | 
| 1454 | 
            +
                        <p id='_36938d4b-05e5-bd0f-a082-0415db50e8f7'>No terms and definitions are listed in this document.</p>
         | 
| 1455 | 
            +
                      </terms>
         | 
| 1456 | 
            +
                    </sections>
         | 
| 1457 | 
            +
                    <bibliography>
         | 
| 1458 | 
            +
                      <references hidden='true' normative='true' displayorder='2'>
         | 
| 1459 | 
            +
                        <title depth='1'>Normative references</title>
         | 
| 1460 | 
            +
                      </references>
         | 
| 1461 | 
            +
                    </bibliography>
         | 
| 1462 | 
            +
                  </standard-document>
         | 
| 1463 | 
            +
                OUTPUT
         | 
| 1464 | 
            +
                expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
         | 
| 1465 | 
            +
                  .convert("test", input, true))
         | 
| 1466 | 
            +
                  .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
         | 
| 1467 | 
            +
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 1468 | 
            +
              end
         | 
| 1469 | 
            +
             | 
| 1298 1470 | 
             
              private
         | 
| 1299 1471 |  | 
| 1300 1472 | 
             
              def mock_symbols
         | 
    
        data/spec/isodoc/ref_spec.rb
    CHANGED
    
    | @@ -854,4 +854,148 @@ RSpec.describe IsoDoc do | |
| 854 854 | 
             
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 855 855 | 
             
              end
         | 
| 856 856 |  | 
| 857 | 
            +
              it "enforces consistent metanorma-ordinal numbering" do
         | 
| 858 | 
            +
                input = <<~INPUT
         | 
| 859 | 
            +
                      <iso-standard xmlns="http://riboseinc.com/isoxml">
         | 
| 860 | 
            +
                      <bibdata>
         | 
| 861 | 
            +
                      <language>en</language>
         | 
| 862 | 
            +
                      </bibdata>
         | 
| 863 | 
            +
                      <bibliography><references id="_normative_references" obligation="informative" normative="false"><title>Bibliography</title>
         | 
| 864 | 
            +
                  <bibitem id="ref1" type="standard">
         | 
| 865 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 866 | 
            +
                    <docidentifier type="IEC">IEC 217</docidentifier>
         | 
| 867 | 
            +
                  </bibitem>
         | 
| 868 | 
            +
                  <bibitem id="ref2" type="standard">
         | 
| 869 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 870 | 
            +
                    <docidentifier type="metanorma">[3]</docidentifier>
         | 
| 871 | 
            +
                  </bibitem>
         | 
| 872 | 
            +
                  <bibitem id="ref3" type="standard">
         | 
| 873 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 874 | 
            +
                    <docidentifier>ABC</docidentifier>
         | 
| 875 | 
            +
                  </bibitem>
         | 
| 876 | 
            +
                  </references></bibliography></iso-standard>
         | 
| 877 | 
            +
                INPUT
         | 
| 878 | 
            +
                presxml = <<~PRESXML
         | 
| 879 | 
            +
                  <bibliography>
         | 
| 880 | 
            +
                     <references id='_normative_references' obligation='informative' normative='false' displayorder='1'>
         | 
| 881 | 
            +
                       <title depth='1'>Bibliography</title>
         | 
| 882 | 
            +
                       <bibitem id='ref1' type='standard'>
         | 
| 883 | 
            +
                         <title format='text/plain'>Cereals or cereal products</title>
         | 
| 884 | 
            +
                         <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
         | 
| 885 | 
            +
                         <docidentifier type='IEC'>IEC 217</docidentifier>
         | 
| 886 | 
            +
                       </bibitem>
         | 
| 887 | 
            +
                       <bibitem id='ref2' type='standard'>
         | 
| 888 | 
            +
                         <title format='text/plain'>Cereals or cereal products</title>
         | 
| 889 | 
            +
                         <docidentifier type='metanorma'>[3]</docidentifier>
         | 
| 890 | 
            +
                       </bibitem>
         | 
| 891 | 
            +
                       <bibitem id='ref3' type='standard'>
         | 
| 892 | 
            +
                         <title format='text/plain'>Cereals or cereal products</title>
         | 
| 893 | 
            +
                         <docidentifier type='metanorma-ordinal'>[4]</docidentifier>
         | 
| 894 | 
            +
                         <docidentifier>ABC</docidentifier>
         | 
| 895 | 
            +
                       </bibitem>
         | 
| 896 | 
            +
                     </references>
         | 
| 897 | 
            +
                   </bibliography>
         | 
| 898 | 
            +
                PRESXML
         | 
| 899 | 
            +
                expect(xmlpp(Nokogiri::XML(
         | 
| 900 | 
            +
                  IsoDoc::PresentationXMLConvert.new({})
         | 
| 901 | 
            +
                  .convert("test", input, true),
         | 
| 902 | 
            +
                ).at("//xmlns:bibliography").to_xml))
         | 
| 903 | 
            +
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 904 | 
            +
              end
         | 
| 905 | 
            +
             | 
| 906 | 
            +
              it "enforces consistent references numbering with hidden items: metanorma identifiers" do
         | 
| 907 | 
            +
                input = <<~INPUT
         | 
| 908 | 
            +
                      <iso-standard xmlns="http://riboseinc.com/isoxml">
         | 
| 909 | 
            +
                      <bibdata>
         | 
| 910 | 
            +
                      <language>en</language>
         | 
| 911 | 
            +
                      </bibdata>
         | 
| 912 | 
            +
                      <bibliography><references id="_normative_references" obligation="informative" normative="false"><title>Bibliography</title>
         | 
| 913 | 
            +
                  <bibitem id="ref1" type="standard">
         | 
| 914 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 915 | 
            +
                    <docidentifier type="metanorma">[1]</docidentifier>
         | 
| 916 | 
            +
                  </bibitem>
         | 
| 917 | 
            +
                  <bibitem id="ref2" type="standard" hidden="true">
         | 
| 918 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 919 | 
            +
                    <docidentifier type="metanorma">[2]</docidentifier>
         | 
| 920 | 
            +
                  </bibitem>
         | 
| 921 | 
            +
                  <bibitem id="ref3" type="standard">
         | 
| 922 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 923 | 
            +
                    <docidentifier type="metanorma">[3]</docidentifier>
         | 
| 924 | 
            +
                  </bibitem>
         | 
| 925 | 
            +
                  </references></bibliography></iso-standard>
         | 
| 926 | 
            +
                INPUT
         | 
| 927 | 
            +
                presxml = <<~PRESXML
         | 
| 928 | 
            +
                  <bibliography>
         | 
| 929 | 
            +
                    <references id='_normative_references' obligation='informative' normative='false' displayorder='1'>
         | 
| 930 | 
            +
                      <title depth='1'>Bibliography</title>
         | 
| 931 | 
            +
                      <bibitem id='ref1' type='standard'>
         | 
| 932 | 
            +
                        <title format='text/plain'>Cereals or cereal products</title>
         | 
| 933 | 
            +
                        <docidentifier type='metanorma'>[1]</docidentifier>
         | 
| 934 | 
            +
                      </bibitem>
         | 
| 935 | 
            +
                      <bibitem id='ref2' type='standard' hidden='true'>
         | 
| 936 | 
            +
                        <title format='text/plain'>Cereals or cereal products</title>
         | 
| 937 | 
            +
                        <docidentifier type='metanorma'>[2]</docidentifier>
         | 
| 938 | 
            +
                      </bibitem>
         | 
| 939 | 
            +
                      <bibitem id='ref3' type='standard'>
         | 
| 940 | 
            +
                        <title format='text/plain'>Cereals or cereal products</title>
         | 
| 941 | 
            +
                        <docidentifier type='metanorma'>[3]</docidentifier>
         | 
| 942 | 
            +
                      </bibitem>
         | 
| 943 | 
            +
                    </references>
         | 
| 944 | 
            +
                  </bibliography>
         | 
| 945 | 
            +
                PRESXML
         | 
| 946 | 
            +
                expect(xmlpp(Nokogiri::XML(
         | 
| 947 | 
            +
                  IsoDoc::PresentationXMLConvert.new({})
         | 
| 948 | 
            +
                  .convert("test", input, true),
         | 
| 949 | 
            +
                ).at("//xmlns:bibliography").to_xml))
         | 
| 950 | 
            +
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 951 | 
            +
              end
         | 
| 952 | 
            +
             | 
| 953 | 
            +
              it "enforces consistent references numbering with hidden items: metanorma-ordinal identifiers" do
         | 
| 954 | 
            +
                input = <<~INPUT
         | 
| 955 | 
            +
                      <iso-standard xmlns="http://riboseinc.com/isoxml">
         | 
| 956 | 
            +
                      <bibdata>
         | 
| 957 | 
            +
                      <language>en</language>
         | 
| 958 | 
            +
                      </bibdata>
         | 
| 959 | 
            +
                      <bibliography><references id="_normative_references" obligation="informative" normative="false"><title>Bibliography</title>
         | 
| 960 | 
            +
                  <bibitem id="ref1" type="standard">
         | 
| 961 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 962 | 
            +
                    <docidentifier>ABC</docidentifier>
         | 
| 963 | 
            +
                  </bibitem>
         | 
| 964 | 
            +
                  <bibitem id="ref2" type="standard" hidden="true">
         | 
| 965 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 966 | 
            +
                    <docidentifier>ABD</docidentifier>
         | 
| 967 | 
            +
                  </bibitem>
         | 
| 968 | 
            +
                  <bibitem id="ref3" type="standard">
         | 
| 969 | 
            +
                    <title format="text/plain">Cereals or cereal products</title>
         | 
| 970 | 
            +
                    <docidentifier>ABE</docidentifier>
         | 
| 971 | 
            +
                  </bibitem>
         | 
| 972 | 
            +
                  </references></bibliography></iso-standard>
         | 
| 973 | 
            +
                INPUT
         | 
| 974 | 
            +
                presxml = <<~PRESXML
         | 
| 975 | 
            +
                  <bibliography>
         | 
| 976 | 
            +
                    <references id='_normative_references' obligation='informative' normative='false' displayorder='1'>
         | 
| 977 | 
            +
                      <title depth='1'>Bibliography</title>
         | 
| 978 | 
            +
                      <bibitem id='ref1' type='standard'>
         | 
| 979 | 
            +
                        <title format='text/plain'>Cereals or cereal products</title>
         | 
| 980 | 
            +
                        <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
         | 
| 981 | 
            +
                        <docidentifier>ABC</docidentifier>
         | 
| 982 | 
            +
                      </bibitem>
         | 
| 983 | 
            +
                      <bibitem id='ref2' type='standard' hidden='true'>
         | 
| 984 | 
            +
                        <title format='text/plain'>Cereals or cereal products</title>
         | 
| 985 | 
            +
                        <docidentifier>ABD</docidentifier>
         | 
| 986 | 
            +
                      </bibitem>
         | 
| 987 | 
            +
                      <bibitem id='ref3' type='standard'>
         | 
| 988 | 
            +
                        <title format='text/plain'>Cereals or cereal products</title>
         | 
| 989 | 
            +
                        <docidentifier type='metanorma-ordinal'>[2]</docidentifier>
         | 
| 990 | 
            +
                        <docidentifier>ABE</docidentifier>
         | 
| 991 | 
            +
                      </bibitem>
         | 
| 992 | 
            +
                    </references>
         | 
| 993 | 
            +
                  </bibliography>
         | 
| 994 | 
            +
                PRESXML
         | 
| 995 | 
            +
                expect(xmlpp(Nokogiri::XML(
         | 
| 996 | 
            +
                  IsoDoc::PresentationXMLConvert.new({})
         | 
| 997 | 
            +
                  .convert("test", input, true),
         | 
| 998 | 
            +
                ).at("//xmlns:bibliography").to_xml))
         | 
| 999 | 
            +
                  .to be_equivalent_to xmlpp(presxml)
         | 
| 1000 | 
            +
              end
         | 
| 857 1001 | 
             
            end
         | 
    
        data/spec/isodoc/xref_spec.rb
    CHANGED
    
    | @@ -262,22 +262,22 @@ RSpec.describe IsoDoc do | |
| 262 262 | 
             
                      </iso-standard>
         | 
| 263 263 | 
             
                INPUT
         | 
| 264 264 | 
             
                output = <<~OUTPUT
         | 
| 265 | 
            -
             | 
| 266 | 
            -
             | 
| 267 | 
            -
             | 
| 268 | 
            -
             | 
| 269 | 
            -
             | 
| 270 | 
            -
             | 
| 271 | 
            -
             | 
| 272 | 
            -
             | 
| 273 | 
            -
             | 
| 274 | 
            -
             | 
| 275 | 
            -
             | 
| 276 | 
            -
             | 
| 277 | 
            -
             | 
| 278 | 
            -
             | 
| 279 | 
            -
             | 
| 280 | 
            -
             | 
| 265 | 
            +
                            <foreword id='fwd' displayorder="1">
         | 
| 266 | 
            +
                              <p>
         | 
| 267 | 
            +
                                 <xref target='N1'>Figure 1</xref>
         | 
| 268 | 
            +
                  <xref target='N2'>Figure (??)</xref>
         | 
| 269 | 
            +
                  <xref target='N'>Figure 2</xref>
         | 
| 270 | 
            +
                  <xref target='note1'>Figure 3</xref>
         | 
| 271 | 
            +
                  <xref target='note3'>Figure 4</xref>
         | 
| 272 | 
            +
                  <xref target='note4'>Figure 5</xref>
         | 
| 273 | 
            +
                  <xref target='note2'>Figure 6</xref>
         | 
| 274 | 
            +
                  <xref target='note51'>[note51]</xref>
         | 
| 275 | 
            +
                  <xref target='AN'>Figure A.1</xref>
         | 
| 276 | 
            +
                  <xref target='Anote1'>Figure (??)</xref>
         | 
| 277 | 
            +
                  <xref target='Anote2'>Figure A.2</xref>
         | 
| 278 | 
            +
                  <xref target='Anote3'>Figure A.3</xref>
         | 
| 279 | 
            +
                              </p>
         | 
| 280 | 
            +
                            </foreword>
         | 
| 281 281 | 
             
                OUTPUT
         | 
| 282 282 | 
             
                expect(xmlpp(Nokogiri.XML(IsoDoc::PresentationXMLConvert.new({})
         | 
| 283 283 | 
             
                  .convert("test", input, true))
         | 
| @@ -824,20 +824,20 @@ RSpec.describe IsoDoc do | |
| 824 824 | 
             
                  </iso-standard>
         | 
| 825 825 | 
             
                INPUT
         | 
| 826 826 | 
             
                output = <<~OUTPUT
         | 
| 827 | 
            -
             | 
| 828 | 
            -
             | 
| 829 | 
            -
             | 
| 830 | 
            -
             | 
| 831 | 
            -
             | 
| 832 | 
            -
             | 
| 833 | 
            -
             | 
| 834 | 
            -
             | 
| 835 | 
            -
             | 
| 836 | 
            -
             | 
| 837 | 
            -
             | 
| 838 | 
            -
             | 
| 839 | 
            -
             | 
| 840 | 
            -
             | 
| 827 | 
            +
                            <foreword displayorder='1'>
         | 
| 828 | 
            +
                              <p>
         | 
| 829 | 
            +
                                 <xref target='N1'>Clause 1, Permission 1</xref>
         | 
| 830 | 
            +
                  <xref target='N2'>Clause 1, Permission 1-1</xref>
         | 
| 831 | 
            +
                  <xref target='N'>Clause 1, Permission 1-1-1</xref>
         | 
| 832 | 
            +
                  <xref target='Q1'>Clause 1, Requirement 1-1</xref>
         | 
| 833 | 
            +
                  <xref target='R1'>Clause 1, Recommendation 1-1</xref>
         | 
| 834 | 
            +
                  <xref target='AN1'>Permission A.1</xref>
         | 
| 835 | 
            +
                  <xref target='AN2'>Permission A.1-1</xref>
         | 
| 836 | 
            +
                  <xref target='AN'>Permission A.1-1-1</xref>
         | 
| 837 | 
            +
                  <xref target='AQ1'>Requirement A.1-1</xref>
         | 
| 838 | 
            +
                  <xref target='AR1'>Recommendation A.1-1</xref>
         | 
| 839 | 
            +
                              </p>
         | 
| 840 | 
            +
                            </foreword>
         | 
| 841 841 | 
             
                OUTPUT
         | 
| 842 842 | 
             
                expect(xmlpp(Nokogiri.XML(IsoDoc::PresentationXMLConvert.new({})
         | 
| 843 843 | 
             
                  .convert("test", input, true))
         | 
| @@ -966,18 +966,18 @@ RSpec.describe IsoDoc do | |
| 966 966 | 
             
                      </iso-standard>
         | 
| 967 967 | 
             
                INPUT
         | 
| 968 968 | 
             
                output = <<~OUTPUT
         | 
| 969 | 
            -
             | 
| 970 | 
            -
             | 
| 971 | 
            -
             | 
| 972 | 
            -
             | 
| 973 | 
            -
             | 
| 974 | 
            -
             | 
| 975 | 
            -
             | 
| 976 | 
            -
             | 
| 977 | 
            -
             | 
| 978 | 
            -
             | 
| 979 | 
            -
             | 
| 980 | 
            -
             | 
| 969 | 
            +
                  <foreword displayorder='1'>
         | 
| 970 | 
            +
                    <p>
         | 
| 971 | 
            +
                      <xref target='N1'>Table 1</xref>
         | 
| 972 | 
            +
                      <xref target='N2'>Table (??)</xref>
         | 
| 973 | 
            +
                      <xref target='N'>Table 2</xref>
         | 
| 974 | 
            +
                      <xref target='note1'>Table 3</xref>
         | 
| 975 | 
            +
                      <xref target='note2'>Table 4</xref>
         | 
| 976 | 
            +
                      <xref target='AN'>Table A.1</xref>
         | 
| 977 | 
            +
                      <xref target='Anote1'>Table (??)</xref>
         | 
| 978 | 
            +
                      <xref target='Anote2'>Table A.2</xref>
         | 
| 979 | 
            +
                    </p>
         | 
| 980 | 
            +
                  </foreword>
         | 
| 981 981 | 
             
                OUTPUT
         | 
| 982 982 | 
             
                expect(xmlpp(Nokogiri.XML(IsoDoc::PresentationXMLConvert.new({})
         | 
| 983 983 | 
             
                  .convert("test", input, true))
         | 
| @@ -1061,13 +1061,13 @@ RSpec.describe IsoDoc do | |
| 1061 1061 | 
             
                      </iso-standard>
         | 
| 1062 1062 | 
             
                INPUT
         | 
| 1063 1063 | 
             
                output = <<~OUTPUT
         | 
| 1064 | 
            -
             | 
| 1065 | 
            -
             | 
| 1066 | 
            -
             | 
| 1067 | 
            -
             | 
| 1068 | 
            -
             | 
| 1069 | 
            -
             | 
| 1070 | 
            -
             | 
| 1064 | 
            +
                  <foreword displayorder='1'>
         | 
| 1065 | 
            +
                    <p>
         | 
| 1066 | 
            +
                      <xref target='note1'>Clause 2.1, Note 1</xref>
         | 
| 1067 | 
            +
                      <xref target='note2'>Clause 2.1.1, Note 1</xref>
         | 
| 1068 | 
            +
                      <xref target='note3'>Clause 2.1.1, Note 2</xref>
         | 
| 1069 | 
            +
                    </p>
         | 
| 1070 | 
            +
                  </foreword>
         | 
| 1071 1071 | 
             
                OUTPUT
         | 
| 1072 1072 | 
             
                expect(xmlpp(Nokogiri.XML(IsoDoc::PresentationXMLConvert.new({})
         | 
| 1073 1073 | 
             
                  .convert("test", input, true))
         | 
| @@ -1151,13 +1151,13 @@ RSpec.describe IsoDoc do | |
| 1151 1151 | 
             
                      </iso-standard>
         | 
| 1152 1152 | 
             
                INPUT
         | 
| 1153 1153 | 
             
                output = <<~OUTPUT
         | 
| 1154 | 
            -
             | 
| 1155 | 
            -
             | 
| 1156 | 
            -
             | 
| 1157 | 
            -
             | 
| 1158 | 
            -
             | 
| 1159 | 
            -
             | 
| 1160 | 
            -
             | 
| 1154 | 
            +
                  <foreword displayorder='1'>
         | 
| 1155 | 
            +
                    <p>
         | 
| 1156 | 
            +
                      <xref target='note1'>Clause 2.1, Example</xref>
         | 
| 1157 | 
            +
                      <xref target='note2'>Clause 2.1.1, Example 1</xref>
         | 
| 1158 | 
            +
                      <xref target='note3'>Clause 2.1.1, Example 2</xref>
         | 
| 1159 | 
            +
                    </p>
         | 
| 1160 | 
            +
                  </foreword>
         | 
| 1161 1161 | 
             
                OUTPUT
         | 
| 1162 1162 | 
             
                expect(xmlpp(Nokogiri.XML(IsoDoc::PresentationXMLConvert.new({})
         | 
| 1163 1163 | 
             
                  .convert("test", input, true))
         | 
| @@ -1255,31 +1255,31 @@ RSpec.describe IsoDoc do | |
| 1255 1255 | 
             
                   </iso-standard>
         | 
| 1256 1256 | 
             
                INPUT
         | 
| 1257 1257 | 
             
                output = <<~OUTPUT
         | 
| 1258 | 
            -
             | 
| 1259 | 
            -
             | 
| 1260 | 
            -
             | 
| 1261 | 
            -
             | 
| 1262 | 
            -
             | 
| 1263 | 
            -
             | 
| 1264 | 
            -
             | 
| 1265 | 
            -
             | 
| 1266 | 
            -
             | 
| 1267 | 
            -
             | 
| 1268 | 
            -
             | 
| 1269 | 
            -
             | 
| 1270 | 
            -
             | 
| 1271 | 
            -
             | 
| 1272 | 
            -
             | 
| 1273 | 
            -
             | 
| 1274 | 
            -
             | 
| 1275 | 
            -
             | 
| 1276 | 
            -
             | 
| 1277 | 
            -
             | 
| 1278 | 
            -
             | 
| 1279 | 
            -
             | 
| 1280 | 
            -
             | 
| 1281 | 
            -
             | 
| 1282 | 
            -
             | 
| 1258 | 
            +
                  <foreword obligation='informative' displayorder='1'>
         | 
| 1259 | 
            +
                    <title>Foreword</title>
         | 
| 1260 | 
            +
                    <p id='A'>
         | 
| 1261 | 
            +
                      This is a preamble
         | 
| 1262 | 
            +
                      <xref target='C'>Introduction Subsection</xref>
         | 
| 1263 | 
            +
                      <xref target='C1'>Introduction, 2</xref>
         | 
| 1264 | 
            +
                      <xref target='D'>Clause 1</xref>
         | 
| 1265 | 
            +
                      <xref target='H'>Clause 3</xref>
         | 
| 1266 | 
            +
                      <xref target='I'>Clause 3.1</xref>
         | 
| 1267 | 
            +
                      <xref target='J'>Clause 3.1.1</xref>
         | 
| 1268 | 
            +
                      <xref target='K'>Clause 3.2</xref>
         | 
| 1269 | 
            +
                      <xref target='L'>Clause 4</xref>
         | 
| 1270 | 
            +
                      <xref target='M'>Clause 5</xref>
         | 
| 1271 | 
            +
                      <xref target='N'>Clause 5.1</xref>
         | 
| 1272 | 
            +
                      <xref target='O'>Clause 5.2</xref>
         | 
| 1273 | 
            +
                      <xref target='P'>Annex A</xref>
         | 
| 1274 | 
            +
                      <xref target='Q'>Annex A.1</xref>
         | 
| 1275 | 
            +
                      <xref target='Q1'>Annex A.1.1</xref>
         | 
| 1276 | 
            +
                      <xref target='QQ'>Annex B</xref>
         | 
| 1277 | 
            +
                      <xref target='QQ1'>Annex B</xref>
         | 
| 1278 | 
            +
                      <xref target='QQ2'>Annex B.1</xref>
         | 
| 1279 | 
            +
                      <xref target='R'>Clause 2</xref>
         | 
| 1280 | 
            +
                      <xref target='S'>Bibliography</xref>
         | 
| 1281 | 
            +
                    </p>
         | 
| 1282 | 
            +
                  </foreword>
         | 
| 1283 1283 | 
             
                OUTPUT
         | 
| 1284 1284 | 
             
                expect(xmlpp(Nokogiri.XML(IsoDoc::PresentationXMLConvert.new({})
         | 
| 1285 1285 | 
             
                  .convert("test", input, true))
         | 
| @@ -1720,31 +1720,31 @@ RSpec.describe IsoDoc do | |
| 1720 1720 | 
             
                            </iso-standard>
         | 
| 1721 1721 | 
             
                INPUT
         | 
| 1722 1722 | 
             
                output = <<~OUTPUT
         | 
| 1723 | 
            -
             | 
| 1724 | 
            -
             | 
| 1725 | 
            -
             | 
| 1726 | 
            -
             | 
| 1727 | 
            -
             | 
| 1728 | 
            -
             | 
| 1729 | 
            -
             | 
| 1730 | 
            -
             | 
| 1731 | 
            -
             | 
| 1732 | 
            -
             | 
| 1733 | 
            -
             | 
| 1734 | 
            -
             | 
| 1735 | 
            -
             | 
| 1736 | 
            -
             | 
| 1737 | 
            -
             | 
| 1738 | 
            -
             | 
| 1739 | 
            -
             | 
| 1740 | 
            -
             | 
| 1741 | 
            -
             | 
| 1742 | 
            -
             | 
| 1743 | 
            -
             | 
| 1744 | 
            -
             | 
| 1745 | 
            -
             | 
| 1746 | 
            -
             | 
| 1747 | 
            -
             | 
| 1723 | 
            +
                     <foreword displayorder='1'>
         | 
| 1724 | 
            +
                       <p>
         | 
| 1725 | 
            +
                    <xref target='N1'>
         | 
| 1726 | 
            +
                    Introduction, Definition List:
         | 
| 1727 | 
            +
                    <stem type='MathML'>
         | 
| 1728 | 
            +
                      <math xmlns='http://www.w3.org/1998/Math/MathML'>
         | 
| 1729 | 
            +
                        <msub>
         | 
| 1730 | 
            +
                          <mrow>
         | 
| 1731 | 
            +
                            <mover accent='true'>
         | 
| 1732 | 
            +
                              <mrow>
         | 
| 1733 | 
            +
                                <mi>e</mi>
         | 
| 1734 | 
            +
                              </mrow>
         | 
| 1735 | 
            +
                              <mo>^</mo>
         | 
| 1736 | 
            +
                            </mover>
         | 
| 1737 | 
            +
                          </mrow>
         | 
| 1738 | 
            +
                          <mrow>
         | 
| 1739 | 
            +
                            <mi>r</mi>
         | 
| 1740 | 
            +
                          </mrow>
         | 
| 1741 | 
            +
                        </msub>
         | 
| 1742 | 
            +
                      </math>
         | 
| 1743 | 
            +
                      <!-- (hat e)_((r)) -->
         | 
| 1744 | 
            +
                    </stem>
         | 
| 1745 | 
            +
                  </xref>
         | 
| 1746 | 
            +
                       </p>
         | 
| 1747 | 
            +
                     </foreword>
         | 
| 1748 1748 | 
             
                OUTPUT
         | 
| 1749 1749 | 
             
                expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
         | 
| 1750 1750 | 
             
                  .convert("test", input, true))
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: isodoc
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0. | 
| 4 | 
            +
              version: 2.0.8.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ribose Inc.
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-04-18 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: asciimath
         | 
| @@ -52,6 +52,20 @@ dependencies: | |
| 52 52 | 
             
                - - "~>"
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: 4.3.4
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: isodoc-i18n
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - "~>"
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: 1.0.0
         | 
| 62 | 
            +
              type: :runtime
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - "~>"
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: 1.0.0
         | 
| 55 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 70 | 
             
              name: liquid
         | 
| 57 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -70,16 +84,16 @@ dependencies: | |
| 70 84 | 
             
              name: emf2svg
         | 
| 71 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 86 | 
             
                requirements:
         | 
| 73 | 
            -
                - - " | 
| 87 | 
            +
                - - "<="
         | 
| 74 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: '1'
         | 
| 89 | 
            +
                    version: '1.3'
         | 
| 76 90 | 
             
              type: :runtime
         | 
| 77 91 | 
             
              prerelease: false
         | 
| 78 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 93 | 
             
                requirements:
         | 
| 80 | 
            -
                - - " | 
| 94 | 
            +
                - - "<="
         | 
| 81 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: '1'
         | 
| 96 | 
            +
                    version: '1.3'
         | 
| 83 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 98 | 
             
              name: mathml2asciimath
         | 
| 85 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         |