isodoc 1.5.0 → 1.5.5
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/rake.yml +11 -41
- data/.rubocop.yml +6 -2
- data/isodoc.gemspec +3 -2
- data/lib/isodoc/convert.rb +4 -0
- data/lib/isodoc/css.rb +6 -1
- data/lib/isodoc/function/blocks.rb +4 -0
- data/lib/isodoc/function/inline.rb +1 -1
- data/lib/isodoc/function/references.rb +1 -1
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/html_function/postprocess.rb +8 -5
- data/lib/isodoc/presentation_function/block.rb +16 -4
- data/lib/isodoc/presentation_function/inline.rb +14 -22
- data/lib/isodoc/presentation_function/section.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/inline.rb +6 -0
- data/lib/isodoc/word_function/postprocess.rb +16 -6
- data/lib/isodoc/xref.rb +1 -1
- data/lib/isodoc/xref/xref_gen.rb +16 -15
- data/lib/isodoc/xslfo_convert.rb +2 -0
- data/spec/assets/html_override.css +1 -0
- data/spec/assets/word_override.css +1 -0
- data/spec/isodoc/blocks_spec.rb +144 -1
- data/spec/isodoc/inline_spec.rb +4 -1
- data/spec/isodoc/postproc_spec.rb +6 -2
- data/spec/isodoc/presentation_xml_spec.rb +6 -2
- data/spec/isodoc/xref_spec.rb +16 -10
- metadata +25 -11
- data/.rubocop.ribose.yml +0 -65
- data/.rubocop.tb.yml +0 -650
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bdc454593acf1b0a4d0a9cc04a6338de5848e3e28b77a3fc22126d8c445f07b
|
4
|
+
data.tar.gz: d4e1a7f0db4f38fdb76eaae029a26fda9d04bb43a5d25d03ad82e7956e247c5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae8cdbb24965be799d0e8bf084dc56c7af1cd303981a3b151f039bc51184dec5792e6537641fad9f0dd5b7098262d961277a5f10a9eb0673e0739775baaaf74
|
7
|
+
data.tar.gz: e300abaa10548c18961d1aac9ab111c6cc392821d28d29c6083c2daab4dcef2a7b245858689995f7f0adb6afad35452707a4dbaaf60b63b463bf4f05305a4298
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,17 +16,17 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
19
|
+
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
22
|
include:
|
23
|
-
- ruby: '
|
23
|
+
- ruby: '3.0'
|
24
24
|
os: 'ubuntu-latest'
|
25
25
|
experimental: true
|
26
|
-
- ruby: '
|
26
|
+
- ruby: '3.0'
|
27
27
|
os: 'windows-latest'
|
28
28
|
experimental: true
|
29
|
-
- ruby: '
|
29
|
+
- ruby: '3.0'
|
30
30
|
os: 'macos-latest'
|
31
31
|
experimental: true
|
32
32
|
steps:
|
@@ -35,49 +35,19 @@ jobs:
|
|
35
35
|
- uses: ruby/setup-ruby@v1
|
36
36
|
with:
|
37
37
|
ruby-version: ${{ matrix.ruby }}
|
38
|
+
bundler-cache: true
|
38
39
|
|
39
|
-
- uses:
|
40
|
-
with:
|
41
|
-
path: vendor/bundle
|
42
|
-
key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
|
43
|
-
restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
|
44
|
-
|
45
|
-
- run: bundle config set path 'vendor/bundle'
|
46
|
-
|
47
|
-
- run: bundle install --jobs 4 --retry 3
|
48
|
-
|
49
|
-
- name: Install Inkscape macOS
|
50
|
-
if: matrix.os == 'macos-latest'
|
51
|
-
run: |
|
52
|
-
brew cask install inkscape
|
53
|
-
inkscape --version
|
54
|
-
|
55
|
-
- name: Install Inkscape Ubuntu
|
56
|
-
if: matrix.os == 'ubuntu-latest'
|
57
|
-
run: |
|
58
|
-
sudo add-apt-repository ppa:inkscape.dev/stable
|
59
|
-
sudo apt update
|
60
|
-
sudo apt install inkscape
|
61
|
-
inkscape --version
|
62
|
-
|
63
|
-
- name: Install Inkscape Windows
|
64
|
-
if: matrix.os == 'windows-latest'
|
65
|
-
run: |
|
66
|
-
choco install --no-progress -y inkscape
|
67
|
-
inkscape --version
|
40
|
+
- uses: metanorma/metanorma-build-scripts/inkscape-setup-action@master
|
68
41
|
|
69
42
|
- run: bundle exec rake
|
70
43
|
|
71
44
|
tests-passed:
|
72
45
|
needs: rake
|
73
46
|
runs-on: ubuntu-latest
|
74
|
-
continue-on-error: true
|
75
47
|
steps:
|
76
|
-
-
|
77
|
-
uses: Sibz/github-status-action@v1
|
48
|
+
- uses: peter-evans/repository-dispatch@v1
|
78
49
|
with:
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
sha: ${{ github.event.pull_request.head.sha || github.sha }}
|
50
|
+
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
51
|
+
repository: ${{ github.repository }}
|
52
|
+
event-type: notify
|
53
|
+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
data/.rubocop.yml
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# This project follows the Ribose OSS style guide.
|
2
2
|
# https://github.com/riboseinc/oss-guides
|
3
3
|
# All project-specific additions and overrides should be specified in this file.
|
4
|
-
|
5
4
|
inherit_from:
|
6
5
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
|
+
|
7
|
+
# local repo-specific modifications
|
8
|
+
|
7
9
|
AllCops:
|
8
|
-
|
10
|
+
DisplayCopNames: false
|
11
|
+
StyleGuideCopsOnly: false
|
12
|
+
TargetRubyVersion: 2.4
|
9
13
|
Rails:
|
10
14
|
Enabled: true
|
data/isodoc.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_dependency "uuidtools"
|
36
36
|
spec.add_dependency "html2doc", "~> 1.0.0"
|
37
37
|
spec.add_dependency "liquid", "~> 4"
|
38
|
-
spec.add_dependency "twitter_cldr"
|
38
|
+
spec.add_dependency "twitter_cldr", ">= 6.6.0"
|
39
39
|
spec.add_dependency "roman-numerals"
|
40
40
|
spec.add_dependency "metanorma", "~> 1.2.0"
|
41
41
|
spec.add_dependency "relaton-cli"
|
@@ -47,7 +47,8 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_development_dependency "guard", "~> 2.14"
|
48
48
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
49
49
|
spec.add_development_dependency "rspec", "~> 3.6"
|
50
|
-
spec.add_development_dependency "rubocop", "
|
50
|
+
spec.add_development_dependency "rubocop", "~> 1.5.2"
|
51
51
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
52
52
|
spec.add_development_dependency "timecop", "~> 0.9"
|
53
|
+
spec.add_development_dependency "rexml"
|
53
54
|
end
|
data/lib/isodoc/convert.rb
CHANGED
@@ -12,7 +12,9 @@ module IsoDoc
|
|
12
12
|
attr_accessor :meta
|
13
13
|
|
14
14
|
# htmlstylesheet: Generic stylesheet for HTML
|
15
|
+
# htmlstylesheet_override: Override stylesheet for HTML
|
15
16
|
# wordstylesheet: Generic stylesheet for Word
|
17
|
+
# wordstylesheet_override: Override stylesheet for Word
|
16
18
|
# standardsheet: Stylesheet specific to Standard
|
17
19
|
# header: Header file for Word
|
18
20
|
# htmlcoverpage: Cover page for HTML
|
@@ -48,6 +50,8 @@ module IsoDoc
|
|
48
50
|
@tempfile_cache = []
|
49
51
|
@htmlstylesheet_name = options[:htmlstylesheet]
|
50
52
|
@wordstylesheet_name = options[:wordstylesheet]
|
53
|
+
@htmlstylesheet_override_name = options[:htmlstylesheet_override]
|
54
|
+
@wordstylesheet_override_name = options[:wordstylesheet_override]
|
51
55
|
@standardstylesheet_name = options[:standardstylesheet]
|
52
56
|
@header = options[:header]
|
53
57
|
@htmlcoverpage = options[:htmlcoverpage]
|
data/lib/isodoc/css.rb
CHANGED
@@ -19,6 +19,12 @@ module IsoDoc
|
|
19
19
|
@htmlstylesheet = generate_css(@htmlstylesheet_name, true)
|
20
20
|
@wordstylesheet = generate_css(@wordstylesheet_name, false)
|
21
21
|
@standardstylesheet = generate_css(@standardstylesheet_name, false)
|
22
|
+
if @htmlstylesheet_override_name
|
23
|
+
@htmlstylesheet_override = File.open(@htmlstylesheet_override_name)
|
24
|
+
end
|
25
|
+
if @wordstylesheet_override_name
|
26
|
+
@wordstylesheet_override = File.open(@wordstylesheet_override_name)
|
27
|
+
end
|
22
28
|
end
|
23
29
|
|
24
30
|
def default_fonts(_options)
|
@@ -77,7 +83,6 @@ module IsoDoc
|
|
77
83
|
# stripwordcss if HTML stylesheet, !stripwordcss if DOC stylesheet
|
78
84
|
def generate_css(filename, stripwordcss)
|
79
85
|
return nil if filename.nil?
|
80
|
-
|
81
86
|
filename = precompiled_style_or_original(filename)
|
82
87
|
stylesheet = File.read(filename, encoding: 'UTF-8')
|
83
88
|
stylesheet = populate_template(stylesheet, :word)
|
@@ -39,7 +39,7 @@ module IsoDoc::Function
|
|
39
39
|
"uri[@type = 'citation']"))
|
40
40
|
return href unless url
|
41
41
|
href = suffix_url(url.text)
|
42
|
-
anchor = node&.at(ns(".//locality[@type = 'anchor']"))&.text
|
42
|
+
anchor = node&.at(ns(".//locality[@type = 'anchor']"))&.text&.strip
|
43
43
|
anchor and href += "##{anchor}"
|
44
44
|
href
|
45
45
|
end
|
@@ -87,7 +87,7 @@ module IsoDoc::Function
|
|
87
87
|
|
88
88
|
def omit_docid_prefix(prefix)
|
89
89
|
return true if prefix.nil? || prefix.empty?
|
90
|
-
return %w(ISO IEC ITU W3C metanorma).include? prefix
|
90
|
+
return %w(ISO IEC IEV ITU W3C csd metanorma rfc-anchor).include? prefix
|
91
91
|
end
|
92
92
|
|
93
93
|
def date_note_process(b, ref)
|
@@ -225,6 +225,7 @@ module IsoDoc::Function
|
|
225
225
|
when "passthrough" then passthrough_parse(node, out)
|
226
226
|
when "amend" then amend_parse(node, out)
|
227
227
|
when "tab" then clausedelimspace(out) # in Presentation XML only
|
228
|
+
when "svg" then svg_parse(node, out) # introduced in Presentation XML only
|
228
229
|
else
|
229
230
|
error_parse(node, out)
|
230
231
|
end
|
@@ -44,12 +44,14 @@ module IsoDoc::HtmlFunction
|
|
44
44
|
IsoDoc::HtmlFunction::MathvariantToPlain.new(docxml).convert
|
45
45
|
end
|
46
46
|
|
47
|
-
def htmlstylesheet
|
48
|
-
|
49
|
-
|
47
|
+
def htmlstylesheet(file)
|
48
|
+
return if file.nil?
|
49
|
+
file.open if file.is_a?(Tempfile)
|
50
|
+
stylesheet = file.read
|
50
51
|
xml = Nokogiri::XML("<style/>")
|
51
52
|
xml.children.first << Nokogiri::XML::Comment.new(xml, "\n#{stylesheet}\n")
|
52
|
-
|
53
|
+
file.close
|
54
|
+
file.unlink if file.is_a?(Tempfile)
|
53
55
|
xml.root.to_s
|
54
56
|
end
|
55
57
|
|
@@ -57,7 +59,8 @@ module IsoDoc::HtmlFunction
|
|
57
59
|
return docxml unless @htmlstylesheet
|
58
60
|
title = docxml.at("//*[local-name() = 'head']/*[local-name() = 'title']")
|
59
61
|
head = docxml.at("//*[local-name() = 'head']")
|
60
|
-
head << htmlstylesheet
|
62
|
+
head << htmlstylesheet(@htmlstylesheet)
|
63
|
+
s = htmlstylesheet(@htmlstylesheet_override) and head << s
|
61
64
|
docxml
|
62
65
|
end
|
63
66
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "base64"
|
2
|
+
|
1
3
|
module IsoDoc
|
2
4
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
5
|
def lower2cap(s)
|
@@ -6,14 +8,24 @@ module IsoDoc
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def figure(docxml)
|
9
|
-
docxml.xpath(ns("//
|
10
|
-
|
11
|
+
docxml.xpath(ns("//image")).each { |f| svg_extract(f) }
|
12
|
+
docxml.xpath(ns("//figure")).each { |f| figure1(f) }
|
13
|
+
docxml.xpath(ns("//svgmap")).each do |s|
|
14
|
+
if f = s.at(ns("./figure")) then s.replace(f)
|
15
|
+
else
|
16
|
+
s.remove
|
17
|
+
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
21
|
+
def svg_extract(f)
|
22
|
+
return unless %r{^data:image/svg\+xml;base64,}.match(f["src"])
|
23
|
+
svg = Base64.strict_decode64(f["src"].sub(%r{^data:image/svg\+xml;base64,}, ""))
|
24
|
+
f.replace(svg.sub(/<\?xml[^>]*>/, ""))
|
25
|
+
end
|
26
|
+
|
14
27
|
def figure1(f)
|
15
|
-
return sourcecode1(f) if f["class"] == "pseudocode" ||
|
16
|
-
f["type"] == "pseudocode"
|
28
|
+
return sourcecode1(f) if f["class"] == "pseudocode" || f["type"] == "pseudocode"
|
17
29
|
return if labelled_ancestor(f) && f.ancestors("figure").empty?
|
18
30
|
return if f.at(ns("./figure")) and !f.at(ns("./name"))
|
19
31
|
lbl = @xrefs.anchor(f['id'], :label, false) or return
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "twitter_cldr"
|
2
|
+
require "bigdecimal"
|
2
3
|
|
3
4
|
module IsoDoc
|
4
5
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
@@ -10,8 +11,7 @@ module IsoDoc
|
|
10
11
|
if node["citeas"].nil? && node["bibitemid"]
|
11
12
|
return @xrefs.anchor(node["bibitemid"] ,:xref) || "???"
|
12
13
|
elsif node["target"] && node["droploc"]
|
13
|
-
return @xrefs.anchor(node["target"], :value) ||
|
14
|
-
@xrefs.anchor(node["target"], :label) ||
|
14
|
+
return @xrefs.anchor(node["target"], :value) || @xrefs.anchor(node["target"], :label) ||
|
15
15
|
@xrefs.anchor(node["target"], :xref) || "???"
|
16
16
|
elsif node["target"] && !/.#./.match(node["target"])
|
17
17
|
linkend = anchor_linkend1(node)
|
@@ -22,9 +22,8 @@ module IsoDoc
|
|
22
22
|
def anchor_linkend1(node)
|
23
23
|
linkend = @xrefs.anchor(node["target"], :xref)
|
24
24
|
container = @xrefs.anchor(node["target"], :container, false)
|
25
|
-
(container && get_note_container_id(node) != container &&
|
26
|
-
|
27
|
-
linkend = prefix_container(container, linkend, node["target"])
|
25
|
+
(container && get_note_container_id(node) != container && @xrefs.get[node["target"]]) &&
|
26
|
+
linkend = prefix_container(container, linkend, node["target"])
|
28
27
|
capitalise_xref(node, linkend)
|
29
28
|
end
|
30
29
|
|
@@ -35,13 +34,11 @@ module IsoDoc
|
|
35
34
|
return linkend if linkend[0,1].match(/\p{Upper}/)
|
36
35
|
prec = nearest_block_parent(node).xpath("./descendant-or-self::text()") &
|
37
36
|
node.xpath("./preceding::text()")
|
38
|
-
(prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map { |p| p.text }.join)) ?
|
39
|
-
linkend&.capitalize : linkend
|
37
|
+
(prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map { |p| p.text }.join)) ? linkend&.capitalize : linkend
|
40
38
|
end
|
41
39
|
|
42
40
|
def nearest_block_parent(node)
|
43
|
-
until %w(p title td th name formula
|
44
|
-
li dt dd sourcecode pre).include?(node.name)
|
41
|
+
until %w(p title td th name formula li dt dd sourcecode pre).include?(node.name)
|
45
42
|
node = node.parent
|
46
43
|
end
|
47
44
|
node
|
@@ -89,8 +86,7 @@ module IsoDoc
|
|
89
86
|
def eref_localities0(r, i, target, delim)
|
90
87
|
if r["type"] == "whole" then l10n("#{delim} #{@i18n.wholeoftext}")
|
91
88
|
else
|
92
|
-
eref_localities1(target, r["type"], r.at(ns("./referenceFrom")),
|
93
|
-
r.at(ns("./referenceTo")), delim, @lang)
|
89
|
+
eref_localities1(target, r["type"], r.at(ns("./referenceFrom")), r.at(ns("./referenceTo")), delim, @lang)
|
94
90
|
end
|
95
91
|
end
|
96
92
|
|
@@ -106,8 +102,7 @@ module IsoDoc
|
|
106
102
|
# TODO: move to localization file
|
107
103
|
def eref_localities1(target, type, from, to, delim, lang = "en")
|
108
104
|
return "" if type == "anchor"
|
109
|
-
lang == "zh" and
|
110
|
-
return l10n(eref_localities1_zh(target, type, from, to, delim))
|
105
|
+
lang == "zh" and return l10n(eref_localities1_zh(target, type, from, to, delim))
|
111
106
|
ret = delim
|
112
107
|
loc = @i18n.locality[type] || type.sub(/^locality:/, "").capitalize
|
113
108
|
ret += " #{loc}"
|
@@ -163,23 +158,22 @@ module IsoDoc
|
|
163
158
|
# TwitterCldr::DataReaders::NumberDataReader.new(locale).symbols
|
164
159
|
def localize_maths(f, locale)
|
165
160
|
f.xpath(".//m:mn", MATHML).each do |x|
|
166
|
-
num =
|
161
|
+
num = BigDecimal(x.text)
|
167
162
|
precision = /\./.match(x.text) ? x.text.sub(/^.*\./, "").size : 0
|
168
163
|
x.children = localized_number(num, locale, precision)
|
169
164
|
end
|
170
165
|
end
|
171
166
|
|
172
|
-
# By itself
|
167
|
+
# By itself twitter-cldr does not support fraction part digits grouping
|
173
168
|
# and custom delimeter, will decorate fraction part manually
|
174
169
|
def localized_number(num, locale, precision)
|
175
|
-
localized = precision == 0 ? num.localize(locale).to_s :
|
170
|
+
localized = (precision == 0) ? num.localize(locale).to_s :
|
176
171
|
num.localize(locale).to_decimal.to_s(:precision => precision)
|
177
172
|
twitter_cldr_reader_symbols = twitter_cldr_reader(locale)
|
178
173
|
return localized unless twitter_cldr_reader_symbols[:decimal]
|
179
174
|
integer, fraction = localized.split(twitter_cldr_reader_symbols[:decimal])
|
180
175
|
return localized if fraction.nil? || fraction.length.zero?
|
181
|
-
[integer, decorate_fraction_part(fraction, locale)].
|
182
|
-
join(twitter_cldr_reader_symbols[:decimal])
|
176
|
+
[integer, decorate_fraction_part(fraction, locale)].join(twitter_cldr_reader_symbols[:decimal])
|
183
177
|
end
|
184
178
|
|
185
179
|
def decorate_fraction_part(fract, locale)
|
@@ -229,8 +223,7 @@ module IsoDoc
|
|
229
223
|
end
|
230
224
|
|
231
225
|
def variant1(node)
|
232
|
-
if (!node["lang"] || node["lang"] == @lang) &&
|
233
|
-
(!node["script"] || node["script"] == @script)
|
226
|
+
if (!node["lang"] || node["lang"] == @lang) && (!node["script"] || node["script"] == @script)
|
234
227
|
elsif found_matching_variant_sibling(node)
|
235
228
|
node["remove"] = "true"
|
236
229
|
else
|
@@ -243,8 +236,7 @@ module IsoDoc
|
|
243
236
|
foll = node.xpath("./following-sibling::xmlns:variant")
|
244
237
|
found = false
|
245
238
|
(prev + foll).each do |n|
|
246
|
-
found = true if n["lang"] == @lang &&
|
247
|
-
(!n["script"] || n["script"] == @script)
|
239
|
+
found = true if n["lang"] == @lang && (!n["script"] || n["script"] == @script)
|
248
240
|
end
|
249
241
|
found
|
250
242
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -22,6 +22,12 @@ module IsoDoc::WordFunction
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def svg_parse(node, out)
|
26
|
+
svg = Base64.strict_encode64(node.to_xml)
|
27
|
+
r = node.replace("<img src='data:image/svg+xml;base64,#{svg}' mimetype='image/svg+xml'/>").first
|
28
|
+
image_parse(r, out, nil)
|
29
|
+
end
|
30
|
+
|
25
31
|
def imgsrc(node)
|
26
32
|
ret = svg_to_emf(node) and return ret
|
27
33
|
return node["src"] unless %r{^data:}.match node["src"]
|
@@ -37,17 +37,27 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
|
37
37
|
|
38
38
|
def toWord(result, filename, dir, header)
|
39
39
|
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
40
|
-
|
41
|
-
@wordstylesheet&.open
|
42
|
-
@wordstylesheet&.write(@landscapestyle)
|
43
|
-
@wordstylesheet&.close
|
44
|
-
end
|
40
|
+
@wordstylesheet = wordstylesheet_update
|
45
41
|
Html2Doc.process(result, filename: filename, stylesheet: @wordstylesheet&.path,
|
46
42
|
header_file: header&.path, dir: dir,
|
47
43
|
asciimathdelims: [@openmathdelim, @closemathdelim],
|
48
44
|
liststyles: { ul: @ulstyle, ol: @olstyle })
|
49
45
|
header&.unlink
|
50
|
-
@wordstylesheet&.unlink
|
46
|
+
@wordstylesheet&.unlink if @wordstylesheet&.is_a?(Tempfile)
|
47
|
+
end
|
48
|
+
|
49
|
+
def wordstylesheet_update()
|
50
|
+
return if @wordstylesheet.nil?
|
51
|
+
f = File.open(@wordstylesheet.path, "a")
|
52
|
+
@landscapestyle.empty? or f.write(@landscapestyle)
|
53
|
+
if @wordstylesheet_override && @wordstylesheet
|
54
|
+
f.write(@wordstylesheet_override.read)
|
55
|
+
@wordstylesheet_override.close
|
56
|
+
elsif @wordstylesheet_override && !@wordstylesheet
|
57
|
+
@wordstylesheet = @wordstylesheet_override
|
58
|
+
end
|
59
|
+
f.close
|
60
|
+
@wordstylesheet
|
51
61
|
end
|
52
62
|
|
53
63
|
def word_admonition_images(docxml)
|