metanorma-standoc 1.4.2 → 1.4.3
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/.github/workflows/macos.yml +0 -7
- data/.github/workflows/ubuntu.yml +6 -11
- data/.github/workflows/windows.yml +0 -8
- data/lib/asciidoctor/standoc/base.rb +10 -17
- data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -4
- data/lib/asciidoctor/standoc/converter.rb +16 -0
- data/lib/asciidoctor/standoc/inline.rb +1 -1
- data/lib/metanorma/standoc/processor.rb +0 -4
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor-standoc/blocks_spec.rb +1 -1
- data/spec/asciidoctor-standoc/inline_spec.rb +2 -2
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ac225a257c1a5c42ce296ee87ef1d95e378111a82875211969771f7d1756bcf2
         | 
| 4 | 
            +
              data.tar.gz: 30ff55c905559089be61b2752cb84c8274a121b4e5359a8cdf547528296a09be
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e66997f17221a04e57e213a66e16ce0061060c5ffd0708bc9196b2b75ec8081673475890b8745086341196bb30a7832ca7f3c1d5615bd80063e31f6f9e243534
         | 
| 7 | 
            +
              data.tar.gz: 1a1e23d189dbb0ef46552e5953cd8568c83b6380d239a68cfab95e8a1cb975583e7697bc6d11babb509ca5a21f9f3c7d4d06e225f8faef39f2c7f3d9d8087f9c
         | 
    
        data/.github/workflows/macos.yml
    CHANGED
    
    | @@ -29,10 +29,6 @@ jobs: | |
| 29 29 | 
             
                    uses: actions/setup-ruby@v1
         | 
| 30 30 | 
             
                    with:
         | 
| 31 31 | 
             
                      ruby-version: ${{ matrix.ruby }}
         | 
| 32 | 
            -
                      architecture: 'x64'
         | 
| 33 | 
            -
                  - uses: actions/setup-node@v1
         | 
| 34 | 
            -
                    with:
         | 
| 35 | 
            -
                      node-version: '10.x'
         | 
| 36 32 | 
             
                  - name: Install LaTeXML
         | 
| 37 33 | 
             
                    run: |
         | 
| 38 34 | 
             
                      brew install libxml2 cpanminus
         | 
| @@ -41,9 +37,6 @@ jobs: | |
| 41 37 | 
             
                  - name: Install PlantUML
         | 
| 42 38 | 
             
                    run: |
         | 
| 43 39 | 
             
                      brew install plantuml
         | 
| 44 | 
            -
                  - name: Install puppeteer
         | 
| 45 | 
            -
                    run: |
         | 
| 46 | 
            -
                      npm -g i puppeteer
         | 
| 47 40 | 
             
                  - name: Update gems
         | 
| 48 41 | 
             
                    run: |
         | 
| 49 42 | 
             
                      sudo gem install bundler --force
         | 
| @@ -29,10 +29,6 @@ jobs: | |
| 29 29 | 
             
                    uses: actions/setup-ruby@v1
         | 
| 30 30 | 
             
                    with:
         | 
| 31 31 | 
             
                      ruby-version: ${{ matrix.ruby }}
         | 
| 32 | 
            -
                      architecture: 'x64'
         | 
| 33 | 
            -
                  - uses: actions/setup-node@v1
         | 
| 34 | 
            -
                    with:
         | 
| 35 | 
            -
                      node-version: '10.x'
         | 
| 36 32 | 
             
                  - name: Update gems
         | 
| 37 33 | 
             
                    run: |
         | 
| 38 34 | 
             
                      gem install bundler
         | 
| @@ -42,13 +38,12 @@ jobs: | |
| 42 38 | 
             
                      sudo snap install latexml --edge
         | 
| 43 39 | 
             
                      echo "::add-path::/snap/bin"
         | 
| 44 40 | 
             
                  - name: Install PlantUML
         | 
| 45 | 
            -
                     | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
                       | 
| 50 | 
            -
                      sudo  | 
| 51 | 
            -
                      npm install -g puppeteer@3.0.1
         | 
| 41 | 
            +
                    uses: nick-invision/retry@v1
         | 
| 42 | 
            +
                    with:
         | 
| 43 | 
            +
                      polling_interval_seconds: 5
         | 
| 44 | 
            +
                      timeout_minutes: 5
         | 
| 45 | 
            +
                      max_attempts: 3
         | 
