mn-requirements 0.4.0 → 0.4.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/lib/isodoc/i18n.rb +1 -1
 - data/lib/isodoc-yaml/i18n-ja.yaml +31 -0
 - data/lib/metanorma/default/cleanup.rb +1 -1
 - data/lib/metanorma/default/default.rb +1 -0
 - data/lib/metanorma/modspec/cleanup.rb +3 -2
 - data/lib/metanorma/modspec/isodoc.rb +7 -6
 - data/lib/metanorma/modspec/reqt_label.rb +13 -13
 - data/lib/metanorma/requirements/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bd0f29f7ad1df5f2127ec2c47f22d03e50bc6ec18e76459352ba6d873117d049
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 60f5b1e8cd4463f0d2492731a502b33ea9b9d3930fa5fc09d99b2aa14285f153
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9028d71bdb94818359b7ebda35103973ce7906eae30aad1b881085fccdde2d78f6a07edb5fdc939c9234738751a48bda2a06bafba6809457808ba5fe563b189c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 83e2726e3edeb550d272860a8e477a50629bc298468555cb3fcf251b60b318a4e63a42b750d2812542bf8185007b0da0eb0ad49a926f4e0688c7c2a4b55efd5b
         
     | 
    
        data/lib/isodoc/i18n.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            requirements:
         
     | 
| 
      
 2 
     | 
    
         
            +
              default:
         
     | 
| 
      
 3 
     | 
    
         
            +
                requirement: 要求
         
     | 
| 
      
 4 
     | 
    
         
            +
                recommendation: 推奨
         
     | 
| 
      
 5 
     | 
    
         
            +
                permission: 許可
         
     | 
| 
      
 6 
     | 
    
         
            +
                obligation: 義務
         
     | 
| 
      
 7 
     | 
    
         
            +
                subject: 主題
         
     | 
| 
      
 8 
     | 
    
         
            +
                inherits: 継承
         
     | 
| 
      
 9 
     | 
    
         
            +
              modspec:
         
     | 
| 
      
 10 
     | 
    
         
            +
                recommendationtest: 要求テスト
         
     | 
| 
      
 11 
     | 
    
         
            +
                requirementtest: 要求テスト
         
     | 
| 
      
 12 
     | 
    
         
            +
                permissiontest: 許可テスト
         
     | 
| 
      
 13 
     | 
    
         
            +
                recommendationclass: 要求クラス
         
     | 
| 
      
 14 
     | 
    
         
            +
                requirementclass: 要求クラス
         
     | 
| 
      
 15 
     | 
    
         
            +
                permissionclass: 許可クラス
         
     | 
| 
      
 16 
     | 
    
         
            +
                abstracttest: 抽象テスト
         
     | 
| 
      
 17 
     | 
    
         
            +
                conformanceclass: 適合クラス
         
     | 
| 
      
 18 
     | 
    
         
            +
                conformancetest: 適合性テスト
         
     | 
| 
      
 19 
     | 
    
         
            +
                targettype: ターゲットタイプ
         
     | 
| 
      
 20 
     | 
    
         
            +
                target: ターゲット
         
     | 
| 
      
 21 
     | 
    
         
            +
                testpurpose: テスト目的
         
     | 
| 
      
 22 
     | 
    
         
            +
                testmethod: 試験方法
         
     | 
| 
      
 23 
     | 
    
         
            +
                dependency: 前提条件
         
     | 
| 
      
 24 
     | 
    
         
            +
                indirectdependency: 間接的な前提条件
         
     | 
| 
      
 25 
     | 
    
         
            +
                identifier: 識別子
         
     | 
| 
      
 26 
     | 
    
         
            +
                included_in: 含まれる
         
     | 
| 
      
 27 
     | 
    
         
            +
                statement: 声明
         
     | 
| 
      
 28 
     | 
    
         
            +
                description: 説明
         
     | 
| 
      
 29 
     | 
    
         
            +
                guidance: ガイダンス
         
     | 
| 
      
 30 
     | 
    
         
            +
                implements: 実装
         
     | 
| 
      
 31 
     | 
    
         
            +
                provision: 規範的声明
         
     | 
| 
         @@ -34,7 +34,7 @@ module Metanorma 
     | 
|
| 
       34 
34 
     | 
    
         
             
                  def requirement_metadata1(reqt, dlist, ins)
         
     | 
| 
       35 
35 
     | 
    
         
             
                    ins1 = super
         
     | 
| 
       36 
