metanorma-generic 1.5.0 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +10 -7
- data/.github/workflows/windows.yml +0 -1
- data/lib/asciidoctor/generic/basicdoc.rng +31 -1
- data/lib/asciidoctor/generic/converter.rb +12 -35
- data/lib/asciidoctor/generic/isodoc.rng +124 -15
- data/lib/isodoc/generic/base_convert.rb +4 -30
- data/lib/isodoc/generic/html/generic.scss +18 -4
- data/lib/isodoc/generic/html_convert.rb +5 -1
- data/lib/isodoc/generic/init.rb +29 -0
- data/lib/isodoc/generic/metadata.rb +6 -2
- data/lib/isodoc/generic/pdf_convert.rb +2 -0
- data/lib/isodoc/generic/presentation_xml_convert.rb +11 -1
- data/lib/isodoc/generic/word_convert.rb +6 -2
- data/lib/metanorma/generic/processor.rb +0 -4
- data/lib/metanorma/generic/version.rb +1 -1
- data/metanorma-generic.gemspec +3 -2
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38f634ace384417096ff4e1ea82dcc50c0cad5d4a81186934df2c7f32e24ebe2
|
4
|
+
data.tar.gz: 76a20654285bb56c3c7796c6ee3e8a57776a3417cdb81f945eca21c064454afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dccf6988964bd683012b07ce100789538f44464b4c98f9f22804e12ef98434c05ada0a879a2f46e67c8d243f1263b0e25639c3dc2e66a320e3f28cf73e7f315e
|
7
|
+
data.tar.gz: fb7a296bb6d167ec80ff110671b7dca107f510bd2e81c9ea2104f687595b10972a9d9fa7a8b9b9e45b4d1f8b6c6b8c0d2624c7e70f7e4d87827644e9a5fe88ad
|
data/.github/workflows/macos.yml
CHANGED
@@ -31,7 +31,6 @@ jobs:
|
|
31
31
|
uses: actions/setup-ruby@v1
|
32
32
|
with:
|
33
33
|
ruby-version: ${{ matrix.ruby }}
|
34
|
-
architecture: 'x64'
|
35
34
|
- name: Update gems
|
36
35
|
run: |
|
37
36
|
gem install bundler
|
@@ -39,15 +38,19 @@ jobs:
|
|
39
38
|
- name: Run specs
|
40
39
|
run: |
|
41
40
|
bundle exec rake
|
42
|
-
- name: Trigger
|
43
|
-
if:
|
41
|
+
- name: Trigger repositories
|
42
|
+
if: matrix.ruby == '2.6'
|
44
43
|
env:
|
45
|
-
GH_USERNAME:
|
46
|
-
GH_ACCESS_TOKEN: ${{ secrets.
|
44
|
+
GH_USERNAME: metanorma-ci
|
45
|
+
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
47
46
|
run: |
|
48
47
|
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
49
48
|
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
50
|
-
|
49
|
+
CLIENT_PAYLOAD=$(cat <<EOF
|
50
|
+
"{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
|
51
|
+
EOF
|
52
|
+
)
|
53
|
+
for repo in $REPOS
|
51
54
|
do
|
52
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "
|
55
|
+
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
53
56
|
done
|
@@ -158,7 +158,17 @@
|
|
158
158
|
<data type="ID"/>
|
159
159
|
</attribute>
|
160
160
|
<oneOrMore>
|
161
|
-
<
|
161
|
+
<choice>
|
162
|
+
<ref name="formula"/>
|
163
|
+
<ref name="ul"/>
|
164
|
+
<ref name="ol"/>
|
165
|
+
<ref name="dl"/>
|
166
|
+
<ref name="quote"/>
|
167
|
+
<ref name="sourcecode"/>
|
168
|
+
<ref name="paragraph"/>
|
169
|
+
<ref name="table"/>
|
170
|
+
<ref name="figure"/>
|
171
|
+
</choice>
|
162
172
|
</oneOrMore>
|
163
173
|
</element>
|
164
174
|
</define>
|
@@ -402,6 +412,16 @@
|
|
402
412
|
</choice>
|
403
413
|
</attribute>
|
404
414
|
</optional>
|
415
|
+
<optional>
|
416
|
+
<attribute name="valign">
|
417
|
+
<choice>
|
418
|
+
<value>top</value>
|
419
|
+
<value>middle</value>
|
420
|
+
<value>bottom</value>
|
421
|
+
<value>baseline</value>
|
422
|
+
</choice>
|
423
|
+
</attribute>
|
424
|
+
</optional>
|
405
425
|
<choice>
|
406
426
|
<zeroOrMore>
|
407
427
|
<ref name="TextElement"/>
|
@@ -429,6 +449,16 @@
|
|
429
449
|
</choice>
|
430
450
|
</attribute>
|
431
451
|
</optional>
|
452
|
+
<optional>
|
453
|
+
<attribute name="valign">
|
454
|
+
<choice>
|
455
|
+
<value>top</value>
|
456
|
+
<value>middle</value>
|
457
|
+
<value>bottom</value>
|
458
|
+
<value>baseline</value>
|
459
|
+
</choice>
|
460
|
+
</attribute>
|
461
|
+
</optional>
|
432
462
|
<choice>
|
433
463
|
<zeroOrMore>
|
434
464
|
<ref name="TextElement"/>
|
@@ -24,26 +24,12 @@ module Asciidoctor
|
|
24
24
|
|
25
25
|
def baselocation(loc)
|
26
26
|
return nil if loc.nil?
|
27
|
-
File.expand_path(File.join(File.dirname(
|
27
|
+
File.expand_path(File.join(File.dirname(
|
28
|
+
self.class::_file || __FILE__), "..", "..", "..", loc))
|
28
29
|
end
|
29
30
|
|
30
|
-
def
|
31
|
-
|
32
|
-
c.role **{ type: "author" }
|
33
|
-
c.organization do |a|
|
34
|
-
a.name configuration.organization_name_long
|
35
|
-
end
|
36
|
-
end
|
37
|
-
personal_author(node, xml)
|
38
|
-
end
|
39
|
-
|
40
|
-
def metadata_publisher(node, xml)
|
41
|
-
xml.contributor do |c|
|
42
|
-
c.role **{ type: "publisher" }
|
43
|
-
c.organization do |a|
|
44
|
-
a.name configuration.organization_name_long
|
45
|
-
end
|
46
|
-
end
|
31
|
+
def default_publisher
|
32
|
+
configuration.organization_name_long
|
47
33
|
end
|
48
34
|
|
49
35
|
def metadata_committee(node, xml)
|
@@ -85,18 +71,6 @@ module Asciidoctor
|
|
85
71
|
xml.docnumber { |i| i << node.attr("docnumber") }
|
86
72
|
end
|
87
73
|
|
88
|
-
def metadata_copyright(node, xml)
|
89
|
-
from = node.attr("copyright-year") || Date.today.year
|
90
|
-
xml.copyright do |c|
|
91
|
-
c.from from
|
92
|
-
c.owner do |owner|
|
93
|
-
owner.organization do |o|
|
94
|
-
o.name configuration.organization_name_long
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
74
|
def metadata_ext(node, ext)
|
101
75
|
super
|
102
76
|
Array(configuration.metadata_extensions).each do |e|
|
@@ -105,7 +79,7 @@ module Asciidoctor
|
|
105
79
|
end
|
106
80
|
|
107
81
|
def doctype(node)
|
108
|
-
d =
|
82
|
+
d = super
|
109
83
|
configuration.doctypes or return d == "article" ? "standard" : d
|
110
84
|
default = configuration.default_doctype || Array(configuration.doctypes).dig(0) ||
|
111
85
|
"standard"
|
@@ -144,9 +118,12 @@ module Asciidoctor
|
|
144
118
|
def outputs(node, ret)
|
145
119
|
File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
|
146
120
|
presentation_xml_converter(node).convert(@filename + ".xml")
|
147
|
-
html_converter(node).convert(@filename + ".presentation.xml",
|
148
|
-
|
149
|
-
|
121
|
+
html_converter(node).convert(@filename + ".presentation.xml",
|
122
|
+
nil, false, "#{@filename}.html")
|
123
|
+
doc_converter(node).convert(@filename + ".presentation.xml",
|
124
|
+
nil, false, "#{@filename}.doc")
|
125
|
+
pdf_converter(node)&.convert(@filename + ".presentation.xml",
|
126
|
+
nil, false, "#{@filename}.pdf")
|
150
127
|
|
151
128
|
end
|
152
129
|
|
@@ -206,7 +183,7 @@ module Asciidoctor
|
|
206
183
|
def boilerplate_isodoc(xmldoc)
|
207
184
|
conv = super
|
208
185
|
Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
|
209
|
-
conv.
|
186
|
+
conv.i18n.set(a, configuration.send(a))
|
210
187
|
end
|
211
188
|
conv
|
212
189
|
end
|
@@ -42,8 +42,11 @@
|
|
42
42
|
</define>
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
|
+
<!-- attribute target { xsd:IDREF }, -->
|
45
46
|
<attribute name="target">
|
46
|
-
<data type="
|
47
|
+
<data type="string">
|
48
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
49
|
+
</data>
|
47
50
|
</attribute>
|
48
51
|
<optional>
|
49
52
|
<attribute name="type">
|
@@ -578,6 +581,8 @@
|
|
578
581
|
<ref name="ol"/>
|
579
582
|
<ref name="dl"/>
|
580
583
|
<ref name="formula"/>
|
584
|
+
<ref name="quote"/>
|
585
|
+
<ref name="sourcecode"/>
|
581
586
|
</choice>
|
582
587
|
</oneOrMore>
|
583
588
|
</element>
|
@@ -661,6 +666,16 @@
|
|
661
666
|
</choice>
|
662
667
|
</attribute>
|
663
668
|
</optional>
|
669
|
+
<optional>
|
670
|
+
<attribute name="valign">
|
671
|
+
<choice>
|
672
|
+
<value>top</value>
|
673
|
+
<value>middle</value>
|
674
|
+
<value>bottom</value>
|
675
|
+
<value>baseline</value>
|
676
|
+
</choice>
|
677
|
+
</attribute>
|
678
|
+
</optional>
|
664
679
|
<choice>
|
665
680
|
<zeroOrMore>
|
666
681
|
<choice>
|
@@ -697,6 +712,16 @@
|
|
697
712
|
</choice>
|
698
713
|
</attribute>
|
699
714
|
</optional>
|
715
|
+
<optional>
|
716
|
+
<attribute name="valign">
|
717
|
+
<choice>
|
718
|
+
<value>top</value>
|
719
|
+
<value>middle</value>
|
720
|
+
<value>bottom</value>
|
721
|
+
<value>baseline</value>
|
722
|
+
</choice>
|
723
|
+
</attribute>
|
724
|
+
</optional>
|
700
725
|
<choice>
|
701
726
|
<zeroOrMore>
|
702
727
|
<choice>
|
@@ -922,6 +947,9 @@
|
|
922
947
|
<optional>
|
923
948
|
<attribute name="script"/>
|
924
949
|
</optional>
|
950
|
+
<optional>
|
951
|
+
<attribute name="type"/>
|
952
|
+
</optional>
|
925
953
|
<optional>
|
926
954
|
<attribute name="obligation">
|
927
955
|
<choice>
|
@@ -961,9 +989,6 @@
|
|
961
989
|
</define>
|
962
990
|
<define name="content-subsection">
|
963
991
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
992
|
<ref name="Content-Section"/>
|
968
993
|
</element>
|
969
994
|
</define>
|
@@ -992,6 +1017,9 @@
|
|
992
1017
|
</choice>
|
993
1018
|
</attribute>
|
994
1019
|
</optional>
|
1020
|
+
<optional>
|
1021
|
+
<attribute name="type"/>
|
1022
|
+
</optional>
|
995
1023
|
<optional>
|
996
1024
|
<ref name="section-title"/>
|
997
1025
|
</optional>
|
@@ -1011,9 +1039,6 @@
|
|
1011
1039
|
</define>
|
1012
1040
|
<define name="clause">
|
1013
1041
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1042
|
<ref name="Clause-Section"/>
|
1018
1043
|
</element>
|
1019
1044
|
</define>
|
@@ -1042,18 +1067,24 @@
|
|
1042
1067
|
</choice>
|
1043
1068
|
</attribute>
|
1044
1069
|
</optional>
|
1070
|
+
<optional>
|
1071
|
+
<attribute name="type"/>
|
1072
|
+
</optional>
|
1045
1073
|
<optional>
|
1046
1074
|
<ref name="section-title"/>
|
1047
1075
|
</optional>
|
1048
1076
|
<group>
|
1049
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1077
|
+
<choice>
|
1078
|
+
<group>
|
1079
|
+
<zeroOrMore>
|
1080
|
+
<ref name="BasicBlock"/>
|
1081
|
+
</zeroOrMore>
|
1082
|
+
<zeroOrMore>
|
1083
|
+
<ref name="note"/>
|
1084
|
+
</zeroOrMore>
|
1085
|
+
</group>
|
1086
|
+
<ref name="amend"/>
|
1087
|
+
</choice>
|
1057
1088
|
<zeroOrMore>
|
1058
1089
|
<choice>
|
1059
1090
|
<ref name="clause-subsection"/>
|
@@ -1180,6 +1211,9 @@
|
|
1180
1211
|
<optional>
|
1181
1212
|
<attribute name="script"/>
|
1182
1213
|
</optional>
|
1214
|
+
<optional>
|
1215
|
+
<attribute name="type"/>
|
1216
|
+
</optional>
|
1183
1217
|
<optional>
|
1184
1218
|
<attribute name="obligation">
|
1185
1219
|
<choice>
|
@@ -1501,4 +1535,79 @@
|
|
1501
1535
|
<ref name="CitationType"/>
|
1502
1536
|
</element>
|
1503
1537
|
</define>
|
1538
|
+
<define name="amend">
|
1539
|
+
<element name="amend">
|
1540
|
+
<optional>
|
1541
|
+
<attribute name="id">
|
1542
|
+
<data type="ID"/>
|
1543
|
+
</attribute>
|
1544
|
+
</optional>
|
1545
|
+
<attribute name="change">
|
1546
|
+
<choice>
|
1547
|
+
<value>add</value>
|
1548
|
+
<value>modify</value>
|
1549
|
+
<value>delete</value>
|
1550
|
+
</choice>
|
1551
|
+
</attribute>
|
1552
|
+
<optional>
|
1553
|
+
<attribute name="path"/>
|
1554
|
+
</optional>
|
1555
|
+
<optional>
|
1556
|
+
<attribute name="path_end"/>
|
1557
|
+
</optional>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="title"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<element name="location">
|
1563
|
+
<zeroOrMore>
|
1564
|
+
<ref name="locality"/>
|
1565
|
+
</zeroOrMore>
|
1566
|
+
</element>
|
1567
|
+
</optional>
|
1568
|
+
<zeroOrMore>
|
1569
|
+
<ref name="autonumber"/>
|
1570
|
+
</zeroOrMore>
|
1571
|
+
<optional>
|
1572
|
+
<element name="description">
|
1573
|
+
<zeroOrMore>
|
1574
|
+
<ref name="BasicBlock"/>
|
1575
|
+
</zeroOrMore>
|
1576
|
+
</element>
|
1577
|
+
</optional>
|
1578
|
+
<optional>
|
1579
|
+
<element name="newcontent">
|
1580
|
+
<zeroOrMore>
|
1581
|
+
<ref name="BasicBlock"/>
|
1582
|
+
</zeroOrMore>
|
1583
|
+
</element>
|
1584
|
+
</optional>
|
1585
|
+
<optional>
|
1586
|
+
<element name="description">
|
1587
|
+
<zeroOrMore>
|
1588
|
+
<ref name="BasicBlock"/>
|
1589
|
+
</zeroOrMore>
|
1590
|
+
</element>
|
1591
|
+
</optional>
|
1592
|
+
</element>
|
1593
|
+
</define>
|
1594
|
+
<define name="autonumber">
|
1595
|
+
<element name="autonumber">
|
1596
|
+
<attribute name="type">
|
1597
|
+
<choice>
|
1598
|
+
<value>requirement</value>
|
1599
|
+
<value>recommendation</value>
|
1600
|
+
<value>permission</value>
|
1601
|
+
<value>table</value>
|
1602
|
+
<value>figure</value>
|
1603
|
+
<value>admonition</value>
|
1604
|
+
<value>formula</value>
|
1605
|
+
<value>sourcecode</value>
|
1606
|
+
<value>example</value>
|
1607
|
+
<value>note</value>
|
1608
|
+
</choice>
|
1609
|
+
</attribute>
|
1610
|
+
<text/>
|
1611
|
+
</element>
|
1612
|
+
</define>
|
1504
1613
|
</grammar>
|
@@ -1,40 +1,13 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require_relative "xref"
|
4
2
|
require "fileutils"
|
5
3
|
|
6
4
|
module IsoDoc
|
7
5
|
module Generic
|
8
6
|
module BaseConvert
|
9
|
-
def metadata_init(lang, script, labels)
|
10
|
-
@meta = Metadata.new(lang, script, labels)
|
11
|
-
end
|
12
|
-
|
13
|
-
def xref_init(lang, script, klass, labels, options)
|
14
|
-
@xrefs = Xref.new(lang, script, klass, labels, options)
|
15
|
-
end
|
16
|
-
|
17
7
|
def baselocation(loc)
|
18
8
|
return nil if loc.nil?
|
19
|
-
File.expand_path(File.join(
|
20
|
-
|
21
|
-
|
22
|
-
def annex_name(annex, name, div)
|
23
|
-
div.h1 **{ class: "Annex" } do |t|
|
24
|
-
t << "#{@xrefs.anchor(annex['id'], :label)} "
|
25
|
-
t.br
|
26
|
-
t.b do |b|
|
27
|
-
name&.children&.each { |c2| parse(c2, b) }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def i18n_init(lang, script)
|
33
|
-
super
|
34
|
-
end
|
35
|
-
|
36
|
-
def fileloc(loc)
|
37
|
-
File.join(File.dirname(__FILE__), loc)
|
9
|
+
File.expand_path(File.join(
|
10
|
+
File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
|
38
11
|
end
|
39
12
|
|
40
13
|
def cleanup(docxml)
|
@@ -52,7 +25,8 @@ module IsoDoc
|
|
52
25
|
end
|
53
26
|
|
54
27
|
def make_body(xml, docxml)
|
55
|
-
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
28
|
+
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
29
|
+
"xml:lang": "EN-US", class: "container" }
|
56
30
|
xml.body **body_attr do |body|
|
57
31
|
make_body1(body, docxml)
|
58
32
|
make_body2(body, docxml)
|
@@ -636,7 +636,7 @@ div.WordSection2
|
|
636
636
|
|
637
637
|
div.WordSection3
|
638
638
|
{page:WordSection3;}
|
639
|
-
table.MsoISOTable
|
639
|
+
table.MsoISOTable, table.MsoISOTableBig
|
640
640
|
{mso-style-name:"Table ISO";
|
641
641
|
mso-tstyle-rowband-size:0;
|
642
642
|
mso-tstyle-colband-size:0;
|
@@ -656,15 +656,15 @@ table.MsoISOTable
|
|
656
656
|
mso-border-insidev:.75pt solid windowtext;
|
657
657
|
font-size:10.0pt;
|
658
658
|
font-family:$bodyfont;}
|
659
|
-
table.MsoISOTable th
|
659
|
+
table.MsoISOTable th, table.MsoISOTableBig th
|
660
660
|
{border:solid windowtext 1pt;
|
661
661
|
mso-border-alt:solid windowtext 1pt;
|
662
662
|
padding:0cm 2.85pt 0cm 2.85pt;}
|
663
|
-
table.MsoISOTable td
|
663
|
+
table.MsoISOTable td, table.MsoISOTableBig td
|
664
664
|
{border:solid windowtext 1pt;
|
665
665
|
mso-border-alt:solid windowtext 1pt;
|
666
666
|
padding:0cm 2.85pt 0cm 2.85pt;}
|
667
|
-
table.MsoISOTable p
|
667
|
+
table.MsoISOTable p, table.MsoISOTableBig p
|
668
668
|
{font-size:10.0pt; }
|
669
669
|
table.MsoTableGrid
|
670
670
|
{mso-style-name:"Table Grid";
|
@@ -750,6 +750,20 @@ div.example p.MsoListParagraph {
|
|
750
750
|
|
751
751
|
div.Note p.MsoListParagraph {
|
752
752
|
font-size: 10.0pt;
|
753
|
+
margin-left: 1.0cm;
|
754
|
+
}
|
755
|
+
|
756
|
+
div.Note span.stem {
|
757
|
+
font-size: 10.0pt; }
|
758
|
+
|
759
|
+
div.Note p.Sourcecode, div.Note pre.Sourcecode {
|
760
|
+
font-size: 8.0pt;
|
761
|
+
margin-left: 1.0cm;
|
762
|
+
}
|
763
|
+
|
764
|
+
div.Note table.dl {
|
765
|
+
font-size: 10.0pt;
|
766
|
+
margin-left: 1.0cm;
|
753
767
|
}
|
754
768
|
|
755
769
|
span.note_label, span.example_label, td.example_label, td.note_label
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "base_convert"
|
2
|
+
require_relative "init"
|
2
3
|
require "isodoc"
|
3
4
|
|
4
5
|
module IsoDoc
|
@@ -51,10 +52,13 @@ module IsoDoc
|
|
51
52
|
|
52
53
|
def googlefonts
|
53
54
|
return unless configuration.webfont
|
54
|
-
Array(configuration.webfont).map
|
55
|
+
Array(configuration.webfont).map do |x|
|
56
|
+
%{<link href="#{x.gsub(/\&/, '&')}" rel="stylesheet">}
|
57
|
+
end.join("\n")
|
55
58
|
end
|
56
59
|
|
57
60
|
include BaseConvert
|
61
|
+
include Init
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
require_relative "xref"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module Generic
|
7
|
+
module Init
|
8
|
+
def metadata_init(lang, script, i18n)
|
9
|
+
@meta = Metadata.new(lang, script, i18n)
|
10
|
+
end
|
11
|
+
|
12
|
+
def xref_init(lang, script, klass, i18n, options)
|
13
|
+
html = HtmlConvert.new(language: lang, script: script)
|
14
|
+
@xrefs = Xref.new(lang, script, html, i18n, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def i18n_init(lang, script, i18nyaml = nil)
|
18
|
+
@i18n = I18n.new(
|
19
|
+
lang, script, i18nyaml ||
|
20
|
+
Metanorma::Generic.configuration.i18nyaml || @i18nyaml)
|
21
|
+
end
|
22
|
+
|
23
|
+
def fileloc(loc)
|
24
|
+
File.join(File.dirname(__FILE__), loc)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "isodoc"
|
2
|
+
require_relative "init"
|
2
3
|
|
3
4
|
module IsoDoc
|
4
5
|
module Generic
|
@@ -22,9 +23,12 @@ module IsoDoc
|
|
22
23
|
k._file = caller_locations.first.absolute_path
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
+
def baselocation(loc)
|
26
27
|
return nil if loc.nil?
|
27
|
-
File.expand_path(File.join(File.dirname(
|
28
|
+
File.expand_path(File.join(File.dirname(
|
29
|
+
self.class.respond_to?(:_file) ? (self.class::_file || __FILE__) :
|
30
|
+
__FILE__),
|
31
|
+
"..", "..", "..", loc))
|
28
32
|
end
|
29
33
|
|
30
34
|
def configuration
|
@@ -1,9 +1,19 @@
|
|
1
|
-
require_relative "
|
1
|
+
require_relative "init"
|
2
|
+
require_relative "metadata"
|
2
3
|
require "isodoc"
|
3
4
|
|
4
5
|
module IsoDoc
|
5
6
|
module Generic
|
6
7
|
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
|
8
|
+
def annex1(f)
|
9
|
+
lbl = @xrefs.anchor(f['id'], :label)
|
10
|
+
if t = f.at(ns("./title"))
|
11
|
+
t.children = "<strong>#{t.children.to_xml}</strong>"
|
12
|
+
end
|
13
|
+
prefix_name(f, "<br/>", lbl, "title")
|
14
|
+
end
|
15
|
+
|
16
|
+
include Init
|
7
17
|
end
|
8
18
|
end
|
9
19
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "base_convert"
|
2
|
+
require_relative "init"
|
2
3
|
require "isodoc"
|
3
4
|
|
4
5
|
module IsoDoc
|
@@ -22,8 +23,10 @@ module IsoDoc
|
|
22
23
|
|
23
24
|
def default_fonts(options)
|
24
25
|
{
|
25
|
-
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
26
|
-
|
26
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
27
|
+
configuration.word_bodyfont || '"Arial",sans-serif'),
|
28
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
29
|
+
configuration.word_headerfont || '"Arial",sans-serif'),
|
27
30
|
monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
|
28
31
|
}
|
29
32
|
end
|
@@ -51,6 +54,7 @@ module IsoDoc
|
|
51
54
|
end
|
52
55
|
|
53
56
|
include BaseConvert
|
57
|
+
include Init
|
54
58
|
end
|
55
59
|
end
|
56
60
|
end
|
@@ -40,10 +40,6 @@ module Metanorma
|
|
40
40
|
"Metanorma::Generic #{Metanorma::Generic::VERSION}"
|
41
41
|
end
|
42
42
|
|
43
|
-
def input_to_isodoc(file, filename)
|
44
|
-
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
45
|
-
end
|
46
|
-
|
47
43
|
def extract_options(file)
|
48
44
|
head = file.sub(/\n\n.*$/m, "\n")
|
49
45
|
/\n:htmlstylesheet: (?<htmlstylesheet>[^\n]+)\n/ =~ head
|
data/metanorma-generic.gemspec
CHANGED
@@ -28,10 +28,11 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
32
|
-
spec.add_dependency "isodoc", "~> 1.
|
31
|
+
spec.add_dependency "metanorma-standoc", "~> 1.5.0"
|
32
|
+
spec.add_dependency "isodoc", "~> 1.2.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 9.1"
|
35
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
35
36
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
36
37
|
spec.add_development_dependency "guard", "~> 2.14"
|
37
38
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-generic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.5.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.5.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: isodoc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.2.0
|
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
|
-
version: 1.
|
68
|
+
version: 1.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '9.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sassc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.4.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: equivalent-xml
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,6 +253,7 @@ files:
|
|
239
253
|
- lib/isodoc/generic/html/word_generic_titlepage.html
|
240
254
|
- lib/isodoc/generic/html/wordstyle.scss
|
241
255
|
- lib/isodoc/generic/html_convert.rb
|
256
|
+
- lib/isodoc/generic/init.rb
|
242
257
|
- lib/isodoc/generic/metadata.rb
|
243
258
|
- lib/isodoc/generic/pdf_convert.rb
|
244
259
|
- lib/isodoc/generic/presentation_xml_convert.rb
|