isodoc 1.0.27 → 1.1.2
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 +4 -8
- data/.github/workflows/ubuntu.yml +18 -16
- data/.github/workflows/windows.yml +4 -8
- data/Rakefile +3 -1
- data/isodoc.gemspec +2 -2
- data/lib/isodoc.rb +2 -0
- data/lib/isodoc/base_style/metanorma_word.scss +0 -1
- data/lib/isodoc/base_style/reset.scss +3 -3
- data/lib/isodoc/common.rb +0 -4
- data/lib/isodoc/convert.rb +121 -58
- data/lib/isodoc/function/blocks.rb +42 -53
- data/lib/isodoc/function/blocks_example_note.rb +108 -0
- data/lib/isodoc/function/cleanup.rb +8 -4
- data/lib/isodoc/function/i18n.rb +1 -0
- data/lib/isodoc/function/inline.rb +70 -90
- data/lib/isodoc/function/inline_simple.rb +72 -0
- data/lib/isodoc/function/lists.rb +12 -6
- data/lib/isodoc/function/references.rb +33 -38
- data/lib/isodoc/function/reqt.rb +14 -5
- data/lib/isodoc/function/section.rb +8 -11
- data/lib/isodoc/function/table.rb +4 -4
- data/lib/isodoc/function/terms.rb +3 -3
- data/lib/isodoc/function/to_word_html.rb +21 -13
- data/lib/isodoc/function/utils.rb +57 -50
- data/lib/isodoc/gem_tasks.rb +104 -0
- data/lib/isodoc/headlesshtml_convert.rb +7 -6
- data/lib/isodoc/html_convert.rb +2 -1
- data/lib/isodoc/html_function/footnotes.rb +1 -1
- data/lib/isodoc/html_function/html.rb +13 -1
- data/lib/isodoc/html_function/postprocess.rb +4 -4
- data/lib/isodoc/metadata.rb +74 -62
- data/lib/isodoc/pdf_convert.rb +8 -6
- data/lib/isodoc/presentation_xml_convert.rb +29 -0
- data/lib/isodoc/sassc_importer.rb +11 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +2 -1
- data/lib/isodoc/word_function/body.rb +14 -48
- data/lib/isodoc/word_function/footnotes.rb +1 -1
- data/lib/isodoc/word_function/inline.rb +75 -0
- data/lib/isodoc/word_function/postprocess.rb +1 -0
- data/lib/isodoc/word_function/table.rb +3 -3
- data/lib/isodoc/xref.rb +59 -0
- data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
- data/lib/isodoc/xref/xref_counter.rb +74 -0
- data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
- data/lib/isodoc/{function → xref}/xref_gen_seq.rb +41 -32
- data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
- data/lib/isodoc/xslfo_convert.rb +16 -4
- data/spec/assets/{html.css → html.scss} +0 -0
- data/spec/assets/i18n.yaml +4 -1
- data/spec/assets/odf.emf +0 -0
- data/spec/assets/odf.svg +4 -0
- data/spec/assets/odf1.svg +4 -0
- data/spec/isodoc/blocks_spec.rb +219 -47
- data/spec/isodoc/cleanup_spec.rb +135 -6
- data/spec/isodoc/footnotes_spec.rb +22 -7
- data/spec/isodoc/inline_spec.rb +262 -2
- data/spec/isodoc/lists_spec.rb +8 -8
- data/spec/isodoc/metadata_spec.rb +110 -3
- data/spec/isodoc/postproc_spec.rb +1321 -1351
- data/spec/isodoc/presentation_xml_spec.rb +20 -0
- data/spec/isodoc/ref_spec.rb +119 -50
- data/spec/isodoc/section_spec.rb +84 -18
- data/spec/isodoc/table_spec.rb +6 -6
- data/spec/isodoc/terms_spec.rb +7 -7
- data/spec/isodoc/xref_spec.rb +165 -45
- metadata +36 -27
- data/lib/isodoc/function/blocks_example.rb +0 -53
- data/lib/isodoc/function/xref_counter.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd9d095a9d498797d6c48b1465b878f5587107e47f09a76a4148ba3a9618db0
|
4
|
+
data.tar.gz: a0825c515977f0ae8fe7047848480d2e2131be9b3baed8c803ae17aedf6270cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23b189ba917e52f1822ad80f096b8abb3fb3eca22e06f860fc300c8f3155492da9a7ef1817a43f6674657456885086ba73c5909d0106cdbbd9efe2392269e408
|
7
|
+
data.tar.gz: 2f72ce5902ef2a944f5b49d657e71e0afde82b1d94a2c6e9661d004b54810f7109faa98f2272b651a917da1fbf19e39bd027186e57597b2ae447e8551886e390
|
data/.github/workflows/macos.yml
CHANGED
@@ -29,18 +29,14 @@ jobs:
|
|
29
29
|
uses: actions/setup-ruby@v1
|
30
30
|
with:
|
31
31
|
ruby-version: ${{ matrix.ruby }}
|
32
|
-
|
32
|
+
- name: Install Inkscape
|
33
|
+
run: |
|
34
|
+
brew cask install inkscape
|
35
|
+
inkscape --version
|
33
36
|
- name: Update gems
|
34
37
|
run: |
|
35
38
|
sudo gem install bundler --force
|
36
39
|
bundle install --jobs 4 --retry 3
|
37
|
-
- name: Use Node
|
38
|
-
uses: actions/setup-node@v1
|
39
|
-
with:
|
40
|
-
node-version: '12'
|
41
|
-
- name: Install Puppeteer
|
42
|
-
run: |
|
43
|
-
npm install -g puppeteer@3.0.1
|
44
40
|
- name: Run specs
|
45
41
|
run: |
|
46
42
|
bundle exec rake
|
@@ -5,6 +5,8 @@ name: ubuntu
|
|
5
5
|
on:
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
|
+
tags:
|
9
|
+
- '*'
|
8
10
|
pull_request:
|
9
11
|
paths-ignore:
|
10
12
|
- .github/workflows/macos.yml
|
@@ -29,32 +31,32 @@ jobs:
|
|
29
31
|
uses: actions/setup-ruby@v1
|
30
32
|
with:
|
31
33
|
ruby-version: ${{ matrix.ruby }}
|
32
|
-
|
34
|
+
- name: Install Inkscape
|
35
|
+
run: |
|
36
|
+
sudo add-apt-repository ppa:inkscape.dev/stable
|
37
|
+
sudo apt update
|
38
|
+
sudo apt install inkscape
|
39
|
+
inkscape --version
|
33
40
|
- name: Update gems
|
34
41
|
run: |
|
35
42
|
gem install bundler
|
36
43
|
bundle install --jobs 4 --retry 3
|
37
|
-
- name: Use Node
|
38
|
-
uses: actions/setup-node@v1
|
39
|
-
with:
|
40
|
-
node-version: '12'
|
41
|
-
- name: Install Puppeteer
|
42
|
-
run: |
|
43
|
-
sudo apt-get update
|
44
|
-
sudo apt-get install libgbm1
|
45
|
-
npm install -g puppeteer@3.0.1
|
46
44
|
- name: Run specs
|
47
45
|
run: |
|
48
46
|
bundle exec rake
|
49
|
-
- name: Trigger
|
50
|
-
if:
|
47
|
+
- name: Trigger repositories
|
48
|
+
if: matrix.ruby == '2.6'
|
51
49
|
env:
|
52
|
-
GH_USERNAME:
|
53
|
-
GH_ACCESS_TOKEN: ${{ secrets.
|
50
|
+
GH_USERNAME: metanorma-ci
|
51
|
+
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
54
52
|
run: |
|
55
53
|
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
56
54
|
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
57
|
-
|
55
|
+
CLIENT_PAYLOAD=$(cat <<EOF
|
56
|
+
"{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
|
57
|
+
EOF
|
58
|
+
)
|
59
|
+
for repo in $REPOS
|
58
60
|
do
|
59
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY
|
61
|
+
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
60
62
|
done
|
@@ -29,20 +29,16 @@ jobs:
|
|
29
29
|
uses: actions/setup-ruby@v1
|
30
30
|
with:
|
31
31
|
ruby-version: ${{ matrix.ruby }}
|
32
|
-
|
32
|
+
- name: Install Inkscape
|
33
|
+
run: |
|
34
|
+
choco install --no-progress -y inkscape
|
35
|
+
inkscape --version
|
33
36
|
- name: Update gems
|
34
37
|
shell: pwsh
|
35
38
|
run: |
|
36
39
|
gem install bundler
|
37
40
|
bundle config --local path vendor/bundle
|
38
41
|
bundle install --jobs 4 --retry 3
|
39
|
-
- name: Use Node
|
40
|
-
uses: actions/setup-node@v1
|
41
|
-
with:
|
42
|
-
node-version: '12'
|
43
|
-
- name: Install Puppeteer
|
44
|
-
run: |
|
45
|
-
npm install -g puppeteer@3.0.1
|
46
42
|
- name: Run specs
|
47
43
|
run: |
|
48
44
|
bundle exec rake
|
data/Rakefile
CHANGED
data/isodoc.gemspec
CHANGED
@@ -36,11 +36,11 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_dependency "html2doc", "~> 1.0.0"
|
37
37
|
spec.add_dependency "liquid"
|
38
38
|
spec.add_dependency "roman-numerals"
|
39
|
-
spec.add_dependency "
|
40
|
-
spec.add_dependency "metanorma", "~> 1.0.0"
|
39
|
+
spec.add_dependency "metanorma", "~> 1.1.0"
|
41
40
|
spec.add_dependency "rake", "~> 12.0"
|
42
41
|
|
43
42
|
spec.add_development_dependency "byebug", "~> 9.1"
|
43
|
+
spec.add_development_dependency "sassc", "~> 2.4.0"
|
44
44
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
45
45
|
spec.add_development_dependency "guard", "~> 2.14"
|
46
46
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
data/lib/isodoc.rb
CHANGED
@@ -49,9 +49,9 @@ time, mark, audio, video {
|
|
49
49
|
}
|
50
50
|
|
51
51
|
html, body, div, span, applet, object, iframe,
|
52
|
-
p, blockquote,
|
53
|
-
a, abbr, acronym, address, big, cite,
|
54
|
-
del, dfn, em, img, ins, q, s,
|
52
|
+
p, blockquote,
|
53
|
+
a, abbr, acronym, address, big, cite,
|
54
|
+
del, dfn, em, img, ins, q, s,
|
55
55
|
small, strike, strong, sub, sup, var,
|
56
56
|
b, u, i, center,
|
57
57
|
dl, dt, dd, ol, ul, li,
|
data/lib/isodoc/common.rb
CHANGED
@@ -9,8 +9,6 @@ require_relative "./function/table"
|
|
9
9
|
require_relative "./function/terms"
|
10
10
|
require_relative "./function/to_word_html"
|
11
11
|
require_relative "./function/utils"
|
12
|
-
require_relative "./function/xref_gen"
|
13
|
-
require_relative "./function/xref_sect_gen"
|
14
12
|
require_relative "./function/reqt"
|
15
13
|
require_relative "./class_utils"
|
16
14
|
|
@@ -27,8 +25,6 @@ module IsoDoc
|
|
27
25
|
include Function::Terms
|
28
26
|
include Function::ToWordHtml
|
29
27
|
include Function::Utils
|
30
|
-
include Function::XrefGen
|
31
|
-
include Function::XrefSectGen
|
32
28
|
|
33
29
|
extend ::IsoDoc::ClassUtils
|
34
30
|
end
|
data/lib/isodoc/convert.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'isodoc/common'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'tempfile'
|
5
6
|
|
6
7
|
module IsoDoc
|
7
8
|
class Convert < ::IsoDoc::Common
|
@@ -27,15 +28,25 @@ module IsoDoc
|
|
27
28
|
# scripts_pdf: Scripts file for PDF
|
28
29
|
# datauriimage: Encode images in HTML output as data URIs
|
29
30
|
def initialize(options)
|
30
|
-
@libdir
|
31
|
-
options.merge!(default_fonts(options))
|
32
|
-
|
31
|
+
@libdir ||= File.dirname(__FILE__)
|
32
|
+
options.merge!(default_fonts(options)) do |_, old, new|
|
33
|
+
old || new
|
34
|
+
end
|
35
|
+
.merge!(default_file_locations(options)) do |_, old, new|
|
36
|
+
old || new
|
37
|
+
end
|
33
38
|
@options = options
|
34
39
|
@files_to_delete = []
|
35
40
|
@tempfile_cache = []
|
36
|
-
@htmlstylesheet_name =
|
37
|
-
|
38
|
-
|
41
|
+
@htmlstylesheet_name = precompiled_style_or_original(
|
42
|
+
options[:htmlstylesheet]
|
43
|
+
)
|
44
|
+
@wordstylesheet_name = precompiled_style_or_original(
|
45
|
+
options[:wordstylesheet]
|
46
|
+
)
|
47
|
+
@standardstylesheet_name = precompiled_style_or_original(
|
48
|
+
options[:standardstylesheet]
|
49
|
+
)
|
39
50
|
@header = options[:header]
|
40
51
|
@htmlcoverpage = options[:htmlcoverpage]
|
41
52
|
@wordcoverpage = options[:wordcoverpage]
|
@@ -48,12 +59,11 @@ module IsoDoc
|
|
48
59
|
@olstyle = options[:olstyle]
|
49
60
|
@datauriimage = options[:datauriimage]
|
50
61
|
@suppressheadingnumbers = options[:suppressheadingnumbers]
|
51
|
-
@break_up_urls_in_tables = options[:break_up_urls_in_tables] ==
|
52
|
-
@termdomain =
|
62
|
+
@break_up_urls_in_tables = options[:break_up_urls_in_tables] == 'true'
|
63
|
+
@termdomain = ''
|
53
64
|
@termexample = false
|
54
65
|
@note = false
|
55
66
|
@sourcecode = false
|
56
|
-
@anchors = {}
|
57
67
|
@footnotes = []
|
58
68
|
@comments = []
|
59
69
|
@in_footnote = false
|
@@ -62,40 +72,57 @@ module IsoDoc
|
|
62
72
|
@in_figure = false
|
63
73
|
@seen_footnote = Set.new
|
64
74
|
@c = HTMLEntities.new
|
65
|
-
@openmathdelim =
|
66
|
-
@closemathdelim =
|
67
|
-
@lang =
|
68
|
-
@script =
|
75
|
+
@openmathdelim = '`'
|
76
|
+
@closemathdelim = '`'
|
77
|
+
@lang = 'en'
|
78
|
+
@script = 'Latn'
|
69
79
|
@maxwidth = 1200
|
70
80
|
@maxheight = 800
|
71
81
|
@wordToClevels = options[:doctoclevels].to_i
|
72
|
-
@wordToClevels = 2 if @wordToClevels
|
82
|
+
@wordToClevels = 2 if @wordToClevels.zero?
|
73
83
|
@htmlToClevels = options[:htmltoclevels].to_i
|
74
|
-
@htmlToClevels = 2 if @htmlToClevels
|
75
|
-
@bookmarks_allocated = {
|
84
|
+
@htmlToClevels = 2 if @htmlToClevels.zero?
|
85
|
+
@bookmarks_allocated = { 'X' => true }
|
76
86
|
@fn_bookmarks = {}
|
77
87
|
end
|
78
88
|
|
89
|
+
# Check if already compiled version(.css) exists,
|
90
|
+
# if not, return original scss file. During release
|
91
|
+
# we compile scss into css files in order to not depend on scss
|
92
|
+
def precompiled_style_or_original(stylesheet_path)
|
93
|
+
# Already have compiled stylesheet, use it
|
94
|
+
return stylesheet_path if stylesheet_path.nil? ||
|
95
|
+
File.extname(stylesheet_path) == '.css'
|
96
|
+
|
97
|
+
basename = File.basename(stylesheet_path, '.*')
|
98
|
+
compiled_path = File.join(File.dirname(stylesheet_path),
|
99
|
+
"#{basename}.css")
|
100
|
+
return stylesheet_path unless File.file?(compiled_path)
|
101
|
+
|
102
|
+
compiled_path
|
103
|
+
end
|
104
|
+
|
79
105
|
# run this after @meta is populated
|
80
106
|
def populate_css
|
81
|
-
@htmlstylesheet = generate_css(@htmlstylesheet_name, true
|
82
|
-
@wordstylesheet = generate_css(@wordstylesheet_name, false
|
83
|
-
@standardstylesheet = generate_css(@standardstylesheet_name, false
|
107
|
+
@htmlstylesheet = generate_css(@htmlstylesheet_name, true)
|
108
|
+
@wordstylesheet = generate_css(@wordstylesheet_name, false)
|
109
|
+
@standardstylesheet = generate_css(@standardstylesheet_name, false)
|
84
110
|
end
|
85
111
|
|
86
112
|
def tmpimagedir_suffix
|
87
|
-
|
113
|
+
'_images'
|
88
114
|
end
|
89
115
|
|
90
116
|
def default_fonts(_options)
|
91
117
|
{
|
92
|
-
bodyfont:
|
93
|
-
headerfont:
|
94
|
-
monospacefont:
|
118
|
+
bodyfont: 'Arial',
|
119
|
+
headerfont: 'Arial',
|
120
|
+
monospacefont: 'Courier'
|
95
121
|
}
|
96
122
|
end
|
97
123
|
|
98
|
-
# none for this parent gem, but will be populated in child
|
124
|
+
# none for this parent gem, but will be populated in child
|
125
|
+
# gems which have access to stylesheets &c; e.g.
|
99
126
|
# {
|
100
127
|
# htmlstylesheet: html_doc_path("htmlstyle.scss"),
|
101
128
|
# htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
|
@@ -113,41 +140,62 @@ module IsoDoc
|
|
113
140
|
{}
|
114
141
|
end
|
115
142
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
143
|
+
def fonts_options
|
144
|
+
{
|
145
|
+
'bodyfont' => options[:bodyfont] || 'Arial',
|
146
|
+
'headerfont' => options[:headerfont] || 'Arial',
|
147
|
+
'monospacefont' => options[:monospacefont] || 'Courier'
|
148
|
+
}
|
149
|
+
end
|
150
|
+
|
151
|
+
def scss_fontheader
|
152
|
+
b = options[:bodyfont] || 'Arial'
|
153
|
+
h = options[:headerfont] || 'Arial'
|
154
|
+
m = options[:monospacefont] || 'Courier'
|
121
155
|
"$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
|
122
156
|
end
|
123
157
|
|
124
158
|
def html_doc_path(file)
|
125
|
-
File.join(@libdir, File.join(
|
159
|
+
File.join(@libdir, File.join('html', file))
|
126
160
|
end
|
127
161
|
|
128
|
-
def
|
129
|
-
|
130
|
-
|
162
|
+
def convert_scss(filename, stylesheet)
|
163
|
+
require 'sassc'
|
164
|
+
require 'isodoc/sassc_importer'
|
165
|
+
|
166
|
+
[File.join(Gem.loaded_specs['isodoc'].full_gem_path,
|
167
|
+
'lib', 'isodoc'),
|
168
|
+
File.dirname(filename)].each do |name|
|
169
|
+
SassC.load_paths << name
|
170
|
+
end
|
171
|
+
SassC::Engine.new(scss_fontheader + stylesheet, syntax: :scss,
|
172
|
+
importer: SasscImporter)
|
173
|
+
.render
|
174
|
+
end
|
175
|
+
|
176
|
+
def generate_css(filename, stripwordcss)
|
177
|
+
return nil if filename.nil?
|
178
|
+
|
179
|
+
stylesheet = File.read(filename, encoding: 'UTF-8')
|
131
180
|
stylesheet = populate_template(stylesheet, :word)
|
132
|
-
stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m,
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
f.write(engine.render)
|
181
|
+
stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m, '\\1') if stripwordcss
|
182
|
+
if File.extname(filename) == '.scss'
|
183
|
+
stylesheet = convert_scss(filename, stylesheet)
|
184
|
+
end
|
185
|
+
Tempfile.open([File.basename(filename, '.*'), 'css'],
|
186
|
+
encoding: 'utf-8') do |f|
|
187
|
+
f.write(stylesheet)
|
140
188
|
f
|
141
189
|
end
|
142
190
|
end
|
143
191
|
|
144
192
|
def convert1(docxml, filename, dir)
|
145
|
-
|
193
|
+
@xrefs.parse docxml
|
146
194
|
noko do |xml|
|
147
|
-
xml.html **{ lang:
|
148
|
-
html.parent.add_namespace(
|
195
|
+
xml.html **{ lang: @lang.to_s } do |html|
|
196
|
+
html.parent.add_namespace('epub', 'http://www.idpf.org/2007/ops')
|
149
197
|
info docxml, nil
|
150
|
-
populate_css
|
198
|
+
populate_css
|
151
199
|
html.head { |head| define_head head, filename, dir }
|
152
200
|
make_body(html, docxml)
|
153
201
|
end
|
@@ -158,25 +206,40 @@ module IsoDoc
|
|
158
206
|
@meta = Metadata.new(lang, script, labels)
|
159
207
|
end
|
160
208
|
|
161
|
-
def
|
209
|
+
def xref_init(lang, script, klass, labels, options)
|
210
|
+
@xrefs = Xref.new(lang, script, klass, labels, options)
|
211
|
+
end
|
212
|
+
|
213
|
+
def convert_init(file, input_filename, debug)
|
162
214
|
docxml = Nokogiri::XML(file)
|
163
|
-
filename, dir = init_file(
|
164
|
-
docxml.root.default_namespace =
|
165
|
-
lang = docxml&.at(ns(
|
166
|
-
script = docxml&.at(ns(
|
215
|
+
filename, dir = init_file(input_filename, debug)
|
216
|
+
docxml.root.default_namespace = ''
|
217
|
+
lang = docxml&.at(ns('//bibdata/language'))&.text || @lang
|
218
|
+
script = docxml&.at(ns('//bibdata/script'))&.text || @script
|
167
219
|
i18n_init(lang, script)
|
168
220
|
metadata_init(lang, script, @labels)
|
221
|
+
@meta.fonts_options = fonts_options
|
222
|
+
xref_init(lang, script, self, @labels, {})
|
169
223
|
[docxml, filename, dir]
|
170
224
|
end
|
171
225
|
|
172
|
-
def convert(
|
173
|
-
|
226
|
+
def convert(input_filename,
|
227
|
+
file = nil,
|
228
|
+
debug = false,
|
229
|
+
output_filename = nil)
|
230
|
+
file = File.read(input_filename, encoding: 'utf-8') if file.nil?
|
174
231
|
@openmathdelim, @closemathdelim = extract_delims(file)
|
175
|
-
docxml, filename, dir = convert_init(file,
|
232
|
+
docxml, filename, dir = convert_init(file, input_filename, debug)
|
176
233
|
result = convert1(docxml, filename, dir)
|
177
234
|
return result if debug
|
178
|
-
|
235
|
+
output_filename ||= "#{filename}.#{@suffix}"
|
236
|
+
postprocess(result, output_filename, dir)
|
179
237
|
FileUtils.rm_rf dir
|
180
238
|
end
|
239
|
+
|
240
|
+
def middle_clause
|
241
|
+
"//clause[parent::sections][not(xmlns:title = 'Scope')]"\
|
242
|
+
'[not(descendant::terms)]'
|
243
|
+
end
|
181
244
|
end
|
182
245
|
end
|