isodoc 1.7.6 → 1.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 +1 -1
- data/lib/isodoc/class_utils.rb +23 -0
- data/lib/isodoc/convert.rb +9 -0
- data/lib/isodoc/function/cleanup.rb +4 -0
- data/lib/isodoc/function/inline.rb +2 -4
- data/lib/isodoc/function/utils.rb +1 -1
- data/lib/isodoc/html_function/html.rb +1 -0
- data/lib/isodoc/html_function/postprocess.rb +4 -6
- data/lib/isodoc/metadata_date.rb +13 -11
- data/lib/isodoc/presentation_function/bibdata.rb +2 -2
- data/lib/isodoc/presentation_function/block.rb +0 -36
- data/lib/isodoc/presentation_function/inline.rb +14 -11
- data/lib/isodoc/presentation_function/terms.rb +179 -0
- data/lib/isodoc/presentation_xml_convert.rb +11 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +24 -14
- data/lib/isodoc/word_function/comments.rb +0 -4
- data/lib/isodoc/word_function/postprocess.rb +184 -176
- data/lib/isodoc/xref/xref_gen.rb +18 -22
- data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
- data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
- data/lib/isodoc/xslfo_convert.rb +11 -7
- data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
- data/lib/isodoc-yaml/i18n-de.yaml +20 -0
- data/lib/isodoc-yaml/i18n-en.yaml +20 -0
- data/lib/isodoc-yaml/i18n-es.yaml +20 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
- data/lib/metanorma/output/xslfo.rb +4 -11
- data/spec/assets/i18n.yaml +3 -1
- data/spec/isodoc/blocks_spec.rb +14 -8
- data/spec/isodoc/i18n_spec.rb +8 -8
- data/spec/isodoc/inline_spec.rb +200 -6
- data/spec/isodoc/lists_spec.rb +344 -222
- data/spec/isodoc/section_spec.rb +11 -10
- data/spec/isodoc/table_spec.rb +71 -73
- data/spec/isodoc/terms_spec.rb +354 -34
- data/spec/isodoc/xref_numbering_spec.rb +347 -0
- data/spec/isodoc/xref_spec.rb +271 -350
- data/spec/isodoc/xslfo_convert_spec.rb +34 -9
- metadata +7 -6
- data/lib/isodoc/presentation_function/concept.rb +0 -68
| @@ -1,160 +1,165 @@ | |
| 1 | 
            -
            module IsoDoc | 
| 2 | 
            -
              module  | 
| 3 | 
            -
                 | 
| 4 | 
            -
                   | 
| 5 | 
            -
             | 
| 6 | 
            -
                     | 
| 7 | 
            -
             | 
| 1 | 
            +
            module IsoDoc
         | 
| 2 | 
            +
              module XrefGen
         | 
| 3 | 
            +
                module Sections
         | 
| 4 | 
            +
                  def back_anchor_names(docxml)
         | 
| 5 | 
            +
                    i = Counter.new("@")
         | 
| 6 | 
            +
                    docxml.xpath(ns("//annex")).each do |c|
         | 
| 7 | 
            +
                      i.increment(c)
         | 
| 8 | 
            +
                      annex_names(c, i.print)
         | 
| 9 | 
            +
                    end
         | 
| 10 | 
            +
                    docxml.xpath(ns(@klass.bibliography_xpath)).each do |b|
         | 
| 11 | 
            +
                      preface_names(b)
         | 
| 12 | 
            +
                    end
         | 
| 13 | 
            +
                    docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
         | 
| 14 | 
            +
                      reference_names(ref)
         | 
| 15 | 
            +
                    end
         | 
| 8 16 | 
             
                  end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 17 | 
            +
             | 
| 18 | 
            +
                  def initial_anchor_names(doc)
         | 
| 19 | 
            +
                    doc.xpath(ns("//preface/*")).each do |c|
         | 
| 20 | 
            +
                      c.element? and preface_names(c)
         | 
| 21 | 
            +
                    end
         | 
| 22 | 
            +
                    # potentially overridden in middle_section_asset_names()
         | 
| 23 | 
            +
                    sequential_asset_names(doc.xpath(ns("//preface/*")))
         | 
| 24 | 
            +
                    n = Counter.new
         | 
| 25 | 
            +
                    n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
         | 
| 26 | 
            +
                    n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
         | 
| 27 | 
            +
                    n = section_names(doc.at(ns("//sections/terms | "\
         | 
| 28 | 
            +
                                                "//sections/clause[descendant::terms]")), n, 1)
         | 
| 29 | 
            +
                    n = section_names(doc.at(ns("//sections/definitions")), n, 1)
         | 
| 30 | 
            +
                    clause_names(doc, n)
         | 
