html2doc 1.0.3 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +42 -0
- data/README.adoc +1 -3
- data/html2doc.gemspec +3 -2
- data/lib/html2doc/math.rb +89 -5
- data/lib/html2doc/mime.rb +3 -3
- data/lib/html2doc/mml2omml.xsl +35 -7
- data/lib/html2doc/version.rb +1 -1
- data/spec/html2doc_spec.rb +58 -6
- metadata +25 -14
- data/.github/workflows/macos.yml +0 -39
- data/.github/workflows/ubuntu.yml +0 -53
- data/.github/workflows/windows.yml +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca7f6e33369a6f035f99d6189d72ef452e512af530b5dfea77b38a1c1104c8ee
|
4
|
+
data.tar.gz: 24aea1bed699c0a6e3f896e5a3807dad1aaf2436aea8019a50d1a250b1608796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc5ada9a3d07d80abd1c95b5abb9b9261b512b33f6a09a8a22edd107c206da50fdef555a394caa00fd5b96cc7eae412dc0ae78c532ac5b5aa8c53da1d6d725d4
|
7
|
+
data.tar.gz: 9aaafdc1b5e53cc1295e5ea6e305f6ebdcf3b0efb5b1d49ddc7028d8f24b9f2d66a2c973f145832f519ce58b6a0ab3b20f48cc927eaa9ed4d75ed06aa9466154
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
continue-on-error: ${{ matrix.experimental }}
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
+
experimental: [ false ]
|
22
|
+
include:
|
23
|
+
- ruby: '3.0'
|
24
|
+
os: 'ubuntu-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: '3.0'
|
27
|
+
os: 'windows-latest'
|
28
|
+
experimental: true
|
29
|
+
- ruby: '3.0'
|
30
|
+
os: 'macos-latest'
|
31
|
+
experimental: true
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
with:
|
35
|
+
submodules: true
|
36
|
+
|
37
|
+
- uses: ruby/setup-ruby@v1
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby }}
|
40
|
+
bundler-cache: true
|
41
|
+
|
42
|
+
- run: bundle exec rake
|
data/README.adoc
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
https://github.com/metanorma/html2doc/workflows/main/badge.svg
|
4
4
|
|
5
5
|
image:https://img.shields.io/gem/v/html2doc.svg["Gem Version", link="https://rubygems.org/gems/html2doc"]
|
6
|
-
image:https://github.com/metanorma/html2doc/workflows/
|
7
|
-
image:https://github.com/metanorma/html2doc/workflows/macos/badge.svg["OSX Build Status", link="https://github.com/metanorma/html2doc/actions?query=workflow%3Amacos"]
|
8
|
-
image:https://github.com/metanorma/html2doc/workflows/windows/badge.svg["Windows Build Status", link="https://github.com/metanorma/html2doc/actions?query=workflow%3Awindows"]
|
6
|
+
image:https://github.com/metanorma/html2doc/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/html2doc/actions?workflow=rake"]
|
9
7
|
image:https://codeclimate.com/github/metanorma/html2doc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/html2doc"]
|
10
8
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/html2doc.svg["Pull Requests", link="https://github.com/metanorma/html2doc/pulls"]
|
11
9
|
image:https://img.shields.io/github/commits-since/metanorma/html2doc/latest.svg["Commits since latest",link="https://github.com/metanorma/html2doc/releases"]
|
data/html2doc.gemspec
CHANGED
@@ -28,10 +28,11 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
29
29
|
spec.add_dependency "image_size"
|
30
30
|
spec.add_dependency "mime-types"
|
31
|
-
spec.add_dependency "nokogiri", "
|
31
|
+
spec.add_dependency "nokogiri", "~> 1.10.4"
|
32
32
|
spec.add_dependency "thread_safe"
|
33
33
|
spec.add_dependency "uuidtools"
|
34
|
-
spec.add_dependency "asciimath", "~> 2.0.
|
34
|
+
spec.add_dependency "asciimath", "~> 2.0.2"
|
35
|
+
spec.add_dependency "plane1converter", "~> 0.0.1"
|
35
36
|
|
36
37
|
spec.add_development_dependency "byebug", "~> 9.1"
|
37
38
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
data/lib/html2doc/math.rb
CHANGED
@@ -2,6 +2,7 @@ require "uuidtools"
|
|
2
2
|
require "asciimath"
|
3
3
|
require "htmlentities"
|
4
4
|
require "nokogiri"
|
5
|
+
require "plane1converter"
|
5
6
|
|
6
7
|
module Html2Doc
|
7
8
|
@xsltemplate =
|
@@ -9,8 +10,15 @@ module Html2Doc
|
|
9
10
|
encoding: "utf-8"))
|
10
11
|
|
11
12
|
def self.asciimath_to_mathml1(x)
|
12
|
-
|
13
|
-
|
13
|
+
begin
|
14
|
+
AsciiMath::MathMLBuilder.new(:msword => true).append_expression(
|
15
|
+
AsciiMath.parse(HTMLEntities.new.decode(x)).ast).to_s.
|
16
|
+
gsub(/<math>/, "<math xmlns='http://www.w3.org/1998/Math/MathML'>")
|
17
|
+
rescue StandardError => e
|
18
|
+
puts "parsing: #{x}"
|
19
|
+
puts e.message
|
20
|
+
raise e
|
21
|
+
end
|
14
22
|
end
|
15
23
|
|
16
24
|
def self.asciimath_to_mathml(doc, delims)
|
@@ -24,17 +32,93 @@ module Html2Doc
|
|
24
32
|
end.join
|
25
33
|
end
|
26
34
|
|
35
|
+
def self.unwrap_accents(doc)
|
36
|
+
doc.xpath("//*[@accent = 'true']").each do |x|
|
37
|
+
x.elements.length > 1 or next
|
38
|
+
x.elements[1].name == "mrow" and
|
39
|
+
x.elements[1].replace(x.elements[1].children)
|
40
|
+
end
|
41
|
+
doc
|
42
|
+
end
|
43
|
+
|
27
44
|
# random fixes to MathML input that OOXML needs to render properly
|
28
45
|
def self.ooxml_cleanup(m, docnamespaces)
|
46
|
+
m = unwrap_accents(mathml_preserve_space(
|
47
|
+
mathml_insert_rows(m, docnamespaces), docnamespaces))
|
48
|
+
m.add_namespace(nil, "http://www.w3.org/1998/Math/MathML")
|
49
|
+
m
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.mathml_insert_rows(m, docnamespaces)
|
29
53
|
m.xpath(%w(msup msub msubsup munder mover munderover).
|
30
54
|
map { |m| ".//xmlns:#{m}" }.join(" | "), docnamespaces).each do |x|
|
31
55
|
next unless x.next_element && x.next_element != "mrow"
|
32
56
|
x.next_element.wrap("<mrow/>")
|
33
57
|
end
|
34
|
-
m.add_namespace(nil, "http://www.w3.org/1998/Math/MathML")
|
35
58
|
m
|
36
59
|
end
|
37
60
|
|
61
|
+
def self.mathml_preserve_space(m, docnamespaces)
|
62
|
+
m.xpath(".//xmlns:mtext", docnamespaces).each do |x|
|
63
|
+
x.children = x.children.to_xml.gsub(/^\s/, " ").gsub(/\s$/, " ")
|
64
|
+
end
|
65
|
+
m
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.unitalic(m)
|
69
|
+
m.xpath(".//xmlns:r[xmlns:rPr[not(xmlns:scr)]/xmlns:sty[@m:val = 'p']]").each do |x|
|
70
|
+
x.wrap("<span style='font-style:normal;'></span>")
|
71
|
+
end
|
72
|
+
m.xpath(".//xmlns:r[xmlns:rPr[not(xmlns:scr)]/xmlns:sty[@m:val = 'bi']]").each do |x|
|
73
|
+
x.wrap("<span class='nostem' style='font-weight:bold;'><em></em></span>")
|
74
|
+
end
|
75
|
+
m.xpath(".//xmlns:r[xmlns:rPr[not(xmlns:scr)]/xmlns:sty[@m:val = 'i']]").each do |x|
|
76
|
+
x.wrap("<span class='nostem'><em></em></span>")
|
77
|
+
end
|
78
|
+
m.xpath(".//xmlns:r[xmlns:rPr[not(xmlns:scr)]/xmlns:sty[@m:val = 'b']]").each do |x|
|
79
|
+
x.wrap("<span style='font-style:normal;font-weight:bold;'></span>")
|
80
|
+
end
|
81
|
+
m.xpath(".//xmlns:r[xmlns:rPr/xmlns:scr[@m:val = 'monospace']]").each do |x|
|
82
|
+
toPlane1(x, :monospace)
|
83
|
+
end
|
84
|
+
m.xpath(".//xmlns:r[xmlns:rPr/xmlns:scr[@m:val = 'double-struck']]").each do |x|
|
85
|
+
toPlane1(x, :doublestruck)
|
86
|
+
end
|
87
|
+
m.xpath(".//xmlns:r[xmlns:rPr[not(xmlns:sty) or xmlns:sty/@m:val = 'p']/xmlns:scr[@m:val = 'script']]").each do |x|
|
88
|
+
toPlane1(x, :script)
|
89
|
+
end
|
90
|
+
m.xpath(".//xmlns:r[xmlns:rPr[xmlns:sty/@m:val = 'b']/xmlns:scr[@m:val = 'script']]").each do |x|
|
91
|
+
toPlane1(x, :scriptbold)
|
92
|
+
end
|
93
|
+
m.xpath(".//xmlns:r[xmlns:rPr[not(xmlns:sty) or xmlns:sty/@m:val = 'p']/xmlns:scr[@m:val = 'fraktur']]").each do |x|
|
94
|
+
toPlane1(x, :fraktur)
|
95
|
+
end
|
96
|
+
m.xpath(".//xmlns:r[xmlns:rPr[xmlns:sty/@m:val = 'b']/xmlns:scr[@m:val = 'fraktur']]").each do |x|
|
97
|
+
toPlane1(x, :frakturbold)
|
98
|
+
end
|
99
|
+
m.xpath(".//xmlns:r[xmlns:rPr[not(xmlns:sty) or xmlns:sty/@m:val = 'p']/xmlns:scr[@m:val = 'sans-serif']]").each do |x|
|
100
|
+
toPlane1(x, :sans)
|
101
|
+
end
|
102
|
+
m.xpath(".//xmlns:r[xmlns:rPr[xmlns:sty/@m:val = 'b']/xmlns:scr[@m:val = 'sans-serif']]").each do |x|
|
103
|
+
toPlane1(x, :sansbold)
|
104
|
+
end
|
105
|
+
m.xpath(".//xmlns:r[xmlns:rPr[xmlns:sty/@m:val = 'i']/xmlns:scr[@m:val = 'sans-serif']]").each do |x|
|
106
|
+
toPlane1(x, :sansitalic)
|
107
|
+
end
|
108
|
+
m.xpath(".//xmlns:r[xmlns:rPr[xmlns:sty/@m:val = 'bi']/xmlns:scr[@m:val = 'sans-serif']]").each do |x|
|
109
|
+
toPlane1(x, :sansbolditalic)
|
110
|
+
end
|
111
|
+
m
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.toPlane1(x, font)
|
115
|
+
x.traverse do |n|
|
116
|
+
next unless n.text?
|
117
|
+
n.replace(Plane1Converter.conv(HTMLEntities.new.decode(n.text), font))
|
118
|
+
end
|
119
|
+
x
|
120
|
+
end
|
121
|
+
|
38
122
|
def self.mathml_to_ooml(docxml)
|
39
123
|
docnamespaces = docxml.collect_namespaces
|
40
124
|
m = docxml.xpath("//*[local-name() = 'math']")
|
@@ -44,10 +128,10 @@ module Html2Doc
|
|
44
128
|
element = ooxml_cleanup(x, docnamespaces)
|
45
129
|
doc = Nokogiri::XML::Document::new()
|
46
130
|
doc.root = element
|
47
|
-
ooxml = (esc_space(@xsltemplate.transform(doc))).to_s.
|
131
|
+
ooxml = (unitalic(esc_space(@xsltemplate.transform(doc)))).to_s.
|
48
132
|
gsub(/<\?[^>]+>\s*/, "").
|
49
133
|
gsub(/ xmlns(:[^=]+)?="[^"]+"/, "").
|
50
|
-
gsub(%r{<(/)?([a-z])}, "<\\1m:\\2")
|
134
|
+
gsub(%r{<(/)?(?!span)(?!em)([a-z])}, "<\\1m:\\2")
|
51
135
|
ooxml = uncenter(x, ooxml)
|
52
136
|
x.swap(ooxml)
|
53
137
|
end
|
data/lib/html2doc/mime.rb
CHANGED
@@ -68,7 +68,7 @@ module Html2Doc
|
|
68
68
|
realSize = ImageSize.path(path).size
|
69
69
|
s = [i["width"].to_i, i["height"].to_i]
|
70
70
|
s = realSize if s[0].zero? && s[1].zero?
|
71
|
-
return [nil, nil] if realSize[0].nil? || realSize[1].nil?
|
71
|
+
return [nil, nil] if realSize.nil? || realSize[0].nil? || realSize[1].nil?
|
72
72
|
s[1] = s[0] * realSize[1] / realSize[0] if s[1].zero? && !s[0].zero?
|
73
73
|
s[0] = s[1] * realSize[0] / realSize[1] if s[0].zero? && !s[1].zero?
|
74
74
|
s = [(s[0] * maxheight / s[1]).ceil, maxheight] if s[1] > maxheight
|
@@ -92,7 +92,7 @@ module Html2Doc
|
|
92
92
|
next unless i.element? && %w(img v:imagedata).include?(i.name)
|
93
93
|
#warnsvg(i["src"])
|
94
94
|
next if /^http/.match i["src"]
|
95
|
-
next if %r{^data:image/[^;]+;base64}.match i["src"]
|
95
|
+
next if %r{^data:(image|application)/[^;]+;base64}.match i["src"]
|
96
96
|
local_filename = %r{^([A-Z]:)?/}.match(i["src"]) ? i["src"] :
|
97
97
|
File.join(localdir, i["src"])
|
98
98
|
new_filename = "#{mkuuid}#{File.extname(i["src"])}"
|
@@ -113,7 +113,7 @@ module Html2Doc
|
|
113
113
|
|
114
114
|
def self.header_image_cleanup1(a, dir, filename, localdir)
|
115
115
|
if a.size == 2 && !(/ src="https?:/.match a[1]) &&
|
116
|
-
!(%r{ src="data:image/[^;]+;base64}.match a[1])
|
116
|
+
!(%r{ src="data:(image|application)/[^;]+;base64}.match a[1])
|
117
117
|
m = / src=['"](?<src>[^"']+)['"]/.match a[1]
|
118
118
|
#warnsvg(m[:src])
|
119
119
|
m2 = /\.(?<suffix>[a-zA-Z_0-9]+)$/.match m[:src]
|
data/lib/html2doc/mml2omml.xsl
CHANGED
@@ -878,9 +878,21 @@
|
|
878
878
|
</xsl:otherwise>
|
879
879
|
</xsl:choose>
|
880
880
|
</xsl:if>
|
881
|
-
|
881
|
+
</xsl:variable>
|
882
|
+
<!-- NN 20200831 https://github.com/metanorma/metanorma-nist/issues/155 Read in ancestor mstyle -->
|
883
|
+
<xsl:variable name="mathvariant2">
|
884
|
+
<xsl:choose>
|
885
|
+
<xsl:when test="$mathvariant=''">
|
886
|
+
<xsl:value-of select="$ndCur/ancestor::mml:mstyle[@mathvariant][1]/@mathvariant"/>
|
887
|
+
</xsl:when>
|
888
|
+
<xsl:otherwise>
|
889
|
+
<xsl:value-of select="$mathvariant"/>
|
890
|
+
</xsl:otherwise>
|
891
|
+
</xsl:choose>
|
892
|
+
</xsl:variable>
|
893
|
+
<!-- END NN -->
|
882
894
|
<xsl:call-template name="CreateMathRPR">
|
883
|
-
<xsl:with-param name="mathvariant" select="$
|
895
|
+
<xsl:with-param name="mathvariant" select="$mathvariant2"/>
|
884
896
|
<xsl:with-param name="fontstyle" select="$fontstyle"/>
|
885
897
|
<xsl:with-param name="fontweight" select="$fontweight"/>
|
886
898
|
<xsl:with-param name="ndCur" select="$ndCur"/>
|
@@ -905,7 +917,7 @@
|
|
905
917
|
<xsl:with-param name="fontweight" select="$fontweight"/>
|
906
918
|
<xsl:with-param name="ndCur" select="$ndCur"/>
|
907
919
|
</xsl:call-template>
|
908
|
-
|
920
|
+
</xsl:variable>
|
909
921
|
<xsl:if test="$fLit=1 or $fNor=1 or ($sFontCur!='italic' and $sFontCur!='')">
|
910
922
|
<rPr>
|
911
923
|
<xsl:if test="$fNor=1">
|
@@ -919,7 +931,7 @@
|
|
919
931
|
<xsl:with-param name="fNor" select="$fNor"/>
|
920
932
|
</xsl:call-template>
|
921
933
|
</rPr>
|
922
|
-
|
934
|
+
</xsl:if>
|
923
935
|
</xsl:template>
|
924
936
|
|
925
937
|
<!-- %%Template: GetFontCur
|
@@ -935,8 +947,10 @@
|
|
935
947
|
</xsl:when>
|
936
948
|
<xsl:when test="not($ndCur)">
|
937
949
|
<xsl:value-of select="'italic'"/>
|
938
|
-
|
939
|
-
|
950
|
+
</xsl:when>
|
951
|
+
<!--<xsl:when test="$ndCur/self::mml:mi and (string-length(normalize-space($ndCur)) <= 1) or $ndCur/self::mml:mn and string(number($ndCur/text()))!='NaN' or $ndCur/self::mml:mo">-->
|
952
|
+
<!-- https://github.com/metanorma/metanorma-nist/issues/155 : DO NOT italicise mml:mo -->
|
953
|
+
<xsl:when test="$ndCur/self::mml:mi and (string-length(normalize-space($ndCur)) <= 1) or $ndCur/self::mml:mn and string(number($ndCur/text()))!='NaN'">
|
940
954
|
|
941
955
|
<!-- The default for the above three cases is fontstyle=italic fontweight=normal.-->
|
942
956
|
<xsl:choose>
|
@@ -1000,6 +1014,12 @@
|
|
1000
1014
|
</sty>
|
1001
1015
|
</xsl:when>
|
1002
1016
|
<xsl:when test="$font='italic'">
|
1017
|
+
<!-- NN 20200901 https://github.com/metanorma/metanorma-itu/issues/173 italic needs to be added explicitly to mtext -->
|
1018
|
+
<xsl:if test="$fNor=1">
|
1019
|
+
<sty>
|
1020
|
+
<xsl:attribute name="m:val">i</xsl:attribute>
|
1021
|
+
</sty>
|
1022
|
+
</xsl:if>
|
1003
1023
|
</xsl:when>
|
1004
1024
|
<xsl:when test="$font='script'">
|
1005
1025
|
<scr>
|
@@ -1067,8 +1087,16 @@
|
|
1067
1087
|
<xsl:attribute name="m:val">bi</xsl:attribute>
|
1068
1088
|
</sty>
|
1069
1089
|
</xsl:when>
|
1070
|
-
<xsl:when test="$font='monospace'"
|
1090
|
+
<xsl:when test="$font='monospace'">
|
1071
1091
|
<!-- We can't do monospace, so leave empty -->
|
1092
|
+
<!-- NN 2020 https://github.com/metanorma/html2doc/issues/47 no, we will -->
|
1093
|
+
<scr>
|
1094
|
+
<xsl:attribute name="m:val">monospace</xsl:attribute>
|
1095
|
+
</scr>
|
1096
|
+
<sty>
|
1097
|
+
<xsl:attribute name="m:val">p</xsl:attribute>
|
1098
|
+
</sty>
|
1099
|
+
</xsl:when>
|
1072
1100
|
<xsl:when test="$font='bold'">
|
1073
1101
|
<sty>
|
1074
1102
|
<xsl:attribute name="m:val">b</xsl:attribute>
|
data/lib/html2doc/version.rb
CHANGED
data/spec/html2doc_spec.rb
CHANGED
@@ -374,7 +374,21 @@ RSpec.describe Html2Doc do
|
|
374
374
|
#{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
|
375
375
|
#{word_body(%{
|
376
376
|
<div><m:oMath>
|
377
|
-
<m:nary><m:naryPr><m:chr m:val="∑"></m:chr><m:limLoc m:val="undOvr"></m:limLoc><m:grow m:val="on"></m:grow><m:subHide m:val="off"></m:subHide><m:supHide m:val="off"></m:supHide></m:naryPr><m:sub><m:r><m:t>i=1</m:t></m:r></m:sub><m:sup><m:r><m:t>n</m:t></m:r></m:sup><m:e><m:sSup><m:e><m:r><m:t>i</m:t></m:r></m:e><m:sup><m:r><m:t>3</m:t></m:r></m:sup></m:sSup></m:e></m:nary><m:r><m:t>=</m:t></m:r><m:sSup><m:e><m:
|
377
|
+
<m:nary><m:naryPr><m:chr m:val="∑"></m:chr><m:limLoc m:val="undOvr"></m:limLoc><m:grow m:val="on"></m:grow><m:subHide m:val="off"></m:subHide><m:supHide m:val="off"></m:supHide></m:naryPr><m:sub><m:r><m:t>i=1</m:t></m:r></m:sub><m:sup><m:r><m:t>n</m:t></m:r></m:sup><m:e><m:sSup><m:e><m:r><m:t>i</m:t></m:r></m:e><m:sup><m:r><m:t>3</m:t></m:r></m:sup></m:sSup></m:e></m:nary><span style="font-style:normal;"><m:r><m:rPr><m:sty m:val="p"></m:sty></m:rPr><m:t>=</m:t></m:r></span><m:sSup><m:e><m:d><m:dPr><m:sepChr m:val=","></m:sepChr></m:dPr><m:e><m:f><m:fPr><m:type m:val="bar"></m:type></m:fPr><m:num><m:r><m:t>n</m:t></m:r><m:d><m:dPr><m:sepChr m:val=","></m:sepChr></m:dPr><m:e><m:r><m:t>n+1</m:t></m:r></m:e></m:d></m:num><m:den><m:r><m:t>2</m:t></m:r></m:den></m:f></m:e></m:d></m:e><m:sup><m:r><m:t>2</m:t></m:r></m:sup></m:sSup><m:r><m:rPr><m:nor></m:nor></m:rPr><m:t>"integer"</m:t></m:r><span style="font-style:normal;"><m:r><m:rPr><m:sty m:val="p"></m:sty></m:rPr><m:t>)</m:t></m:r></span>
|
378
|
+
</m:oMath>
|
379
|
+
</div>}, '<div style="mso-element:footnote-list"/>')}
|
380
|
+
#{WORD_FTR1}
|
381
|
+
OUTPUT
|
382
|
+
end
|
383
|
+
|
384
|
+
it "processes mstyle" do
|
385
|
+
Html2Doc.process(html_input(%[<div>{{bb (-log_2 (p_u)) bb "BB" bbb "BBB" cc "CC" bcc "BCC" tt "TT" fr "FR" bfr "BFR" sf "SF" bsf "BSFα" sfi "SFI" sfbi "SFBIα" bii "BII" ii "II"}}</div>]), filename: "test", asciimathdelims: ["{{", "}}"])
|
386
|
+
expect(guid_clean(File.read("test.doc", encoding: "utf-8"))).
|
387
|
+
to match_fuzzy(<<~OUTPUT)
|
388
|
+
#{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
|
389
|
+
#{word_body(%{
|
390
|
+
<div><m:oMath>
|
391
|
+
<span style="font-style:normal;font-weight:bold;"><m:r><m:rPr><m:sty m:val="b"></m:sty></m:rPr><m:t>−</m:t></m:r></span><m:sSub><m:e><span style="font-style:normal;font-weight:bold;"><m:r><m:rPr><m:sty m:val="b"></m:sty></m:rPr><m:t>log</m:t></m:r></span></m:e><m:sub><span style="font-style:normal;font-weight:bold;"><m:r><m:rPr><m:sty m:val="b"></m:sty></m:rPr><m:t>2</m:t></m:r></span></m:sub></m:sSub><m:d><m:dPr><m:sepChr m:val=","></m:sepChr></m:dPr><m:e><m:sSub><m:e><span style="font-style:normal;font-weight:bold;"><m:r><m:rPr><m:sty m:val="b"></m:sty></m:rPr><m:t>p</m:t></m:r></span></m:e><m:sub><span style="font-style:normal;font-weight:bold;"><m:r><m:rPr><m:sty m:val="b"></m:sty></m:rPr><m:t>u</m:t></m:r></span></m:sub></m:sSub></m:e></m:d><span style="font-style:normal;font-weight:bold;"><m:r><m:rPr><m:nor></m:nor><m:sty m:val="b"></m:sty></m:rPr><m:t>BB</m:t></m:r></span><m:r><m:rPr><m:nor></m:nor><m:scr m:val="double-struck"></m:scr><m:sty m:val="p"></m:sty></m:rPr><m:t>𝔹𝔹𝔹</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="script"></m:scr></m:rPr><m:t>𝒞𝒞</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="script"></m:scr><m:sty m:val="b"></m:sty></m:rPr><m:t>𝓑𝓒𝓒</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="monospace"></m:scr><m:sty m:val="p"></m:sty></m:rPr><m:t>𝚃𝚃</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="fraktur"></m:scr><m:sty m:val="p"></m:sty></m:rPr><m:t>𝔉ℜ</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="fraktur"></m:scr><m:sty m:val="b"></m:sty></m:rPr><m:t>𝕭𝕱𝕽</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="sans-serif"></m:scr><m:sty m:val="p"></m:sty></m:rPr><m:t>𝖲𝖥</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="sans-serif"></m:scr><m:sty m:val="b"></m:sty></m:rPr><m:t>𝗕𝗦𝗙𝝰</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="sans-serif"></m:scr></m:rPr><m:t>𝖲𝖥𝖨</m:t></m:r><m:r><m:rPr><m:nor></m:nor><m:scr m:val="sans-serif"></m:scr><m:sty m:val="bi"></m:sty></m:rPr><m:t>𝙎𝙁𝘽𝙄𝞪</m:t></m:r><span class="nostem" style="font-weight:bold;"><em></em><m:r><m:rPr><m:nor></m:nor><m:sty m:val="bi"></m:sty></m:rPr><m:t>BII</m:t></m:r></span><span class="nostem"><em></em><m:r><m:rPr><m:nor></m:nor><m:sty m:val="i"></m:sty></m:rPr><m:t>II</m:t></m:r></span>
|
378
392
|
</m:oMath>
|
379
393
|
</div>}, '<div style="mso-element:footnote-list"/>')}
|
380
394
|
#{WORD_FTR1}
|
@@ -386,11 +400,41 @@ RSpec.describe Html2Doc do
|
|
386
400
|
expect(guid_clean(File.read("test.doc", encoding: "utf-8"))).
|
387
401
|
to match_fuzzy(<<~OUTPUT)
|
388
402
|
#{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
|
389
|
-
#{word_body(
|
403
|
+
#{word_body('
|
390
404
|
<div><m:oMath>
|
391
|
-
<m:r><m:t>text</m:t></m:r><m:r><m:rPr><m:nor></m:nor></m:rPr><m:t
|
405
|
+
<m:r><m:t>text</m:t></m:r><m:r><m:rPr><m:nor></m:nor></m:rPr><m:t> integer </m:t></m:r><span style="font-style:normal;"><m:r><m:rPr><m:sty m:val="p"></m:sty></m:rPr><m:t>)</m:t></m:r></span>
|
392
406
|
</m:oMath>
|
393
|
-
</div>
|
407
|
+
</div>', '<div style="mso-element:footnote-list"/>')}
|
408
|
+
#{WORD_FTR1}
|
409
|
+
OUTPUT
|
410
|
+
end
|
411
|
+
|
412
|
+
it "processes spaces in MathML mtext" do
|
413
|
+
Html2Doc.process(html_input("<div><math xmlns='http://www.w3.org/1998/Math/MathML'>
|
414
|
+
<mrow><mi>H</mi><mtext> original </mtext><mi>J</mi></mrow>
|
415
|
+
</math></div>"), filename: "test", asciimathdelims: ["{{", "}}"])
|
416
|
+
expect(guid_clean(File.read("test.doc", encoding: "utf-8"))).
|
417
|
+
to match_fuzzy(<<~OUTPUT)
|
418
|
+
#{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
|
419
|
+
#{word_body('<div><m:oMath>
|
420
|
+
<m:r><m:t>H</m:t></m:r><m:r><m:rPr><m:nor></m:nor></m:rPr><m:t> original </m:t></m:r><m:r><m:t>J</m:t></m:r>
|
421
|
+
</m:oMath>
|
422
|
+
</div>', '<div style="mso-element:footnote-list"/>')}
|
423
|
+
#{WORD_FTR1}
|
424
|
+
OUTPUT
|
425
|
+
end
|
426
|
+
|
427
|
+
it "unwraps accent in MathML" do
|
428
|
+
Html2Doc.process(html_input("<div><math xmlns='http://www.w3.org/1998/Math/MathML'>
|
429
|
+
<mover accent='true'><mrow><mi>p</mi></mrow><mrow><mo>^</mo></mrow></mover>
|
430
|
+
</math></div>"), filename: "test", asciimathdelims: ["{{", "}}"])
|
431
|
+
expect(guid_clean(File.read("test.doc", encoding: "utf-8"))).
|
432
|
+
to match_fuzzy(<<~OUTPUT)
|
433
|
+
#{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
|
434
|
+
#{word_body('<div><m:oMath>
|
435
|
+
<m:acc><m:accPr><m:chr m:val="^"></m:chr></m:accPr><m:e><m:r><m:t>p</m:t></m:r></m:e></m:acc>
|
436
|
+
</m:oMath>
|
437
|
+
</div>', '<div style="mso-element:footnote-list"/>')}
|
394
438
|
#{WORD_FTR1}
|
395
439
|
OUTPUT
|
396
440
|
end
|
@@ -402,7 +446,7 @@ RSpec.describe Html2Doc do
|
|
402
446
|
#{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
|
403
447
|
#{word_body(%{
|
404
448
|
<div style="text-align:left;"><m:oMathPara><m:oMathParaPr><m:jc m:val="left"/></m:oMathParaPr><m:oMath>
|
405
|
-
<m:nary><m:naryPr><m:chr m:val="∑"></m:chr><m:limLoc m:val="undOvr"></m:limLoc><m:grow m:val="on"></m:grow><m:subHide m:val="off"></m:subHide><m:supHide m:val="off"></m:supHide></m:naryPr><m:sub><m:r><m:t>i=1</m:t></m:r></m:sub><m:sup><m:r><m:t>n</m:t></m:r></m:sup><m:e><m:sSup><m:e><m:r><m:t>i</m:t></m:r></m:e><m:sup><m:r><m:t>3</m:t></m:r></m:sup></m:sSup></m:e></m:nary><m:r><m:t>=</m:t></m:r><m:sSup><m:e><m:
|
449
|
+
<m:nary><m:naryPr><m:chr m:val="∑"></m:chr><m:limLoc m:val="undOvr"></m:limLoc><m:grow m:val="on"></m:grow><m:subHide m:val="off"></m:subHide><m:supHide m:val="off"></m:supHide></m:naryPr><m:sub><m:r><m:t>i=1</m:t></m:r></m:sub><m:sup><m:r><m:t>n</m:t></m:r></m:sup><m:e><m:sSup><m:e><m:r><m:t>i</m:t></m:r></m:e><m:sup><m:r><m:t>3</m:t></m:r></m:sup></m:sSup></m:e></m:nary><span style="font-style:normal;"><m:r><m:rPr><m:sty m:val="p"></m:sty></m:rPr><m:t>=</m:t></m:r></span><m:sSup><m:e><m:d><m:dPr><m:sepChr m:val=","></m:sepChr></m:dPr><m:e><m:f><m:fPr><m:type m:val="bar"></m:type></m:fPr><m:num><m:r><m:t>n</m:t></m:r><m:d><m:dPr><m:sepChr m:val=","></m:sepChr></m:dPr><m:e><m:r><m:t>n+1</m:t></m:r></m:e></m:d></m:num><m:den><m:r><m:t>2</m:t></m:r></m:den></m:f></m:e></m:d></m:e><m:sup><m:r><m:t>2</m:t></m:r></m:sup></m:sSup>
|
406
450
|
</m:oMath>
|
407
451
|
</m:oMathPara></div>}, '<div style="mso-element:footnote-list"/>')}
|
408
452
|
#{WORD_FTR1}
|
@@ -416,13 +460,21 @@ RSpec.describe Html2Doc do
|
|
416
460
|
#{WORD_HDR} #{DEFAULT_STYLESHEET} #{WORD_HDR_END}
|
417
461
|
#{word_body(%{
|
418
462
|
<div style="text-align:right;"><m:oMathPara><m:oMathParaPr><m:jc m:val="right"/></m:oMathParaPr><m:oMath>
|
419
|
-
<m:nary><m:naryPr><m:chr m:val="∑"></m:chr><m:limLoc m:val="undOvr"></m:limLoc><m:grow m:val="on"></m:grow><m:subHide m:val="off"></m:subHide><m:supHide m:val="off"></m:supHide></m:naryPr><m:sub><m:r><m:t>i=1</m:t></m:r></m:sub><m:sup><m:r><m:t>n</m:t></m:r></m:sup><m:e><m:sSup><m:e><m:r><m:t>i</m:t></m:r></m:e><m:sup><m:r><m:t>3</m:t></m:r></m:sup></m:sSup></m:e></m:nary><m:r><m:t>=</m:t></m:r><m:sSup><m:e><m:
|
463
|
+
<m:nary><m:naryPr><m:chr m:val="∑"></m:chr><m:limLoc m:val="undOvr"></m:limLoc><m:grow m:val="on"></m:grow><m:subHide m:val="off"></m:subHide><m:supHide m:val="off"></m:supHide></m:naryPr><m:sub><m:r><m:t>i=1</m:t></m:r></m:sub><m:sup><m:r><m:t>n</m:t></m:r></m:sup><m:e><m:sSup><m:e><m:r><m:t>i</m:t></m:r></m:e><m:sup><m:r><m:t>3</m:t></m:r></m:sup></m:sSup></m:e></m:nary><span style="font-style:normal;"><m:r><m:rPr><m:sty m:val="p"></m:sty></m:rPr><m:t>=</m:t></m:r></span><m:sSup><m:e><m:d><m:dPr><m:sepChr m:val=","></m:sepChr></m:dPr><m:e><m:f><m:fPr><m:type m:val="bar"></m:type></m:fPr><m:num><m:r><m:t>n</m:t></m:r><m:d><m:dPr><m:sepChr m:val=","></m:sepChr></m:dPr><m:e><m:r><m:t>n+1</m:t></m:r></m:e></m:d></m:num><m:den><m:r><m:t>2</m:t></m:r></m:den></m:f></m:e></m:d></m:e><m:sup><m:r><m:t>2</m:t></m:r></m:sup></m:sSup>
|
420
464
|
</m:oMath>
|
421
465
|
</m:oMathPara></div>}, '<div style="mso-element:footnote-list"/>')}
|
422
466
|
#{WORD_FTR1}
|
423
467
|
OUTPUT
|
424
468
|
end
|
425
469
|
|
470
|
+
it "raises error in processing of broken AsciiMath" do
|
471
|
+
begin
|
472
|
+
expect{ Html2Doc.process(html_input(%[<div style='text-align:right;'>{{u_c = 6.6"unitsml(kHz)}}</div>]), filename: "test", asciimathdelims: ["{{", "}}"]) }.to output('parsing: u_c = 6.6"unitsml(kHz)').to_stderr
|
473
|
+
rescue StandardError
|
474
|
+
end
|
475
|
+
expect{ Html2Doc.process(html_input(%[<div style='text-align:right;'>{{u_c = 6.6"unitsml(kHz)}}</div>]), filename: "test", asciimathdelims: ["{{", "}}"]) }.to raise_error(StandardError)
|
476
|
+
end
|
477
|
+
|
426
478
|
it "wraps msup after munderover in MathML" do
|
427
479
|
Html2Doc.process(html_input("<div><math xmlns='http://www.w3.org/1998/Math/MathML'>
|
428
480
|
<munderover><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>0</mn></mrow><mrow><mi>n</mi></mrow></munderover><msup><mn>2</mn><mrow><mi>i</mi></mrow></msup></math></div>"), filename: "test", asciimathdelims: ["{{", "}}"])
|
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.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.10.4
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.10.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -100,14 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.0.
|
103
|
+
version: 2.0.2
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.0.2
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: plane1converter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.0.1
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: 0.0.1
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: byebug
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -259,9 +273,7 @@ extensions: []
|
|
259
273
|
extra_rdoc_files: []
|
260
274
|
files:
|
261
275
|
- ".gitattributes"
|
262
|
-
- ".github/workflows/
|
263
|
-
- ".github/workflows/ubuntu.yml"
|
264
|
-
- ".github/workflows/windows.yml"
|
276
|
+
- ".github/workflows/rake.yml"
|
265
277
|
- ".gitignore"
|
266
278
|
- ".hound.yml"
|
267
279
|
- ".oss-guides.rubocop.yml"
|
@@ -309,7 +321,7 @@ licenses:
|
|
309
321
|
- CC-BY-SA-3.0
|
310
322
|
- BSD-2-Clause
|
311
323
|
metadata: {}
|
312
|
-
post_install_message:
|
324
|
+
post_install_message:
|
313
325
|
rdoc_options: []
|
314
326
|
require_paths:
|
315
327
|
- lib
|
@@ -324,9 +336,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
324
336
|
- !ruby/object:Gem::Version
|
325
337
|
version: '0'
|
326
338
|
requirements: []
|
327
|
-
|
328
|
-
|
329
|
-
signing_key:
|
339
|
+
rubygems_version: 3.1.4
|
340
|
+
signing_key:
|
330
341
|
specification_version: 4
|
331
342
|
summary: Convert HTML document to Microsoft Word document
|
332
343
|
test_files: []
|
data/.github/workflows/macos.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: macos
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
paths-ignore:
|
10
|
-
- .github/workflows/ubuntu.yml
|
11
|
-
- .github/workflows/windows.yml
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test-macos:
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} macOS
|
16
|
-
runs-on: macos-latest
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
-
experimental: [false]
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
experimental: true
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@master
|
28
|
-
- name: Use Ruby
|
29
|
-
uses: actions/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
architecture: 'x64'
|
33
|
-
- name: Update gems
|
34
|
-
run: |
|
35
|
-
sudo gem install bundler --force
|
36
|
-
bundle install --jobs 4 --retry 3
|
37
|
-
- name: Run specs
|
38
|
-
run: |
|
39
|
-
bundle exec rake
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: ubuntu
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
tags:
|
9
|
-
- '*'
|
10
|
-
pull_request:
|
11
|
-
paths-ignore:
|
12
|
-
- .github/workflows/macos.yml
|
13
|
-
- .github/workflows/windows.yml
|
14
|
-
|
15
|
-
jobs:
|
16
|
-
test-linux:
|
17
|
-
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
continue-on-error: ${{ matrix.experimental }}
|
20
|
-
strategy:
|
21
|
-
fail-fast: false
|
22
|
-
matrix:
|
23
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
24
|
-
experimental: [false]
|
25
|
-
include:
|
26
|
-
- ruby: '2.7'
|
27
|
-
experimental: true
|
28
|
-
steps:
|
29
|
-
- uses: actions/checkout@master
|
30
|
-
- name: Use Ruby
|
31
|
-
uses: actions/setup-ruby@v1
|
32
|
-
with:
|
33
|
-
ruby-version: ${{ matrix.ruby }}
|
34
|
-
architecture: 'x64'
|
35
|
-
- name: Update gems
|
36
|
-
run: |
|
37
|
-
gem install bundler
|
38
|
-
bundle install --jobs 4 --retry 3
|
39
|
-
- name: Run specs
|
40
|
-
run: |
|
41
|
-
bundle exec rake
|
42
|
-
- name: Trigger dependent repositories
|
43
|
-
if: github.ref == 'refs/heads/master' && matrix.ruby == '2.6'
|
44
|
-
env:
|
45
|
-
GH_USERNAME: ${{ secrets.PAT_USERNAME }}
|
46
|
-
GH_ACCESS_TOKEN: ${{ secrets.PAT_TOKEN }}
|
47
|
-
run: |
|
48
|
-
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
49
|
-
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
50
|
-
for repo in $DEPENDENT_REPOS
|
51
|
-
do
|
52
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "{ \"ref\": \"${GITHUB_REF}\" }"
|
53
|
-
done
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: windows
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
paths-ignore:
|
10
|
-
- .github/workflows/macos.yml
|
11
|
-
- .github/workflows/ubuntu.yml
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test-windows:
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} Windows
|
16
|
-
runs-on: windows-latest
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
-
experimental: [false]
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
experimental: true
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@master
|
28
|
-
- name: Use Ruby
|
29
|
-
uses: actions/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
architecture: 'x64'
|
33
|
-
- name: Update gems
|
34
|
-
shell: pwsh
|
35
|
-
run: |
|
36
|
-
gem install bundler
|
37
|
-
bundle config --local path vendor/bundle
|
38
|
-
bundle install --jobs 4 --retry 3
|
39
|
-
- name: Run specs
|
40
|
-
run: |
|
41
|
-
bundle exec rake
|