metanorma 2.0.2 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metanorma/collection/filelookup/filelookup.rb +1 -1
- data/lib/metanorma/collection/multilingual/multilingual.rb +660 -0
- data/lib/metanorma/collection/renderer/fileparse.rb +1 -0
- data/lib/metanorma/collection/renderer/fileprocess.rb +2 -1
- data/lib/metanorma/collection/renderer/renderer.rb +32 -9
- data/lib/metanorma/compile/compile.rb +1 -1
- data/lib/metanorma/registry/registry.rb +2 -2
- data/lib/metanorma/version.rb +1 -1
- data/metanorma.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77856427b06326b7de35ad6782ffc5dbfe5331d9596d6df53a6af4c2bb681c81
|
4
|
+
data.tar.gz: d63ffb87f0abe973ed040f8567c986d504792433a9b3d46f4618752f9f254f59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b252f5a1c35eee2d8c6689bd2c7501964e557401cfc3ba129e962faf0f0c5631feacd6f46fcc606ba973a8e8ac43f4078488d4726f81a3dce087e921db5cd28
|
7
|
+
data.tar.gz: 66cece76fb4ac1fca9f5795f002f15d7062e73aac558056a5b02fe98a8de45d4fbd68d3c30ae7883b74f6ef6247d84840db4c1a9bfe64a0dc57e37ab70f7f861
|
@@ -123,7 +123,7 @@ module Metanorma
|
|
123
123
|
def url_in_css_styles(doc, document_suffix)
|
124
124
|
doc.xpath("//*[@style]").each do |s|
|
125
125
|
s["style"] = s["style"]
|
126
|
-
.gsub(%r{url\(#([^)]+)\)}, "url(#\\1_#{document_suffix})")
|
126
|
+
.gsub(%r{url\(#([^()]+)\)}, "url(#\\1_#{document_suffix})")
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -0,0 +1,660 @@
|
|
1
|
+
module Metanorma
|
2
|
+
class Collection
|
3
|
+
class Multilingual
|
4
|
+
def to_xml(node)
|
5
|
+
node&.to_xml(encoding: "UTF-8", indent: 0,
|
6
|
+
save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
|
7
|
+
end
|
8
|
+
|
9
|
+
def xmldoc(node)
|
10
|
+
ret = Nokogiri::XML::Document.new
|
11
|
+
ret.root = node.dup
|
12
|
+
ret
|
13
|
+
end
|
14
|
+
|
15
|
+
def flatxml_step1(param, elements)
|
16
|
+
<<~XSLT
|
17
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
18
|
+
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
19
|
+
xmlns:jcgm="https://www.metanorma.org/ns/bipm"
|
20
|
+
xmlns:bipm="https://www.metanorma.org/ns/bipm"
|
21
|
+
xmlns:mathml="http://www.w3.org/1998/Math/MathML"
|
22
|
+
xmlns:xalan="http://xml.apache.org/xalan"
|
23
|
+
xmlns:exsl="http://exslt.org/common"
|
24
|
+
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
|
25
|
+
xmlns:java="http://xml.apache.org/xalan/java"
|
26
|
+
exclude-result-prefixes="java"
|
27
|
+
version="1.0">
|
28
|
+
|
29
|
+
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
|
30
|
+
|
31
|
+
<xsl:template match="@* | node()">
|
32
|
+
<xsl:copy>
|
33
|
+
<xsl:apply-templates select="@* | node()"/>
|
34
|
+
</xsl:copy>
|
35
|
+
</xsl:template>
|
36
|
+
|
37
|
+
<xsl:template match="/*[local-name()='doc-container']">
|
38
|
+
<xsl:copy>
|
39
|
+
<xsl:apply-templates select="@* | node()" mode="flatxml_step1">
|
40
|
+
<xsl:with-param name="num" select="'#{param}'"/>
|
41
|
+
</xsl:apply-templates>
|
42
|
+
</xsl:copy>
|
43
|
+
</xsl:template>
|
44
|
+
|
45
|
+
<xsl:param name="align-cross-elements">#{elements}</xsl:param>
|
46
|
+
|
47
|
+
<xsl:variable name="align_cross_elements_default">clause</xsl:variable>
|
48
|
+
<xsl:variable name="align_cross_elements_doc">
|
49
|
+
<xsl:choose>
|
50
|
+
<xsl:when test="normalize-space($align-cross-elements) != ''"><xsl:value-of select="$align-cross-elements"/></xsl:when>
|
51
|
+
<xsl:otherwise>
|
52
|
+
<xsl:value-of select="normalize-space((//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:ext/jcgm:parallel-align-element)"/>
|
53
|
+
</xsl:otherwise>
|
54
|
+
</xsl:choose>
|
55
|
+
</xsl:variable>
|
56
|
+
<xsl:variable name="align_cross_elements_">
|
57
|
+
<xsl:choose>
|
58
|
+
<xsl:when test="$align_cross_elements_doc != ''">
|
59
|
+
<xsl:value-of select="$align_cross_elements_doc"/>
|
60
|
+
</xsl:when>
|
61
|
+
<xsl:otherwise>
|
62
|
+
<xsl:value-of select="$align_cross_elements_default"/>
|
63
|
+
</xsl:otherwise>
|
64
|
+
</xsl:choose>
|
65
|
+
</xsl:variable>
|
66
|
+
<xsl:variable name="align_cross_elements">
|
67
|
+
<xsl:text>#</xsl:text><xsl:value-of select="translate(normalize-space($align_cross_elements_), ' ', '#')"/><xsl:text>#</xsl:text>
|
68
|
+
</xsl:variable>
|
69
|
+
|
70
|
+
<!-- ================================= -->
|
71
|
+
<!-- First step -->
|
72
|
+
<!-- ================================= -->
|
73
|
+
|
74
|
+
<xsl:template match="@*|node()" mode="flatxml_step1">
|
75
|
+
<xsl:copy>
|
76
|
+
<xsl:apply-templates select="@*|node()" mode="flatxml_step1"/>
|
77
|
+
</xsl:copy>
|
78
|
+
</xsl:template>
|
79
|
+
<xsl:template match="/*[local-name()='doc-container']/*[1]" mode="flatxml_step1">
|
80
|
+
<xsl:param name="num"/>
|
81
|
+
<xsl:copy>
|
82
|
+
<xsl:attribute name="cross-align">true</xsl:attribute>
|
83
|
+
<xsl:attribute name="{$num}"/>
|
84
|
+
<xsl:apply-templates select="@*"/>
|
85
|
+
<xsl:apply-templates select="node()" mode="flatxml_step1"/>
|
86
|
+
</xsl:copy>
|
87
|
+
</xsl:template>
|
88
|
+
|
89
|
+
<!-- enclose clause[@type='scope'] into scope -->
|
90
|
+
<xsl:template match="*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="flatxml_step1" priority="2">
|
91
|
+
<!-- <section_scope>
|
92
|
+
<clause @type=scope>...
|
93
|
+
</section_scope> -->
|
94
|
+
<xsl:element name="section_scope" namespace="https://www.metanorma.org/ns/bipm">
|
95
|
+
<xsl:call-template name="clause"/>
|
96
|
+
</xsl:element>
|
97
|
+
</xsl:template>
|
98
|
+
|
99
|
+
<xsl:template match="jcgm:sections//jcgm:clause | jcgm:annex//jcgm:clause" mode="flatxml_step1" name="clause">
|
100
|
+
<!-- From:
|
101
|
+
<clause>
|
102
|
+
<title>...</title>
|
103
|
+
<p>...</p>
|
104
|
+
</clause>
|
105
|
+
To:
|
106
|
+
<clause/>
|
107
|
+
<title>...</title>
|
108
|
+
<p>...</p>
|
109
|
+
-->
|
110
|
+
<xsl:copy>
|
111
|
+
<xsl:apply-templates select="@*" mode="flatxml_step1"/>
|
112
|
+
<xsl:call-template name="setCrossAlignAttributes"/>
|
113
|
+
</xsl:copy>
|
114
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
115
|
+
</xsl:template>
|
116
|
+
|
117
|
+
<!-- allow cross-align for element title -->
|
118
|
+
<xsl:template match="jcgm:sections//jcgm:title | jcgm:annex//jcgm:title" mode="flatxml_step1">
|
119
|
+
<xsl:copy>
|
120
|
+
<xsl:apply-templates select="@*" mode="flatxml_step1"/>
|
121
|
+
<xsl:call-template name="setCrossAlignAttributes"/>
|
122
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
123
|
+
<xsl:if test="parent::jcgm:annex">
|
124
|
+
<xsl:attribute name="depth">1</xsl:attribute>
|
125
|
+
</xsl:if>
|
126
|
+
<xsl:if test="../@inline-header = 'true'">
|
127
|
+
<xsl:copy-of select="../@inline-header"/>
|
128
|
+
</xsl:if>
|
129
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
130
|
+
</xsl:copy>
|
131
|
+
</xsl:template>
|
132
|
+
|
133
|
+
<xsl:template match="*[local-name()='annex']" mode="flatxml_step1">
|
134
|
+
<xsl:copy>
|
135
|
+
<xsl:apply-templates select="@*" mode="flatxml_step1"/>
|
136
|
+
<!-- create empty element for case if first element isn't cross-align -->
|
137
|
+
<xsl:element name="empty" namespace="https://www.metanorma.org/ns/bipm">
|
138
|
+
<xsl:attribute name="cross-align">true</xsl:attribute>
|
139
|
+
<xsl:attribute name="element-number">empty_annex<xsl:number/></xsl:attribute>
|
140
|
+
</xsl:element>
|
141
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
142
|
+
</xsl:copy>
|
143
|
+
</xsl:template>
|
144
|
+
|
145
|
+
|
146
|
+
<xsl:template match="*[local-name()='sections']//*[local-name()='terms']" mode="flatxml_step1" priority="2">
|
147
|
+
<!-- From:
|
148
|
+
<terms>
|
149
|
+
<term>...</term>
|
150
|
+
<term>...</term>
|
151
|
+
</terms>
|
152
|
+
To:
|
153
|
+
<section_terms>
|
154
|
+
<terms>...</terms>
|
155
|
+
</section_terms> -->
|
156
|
+
<xsl:element name="section_terms" namespace="https://www.metanorma.org/ns/bipm">
|
157
|
+
<!-- create empty element for case if first element isn't cross-align -->
|
158
|
+
<xsl:element name="empty" namespace="https://www.metanorma.org/ns/bipm">
|
159
|
+
<xsl:attribute name="cross-align">true</xsl:attribute>
|
160
|
+
<xsl:attribute name="element-number">empty_terms_<xsl:number/></xsl:attribute>
|
161
|
+
</xsl:element>
|
162
|
+
<xsl:call-template name="terms"/>
|
163
|
+
</xsl:element>
|
164
|
+
</xsl:template>
|
165
|
+
<xsl:template match="*[local-name()='sections']//*[local-name()='definitions']" mode="flatxml_step1" priority="2">
|
166
|
+
<xsl:element name="section_terms" namespace="https://www.metanorma.org/ns/bipm">
|
167
|
+
<xsl:call-template name="terms"/>
|
168
|
+
</xsl:element>
|
169
|
+
</xsl:template>
|
170
|
+
|
171
|
+
|
172
|
+
<!-- From:
|
173
|
+
<terms>
|
174
|
+
<term>...</term>
|
175
|
+
<term>...</term>
|
176
|
+
</terms>
|
177
|
+
To:
|
178
|
+
<terms/>
|
179
|
+
<term>...</term>
|
180
|
+
<term>...</term>-->
|
181
|
+
<!-- And
|
182
|
+
From:
|
183
|
+
<term>
|
184
|
+
<name>...</name>
|
185
|
+
<preferred>...</preferred>
|
186
|
+
<definition>...</definition>
|
187
|
+
<termsource>...</termsource>
|
188
|
+
</term>
|
189
|
+
To:
|
190
|
+
<term/>
|
191
|
+
<term_name>...</term_name>
|
192
|
+
<preferred>...</preferred>
|
193
|
+
<definition>...</definition>
|
194
|
+
<termsource>...</termsource>
|
195
|
+
-->
|
196
|
+
<xsl:template match="jcgm:sections//jcgm:terms | jcgm:annex//jcgm:terms |
|
197
|
+
jcgm:sections//jcgm:term | jcgm:annex//jcgm:term" mode="flatxml_step1" name="terms">
|
198
|
+
<xsl:copy>
|
199
|
+
<xsl:apply-templates select="@*" mode="flatxml_step1"/>
|
200
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
201
|
+
<xsl:call-template name="setCrossAlignAttributes"/>
|
202
|
+
</xsl:copy>
|
203
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
204
|
+
</xsl:template>
|
205
|
+
|
206
|
+
<!-- From:
|
207
|
+
<term><name>...</name></term>
|
208
|
+
To:
|
209
|
+
<term><term_name>...</term_name></term> -->
|
210
|
+
<xsl:template match="jcgm:term/jcgm:name" mode="flatxml_step1">
|
211
|
+
<xsl:element name="term_name" namespace="https://www.metanorma.org/ns/bipm">
|
212
|
+
<xsl:apply-templates select="@*" mode="flatxml_step1"/>
|
213
|
+
<xsl:call-template name="setCrossAlignAttributes"/>
|
214
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
215
|
+
</xsl:element>
|
216
|
+
</xsl:template>
|
217
|
+
|
218
|
+
<!-- From:
|
219
|
+
<ul>
|
220
|
+
<li>...</li>
|
221
|
+
<li>...</li>
|
222
|
+
</ul>
|
223
|
+
To:
|
224
|
+
<ul/
|
225
|
+
<li>...</li>
|
226
|
+
<li>...</li> -->
|
227
|
+
<xsl:template match="jcgm:sections//jcgm:ul | jcgm:annex//jcgm:ul | jcgm:sections//jcgm:ol | jcgm:annex//jcgm:ol" mode="flatxml_step1">
|
228
|
+
<xsl:copy>
|
229
|
+
<xsl:apply-templates select="@*" mode="flatxml_step1"/>
|
230
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
231
|
+
<xsl:call-template name="setCrossAlignAttributes"/>
|
232
|
+
</xsl:copy>
|
233
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
234
|
+
</xsl:template>
|
235
|
+
|
236
|
+
|
237
|
+
<!-- allow cross-align for element p, note, termsource, table, figure, li (and set label) -->
|
238
|
+
<xsl:template match="jcgm:sections//jcgm:p |
|
239
|
+
jcgm:sections//jcgm:note |
|
240
|
+
jcgm:sections//jcgm:termsource |
|
241
|
+
jcgm:sections//jcgm:li |
|
242
|
+
jcgm:table |
|
243
|
+
jcgm:figure |
|
244
|
+
jcgm:annex//jcgm:p |
|
245
|
+
jcgm:annex//jcgm:note |
|
246
|
+
jcgm:annex//jcgm:termsource |
|
247
|
+
jcgm:annex//jcgm:li" mode="flatxml_step1">
|
248
|
+
<xsl:copy>
|
249
|
+
<xsl:apply-templates select="@*" mode="flatxml_step1"/>
|
250
|
+
<xsl:call-template name="setCrossAlignAttributes"/>
|
251
|
+
<xsl:choose>
|
252
|
+
<xsl:when test="*[local-name() = 'ul']/*[local-name() = 'li']">
|
253
|
+
<xsl:element name="ul" namespace="https://www.metanorma.org/ns/bipm">
|
254
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
255
|
+
</xsl:element>
|
256
|
+
</xsl:when>
|
257
|
+
<xsl:otherwise>
|
258
|
+
<xsl:apply-templates mode="flatxml_step1"/>
|
259
|
+
</xsl:otherwise>
|
260
|
+
</xsl:choose>
|
261
|
+
</xsl:copy>
|
262
|
+
</xsl:template>
|
263
|
+
|
264
|
+
|
265
|
+
<xsl:template name="setCrossAlignAttributes">
|
266
|
+
<xsl:variable name="is_cross_aligned">
|
267
|
+
<xsl:call-template name="isCrossAligned"/>
|
268
|
+
</xsl:variable>
|
269
|
+
<xsl:if test="normalize-space($is_cross_aligned) = 'true'">
|
270
|
+
<xsl:attribute name="cross-align">true</xsl:attribute>
|
271
|
+
<!-- <xsl:attribute name="keep-with-next">always</xsl:attribute> -->
|
272
|
+
</xsl:if>
|
273
|
+
<xsl:call-template name="setElementNumber"/>
|
274
|
+
</xsl:template>
|
275
|
+
|
276
|
+
<!--
|
277
|
+
Elements that should be aligned:
|
278
|
+
- name of element presents in field align-cross-elements="clause note"
|
279
|
+
- marked with attribute name
|
280
|
+
- table/figure with attribute @multilingual-rendering = 'common' or @multilingual-rendering = 'all-columns'
|
281
|
+
- marked with attribute cross-align
|
282
|
+
-->
|
283
|
+
<xsl:template name="isCrossAligned">
|
284
|
+
<xsl:variable name="element_name" select="local-name()"/>
|
285
|
+
<xsl:choose>
|
286
|
+
<!-- if element`s name is presents in array align_cross_elements -->
|
287
|
+
<xsl:when test="contains($align_cross_elements, concat('#',$element_name,'#'))">true</xsl:when>
|
288
|
+
<!-- if element has attribute name/bookmark -->
|
289
|
+
<xsl:when test="normalize-space(@name) != '' and @multilingual-rendering = 'name'">true</xsl:when>
|
290
|
+
<xsl:when test="($element_name = 'table' or $element_name = 'figure') and (@multilingual-rendering = 'common' or @multilingual-rendering = 'all-columns')">true</xsl:when>
|
291
|
+
<!-- element marked as cross-align -->
|
292
|
+
<xsl:when test="@multilingual-rendering='parallel'">true</xsl:when>
|
293
|
+
<xsl:otherwise>false</xsl:otherwise>
|
294
|
+
</xsl:choose>
|
295
|
+
</xsl:template>
|
296
|
+
|
297
|
+
<!-- calculate element number in tree to find a match between documents -->
|
298
|
+
<xsl:template name="setElementNumber">
|
299
|
+
<xsl:variable name="element-number">
|
300
|
+
<xsl:choose>
|
301
|
+
<!-- if name set, then use it -->
|
302
|
+
<xsl:when test="@name and @multilingual-rendering = 'name'"><xsl:value-of select="@name"/></xsl:when>
|
303
|
+
<xsl:otherwise>
|
304
|
+
<xsl:for-each select="ancestor-or-self::*[ancestor-or-self::*[local-name() = 'sections' or local-name() = 'annex']]">
|
305
|
+
<xsl:value-of select="local-name()"/>
|
306
|
+
<xsl:choose>
|
307
|
+
<xsl:when test="local-name() = 'terms'"></xsl:when>
|
308
|
+
<xsl:when test="local-name() = 'sections'"></xsl:when>
|
309
|
+
<xsl:otherwise><xsl:number /></xsl:otherwise>
|
310
|
+
</xsl:choose>
|
311
|
+
<xsl:text>_</xsl:text>
|
312
|
+
</xsl:for-each>
|
313
|
+
</xsl:otherwise>
|
314
|
+
</xsl:choose>
|
315
|
+
</xsl:variable>
|
316
|
+
<xsl:attribute name="element-number">
|
317
|
+
<xsl:value-of select="normalize-space($element-number)"/>
|
318
|
+
</xsl:attribute>
|
319
|
+
</xsl:template>
|
320
|
+
<!-- ================================= -->
|
321
|
+
<!-- ================================= -->
|
322
|
+
<!-- End First step -->
|
323
|
+
<!-- ================================= -->
|
324
|
+
|
325
|
+
</xsl:stylesheet>
|
326
|
+
XSLT
|
327
|
+
end
|
328
|
+
|
329
|
+
def flatxml_step2
|
330
|
+
<<~XSLT
|
331
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
332
|
+
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
333
|
+
xmlns:jcgm="https://www.metanorma.org/ns/bipm"
|
334
|
+
xmlns:bipm="https://www.metanorma.org/ns/bipm"
|
335
|
+
xmlns:mathml="http://www.w3.org/1998/Math/MathML"
|
336
|
+
xmlns:xalan="http://xml.apache.org/xalan"
|
337
|
+
xmlns:exsl="http://exslt.org/common"
|
338
|
+
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
|
339
|
+
xmlns:java="http://xml.apache.org/xalan/java"
|
340
|
+
exclude-result-prefixes="java"
|
341
|
+
version="1.0">
|
342
|
+
|
343
|
+
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
|
344
|
+
|
345
|
+
<xsl:template match="@* | node()">
|
346
|
+
<xsl:copy>
|
347
|
+
<xsl:apply-templates select="@* | node()"/>
|
348
|
+
</xsl:copy>
|
349
|
+
</xsl:template>
|
350
|
+
|
351
|
+
<xsl:template match="/*[local-name()='doc-container']/*[1]">
|
352
|
+
<xsl:copy>
|
353
|
+
<xsl:apply-templates select="@*|node()" mode="flatxml_step2"/>
|
354
|
+
</xsl:copy>
|
355
|
+
</xsl:template>
|
356
|
+
|
357
|
+
<!-- ================================= -->
|
358
|
+
<!-- Second step -->
|
359
|
+
<!-- ================================= -->
|
360
|
+
<xsl:template match="@*|node()" mode="flatxml_step2">
|
361
|
+
<xsl:copy>
|
362
|
+
<xsl:apply-templates select="@*|node()" mode="flatxml_step2"/>
|
363
|
+
</xsl:copy>
|
364
|
+
</xsl:template>
|
365
|
+
<!-- enclose elements after table/figure with @multilingual-rendering = 'common' and @multilingual-rendering = 'all-columns' in a separate element cross-align -->
|
366
|
+
<xsl:template match="*[@multilingual-rendering = 'common' or @multilingual-rendering = 'all-columns']" mode="flatxml_step2" priority="2">
|
367
|
+
<xsl:variable name="curr_id" select="generate-id()"/>
|
368
|
+
<xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
|
369
|
+
<xsl:copy-of select="@element-number"/>
|
370
|
+
<xsl:copy-of select="@multilingual-rendering"/>
|
371
|
+
<xsl:copy-of select="@displayorder"/>
|
372
|
+
<xsl:copy-of select="."/>
|
373
|
+
</xsl:element>
|
374
|
+
<xsl:if test="following-sibling::*[(not(@cross-align) or not(@cross-align='true')) and preceding-sibling::*[@cross-align='true'][1][generate-id() = $curr_id]]">
|
375
|
+
<xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
|
376
|
+
<!-- <xsl:copy-of select="following-sibling::*[(not(@cross-align) or not(@cross-align='true')) and preceding-sibling::*[@cross-align='true'][1][generate-id() = $curr_id]][1]/@element-number"/> -->
|
377
|
+
<xsl:for-each select="following-sibling::*[(not(@cross-align) or not(@cross-align='true')) and preceding-sibling::*[@cross-align='true'][1][generate-id() = $curr_id]]">
|
378
|
+
<xsl:if test="position() = 1">
|
379
|
+
<xsl:copy-of select="@element-number"/>
|
380
|
+
</xsl:if>
|
381
|
+
<xsl:copy-of select="@displayorder"/>
|
382
|
+
<xsl:copy-of select="."/>
|
383
|
+
</xsl:for-each>
|
384
|
+
</xsl:element>
|
385
|
+
</xsl:if>
|
386
|
+
</xsl:template>
|
387
|
+
|
388
|
+
<xsl:template match="*[@cross-align='true']" mode="flatxml_step2">
|
389
|
+
<xsl:variable name="curr_id" select="generate-id()"/>
|
390
|
+
<xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
|
391
|
+
<xsl:copy-of select="@element-number"/>
|
392
|
+
<xsl:copy-of select="@displayorder"/>
|
393
|
+
<xsl:if test="local-name() = 'clause'">
|
394
|
+
<xsl:copy-of select="@keep-with-next"/>
|
395
|
+
</xsl:if>
|
396
|
+
<xsl:if test="local-name() = 'title'">
|
397
|
+
<xsl:copy-of select="@keep-with-next"/>
|
398
|
+
</xsl:if>
|
399
|
+
<xsl:copy-of select="@multilingual-rendering"/>
|
400
|
+
<xsl:copy-of select="."/>
|
401
|
+
|
402
|
+
<!-- copy next elements until next element with cross-align=true -->
|
403
|
+
<xsl:for-each select="following-sibling::*[(not(@cross-align) or not(@cross-align='true')) and preceding-sibling::*[@cross-align='true'][1][generate-id() = $curr_id]]">
|
404
|
+
<xsl:copy-of select="."/>
|
405
|
+
</xsl:for-each>
|
406
|
+
</xsl:element>
|
407
|
+
</xsl:template>
|
408
|
+
|
409
|
+
<xsl:template match="*" mode="flatxml_step2">
|
410
|
+
<xsl:choose>
|
411
|
+
<xsl:when test="preceding-sibling::*[@cross-align='true'] and (not(@cross-align) or not(@cross-align='true'))"/>
|
412
|
+
<xsl:otherwise>
|
413
|
+
<xsl:copy>
|
414
|
+
<xsl:apply-templates select="@*|node()" mode="flatxml_step2"/>
|
415
|
+
</xsl:copy>
|
416
|
+
</xsl:otherwise>
|
417
|
+
</xsl:choose>
|
418
|
+
</xsl:template>
|
419
|
+
|
420
|
+
<!-- ================================= -->
|
421
|
+
<!-- End Second step -->
|
422
|
+
<!-- ================================= -->
|
423
|
+
|
424
|
+
</xsl:stylesheet>
|
425
|
+
XSLT
|
426
|
+
end
|
427
|
+
|
428
|
+
def two_column
|
429
|
+
<<~XSLT
|
430
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
431
|
+
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
432
|
+
xmlns:jcgm="https://www.metanorma.org/ns/bipm"
|
433
|
+
xmlns:bipm="https://www.metanorma.org/ns/bipm"
|
434
|
+
xmlns:mathml="http://www.w3.org/1998/Math/MathML"
|
435
|
+
xmlns:xalan="http://xml.apache.org/xalan"
|
436
|
+
xmlns:exsl="http://exslt.org/common"
|
437
|
+
xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
|
438
|
+
xmlns:java="http://xml.apache.org/xalan/java"
|
439
|
+
exclude-result-prefixes="java"
|
440
|
+
version="1.0">
|
441
|
+
|
442
|
+
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
|
443
|
+
|
444
|
+
<xsl:template match="@* | node()">
|
445
|
+
<xsl:copy>
|
446
|
+
<xsl:apply-templates select="@* | node()"/>
|
447
|
+
</xsl:copy>
|
448
|
+
</xsl:template>
|
449
|
+
|
450
|
+
<xsl:template match="//*[local-name()='doc-container'][1]">
|
451
|
+
<xsl:copy>
|
452
|
+
<xsl:apply-templates select="@* | node()" mode="multi_columns"/>
|
453
|
+
</xsl:copy>
|
454
|
+
</xsl:template>
|
455
|
+
|
456
|
+
<xsl:template match="@* | node()" mode="multi_columns">
|
457
|
+
<xsl:copy>
|
458
|
+
<xsl:apply-templates select="@* | node()" mode="multi_columns"/>
|
459
|
+
</xsl:copy>
|
460
|
+
</xsl:template>
|
461
|
+
|
462
|
+
<xsl:template match="//*[local-name()='doc-container'][position() > 1]">
|
463
|
+
</xsl:template>
|
464
|
+
|
465
|
+
<!-- =================== -->
|
466
|
+
<!-- Two columns layout -->
|
467
|
+
<!-- =================== -->
|
468
|
+
|
469
|
+
<!-- <xsl:template match="*[@first]/*[local-name()='sections']//*[not(@cross-align) or not(@cross-align='true')]"/> -->
|
470
|
+
|
471
|
+
<xsl:template match="*[@first]/*[local-name()='sections']//*[local-name() = 'cross-align'] | *[@first]/*[local-name()='annex']//*[local-name() = 'cross-align']" mode="multi_columns">
|
472
|
+
<xsl:variable name="element-number" select="@element-number"/>
|
473
|
+
<xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
|
474
|
+
|
475
|
+
<xsl:copy-of select="@keep-with-next"/>
|
476
|
+
<xsl:copy-of select="@displayorder"/>
|
477
|
+
<xsl:element name="align-cell" namespace="https://www.metanorma.org/ns/bipm">
|
478
|
+
<xsl:copy-of select="@keep-with-next"/>
|
479
|
+
<xsl:apply-templates select="." />
|
480
|
+
</xsl:element>
|
481
|
+
<xsl:variable name="keep-with-next" select="@keep-with-next"/>
|
482
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
483
|
+
<xsl:element name="align-cell" namespace="https://www.metanorma.org/ns/bipm">
|
484
|
+
<xsl:if test="$keep-with-next != ''">
|
485
|
+
<xsl:attribute name="keep-with-next"><xsl:value-of select="$keep-with-next"/></xsl:attribute>
|
486
|
+
</xsl:if>
|
487
|
+
<xsl:apply-templates select=".//*[local-name() = 'cross-align' and @element-number=$element-number]"/>
|
488
|
+
</xsl:element>
|
489
|
+
</xsl:for-each>
|
490
|
+
</xsl:element>
|
491
|
+
</xsl:template>
|
492
|
+
|
493
|
+
<xsl:template match="*[local-name() = 'cross-align']" priority="3">
|
494
|
+
<xsl:apply-templates />
|
495
|
+
</xsl:template>
|
496
|
+
|
497
|
+
<!-- no display table/figure from slave documents if @multilingual-rendering="common" or @multilingual-rendering = 'all-columns' -->
|
498
|
+
<xsl:template match="*[@slave]//*[local-name()='table'][@multilingual-rendering= 'common']" priority="2"/>
|
499
|
+
<xsl:template match="*[@slave]//*[local-name()='table'][@multilingual-rendering = 'all-columns']" priority="2"/>
|
500
|
+
<xsl:template match="*[@slave]//*[local-name()='figure'][@multilingual-rendering = 'common']" priority="2"/>
|
501
|
+
<xsl:template match="*[@slave]//*[local-name()='figure'][@multilingual-rendering = 'all-columns']" priority="2"/>
|
502
|
+
|
503
|
+
<!-- for table and figure with @multilingual-rendering="common" -->
|
504
|
+
<!-- display only element from first document -->
|
505
|
+
<xsl:template match="*[@first]//*[local-name() = 'cross-align'][@multilingual-rendering = 'common']" mode="multi_columns">
|
506
|
+
<xsl:apply-templates />
|
507
|
+
</xsl:template>
|
508
|
+
|
509
|
+
<!-- for table and figure with @multilingual-rendering = 'all-columns' -->
|
510
|
+
<!-- display element from first document, then (after) from 2nd one, then 3rd, etc. -->
|
511
|
+
<xsl:template match="*[@first]//*[local-name() = 'cross-align'][@multilingual-rendering = 'all-columns']" mode="multi_columns">
|
512
|
+
<xsl:variable name="element-number" select="@element-number"/>
|
513
|
+
<xsl:apply-templates />
|
514
|
+
<xsl:choose>
|
515
|
+
<xsl:when test="local-name(*[@multilingual-rendering = 'all-columns']) = 'table'">
|
516
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
517
|
+
<xsl:for-each select=".//*[local-name() = 'table' and @element-number=$element-number]">
|
518
|
+
<xsl:call-template name="table"/>
|
519
|
+
</xsl:for-each>
|
520
|
+
</xsl:for-each>
|
521
|
+
</xsl:when>
|
522
|
+
<xsl:when test="local-name(*[@multilingual-rendering = 'all-columns']) = 'figure'">
|
523
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
524
|
+
|
525
|
+
<xsl:for-each select=".//*[local-name() = 'figure' and @element-number=$element-number]">
|
526
|
+
<xsl:call-template name="figure"/>
|
527
|
+
</xsl:for-each>
|
528
|
+
</xsl:for-each>
|
529
|
+
</xsl:when>
|
530
|
+
</xsl:choose>
|
531
|
+
</xsl:template>
|
532
|
+
|
533
|
+
<!-- =========== -->
|
534
|
+
<!-- References -->
|
535
|
+
<xsl:template match="*[@first]//*[local-name()='references'][@normative='true']" mode="multi_columns">
|
536
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
537
|
+
<xsl:element name="bookmark" namespace="https://www.metanorma.org/ns/bipm">
|
538
|
+
<xsl:attribute name="id"><xsl:value-of select=".//*[local-name()='references'][@normative='true']/@id"/></xsl:attribute>
|
539
|
+
</xsl:element>
|
540
|
+
</xsl:for-each>
|
541
|
+
<xsl:apply-templates mode="multi_columns"/>
|
542
|
+
</xsl:template>
|
543
|
+
|
544
|
+
<xsl:template match="*[@first]//*[local-name()='references'][@normative='true']/*" mode="multi_columns">
|
545
|
+
<xsl:variable name="number_"><xsl:number count="*"/></xsl:variable>
|
546
|
+
<xsl:variable name="number" select="number(normalize-space($number_))"/>
|
547
|
+
<xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
|
548
|
+
<xsl:copy-of select="@displayorder"/>
|
549
|
+
<xsl:element name="align-cell" namespace="https://www.metanorma.org/ns/bipm">
|
550
|
+
<xsl:apply-templates select="." />
|
551
|
+
</xsl:element>
|
552
|
+
|
553
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
554
|
+
<xsl:element name="align-cell" namespace="https://www.metanorma.org/ns/bipm">
|
555
|
+
<xsl:apply-templates select="(.//*[local-name()='references'][@normative='true']/*)[$number]"/>
|
556
|
+
</xsl:element>
|
557
|
+
</xsl:for-each>
|
558
|
+
</xsl:element>
|
559
|
+
</xsl:template>
|
560
|
+
|
561
|
+
<xsl:template match="*[@first]//*[local-name()='references'][not(@normative='true')]" mode="multi_columns">
|
562
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
563
|
+
<!--<bookmark id="{.//*[local-name()='references'][not(@normative='true')]/@id}"/>-->
|
564
|
+
<xsl:element name="bookmark" namespace="https://www.metanorma.org/ns/bipm">
|
565
|
+
<xsl:attribute name="id"><xsl:value-of select=".//*[local-name()='references'][not(@normative='true')]/@id"/></xsl:attribute>
|
566
|
+
</xsl:element>
|
567
|
+
</xsl:for-each>
|
568
|
+
<xsl:apply-templates mode="multi_columns"/>
|
569
|
+
</xsl:template>
|
570
|
+
|
571
|
+
<xsl:template match="*[@first]//*[local-name()='references'][not(@normative='true')]/*" mode="multi_columns">
|
572
|
+
<xsl:variable name="number_"><xsl:number count="*"/></xsl:variable>
|
573
|
+
<xsl:variable name="number" select="number(normalize-space($number_))"/>
|
574
|
+
<xsl:element name="cross-align" namespace="https://www.metanorma.org/ns/bipm">
|
575
|
+
<xsl:copy-of select="@displayorder"/>
|
576
|
+
<xsl:element name="align-cell" namespace="https://www.metanorma.org/ns/bipm">
|
577
|
+
<xsl:apply-templates select="." />
|
578
|
+
</xsl:element>
|
579
|
+
|
580
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
581
|
+
|
582
|
+
<xsl:element name="align-cell" namespace="https://www.metanorma.org/ns/bipm">
|
583
|
+
<xsl:apply-templates select="(.//*[local-name()='references'][not(@normative='true')]/*)[$number]"/>
|
584
|
+
</xsl:element>
|
585
|
+
</xsl:for-each>
|
586
|
+
</xsl:element>
|
587
|
+
</xsl:template>
|
588
|
+
<!-- End of References -->
|
589
|
+
|
590
|
+
<xsl:template match="*[@first]//*[local-name()='annex']" mode="multi_columns">
|
591
|
+
<xsl:variable name="number_"><xsl:number /></xsl:variable>
|
592
|
+
<xsl:variable name="number" select="number(normalize-space($number_))"/>
|
593
|
+
<xsl:for-each select="//*[local-name()='doc-container'][position() > 1]">
|
594
|
+
|
595
|
+
<!--<bookmark id="{(.//*[local-name()='annex'])[$number]/@id}"/>-->
|
596
|
+
<xsl:element name="bookmark" namespace="https://www.metanorma.org/ns/bipm">
|
597
|
+
<xsl:attribute name="id"><xsl:value-of select=".//*[local-name()='annex'][$number]/@id"/></xsl:attribute>
|
598
|
+
</xsl:element>
|
599
|
+
</xsl:for-each>
|
600
|
+
<xsl:apply-templates mode="multi_columns"/>
|
601
|
+
</xsl:template>
|
602
|
+
|
603
|
+
<!-- =================== -->
|
604
|
+
<!-- End Two columns layout -->
|
605
|
+
<!-- =================== -->
|
606
|
+
|
607
|
+
</xsl:stylesheet>
|
608
|
+
XSLT
|
609
|
+
end
|
610
|
+
|
611
|
+
def initialize(options)
|
612
|
+
options[:align_cross_elements] ||= %w(note p)
|
613
|
+
@align_cross_elements = " #{options[:align_cross_elements].join(' ')} "
|
614
|
+
@doctype = options[:doctype]
|
615
|
+
@outdir = options[:outdir]
|
616
|
+
@converter_opt = options[:converter_options]
|
617
|
+
end
|
618
|
+
|
619
|
+
def htmlconv
|
620
|
+
x = Asciidoctor.load nil, backend: @doctype
|
621
|
+
x.converter.html_converter(@converter_opt)
|
622
|
+
end
|
623
|
+
|
624
|
+
def to_bilingual(input)
|
625
|
+
presxml = Nokogiri::XML(input)
|
626
|
+
doc_first_input = xmldoc(presxml.at("//xmlns:doc-container[1]"))
|
627
|
+
doc_first_step1 =
|
628
|
+
Nokogiri::XSLT(flatxml_step1("first", @align_cross_elements))
|
629
|
+
.transform(doc_first_input)
|
630
|
+
doc_first = Nokogiri::XSLT(flatxml_step2).transform(doc_first_step1)
|
631
|
+
docs_slave_input = presxml.xpath("//xmlns:doc-container[position() > 1]")
|
632
|
+
.map do |x|
|
633
|
+
xmldoc(x)
|
634
|
+
end
|
635
|
+
docs_slave_step1 = docs_slave_input.map do |x|
|
636
|
+
Nokogiri::XSLT(flatxml_step1("slave",
|
637
|
+
@align_cross_elements)).transform(x)
|
638
|
+
end
|
639
|
+
docs_slave = docs_slave_step1.map do |x|
|
640
|
+
Nokogiri::XSLT(flatxml_step2).transform(x)
|
641
|
+
end
|
642
|
+
doc = Nokogiri::XML("<root xmlns='http://metanorma.org'/>")
|
643
|
+
doc.root << doc_first.root
|
644
|
+
docs_slave.each { |x| doc.root << x.root }
|
645
|
+
ret = Nokogiri::XSLT(two_column).transform(doc)
|
646
|
+
presxml.at("//xmlns:doc-container[1]").replace(ret.root.children)
|
647
|
+
to_xml(presxml)
|
648
|
+
end
|
649
|
+
|
650
|
+
def to_html(presxml)
|
651
|
+
xml = Nokogiri::XML(File.read(presxml))
|
652
|
+
doc = xml.at("//xmlns:doc-container[1]/*")
|
653
|
+
# will need to concatenate preface if present
|
654
|
+
out = File.join(@outdir, "collection.bilingual.presentation.xml")
|
655
|
+
File.open(out, "w:utf-8") { |f| f.write to_xml(doc) }
|
656
|
+
htmlconv.convert(out)
|
657
|
+
end
|
658
|
+
end
|
659
|
+
end
|
660
|
+
end
|
@@ -110,6 +110,7 @@ module Metanorma
|
|
110
110
|
|
111
111
|
def svgmap_resolve_eref(eref, isodoc, _docxml, ids)
|
112
112
|
href = isodoc.eref_target(eref) or return
|
113
|
+
href = href[:link]
|
113
114
|
href == "##{eref['bibitemid']}" ||
|
114
115
|
(href =~ /^#/ && !ids[href.sub(/^#/, "")]) and return
|
115
116
|
eref["target"] = href.strip
|
@@ -35,7 +35,8 @@ module Metanorma
|
|
35
35
|
|
36
36
|
def file_compile_formats(filename, identifier)
|
37
37
|
f = @files.get(identifier, :outputs)
|
38
|
-
|
38
|
+
concatenate_presentation?({ format: @format }) and
|
39
|
+
@format << :presentation
|
39
40
|
@format.each do |e|
|
40
41
|
ext = @compile.processor.output_formats[e]
|
41
42
|
fn = File.basename(filename).sub(/(?<=\.)[^.]+$/, ext.to_s)
|
@@ -4,6 +4,7 @@ require_relative "fileprocess"
|
|
4
4
|
require_relative "../../util/fontist_helper"
|
5
5
|
require_relative "../../util/util"
|
6
6
|
require_relative "../filelookup/filelookup"
|
7
|
+
require_relative "../multilingual/multilingual"
|
7
8
|
require_relative "utils"
|
8
9
|
require_relative "render_word"
|
9
10
|
require_relative "navigation"
|
@@ -36,6 +37,7 @@ module Metanorma
|
|
36
37
|
@lang = collection.bibdata.language.first || "en"
|
37
38
|
@script = collection.bibdata.script.first || "Latn"
|
38
39
|
@locale = @xml.at("//xmlns:bibdata/xmlns:locale")&.text
|
40
|
+
@registry = Metanorma::Registry.instance
|
39
41
|
@doctype = doctype
|
40
42
|
@compile = Compile.new
|
41
43
|
@compile.load_flavor(@doctype)
|
@@ -58,7 +60,8 @@ module Metanorma
|
|
58
60
|
@final = collection.final
|
59
61
|
@c = HTMLEntities.new
|
60
62
|
@files_to_delete = []
|
61
|
-
@nested = options[:nested]
|
63
|
+
@nested = options[:nested]
|
64
|
+
# if false, this is the root instance of Renderer
|
62
65
|
# if true, then this is not the last time Renderer will be run
|
63
66
|
# (e.g. this is sectionsplit)
|
64
67
|
|
@@ -93,40 +96,61 @@ module Metanorma
|
|
93
96
|
|
94
97
|
def concatenate(col, options)
|
95
98
|
warn "\n\n\n\n\nConcatenate: #{DateTime.now.strftime('%H:%M:%S')}"
|
96
|
-
(options
|
99
|
+
concatenate_presentation?(options) and
|
97
100
|
options[:format] << :presentation
|
98
101
|
concatenate_prep(col, options)
|
99
102
|
concatenate_outputs(options)
|
100
103
|
end
|
101
104
|
|
105
|
+
def concatenate_presentation?(options)
|
106
|
+
!(options[:format] & %i(pdf doc)).empty? ||
|
107
|
+
(@directives.detect { |d| d.key == "bilingual" } &&
|
108
|
+
options[:format].include?(:html))
|
109
|
+
end
|
110
|
+
|
102
111
|
def concatenate_prep(col, options)
|
103
112
|
%i(xml presentation).each do |e|
|
104
113
|
options[:format].include?(e) or next
|
105
114
|
ext = e == :presentation ? "presentation.xml" : e.to_s
|
106
115
|
File.open(File.join(@outdir, "collection.#{ext}"), "w:UTF-8") do |f|
|
107
116
|
b = concatenate1(col.clone, e).to_xml
|
108
|
-
e == :presentation and
|
109
|
-
b.sub!("<metanorma-collection>", "<metanorma-collection xmlns='http://metanorma.org'>")
|
110
|
-
# TODO BEING FORCED TO DO THAT BECAUSE SHALE IS NOT DEALING WITH DEFAULT NAMESPACES
|
117
|
+
e == :presentation and b = concatenate_presentation(b)
|
111
118
|
f.write(b)
|
112
119
|
end
|
113
120
|
end
|
114
121
|
end
|
115
122
|
|
123
|
+
def concatenate_presentation(xml)
|
124
|
+
xml.sub!("<metanorma-collection>", "<metanorma-collection xmlns='http://metanorma.org'>")
|
125
|
+
# TODO BEING FORCED TO DO THAT BECAUSE SHALE IS NOT DEALING WITH DEFAULT NAMESPACES
|
126
|
+
@directives.detect { |d| d.key == "bilingual" } and
|
127
|
+
xml = Metanorma::Collection::Multilingual
|
128
|
+
.new({ align_cross_elements: %w(p note) }).to_bilingual(xml)
|
129
|
+
xml
|
130
|
+
end
|
131
|
+
|
116
132
|
def concatenate_outputs(options)
|
117
133
|
pres = File.join(@outdir, "collection.presentation.xml")
|
118
134
|
options[:format].include?(:pdf) and pdfconv.convert(pres)
|
119
135
|
options[:format].include?(:doc) and docconv_convert(pres)
|
136
|
+
@directives.detect { |d| d.key == "bilingual" } &&
|
137
|
+
options[:format].include?(:html) and
|
138
|
+
Metanorma::Collection::Multilingual.new(
|
139
|
+
{ doctype: doctype.to_sym,
|
140
|
+
converter_options: PdfOptionsNode.new(doctype, @compile_options),
|
141
|
+
outdir: @outdir },
|
142
|
+
).to_html(pres)
|
120
143
|
end
|
121
144
|
|
122
145
|
def concatenate1(out, ext)
|
123
|
-
out.directives << ::Metanorma::Collection::Config::Directive
|
146
|
+
out.directives << ::Metanorma::Collection::Config::Directive
|
147
|
+
.new(key: "documents-inline")
|
124
148
|
out.bibdatas.each_key do |ident|
|
125
149
|
id = @isodoc.docid_prefix(nil, ident.dup)
|
126
150
|
@files.get(id, :attachment) || @files.get(id, :outputs).nil? and next
|
127
151
|
out.documents[Util::key id] =
|
128
|
-
Metanorma::Collection::Document
|
129
|
-
|
152
|
+
Metanorma::Collection::Document
|
153
|
+
.raw_file(@files.get(id, :outputs)[ext])
|
130
154
|
end
|
131
155
|
out
|
132
156
|
end
|
@@ -139,7 +163,6 @@ module Metanorma
|
|
139
163
|
dt = docid.sub(/\s.*$/, "").lowercase
|
140
164
|
else return "standoc"
|
141
165
|
end
|
142
|
-
@registry = Metanorma::Registry.instance
|
143
166
|
@registry.alias(dt.to_sym)&.to_s || dt
|
144
167
|
end
|
145
168
|
|
@@ -28,8 +28,8 @@ module Metanorma
|
|
28
28
|
def compile(filename, options = {})
|
29
29
|
options_process(filename, options)
|
30
30
|
@processor = @registry.find_processor(options[:type].to_sym)
|
31
|
-
extensions = get_extensions(options) or return nil
|
32
31
|
(file, isodoc = process_input(filename, options)) or return nil
|
32
|
+
extensions = get_extensions(options) or return nil
|
33
33
|
relaton_export(isodoc, options)
|
34
34
|
extract(isodoc, options[:extract], options[:extract_type])
|
35
35
|
process_exts(filename, extensions, file, isodoc, options)
|
data/lib/metanorma/version.rb
CHANGED
data/metanorma.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -262,6 +262,20 @@ dependencies:
|
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0.15'
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: xml-c14n
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - ">="
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '0'
|
272
|
+
type: :development
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - ">="
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '0'
|
265
279
|
description: Library to process any Metanorma standard.
|
266
280
|
email:
|
267
281
|
- open.source@ribose.com
|
@@ -296,6 +310,7 @@ files:
|
|
296
310
|
- lib/metanorma/collection/filelookup/filelookup.rb
|
297
311
|
- lib/metanorma/collection/filelookup/filelookup_sectionsplit.rb
|
298
312
|
- lib/metanorma/collection/manifest/manifest.rb
|
313
|
+
- lib/metanorma/collection/multilingual/multilingual.rb
|
299
314
|
- lib/metanorma/collection/renderer/fileparse.rb
|
300
315
|
- lib/metanorma/collection/renderer/fileprocess.rb
|
301
316
|
- lib/metanorma/collection/renderer/navigation.rb
|