| 31 | 
            +
                    middle_section_asset_names(doc)
         | 
| 32 | 
            +
                    termnote_anchor_names(doc)
         | 
| 33 | 
            +
                    termexample_anchor_names(doc)
         | 
| 11 34 | 
             
                  end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 35 | 
            +
             | 
| 36 | 
            +
                  def preface_clause_name(clause)
         | 
| 37 | 
            +
                    clause.at(ns("./title"))&.text || clause.name.capitalize
         | 
| 14 38 | 
             
                  end
         | 
| 15 | 
            -
                end
         | 
| 16 39 |  | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
                  # potentially overridden in middle_section_asset_names()
         | 
| 20 | 
            -
                  sequential_asset_names(doc.xpath(ns("//preface/*")))
         | 
| 21 | 
            -
                  n = Counter.new
         | 
| 22 | 
            -
                  n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
         | 
| 23 | 
            -
                  n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
         | 
| 24 | 
            -
                  n = section_names(doc.at(ns("//sections/terms | "\
         | 
| 25 | 
            -
                                            "//sections/clause[descendant::terms]")), n, 1)
         | 
| 26 | 
            -
                  n = section_names(doc.at(ns("//sections/definitions")), n, 1)
         | 
| 27 | 
            -
                  clause_names(doc, n)
         | 
| 28 | 
            -
                  middle_section_asset_names(doc)
         | 
| 29 | 
            -
                  termnote_anchor_names(doc)
         | 
| 30 | 
            -
                  termexample_anchor_names(doc)
         | 
| 31 | 
            -
                end
         | 
| 40 | 
            +
                  SUBCLAUSES =
         | 
| 41 | 
            +
                    "./clause | ./references | ./term  | ./terms | ./definitions".freeze
         | 
| 32 42 |  | 
| 33 | 
            -
             | 
| 34 | 
            -
                  clause | 
| 35 | 
            -
             | 
| 43 | 
            +
                  # in StanDoc, prefaces have no numbering; they are referenced only by title
         | 
| 44 | 
            +
                  def preface_names(clause)
         | 
| 45 | 
            +
                    return if clause.nil?
         | 
| 36 46 |  | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 47 | 
            +
                    @anchors[clause["id"]] =
         | 
| 48 | 
            +
                      { label: nil, level: 1, xref: preface_clause_name(clause),
         | 
| 49 | 
            +
                        type: "clause" }
         | 
| 50 | 
            +
                    clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
         | 
| 51 | 
            +
                      preface_names1(c, c.at(ns("./title"))&.text,
         | 
| 52 | 
            +
                                     "#{preface_clause_name(clause)}, #{i + 1}", 2)
         | 
| 53 | 
            +
                    end
         | 
| 54 | 
            +
                  end
         | 
| 39 55 |  | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 56 | 
            +
                  def preface_names1(clause, title, parent_title, level)
         | 
| 57 | 
            +
                    label = title || parent_title
         | 
| 58 | 
            +
                    @anchors[clause["id"]] =
         | 
| 59 | 
            +
                      { label: nil, level: level, xref: label, type: "clause" }
         | 
| 60 | 
            +
                    clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
         | 
| 61 | 
            +
                      preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
         | 
| 62 | 
            +
                                     level + 1)
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
                  end
         | 
| 43 65 |  | 
| 44 | 
            -
                   | 
| 45 | 
            -
                     | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 66 | 
            +
                  def middle_section_asset_names(doc)
         | 
| 67 | 
            +
                    middle_sections = "//clause[@type = 'scope'] | "\
         | 
| 68 | 
            +
                                      "#{@klass.norm_ref_xpath} | "\
         | 
| 69 | 
            +
                                      "//sections/terms | //preface/* | "\
         | 
| 70 | 
            +
                                      "//sections/definitions | //clause[parent::sections]"
         | 
| 71 | 
            +
                    sequential_asset_names(doc.xpath(ns(middle_sections)))
         | 
| 50 72 | 
             
                  end
         | 
| 51 | 
            -
                end
         | 
| 52 73 |  | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
                     | 
| 57 | 
            -
                  clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
         | 
| 58 | 
            -
                    preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
         | 
| 59 | 
            -
                                   level + 1)
         | 
| 74 | 
            +
                  def clause_names(docxml, num)
         | 
| 75 | 
            +
                    docxml.xpath(ns(@klass.middle_clause(docxml))).each_with_index do |c, _i|
         | 
| 76 | 
            +
                      section_names(c, num, 1)
         | 
| 77 | 
            +
                    end
         | 
| 60 78 | 
             
                  end
         | 
| 61 | 
            -
                end
         | 
| 62 79 |  | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
                    "#{@klass.norm_ref_xpath} | "\
         | 
