html2doc 1.9.0 → 1.9.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/html2doc/math.rb +11 -5
- data/lib/html2doc/version.rb +1 -1
- 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: abee9d2b61164e6a1ca6a93832d2f0883fd7f759287590e0a3995287f1711964
         | 
| 4 | 
            +
              data.tar.gz: efaee47d719f40b076dbc851299e7fd59594a77b3af1654fe3827ba1cce28e6a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7898834a57a94b995beea51a93270efa90b19f247f8d3bb4d8ee95d9216e9c3828ff8991432a7ac561fe7257fe5ae43760733f035d5562e4f6fc2953c5a9f597
         | 
| 7 | 
            +
              data.tar.gz: 78ac742fe5ca906728541c21973739ea6b22256762fc361a9fc7264e3f966fd14f0f29e8f30e2f5a77b8c739201089decf88f3b4c8361f01ecea0413b1c3f464
         | 
    
        data/lib/html2doc/math.rb
    CHANGED
    
    | @@ -167,7 +167,8 @@ class Html2Doc | |
| 167 167 | 
             
                doc.root = ooxml_cleanup(xml, docnamespaces)
         | 
| 168 168 | 
             
                # d = xml.parent["block"] != "false" # display_style
         | 
| 169 169 | 
             
                ooxml = Nokogiri::XML(Plurimath::Math
         | 
| 170 | 
            -
                  .parse(doc.root.to_xml(indent: 0), :mathml) | 
| 170 | 
            +
                  .parse(doc.root.to_xml(indent: 0), :mathml)
         | 
| 171 | 
            +
                  .to_omml(split_on_linebreak: true))
         | 
| 171 172 | 
             
                ooxml = unitalic(accent_tr(ooxml))
         | 
| 172 173 | 
             
                ooxml = ooml_clean(uncenter(xml, ooxml))
         | 
| 173 174 | 
             
                xml.swap(ooxml)
         | 
| @@ -217,15 +218,20 @@ class Html2Doc | |
| 217 218 | 
             
                alignnode = math.xpath(STYLE_BEARING_NODE).last
         | 
| 218 219 | 
             
                ooxml.document? and ooxml = ooxml.root
         | 
| 219 220 | 
             
                ret = uncenter_unneeded(math, ooxml, alignnode) and return ret
         | 
| 220 | 
            -
                dir =  | 
| 221 | 
            -
                 | 
| 222 | 
            -
                ooxml.name == "oMathPara" or
         | 
| 223 | 
            -
                  ooxml.wrap("<m:oMathPara></m:oMathPara>")
         | 
| 221 | 
            +
                dir = ooxml_alignment(alignnode)
         | 
| 222 | 
            +
                ooxml.name == "oMathPara" or ooxml.wrap("<m:oMathPara></m:oMathPara>")
         | 
| 224 223 | 
             
                ooxml.elements.first.previous =
         | 
| 225 224 | 
             
                  "<m:oMathParaPr><m:jc m:val='#{dir}'/></m:oMathParaPr>"
         | 
| 226 225 | 
             
                ooxml
         | 
| 227 226 | 
             
              end
         | 
| 228 227 |  | 
| 228 | 
            +
              def ooxml_alignment(alignnode)
         | 
| 229 | 
            +
                dir = "left"
         | 
| 230 | 
            +
                /text-align:\s*right/.match?(alignnode["style"]) and dir = "right"
         | 
| 231 | 
            +
                /text-align:\s*center/.match?(alignnode["style"]) and dir = "center"
         | 
| 232 | 
            +
                dir
         | 
| 233 | 
            +
              end
         | 
| 234 | 
            +
             | 
| 229 235 | 
             
              def uncenter_unneeded(math, ooxml, alignnode)
         | 
| 230 236 | 
             
                (math_block?(ooxml, math) || !alignnode) and return ooxml
         | 
| 231 237 | 
             
                math_only_para?(alignnode) and return nil
         | 
    
        data/lib/html2doc/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: html2doc
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.9. | 
| 4 | 
            +
              version: 1.9.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: 2025- | 
| 11 | 
            +
            date: 2025-04-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: base64
         |