| 46 | 
            +
                      command: sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
         | 
| 52 47 | 
             
                  - name: Run specs
         | 
| 53 48 | 
             
                    run: |
         | 
| 54 49 | 
             
                      bundle exec rake
         | 
| @@ -29,10 +29,6 @@ jobs: | |
| 29 29 | 
             
                    uses: actions/setup-ruby@v1
         | 
| 30 30 | 
             
                    with:
         | 
| 31 31 | 
             
                      ruby-version: ${{ matrix.ruby }}
         | 
| 32 | 
            -
                      architecture: 'x64'
         | 
| 33 | 
            -
                  - uses: actions/setup-node@v1
         | 
| 34 | 
            -
                    with:
         | 
| 35 | 
            -
                      node-version: '10.x'
         | 
| 36 32 | 
             
                  - name: Install MN Windows dependencies
         | 
| 37 33 | 
             
                    shell: pwsh
         | 
| 38 34 | 
             
                    run: |
         | 
| @@ -50,10 +46,6 @@ jobs: | |
| 50 46 | 
             
                      refreshenv
         | 
| 51 47 | 
             
                      set PATH=C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;%PATH%
         | 
| 52 48 | 
             
                      where latexmlmath
         | 
| 53 | 
            -
                  - name: Install puppeteer
         | 
| 54 | 
            -
                    shell: pwsh
         | 
| 55 | 
            -
                    run: |
         | 
| 56 | 
            -
                      npm -g i puppeteer
         | 
| 57 49 | 
             
                  - name: Run specs
         | 
| 58 50 | 
             
                    shell: pwsh
         | 
| 59 51 | 
             
                    run: |
         | 
| @@ -14,22 +14,6 @@ module Asciidoctor | |
| 14 14 | 
             
                  XML_ROOT_TAG = "standard-document".freeze
         | 
| 15 15 | 
             
                  XML_NAMESPACE = "https://www.metanorma.org/ns/standoc".freeze
         | 
| 16 16 |  | 
| 17 | 
            -
                  Asciidoctor::Extensions.register do
         | 
| 18 | 
            -
                    preprocessor Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor
         | 
| 19 | 
            -
                    preprocessor Asciidoctor::Standoc::Datamodel::DiagramPreprocessor
         | 
| 20 | 
            -
                    preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
         | 
| 21 | 
            -
                    inline_macro Asciidoctor::Standoc::AltTermInlineMacro
         | 
| 22 | 
            -
                    inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
         | 
| 23 | 
            -
                    inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
         | 
| 24 | 
            -
                    inline_macro Asciidoctor::Standoc::InheritInlineMacro
         | 
| 25 | 
            -
                    inline_macro Asciidoctor::Standoc::HTML5RubyMacro
         | 
| 26 | 
            -
                    inline_macro Asciidoctor::Standoc::ConceptInlineMacro
         | 
| 27 | 
            -
                    block Asciidoctor::Standoc::ToDoAdmonitionBlock
         | 
| 28 | 
            -
                    treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
         | 
| 29 | 
            -
                    block Asciidoctor::Standoc::PlantUMLBlockMacro
         | 
| 30 | 
            -
                    block Asciidoctor::Standoc::PseudocodeBlockMacro
         | 
| 31 | 
            -
                  end
         | 
| 32 | 
            -
             | 
| 33 17 | 
             
                  def xml_root_tag
         | 
| 34 18 | 
             
                    self.class::XML_ROOT_TAG
         | 
| 35 19 | 
             
                  end
         | 
| @@ -117,6 +101,7 @@ module Asciidoctor | |
| 117 101 | 
             
                    @filename = node.attr("docfile") ?
         | 
| 118 102 | 
             
                      File.basename(node.attr("docfile")).gsub(/\.adoc$/, "") : ""
         | 
| 119 103 | 
             
                    @localdir = Utils::localdir(node)
         | 
| 104 | 
            +
                    @output_dir = outputdir node
         | 
| 120 105 | 
             
                    @no_isobib_cache = node.attr("no-isobib-cache")
         | 
| 121 106 | 
             
                    @no_isobib = node.attr("no-isobib")
         | 
| 122 107 | 
             
                    @bibdb = nil
         | 
| @@ -158,7 +143,7 @@ module Asciidoctor | |
| 158 143 | 
             
                  end
         | 