| 66 | 
            -
                    "//sections/terms | //preface/* | "\
         | 
| 67 | 
            -
                    "//sections/definitions | //clause[parent::sections]"
         | 
| 68 | 
            -
                  sequential_asset_names(doc.xpath(ns(middle_sections)))
         | 
| 69 | 
            -
                end
         | 
| 80 | 
            +
                  def section_names(clause, num, lvl)
         | 
| 81 | 
            +
                    return num if clause.nil?
         | 
| 70 82 |  | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 83 | 
            +
                    num.increment(clause)
         | 
| 84 | 
            +
                    @anchors[clause["id"]] =
         | 
| 85 | 
            +
                      { label: num.print, xref: l10n("#{@labels['clause']} #{num.print}"),
         | 
| 86 | 
            +
                        level: lvl, type: "clause" }
         | 
| 87 | 
            +
                    i = Counter.new
         | 
| 88 | 
            +
                    clause.xpath(ns(SUBCLAUSES)).each do |c|
         | 
| 89 | 
            +
                      i.increment(c)
         | 
| 90 | 
            +
                      section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
         | 
| 91 | 
            +
                    end
         | 
| 92 | 
            +
                    num
         | 
| 74 93 | 
             
                  end
         | 
| 75 | 
            -
                end
         | 
| 76 94 |  | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
                     | 
| 83 | 
            -
                       | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
                    i.increment(c)
         | 
| 87 | 
            -
                    section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
         | 
| 95 | 
            +
                  def section_names1(clause, num, level)
         | 
| 96 | 
            +
                    @anchors[clause["id"]] =
         | 
| 97 | 
            +
                      { label: num, level: level, xref: l10n("#{@labels['clause']} #{num}"),
         | 
| 98 | 
            +
                        type: "clause" }
         | 
| 99 | 
            +
                    i = Counter.new
         | 
| 100 | 
            +
                    clause.xpath(ns(SUBCLAUSES)).each do |c|
         | 
| 101 | 
            +
                      i.increment(c)
         | 
| 102 | 
            +
                      section_names1(c, "#{num}.#{i.print}", level + 1)
         | 
| 103 | 
            +
                    end
         | 
| 88 104 | 
             
                  end
         | 
| 89 | 
            -
                  num
         | 
| 90 | 
            -
                end
         | 
| 91 105 |  | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
                     | 
| 95 | 
            -
                       | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
                    i.increment(c)
         | 
| 99 | 
            -
                    section_names1(c, "#{num}.#{i.print}", level + 1)
         | 
| 106 | 
            +
                  def annex_name_lbl(clause, num)
         | 
| 107 | 
            +
                    obl = l10n("(#{@labels['inform_annex']})")
         | 
| 108 | 
            +
                    clause["obligation"] == "normative" and
         | 
| 109 | 
            +
                      obl = l10n("(#{@labels['norm_annex']})")
         | 
| 110 | 
            +
                    title = Common::case_with_markup(@labels["annex"], "capital", @script)
         | 
| 111 | 
            +
                    l10n("<strong>#{title} #{num}</strong><br/>#{obl}")
         | 
| 100 112 | 
             
                  end
         | 
| 101 | 
            -
                end
         | 
| 102 113 |  | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
                     | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 114 | 
            +
                  def single_annex_special_section(clause)
         | 
| 115 | 
            +
                    a = clause.xpath(ns("./references | ./terms | ./definitions"))
         | 
| 116 | 
            +
                    a.size == 1 or return nil
         | 
| 117 | 
            +
                    clause.xpath(ns("./clause | ./p | ./table | ./ol | ./ul | ./dl | "\
         | 
| 118 | 
            +
                                    "./note | ./admonition | ./figure")).empty? or
         | 
| 119 | 
            +
                      return nil
         | 
| 120 | 
            +
                    a[0]
         | 
| 121 | 
            +
                  end
         | 
| 109 122 |  | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 123 | 
            +
                  def annex_names(clause, num)
         | 
| 124 | 
            +
                    @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
         | 
| 125 | 
            +
                                               type: "clause", value: num.to_s, level: 1,
         | 
| 126 | 
            +
                                               xref: "#{@labels['annex']} #{num}" }
         | 
| 127 | 
            +
                    if a = single_annex_special_section(clause)
         | 
| 128 | 
            +
                      annex_names1(a, num.to_s, 1)
         | 
| 129 | 
            +
                    else
         | 
| 130 | 
            +
                      i = Counter.new
         | 
| 131 | 
            +
                      clause.xpath(ns(SUBCLAUSES)).each do |c|
         | 
| 132 | 
            +
                        i.increment(c)
         | 