36 
     | 
    
         
             
                    dlist.xpath("./dt").each do |e|
         
     | 
| 
       37 
     | 
    
         
            -
                      tag = e.text&. 
     | 
| 
      
 37 
     | 
    
         
            +
                      tag = e.text&.tr(" ", "-")&.downcase
         
     | 
| 
       38 
38 
     | 
    
         
             
                      tag = "description" if tag == "statement"
         
     | 
| 
       39 
39 
     | 
    
         
             
                      next unless requirement_metadata_component_tags.include?(tag)
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
         @@ -93,7 +93,8 @@ module Metanorma 
     | 
|
| 
       93 
93 
     | 
    
         
             
                  end
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
       95 
95 
     | 
    
         
             
                  def requirement_metadata_to_component(reqt)
         
     | 
| 
       96 
     | 
    
         
            -
                    xpath = requirement_metadata_component_tags - %w(statement 
     | 
| 
      
 96 
     | 
    
         
            +
                    xpath = requirement_metadata_component_tags - %w(statement
         
     | 
| 
      
 97 
     | 
    
         
            +
                                                                     description) -
         
     | 
| 
       97 
98 
     | 
    
         
             
                      requirement_metadata_requirement_tags
         
     | 
| 
       98 
99 
     | 
    
         
             
                    reqt.xpath(xpath.map { |x| ".//#{x}" }.join(" | ")).each do |c|
         
     | 
| 
       99 
100 
     | 
    
         
             
                      c["class"] = c.name
         
     | 
| 
         @@ -8,7 +8,9 @@ module Metanorma 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  def requirement_render1(node)
         
     | 
| 
       9 
9 
     | 
    
         
             
                    init_lookups(node.document)
         
     | 
| 
       10 
10 
     | 
    
         
             
                    ret = requirement_guidance_parse(node, super)
         
     | 
| 
       11 
     | 
    
         
            -
                    requirement_table_cleanup(node, ret)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    out = requirement_table_cleanup(node, ret)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    out["class"] = "modspec" # deferred; node["class"] is labelling class
         
     | 
| 
      
 13 
     | 
    
         
            +
                    out
         
     | 
| 
       12 
14 
     | 
    
         
             
                  end
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
       14 
16 
     | 
    
         
             
                  def recommendation_base(node, _klass)
         
     | 
| 
         @@ -17,7 +19,6 @@ module Metanorma 
     | 
|
| 
       17 
19 
     | 
    
         
             
                    %w(id keep-with-next keep-lines-together unnumbered).each do |x|
         
     | 
| 
       18 
20 
     | 
    
         
             
                      out[x] = node[x] if node[x]
         
     | 
| 
       19 
21 
     | 
    
         
             
                    end
         
     | 
| 
       20 
     | 
    
         
            -
                    out["class"] = "modspec"
         
     | 
| 
       21 
22 
     | 
    
         
             
                    out["type"] = recommend_class(node)
         
     | 
| 
       22 
23 
     | 
    
         
             
                    recommendation_component_labels(node)
         
     | 
| 
       23 
24 
     | 
    
         
             
                    out
         
     | 
| 
         @@ -35,9 +36,9 @@ module Metanorma 
     | 
|
| 
       35 
36 
     | 
    
         
             
                  def recommendation_header(reqt, out)
         
     | 
| 
       36 
37 
     | 
    
         
             
                    n = recommendation_name(reqt, nil)
         
     | 
| 
       37 
38 
     | 
    
         
             
                    x = if reqt.ancestors("requirement, recommendation, permission").empty?
         
     | 
| 
       38 
     | 
    
         
            -
                           
     | 
| 
       39 
     | 
    
         
            -
                             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
                          <<~THEAD
         
     | 
| 
      
 40 
     | 
    
         
            +
                            <thead><tr><th scope='colgroup' colspan='2'><p class='#{recommend_name_class(reqt)}'>#{n}</p></th></tr></thead>
         
     | 
| 
      
 41 
     | 
    
         
            +
                          THEAD
         
     | 
| 
       41 
42 
     | 
    
         
             
                        else
         
     | 
| 
       42 
43 
     | 
    
         
             
                          "<thead><tr><th>#{recommendation_class_label(reqt)}</th>" \
         
     | 
| 
       43 
44 
     | 
    
         
             
                            "<td>#{n}</td></tr></thead>"
         
     | 
| 
         @@ -129,7 +130,7 @@ module Metanorma 
     | 
|
| 
       129 
130 
     | 
    
         
             
                      node.xpath(ns("./classification[tag][value]")).each do |c|
         
     | 
| 
       130 
131 
     | 
    
         
             
                        c.at(ns("./tag")).text.casecmp(x).zero? or next
         
     | 
| 
       131 
132 
     | 
    
         
             
                        xref = recommendation_id(c.at(ns("./value")).children.to_xml) and
         
     | 
| 
       132 
     | 
    
         
            -
                          head << [@labels["modspec"][x. 
     | 
| 
      
 133 
     | 
    
         
            +
                          head << [@labels["modspec"][x.delete("-")], xref]
         
     | 
| 
       133 
134 
     | 
    
         
             
                      end
         
     | 
| 
       134 
135 
     | 
    
         
             
                    end
         
     | 
| 
       135 
136 
     | 
    
         
             
                    head
         
     | 
| 
         @@ -1,7 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
                   
     | 
| 
      
 1 
     | 
    
         
            +
            module Nokogiri
         
     | 
| 
      
 2 
     | 
    
         
            +
              module XML
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Document
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def reqt_iter(&block)
         
     | 
| 
      
 5 
     | 
    
         
            +
                    xpath("//xmlns:requirement | //xmlns:recommendation | //xmlns:permission")
         
     | 
| 
      
 6 
     | 
    
         
            +
                      .each_with_object({}, &block)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
       5 
9 
     | 
    
         
             
              end
         
     | 
| 
       6 
10 
     | 
    
         
             
            end
         
     | 
| 
       7 
11 
     | 
    
         | 
| 
         @@ -54,17 +58,13 @@ module Metanorma 
     | 
|
| 
       54 
58 
     | 
    
         
             
                  end
         
     | 
| 
       55 
59 
     | 
    
         | 
| 
       56 
60 
     | 
    
         
             
                  def recommendation_class_label(node)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    node["class"] and return node["class"]
         
     | 
| 
       57 
62 
     | 
    
         
             
                    case node["type"]
         
     | 
| 
       58 
     | 
    
         
            -
                    when "verification" then @labels["modspec"]["conformancetest"]
         
     | 
| 
       59 
63 
     | 
    
         
             
                    when "class" then @labels["modspec"]["#{node.name}class"]
         
     | 
| 
       60 
     | 
    
         
            -
                    when " 
     | 
| 
       61 
     | 
    
         
            -
                    when " 
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                      when "recommendation" then @labels["default"]["recommendation"]
         
     | 
| 
       65 
     | 
    
         
            -
                      when "requirement" then @labels["default"]["requirement"]
         
     | 
| 
       66 
     | 
    
         
            -
                      when "permission" then @labels["default"]["permission"]
         
     | 
| 
       67 
     | 
    
         
            -
                      end
         
     | 
| 
      
 64 
     | 
    
         
            +
                    when "verification" then @labels["modspec"]["conformancetest"]
         
     | 
| 
      
 65 
     | 
    
         
            +
                    when "abstracttest", "conformanceclass"
         
     | 
| 
      
 66 
     | 
    
         
            +
                      @labels["modspec"][node["type"]]
         
     | 
| 
      
 67 
     | 
    
         
            +
                    else @labels["default"][node.name]
         
     | 
| 
       68 
68 
     | 
    
         
             
                    end
         
     | 
| 
       69 
69 
     | 
    
         
             
                  end
         
     | 
| 
       70 
70 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mn-requirements
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ribose Inc.
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-08- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-08-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: isodoc-i18n
         
     | 
| 
         @@ -226,6 +226,7 @@ files: 
     | 
|
| 
       226 
226 
     | 
    
         
             
            - lib/isodoc-yaml/i18n-en.yaml
         
     | 
| 
       227 
227 
     | 
    
         
             
            - lib/isodoc-yaml/i18n-es.yaml
         
     | 
| 
       228 
228 
     | 
    
         
             
            - lib/isodoc-yaml/i18n-fr.yaml
         
     | 
| 
      
 229 
     | 
    
         
            +
            - lib/isodoc-yaml/i18n-ja.yaml
         
     | 
| 
       229 
230 
     | 
    
         
             
            - lib/isodoc-yaml/i18n-ru.yaml
         
     | 
| 
       230 
231 
     | 
    
         
             
            - lib/isodoc-yaml/i18n-zh-Hans.yaml
         
     | 
| 
       231 
232 
     | 
    
         
             
            - lib/isodoc/i18n.rb
         
     |