metanorma-iso 1.9.4 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +41 -0
- data/Gemfile +3 -4
- data/Makefile +44 -0
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/lib/asciidoctor/iso/basicdoc.rng +32 -5
- data/lib/asciidoctor/iso/biblio.rng +2 -0
- data/lib/asciidoctor/iso/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/front.rb +9 -1
- data/lib/asciidoctor/iso/isodoc.rng +430 -76
- data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
- data/lib/asciidoctor/iso/isostandard.rng +9 -23
- data/lib/asciidoctor/iso/reqt.rng +24 -3
- data/lib/asciidoctor/iso/validate.rb +7 -7
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/isodoc/iso/html/isodoc.css +1 -2
- data/lib/isodoc/iso/html/isodoc.scss +1 -1
- data/lib/isodoc/iso/html/wordstyle.css +16 -4
- data/lib/isodoc/iso/html/wordstyle.scss +16 -4
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +200 -20
- data/lib/isodoc/iso/iso.international-standard.xsl +200 -20
- data/lib/isodoc/iso/presentation_xml_convert.rb +9 -10
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -89
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -3
- data/spec/asciidoctor/base_spec.rb +685 -178
- data/spec/asciidoctor/blank_spec.rb +38 -0
- data/spec/asciidoctor/blocks_spec.rb +22 -47
- data/spec/asciidoctor/cleanup_spec.rb +34 -20
- data/spec/asciidoctor/inline_spec.rb +10 -2
- data/spec/asciidoctor/refs_spec.rb +87 -4
- data/spec/asciidoctor/section_spec.rb +3 -3
- data/spec/isodoc/i18n_spec.rb +29 -15
- data/spec/isodoc/inline_spec.rb +56 -26
- data/spec/isodoc/section_spec.rb +1 -1
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/isodoc/terms_spec.rb +11 -11
- data/spec/isodoc/xref_spec.rb +1397 -1376
- data/spec/metanorma/processor_spec.rb +4 -1
- data/spec/spec_helper.rb +14 -1
- data/spec/vcr_cassettes/docrels.yml +783 -0
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +38 -19
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative "base_convert"
|
2
2
|
require "isodoc"
|
3
3
|
require_relative "init"
|
4
|
+
require_relative "word_cleanup"
|
4
5
|
|
5
6
|
module IsoDoc
|
6
7
|
module Iso
|
@@ -59,92 +60,11 @@ module IsoDoc
|
|
59
60
|
return if !stage.nil? && stage < 60
|
60
61
|
|
61
62
|
body.br **{ clear: "all", style: "page-break-before:left;"\
|
62
|
-
|
63
|
+
"mso-break-type:section-break" }
|
63
64
|
body.div **{ class: "colophon" } do |div|
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
67
|
-
def figure_cleanup(xml)
|
68
|
-
super
|
69
|
-
xml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
|
70
|
-
t["class"] = "figdl"
|
71
|
-
d = t.add_previous_sibling("<div class='figdl' "\
|
72
|
-
"style='page-break-after:avoid;'/>")
|
73
|
-
t.parent = d.first
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# force Annex h2 down to be p.h2Annex, so it is not picked up by ToC
|
78
|
-
def word_annex_cleanup1(docxml, lvl)
|
79
|
-
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
80
|
-
h2.name = "p"
|
81
|
-
h2["class"] = "h#{lvl}Annex"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def word_annex_cleanup(docxml)
|
86
|
-
(2..6).each { |i| word_annex_cleanup1(docxml, i) }
|
87
|
-
end
|
88
|
-
|
89
|
-
def word_annex_cleanup_h1(docxml)
|
90
|
-
docxml.xpath("//h1[@class = 'Annex']").each do |h|
|
91
|
-
h.name = "p"
|
92
|
-
h["class"] = "ANNEX"
|
93
|
-
end
|
94
|
-
%w(BiblioTitle ForewordTitle IntroTitle).each do |s|
|
95
|
-
docxml.xpath("//*[@class = '#{s}']").each do |h|
|
96
|
-
h.name = "p"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def style_cleanup(docxml)
|
102
|
-
word_annex_cleanup_h1(docxml)
|
103
|
-
style_cleanup1(docxml)
|
104
|
-
end
|
105
|
-
|
106
|
-
def style_cleanup1(docxml)
|
107
|
-
docxml.xpath("//*[@class = 'example']").each do |p|
|
108
|
-
p["class"] = "Example"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def authority_hdr_cleanup(docxml)
|
113
|
-
docxml&.xpath("//div[@class = 'boilerplate-license']")&.each do |d|
|
114
|
-
d.xpath(".//h1").each do |p|
|
115
|
-
p.name = "p"
|
116
|
-
p["class"] = "zzWarningHdr"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
docxml&.xpath("//div[@class = 'boilerplate-copyright']")&.each do |d|
|
120
|
-
d.xpath(".//h1").each do |p|
|
121
|
-
p.name = "p"
|
122
|
-
p["class"] = "zzCopyrightHdr"
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def authority_cleanup(docxml)
|
128
|
-
insert = docxml.at("//div[@id = 'boilerplate-license-destination']")
|
129
|
-
auth = docxml&.at("//div[@class = 'boilerplate-license']")&.remove
|
130
|
-
auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
|
131
|
-
auth and insert.children = auth
|
132
|
-
insert = docxml.at("//div[@id = 'boilerplate-copyright-destination']")
|
133
|
-
auth = docxml&.at("//div[@class = 'boilerplate-copyright']")&.remove
|
134
|
-
auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzCopyright" }
|
135
|
-
auth&.xpath(".//p[@id = 'boilerplate-message']")&.each { |p| p["class"] = "zzCopyright1" }
|
136
|
-
auth&.xpath(".//p[@id = 'boilerplate-address']")&.each { |p| p["class"] = "zzAddress" }
|
137
|
-
auth&.xpath(".//p[@id = 'boilerplate-place']")&.each { |p| p["class"] = "zzCopyright1" }
|
138
|
-
auth and insert.children = auth
|
139
|
-
end
|
140
|
-
|
141
|
-
def word_cleanup(docxml)
|
142
|
-
authority_hdr_cleanup(docxml)
|
143
|
-
super
|
144
|
-
style_cleanup(docxml)
|
145
|
-
docxml
|
146
|
-
end
|
147
|
-
|
148
68
|
def word_toc_preface(level)
|
149
69
|
<<~TOC.freeze
|
150
70
|
<span lang="EN-GB"><span
|
@@ -166,7 +86,7 @@ module IsoDoc
|
|
166
86
|
end
|
167
87
|
|
168
88
|
def bibliography(xml, out)
|
169
|
-
f = xml.at(ns(bibliography_xpath)) and f["hidden"] != "true" or return
|
89
|
+
(f = xml.at(ns(bibliography_xpath)) and f["hidden"] != "true") or return
|
170
90
|
page_break(out)
|
171
91
|
out.div do |div|
|
172
92
|
div.h1 **bibliography_attrs do |h1|
|
@@ -185,13 +105,16 @@ module IsoDoc
|
|
185
105
|
end
|
186
106
|
end
|
187
107
|
|
108
|
+
def definition_parse(node, out)
|
109
|
+
@definition = true
|
110
|
+
super
|
111
|
+
@definition = false
|
112
|
+
end
|
113
|
+
|
188
114
|
def para_class(node)
|
189
|
-
if
|
190
|
-
|
191
|
-
|
192
|
-
"ForewordText"
|
193
|
-
else
|
194
|
-
super
|
115
|
+
if @definition && !@in_footnote then "Definition"
|
116
|
+
elsif @foreword && !@in_footnote then "ForewordText"
|
117
|
+
else super
|
195
118
|
end
|
196
119
|
end
|
197
120
|
|
data/metanorma-iso.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["open.source@ribose.com"]
|
12
12
|
|
13
13
|
spec.summary = "metanorma-iso lets you write ISO standards "\
|
14
|
-
|
14
|
+
"in AsciiDoc."
|
15
15
|
spec.description = <<~DESCRIPTION
|
16
16
|
metanorma-iso lets you write ISO standards in AsciiDoc syntax.
|
17
17
|
|
@@ -29,8 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
31
31
|
|
32
|
-
spec.add_dependency "
|
33
|
-
spec.add_dependency "metanorma-standoc", "~> 1.10.0"
|
32
|
+
spec.add_dependency "metanorma-standoc", "~> 1.11.0"
|
34
33
|
spec.add_dependency "mnconvert", "~> 1.8.0"
|
35
34
|
spec.add_dependency "ruby-jing"
|
36
35
|
spec.add_dependency "tokenizer", "~> 0.3.0"
|
@@ -47,4 +46,6 @@ Gem::Specification.new do |spec|
|
|
47
46
|
spec.add_development_dependency "sassc", "2.4.0"
|
48
47
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
49
48
|
spec.add_development_dependency "timecop", "~> 0.9"
|
49
|
+
spec.add_development_dependency "vcr", "~> 5.0.0"
|
50
|
+
spec.add_development_dependency "webmock"
|
50
51
|
end
|