| 133 | 
            +
                        annex_names1(c, "#{num}.#{i.print}", 2)
         | 
| 134 | 
            +
                      end
         | 
| 135 | 
            +
                    end
         | 
| 136 | 
            +
                    hierarchical_asset_names(clause, num)
         | 
| 137 | 
            +
                  end
         | 
| 118 138 |  | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
                                             xref: "#{@labels['annex']} #{num}", level: 1 }
         | 
| 123 | 
            -
                  if a = single_annex_special_section(clause)
         | 
| 124 | 
            -
                    annex_names1(a, num.to_s, 1)
         | 
| 125 | 
            -
                  else
         | 
| 139 | 
            +
                  def annex_names1(clause, num, level)
         | 
| 140 | 
            +
                    @anchors[clause["id"]] = { xref: "#{@labels['annex']} #{num}",
         | 
| 141 | 
            +
                                               label: num, level: level, type: "clause" }
         | 
| 126 142 | 
             
                    i = Counter.new
         | 
| 127 143 | 
             
                    clause.xpath(ns(SUBCLAUSES)).each do |c|
         | 
| 128 144 | 
             
                      i.increment(c)
         | 
| 129 | 
            -
                      annex_names1(c, "#{num}.#{i.print}",  | 
| 145 | 
            +
                      annex_names1(c, "#{num}.#{i.print}", level + 1)
         | 
| 130 146 | 
             
                    end
         | 
| 131 147 | 
             
                  end
         | 
| 132 | 
            -
                  hierarchical_asset_names(clause, num)
         | 
| 133 | 
            -
                end
         | 
| 134 148 |  | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 149 | 
            +
                  ISO_PUBLISHER_XPATH =
         | 
| 150 | 
            +
                    "./contributor[xmlns:role/@type = 'publisher']/"\
         | 
| 151 | 
            +
                    "organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
         | 
| 152 | 
            +
                    "xmlns:name = 'International Organization for Standardization' or "\
         | 
| 153 | 
            +
                    "xmlns:name = 'International Electrotechnical Commission']".freeze
         | 
| 154 | 
            +
             | 
| 155 | 
            +
                  def reference_names(ref)
         | 
| 156 | 
            +
                    # isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
         | 
| 157 | 
            +
                    ids = @klass.bibitem_ref_code(ref)
         | 
| 158 | 
            +
                    identifiers = @klass.render_identifier(ids)
         | 
| 159 | 
            +
                    # date = ref.at(ns("./date[@type = 'published']"))
         | 
| 160 | 
            +
                    reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
         | 
| 161 | 
            +
                    @anchors[ref["id"]] = { xref: reference }
         | 
| 142 162 | 
             
                  end
         | 
| 143 163 | 
             
                end
         | 
| 144 | 
            -
             | 
| 145 | 
            -
                ISO_PUBLISHER_XPATH =
         | 
| 146 | 
            -
                  "./contributor[xmlns:role/@type = 'publisher']/"\
         | 
| 147 | 
            -
                  "organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
         | 
| 148 | 
            -
                  "xmlns:name = 'International Organization for Standardization' or "\
         | 
| 149 | 
            -
                  "xmlns:name = 'International Electrotechnical Commission']".freeze
         | 
| 150 | 
            -
             | 
| 151 | 
            -
                def reference_names(ref)
         | 
| 152 | 
            -
                  # isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
         | 
| 153 | 
            -
                  ids = @klass.bibitem_ref_code(ref)
         | 
| 154 | 
            -
                  identifiers = @klass.render_identifier(ids)
         | 
| 155 | 
            -
                  # date = ref.at(ns("./date[@type = 'published']"))
         | 
| 156 | 
            -
                  reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
         | 
| 157 | 
            -
                  @anchors[ref["id"]] = { xref: reference }
         | 
| 158 | 
            -
                end
         | 
| 159 164 | 
             
              end
         | 
| 160 165 | 
             
            end
         | 
    
        data/lib/isodoc/xslfo_convert.rb
    CHANGED
    
    | @@ -3,7 +3,7 @@ require "metanorma" | |
| 3 3 | 
             
            module IsoDoc
         | 
| 4 4 | 
             
              class XslfoPdfConvert < ::IsoDoc::Convert
         | 
| 5 5 | 
             
                MN2PDF_OPTIONS = :mn2pdf
         | 
| 6 | 
            -
                MN2PDF_FONT_MANIFEST = : | 
| 6 | 
            +
                MN2PDF_FONT_MANIFEST = :font_manifest
         | 
| 7 7 |  | 
| 8 8 | 
             
                def initialize(options)
         | 
| 9 9 | 
             
                  @format = :pdf
         | 
| @@ -20,12 +20,16 @@ module IsoDoc | |
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 22 | 
             
                def pdf_options(_docxml)
         | 
| 23 | 
            -
                   | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 23 | 
            +
                  ret = {}
         | 
| 24 | 
            +
                  font_manifest = @options.dig(MN2PDF_OPTIONS,
         | 
| 25 | 
            +
                                               MN2PDF_FONT_MANIFEST) and
         | 
| 26 | 
            +
                    ret[MN2PDF_FONT_MANIFEST] = font_manifest
         | 
| 27 | 
            +
                  @aligncrosselements && !@aligncrosselements.empty? and
         | 
| 28 | 
            +
                    ret["--param align-cross-elements="] =
         | 
| 29 | 
            +
                      @aligncrosselements.gsub(/,/, " ")
         | 
| 30 | 
            +
                  @baseassetpath and
         | 
| 31 | 
            +
                    ret["--param baseassetpath="] = @baseassetpath
         | 
| 32 | 
            +
                  ret
         | 
| 29 33 | 
             
                end
         | 
| 30 34 |  | 
| 31 35 | 
             
                def convert(input_filename, file = nil, debug = false,
         | 
| @@ -89,6 +89,28 @@ locality: | |
| 89 89 | 
             
              example: مثال
         | 
| 90 90 | 
             
              note: ملحوظة, ملاحظة
         | 
| 91 91 | 
             
              formula: معادلة
         | 
| 92 | 
            +
            grammar_abbrevs:
         | 
| 93 | 
            +
              masculine: مذكر
         | 
| 94 | 
            +
              feminine: مؤ
         | 
| 95 | 
            +
              neuter: محايد
         | 
| 96 | 
            +
              common: خنثى
         | 
| 97 | 
            +
              isPreposition: حرف جر
         | 
| 98 | 
            +
              isParticiple: النعت
         | 
| 99 | 
            +
              isAdjective: صفة
         | 
| 100 | 
            +
              isAdverb: ظرف
         | 
| 101 | 
            +
              isNoun: اسم
         | 
| 102 | 
            +
              isVerb: الفعل
         | 
| 103 | 
            +
            relatedterms:
         | 
| 104 | 
            +
              deprecates: يهمل
         | 
| 105 | 
            +
              supersedes: حل محل
         | 
| 106 | 
            +
              # حل محل
         | 
| 107 | 
            +
              narrower: أضيق
         | 
| 108 | 
            +
              broader: أوسع
         | 
| 109 | 
            +
              equivalent: مُعادل
         | 
| 110 | 
            +
              compare: قارن
         | 
| 111 | 
            +
              contrast: مضاد
         | 
| 112 | 
            +
              # تباين
         | 
| 113 | 
            +
              see: انظر
         | 
| 92 114 | 
             
            inflection:
         | 
| 93 115 | 
             
              فقرة:
         | 
| 94 116 | 
             
                sg: فقرة
         | 
| @@ -93,6 +93,26 @@ locality: { | |
| 93 93 | 
             
              note: Hinweis,
         | 
| 94 94 | 
             
              formula: Formel
         | 
| 95 95 | 
             
            }
         | 
| 96 | 
            +
            grammar_abbrevs:
         | 
| 97 | 
            +
              masculine: mask
         | 
| 98 | 
            +
              feminine: fem
         | 
| 99 | 
            +
              neuter: neutr
         | 
| 100 | 
            +
              common: gemein
         | 
| 101 | 
            +
              isPreposition: Präp
         | 
| 102 | 
            +
              isParticiple: Part
         | 
| 103 | 
            +
              isAdjective: Adj
         | 
| 104 | 
            +
              isAdverb: Adv
         | 
| 105 | 
            +
              isNoun: Subs
         | 
| 106 | 
            +
              isVerb: V
         | 
| 107 | 
            +
            relatedterms:
         | 
| 108 | 
            +
              deprecates: veraltet
         | 
| 109 | 
            +
              supersedes: ersetzt
         | 
| 110 | 
            +
              narrower: enger
         | 
| 111 | 
            +
              broader: breiter
         | 
| 112 | 
            +
              equivalent: entspricht
         | 
| 113 | 
            +
              compare: vergleiche
         | 
| 114 | 
            +
              contrast: dagegen
         | 
| 115 | 
            +
              see: siehe
         | 
| 96 116 | 
             
            inflection:
         | 
| 97 117 | 
             
              Klausel:
         | 
| 98 118 | 
             
                sg: Klausel
         | 
| @@ -99,6 +99,26 @@ locality: { | |
| 99 99 | 
             
                                  note: Note,
         | 
| 100 100 | 
             
                                  formula: Formula
         | 
| 101 101 | 
             
                                }
         | 
| 102 | 
            +
            grammar_abbrevs:
         | 
| 103 | 
            +
              masculine: masc
         | 
| 104 | 
            +
              feminine: fem
         | 
| 105 | 
            +
              neuter: neut
         | 
| 106 | 
            +
              common: common
         | 
| 107 | 
            +
              isPreposition: prep
         | 
| 108 | 
            +
              isParticiple: part
         | 
| 109 | 
            +
              isAdjective: adj
         | 
| 110 | 
            +
              isAdverb: adv
         | 
| 111 | 
            +
              isNoun: n
         | 
| 112 | 
            +
              isVerb: v
         | 
| 113 | 
            +
            relatedterms:
         | 
| 114 | 
            +
              deprecates: deprecates
         | 
| 115 | 
            +
              supersedes: supersedes
         | 
| 116 | 
            +
              narrower: narrower
         | 
| 117 | 
            +
              broader: broader
         | 
| 118 | 
            +
              equivalent: equivalent
         | 
| 119 | 
            +
              compare: compare
         | 
| 120 | 
            +
              contrast: contrast
         | 
| 121 | 
            +
              see: see
         | 
| 102 122 | 
             
            inflection:
         | 
| 103 123 | 
             
              Clause:
         | 
| 104 124 | 
             
                sg: Clause
         | 
| @@ -95,6 +95,26 @@ locality: { | |
| 95 95 | 
             
                                  note: Nota,
         | 
| 96 96 | 
             
                                  formula: Fórmula
         | 
| 97 97 | 
             
                                }
         | 
| 98 | 
            +
            grammar_abbrevs:
         | 
| 99 | 
            +
              masculine: masc
         | 
| 100 | 
            +
              feminine: fem
         | 
| 101 | 
            +
              neuter: neut
         | 
| 102 | 
            +
              common: epicen@
         | 
| 103 | 
            +
              isPreposition: prep
         | 
| 104 | 
            +
              isParticiple: part
         | 
| 105 | 
            +
              isAdjective: adj
         | 
| 106 | 
            +
              isAdverb: adv
         | 
| 107 | 
            +
              isNoun: sust
         | 
| 108 | 
            +
              isVerb: v
         | 
| 109 | 
            +
            relatedterms:
         | 
| 110 | 
            +
              deprecates: obsoleto
         | 
| 111 | 
            +
              supersedes: reemplaza
         | 
| 112 | 
            +
              narrower: incluye
         | 
| 113 | 
            +
              broader: extiende
         | 
| 114 | 
            +
              equivalent: equivalente
         | 
| 115 | 
            +
              compare: relacionado
         | 
| 116 | 
            +
              contrast: difiere
         | 
| 117 | 
            +
              see: véase
         | 
| 98 118 | 
             
            inflection:
         | 
| 99 119 | 
             
              Cláusula:
         | 
| 100 120 | 
             
                sg: Cláusula
         | 
| @@ -92,6 +92,26 @@ locality: { | |
| 92 92 | 
             
                                  note: Note,
         | 
| 93 93 | 
             
                                  formula: Formule
         | 
| 94 94 | 
             
                                }
         | 
| 95 | 
            +
            grammar_abbrevs:
         | 
| 96 | 
            +
              masculine: masc
         | 
| 97 | 
            +
              feminine: fem
         | 
| 98 | 
            +
              neuter: neut
         | 
| 99 | 
            +
              common: épicène
         | 
| 100 | 
            +
              isPreposition: prép
         | 
| 101 | 
            +
              isParticiple: part
         | 
| 102 | 
            +
              isAdjective: adj
         | 
| 103 | 
            +
              isAdverb: adv
         | 
| 104 | 
            +
              isNoun: subst
         | 
| 105 | 
            +
              isVerb: vb
         | 
| 106 | 
            +
            relatedterms:
         | 
| 107 | 
            +
              deprecates: déprécie
         | 
| 108 | 
            +
              supersedes: remplace
         | 
| 109 | 
            +
              narrower: plus étroit
         | 
| 110 | 
            +
              broader: plus large
         | 
| 111 | 
            +
              equivalent: équivalent
         | 
| 112 | 
            +
              compare: comparez
         | 
| 113 | 
            +
              contrast: contrastez
         | 
| 114 | 
            +
              see: voir
         | 
| 95 115 | 
             
            inflection:
         | 
| 96 116 | 
             
              Clause:
         | 
| 97 117 | 
             
                sg: Article
         | 
| @@ -97,7 +97,27 @@ locality: { | |
| 97 97 | 
             
                                  example: Пример,
         | 
| 98 98 | 
             
                                  note: Примечание,
         | 
| 99 99 | 
             
                                  formula: Формула
         | 
| 100 | 
            -
             | 
| 100 | 
            +
            }
         | 
| 101 | 
            +
            grammar_abbrevs:
         | 
| 102 | 
            +
              masculine: муж
         | 
| 103 | 
            +
              feminine: жен
         | 
| 104 | 
            +
              neuter: ср
         | 
| 105 | 
            +
              common: общего рода
         | 
| 106 | 
            +
              isPreposition: предл
         | 
| 107 | 
            +
              isParticiple: прич
         | 
| 108 | 
            +
              isAdjective: прил
         | 
| 109 | 
            +
              isAdverb: нар
         | 
| 110 | 
            +
              isNoun: сущ
         | 
| 111 | 
            +
              isVerb: глаг
         | 
| 112 | 
            +
            relatedterms:
         | 
| 113 | 
            +
              deprecates: устаревший
         | 
| 114 | 
            +
              supersedes: заменяет
         | 
| 115 | 
            +
              narrower: более узкий
         | 
| 116 | 
            +
              broader: более широкий
         | 
| 117 | 
            +
              equivalent: эквивалент
         | 
| 118 | 
            +
              compare: наравне
         | 
| 119 | 
            +
              contrast: противоположный
         | 
| 120 | 
            +
              see: см.
         | 
| 101 121 | 
             
            inflection:
         | 
| 102 122 | 
             
              Пункт:
         | 
| 103 123 | 
             
                sg: Пункт
         | 
| @@ -93,3 +93,24 @@ locality: { | |
| 93 93 | 
             
              example: 示例,
         | 
| 94 94 | 
             
              note: 注
         | 
| 95 95 | 
             
            }
         | 
| 96 | 
            +
            grammar_abbrevs:
         | 
| 97 | 
            +
              masculine: 男性性别
         | 
| 98 | 
            +
              feminine: 阴性
         | 
| 99 | 
            +
              neuter: 中性的
         | 
| 100 | 
            +
              common: 通性
         | 
| 101 | 
            +
              isPreposition: 介词
         | 
| 102 | 
            +
              isParticiple: 分词
         | 
| 103 | 
            +
              isAdjective: 形容词
         | 
| 104 | 
            +
              isAdverb: 副词
         | 
| 105 | 
            +
              isNoun: 名词
         | 
| 106 | 
            +
              isVerb: 动词
         | 
| 107 | 
            +
            relatedterms:
         | 
| 108 | 
            +
              deprecates: 旧词
         | 
| 109 | 
            +
              supersedes: 取替
         | 
| 110 | 
            +
              narrower: 狭义
         | 
| 111 | 
            +
              broader: 广义
         | 
| 112 | 
            +
              equivalent: 同义
         | 
| 113 | 
            +
              compare: 比较
         | 
| 114 | 
            +
              contrast: 对比
         | 
| 115 | 
            +
              see: 见
         | 
| 116 | 
            +
             | 
| @@ -1,21 +1,14 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
            require_relative "./utils | 
| 1 | 
            +
            require "mn2pdf"
         | 
| 2 | 
            +
            require_relative "./utils"
         | 
| 3 3 |  | 
| 4 4 | 
             
            module Metanorma
         | 
| 5 5 | 
             
              module Output
         | 
| 6 6 | 
             
                class XslfoPdf < Base
         | 
| 7 | 
            -
                  def convert(url_path, output_path, xsl_stylesheet, options =  | 
| 7 | 
            +
                  def convert(url_path, output_path, xsl_stylesheet, options = {})
         | 
| 8 8 | 
             
                    return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
         | 
| 9 9 |  | 
| 10 | 
            -
                    Mn2pdf.convert( | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                  def quote(x)
         | 
| 14 | 
            -
                    return x if /^'.*'$/.match(x)
         | 
| 15 | 
            -
                    return x if /^".*"$/.match(x)
         | 
| 16 | 
            -
                    %("#{x}")
         | 
| 10 | 
            +
                    Mn2pdf.convert(url_path, output_path, xsl_stylesheet, options)
         | 
| 17 11 | 
             
                  end
         | 
| 18 12 | 
             
                end
         | 
| 19 13 | 
             
              end
         | 
| 20 14 | 
             
            end
         | 
| 21 | 
            -
             | 
    
        data/spec/assets/i18n.yaml
    CHANGED
    
    | @@ -6,12 +6,14 @@ source: SOURCE | |
| 6 6 | 
             
            modified: modified
         | 
| 7 7 | 
             
            scope: Amplekso
         | 
| 8 8 | 
             
            symbols: Simboloj kai mallongigitaj terminoj
         | 
| 9 | 
            -
            annex:  | 
| 9 | 
            +
            annex: <strong>aldono</strong>
         | 
| 10 10 | 
             
            normref: Normaj citaĵoj
         | 
| 11 11 | 
             
            bibliography: Bibliografio
         | 
| 12 12 | 
             
            inform_annex: informa
         | 
| 13 13 | 
             
            all_parts: ĉiuj partoj
         | 
| 14 14 | 
             
            norm_annex: normative
         | 
| 15 | 
            +
            figure: figur-etikedo duvorta
         | 
| 16 | 
            +
            example: Ekzempl-etikedo Duvorta
         | 
| 15 17 | 
             
            note: NOTO
         | 
| 16 18 | 
             
            locality: {
         | 
| 17 19 | 
             
              table: Tabelo
         | 
    
        data/spec/isodoc/blocks_spec.rb
    CHANGED
    
    | @@ -809,8 +809,11 @@ RSpec.describe IsoDoc do | |
| 809 809 | 
             
                expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
         | 
| 810 810 | 
             
                  .convert("test", input, true)
         | 
| 811 811 | 
             
                  .gsub(/</, "<")
         | 
| 812 | 
            -
                .gsub(%r{data:application/x-msmetafile[^"']+}, | 
| 813 | 
            -
             | 
| 812 | 
            +
                .gsub(%r{data:application/x-msmetafile[^"']+},
         | 
| 813 | 
            +
                      "data:application/x-msmetafile")))
         | 
| 814 | 
            +
                  .to be_equivalent_to xmlpp(presxml
         | 
| 815 | 
            +
                  .gsub(%r{data:application/x-msmetafile[^"']+},
         | 
| 816 | 
            +
                        "data:application/x-msmetafile"))
         | 
| 814 817 | 
             
                expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
         | 
| 815 818 | 
             
                  .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html)
         | 
| 816 819 | 
             
                expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
         | 
| @@ -900,9 +903,11 @@ RSpec.describe IsoDoc do | |
| 900 903 | 
             
                expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
         | 
| 901 904 | 
             
                 .convert("test", input, true)
         | 
| 902 905 | 
             
                 .gsub(/</, "<")
         | 
| 903 | 
            -
                .gsub(%r{data:application/x-msmetafile[^"']+}, | 
| 906 | 
            +
                .gsub(%r{data:application/x-msmetafile[^"']+},
         | 
| 907 | 
            +
                      "data:application/x-msmetafile")))
         | 
| 904 908 | 
             
                  .to be_equivalent_to xmlpp(presxml
         | 
| 905 | 
            -
                  .gsub( | 
| 909 | 
            +
                  .gsub(%r{data:application/x-msmetafile[^"']+},
         | 
| 910 | 
            +
                        "data:application/x-msmetafile"))
         | 
| 906 911 | 
             
                expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
         | 
| 907 912 | 
             
                  .convert("test", presxml, true)
         | 
| 908 913 | 
             
                  .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'")
         | 
| @@ -991,9 +996,11 @@ RSpec.describe IsoDoc do | |
| 991 996 | 
             
                  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
         | 
| 992 997 | 
             
                   .convert("test", input, true)
         | 
| 993 998 | 
             
                   .gsub(/</, "<")
         | 
| 994 | 
            -
                    .gsub(%r{data:application/x-msmetafile[^"']+}, | 
| 999 | 
            +
                    .gsub(%r{data:application/x-msmetafile[^"']+},
         | 
| 1000 | 
            +
                          "data:application/x-msmetafile")))
         | 
| 995 1001 | 
             
                    .to be_equivalent_to xmlpp(presxml
         | 
| 996 | 
            -
                    .gsub( | 
| 1002 | 
            +
                    .gsub(%r{data:application/x-msmetafile[^"']+},
         | 
| 1003 | 
            +
                          "data:application/x-msmetafile"))
         | 
| 997 1004 | 
             
                  expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
         | 
| 998 1005 | 
             
                    .convert("test", presxml, true)
         | 
| 999 1006 | 
             
                    .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'")
         | 
| @@ -2521,8 +2528,7 @@ RSpec.describe IsoDoc do | |
| 2521 2528 | 
             
                  .convert("test", input, true))
         | 
| 2522 2529 | 
             
                  .sub(%r{<localized-strings>.*</localized-strings>}m, "")
         | 
| 2523 2530 | 
             
                  .gsub(%r{"\.\\}, '"./')
         | 
| 2524 | 
            -
                  .gsub(%r{'\.\\}, "'./")
         | 
| 2525 | 
            -
                  )
         | 
| 2531 | 
            +
                  .gsub(%r{'\.\\}, "'./"))
         | 
| 2526 2532 | 
             
                  .to be_equivalent_to xmlpp(output)
         | 
| 2527 2533 | 
             
              end
         | 
| 2528 2534 |  |