| 159 144 |  | 
| 160 145 | 
             
                  def clean_exit
         | 
| 161 | 
            -
                    @log.write(@ | 
| 146 | 
            +
                    @log.write(@output_dir + @filename + ".err") unless @novalid
         | 
| 162 147 | 
             
                    @files_to_delete.each { |f| FileUtils.rm f }
         | 
| 163 148 | 
             
                  end
         | 
| 164 149 |  | 
| @@ -243,6 +228,14 @@ module Asciidoctor | |
| 243 228 | 
             
                      end
         | 
| 244 229 | 
             
                    end.join("\n")
         | 
| 245 230 | 
             
                  end
         | 
| 231 | 
            +
             | 
| 232 | 
            +
                  private
         | 
| 233 | 
            +
             | 
| 234 | 
            +
                  def outputdir(node)
         | 
| 235 | 
            +
                    if node.attr("output_dir").nil_or_empty? then Utils::localdir(node)
         | 
| 236 | 
            +
                    else File.join(node.attr("output_dir"), "")
         | 
| 237 | 
            +
                    end
         | 
| 238 | 
            +
                  end
         | 
| 246 239 | 
             
                end
         | 
| 247 240 | 
             
              end
         | 
| 248 241 | 
             
            end
         | 
| @@ -50,7 +50,8 @@ module Asciidoctor | |
| 50 50 | 
             
                  # only numeric references are renumbered
         | 
| 51 51 | 
             
                  def biblio_renumber(xmldoc)
         | 
| 52 52 | 
             
                    r = xmldoc.at("//references[@normative = 'false'] | "\
         | 
| 53 | 
            -
                                  "//clause[.//references[@normative = 'false']] | 
| 53 | 
            +
                                  "//clause[.//references[@normative = 'false']] | "\
         | 
| 54 | 
            +
                                  "//annex[.//references[@normative = 'false']]") or return
         | 
| 54 55 | 
             
                    r.xpath(".//bibitem[not(ancestor::bibitem)]").each_with_index do |b, i|
         | 
| 55 56 | 
             
                      next unless docid = b.at("./docidentifier[@type = 'metanorma']")
         | 
| 56 57 | 
             
                      next unless  /^\[\d+\]$/.match(docid.text)
         | 
| @@ -134,13 +135,13 @@ module Asciidoctor | |
| 134 135 | 
             
                  def validate_ref_dl(bib, c)
         | 
| 135 136 | 
             
                    unless bib["id"]
         | 
| 136 137 | 
             
                      @log.add("Anchors", c, "The following reference is missing "\
         | 
| 137 | 
            -
             | 
| 138 | 
            +
                               "an anchor:\n" + c.to_xml)
         | 
| 138 139 | 
             
                      return
         | 
| 139 140 | 
             
                    end
         | 
| 140 141 | 
             
                    bib["title"] or @log.add("Bibliography", c, "Reference #{bib['id']} "\
         | 
| 141 | 
            -
             | 
| 142 | 
            +
                                             "is missing a title")
         | 
| 142 143 | 
             
                    bib["docid"] or @log.add("Bibliography", c, "Reference #{bib['id']} "\
         | 
| 143 | 
            -
             | 
| 144 | 
            +
                                             "is missing a document identifier (docid)")
         | 
| 144 145 | 
             
                  end
         | 
| 145 146 |  | 
| 146 147 | 
             
                  def extract_from_p(tag, bib, key)
         | 
| @@ -21,6 +21,22 @@ module Asciidoctor | |
| 21 21 | 
             
                # A {Converter} implementation that generates Standoc output, and a document
         | 
| 22 22 | 
             
                # schema encapsulation of the document for validation
         | 
| 23 23 | 
             
                class Converter
         | 
| 24 | 
            +
                  Asciidoctor::Extensions.register do
         | 
| 25 | 
            +
                    preprocessor Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor
         | 
| 26 | 
            +
                    preprocessor Asciidoctor::Standoc::Datamodel::DiagramPreprocessor
         | 
| 27 | 
            +
                    preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
         | 
| 28 | 
            +
                    inline_macro Asciidoctor::Standoc::AltTermInlineMacro
         | 
| 29 | 
            +
                    inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
         | 
| 30 | 
            +
                    inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
         | 
| 31 | 
            +
                    inline_macro Asciidoctor::Standoc::InheritInlineMacro
         | 
| 32 | 
            +
                    inline_macro Asciidoctor::Standoc::HTML5RubyMacro
         | 
| 33 | 
            +
                    inline_macro Asciidoctor::Standoc::ConceptInlineMacro
         | 
| 34 | 
            +
                    block Asciidoctor::Standoc::ToDoAdmonitionBlock
         | 
| 35 | 
            +
                    treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
         | 
| 36 | 
            +
                    block Asciidoctor::Standoc::PlantUMLBlockMacro
         | 
| 37 | 
            +
                    block Asciidoctor::Standoc::PseudocodeBlockMacro
         | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
             | 
| 24 40 | 
             
                  include ::Asciidoctor::Converter
         | 
| 25 41 | 
             
                  include ::Asciidoctor::Writer
         | 
| 26 42 |  | 
| @@ -135,7 +135,7 @@ module Asciidoctor | |
| 135 135 | 
             
                    results.nil? and
         | 
| 136 136 | 
             
                      @log.add('Math', nil,
         | 
| 137 137 | 
             
                               "latexmlmath failed to process equation:\n#{lxm_input}")
         | 
| 138 | 
            -
                    results
         | 
| 138 | 
            +
                    results&.sub(%r{<math ([^>]+ )?display="block"}, "<math \\1")
         | 
| 139 139 | 
             
                  end
         | 
| 140 140 |  | 
| 141 141 | 
             
                  def stem_parse(text, xml, style)
         | 
| @@ -21,10 +21,6 @@ module Metanorma | |
| 21 21 | 
             
                    "Metanorma::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
         | 
| 22 22 | 
             
                  end
         | 
| 23 23 |  | 
| 24 | 
            -
                  def input_to_isodoc(file, filename)
         | 
| 25 | 
            -
                    Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
         | 
| 26 | 
            -
                  end
         | 
| 27 | 
            -
             | 
| 28 24 | 
             
                  def output(isodoc_node, inname, outname, format, options={})
         | 
| 29 25 | 
             
                    case format
         | 
| 30 26 | 
             
                    when :html
         | 
| @@ -96,7 +96,7 @@ RSpec.describe Asciidoctor::Standoc do | |
| 96 96 | 
             
                   </formula>
         | 
| 97 97 | 
             
                          <formula id="_" subsequence="A">
         | 
| 98 98 | 
             
                     <stem type="MathML">
         | 
| 99 | 
            -
                   <math xmlns="http://www.w3.org/1998/Math/MathML" | 
| 99 | 
            +
                   <math xmlns="http://www.w3.org/1998/Math/MathML">
         | 
| 100 100 | 
             
                     <mrow>
         | 
| 101 101 | 
             
                       <mi>M</mi>
         | 
| 102 102 | 
             
                       <mo>=</mo>
         | 
| @@ -88,7 +88,7 @@ text, including nested markup. | |
| 88 88 | 
             
                  <sections>
         | 
| 89 89 | 
             
                  <p id="_">
         | 
| 90 90 | 
             
                      <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem><br/>
         | 
| 91 | 
            -
                      <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML" | 
| 91 | 
            +
                      <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML">   <mrow>     <mi>n</mi>     <mo><</mo>     <mn>1</mn>   </mrow> </math></stem>
         | 
| 92 92 | 
             
                    </p>
         | 
| 93 93 | 
             
                  </sections>
         | 
| 94 94 | 
             
                   </standard-document>
         | 
| @@ -106,7 +106,7 @@ text, including nested markup. | |
| 106 106 | 
             
                  <sections>
         | 
| 107 107 | 
             
                  <p id="_">
         | 
| 108 108 | 
             
                      <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo><</mo><mn>1</mn></math></stem>
         | 
| 109 | 
            -
                      <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML" | 
| 109 | 
            +
                      <stem type="MathML"> <math xmlns="http://www.w3.org/1998/Math/MathML">   <mrow>     <mi>n</mi>     <mo><</mo>     <mn>1</mn>   </mrow> </math></stem>
         | 
| 110 110 | 
             
                    </p>
         | 
| 111 111 | 
             
                  </sections>
         | 
| 112 112 | 
             
                   </standard-document>
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: metanorma-standoc
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.4. | 
| 4 | 
            +
              version: 1.4.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ribose Inc.
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 11 | 
            +
            date: 2020-07-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: asciidoctor
         |