metanorma-nist 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +1 -2
- data/lib/asciidoctor/nist/converter.rb +1 -1
- data/lib/asciidoctor/nist/isodoc.rng +3 -0
- data/lib/isodoc/nist/html/html_nist_titlepage.html +1 -0
- data/lib/isodoc/nist/html/htmlstyle.scss +6 -2
- data/lib/isodoc/nist/html/word_nist_titlepage.html +1 -0
- data/lib/isodoc/nist/html/wordstyle.scss +230 -5
- data/lib/isodoc/nist/html_convert.rb +22 -20
- data/lib/isodoc/nist/i18n-en.yaml +0 -1
- data/lib/isodoc/nist/pdf_convert.rb +4 -3
- data/lib/isodoc/nist/word_convert.rb +145 -36
- data/lib/metanorma/nist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 479ffc86d11ce177921f465e151fb8fa57f20e946234b079879523f2de275e68
|
4
|
+
data.tar.gz: 681de2826b7931bab707e701dc85fc6ed090c860c3c20e5105c86fbe57c837f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cd443581973f965269c74a3b4b185014513cda9733135a117db5e3775b201d5ccaa146c587ff7694166f9bc09f2af59b833f650bb0d8019e9950eff84384d72
|
7
|
+
data.tar.gz: 73566c4935a4778599499eec7f88bf2d82ca4317420f6e8dc5a6b8594cd9b9103ed52bf8f1f9f75f2c25cba9438cf4d55384fe151b4bbad2b3a5330801e4d8b7
|
data/README.adoc
CHANGED
@@ -145,8 +145,7 @@ introduced with `=`, is ignored)
|
|
145
145
|
|
146
146
|
`:docnumber:`:: The internal identifier referring to this document.
|
147
147
|
|
148
|
-
`:
|
149
|
-
Metanorma XML output; otherwise they are suppressed. The value of
|
148
|
+
`:edition:`:: Edition (revision) of the document. The value of
|
150
149
|
this attribute will be displayed as part of the heading, prefixed with "Revision".
|
151
150
|
|
152
151
|
////
|
@@ -138,7 +138,7 @@ module Asciidoctor
|
|
138
138
|
result << noko { |ixml| front node, ixml }
|
139
139
|
result << noko { |ixml| middle node, ixml }
|
140
140
|
result << "</nist-standard>"
|
141
|
-
result = textcleanup(result
|
141
|
+
result = textcleanup(result)
|
142
142
|
ret1 = cleanup(Nokogiri::XML(result))
|
143
143
|
validate(ret1)
|
144
144
|
ret1.root.add_namespace(nil, EXAMPLE_NAMESPACE)
|
@@ -590,7 +590,7 @@ ul > li:first-child {
|
|
590
590
|
.rule {
|
591
591
|
width: 100%;
|
592
592
|
height: 1px;
|
593
|
-
background-color: #
|
593
|
+
background-color: #2677ea;
|
594
594
|
margin: 2em 0;
|
595
595
|
}
|
596
596
|
|
@@ -688,6 +688,10 @@ span.nistvariable {
|
|
688
688
|
margin-left:-1.5em;
|
689
689
|
}
|
690
690
|
|
691
|
+
.example .Sourcecode {
|
692
|
+
background: none;
|
693
|
+
}
|
694
|
+
|
691
695
|
.pseudocode {
|
692
696
|
background-color: #dddddd;
|
693
697
|
padding: 1.2em;
|
@@ -1001,7 +1005,7 @@ h2 p {
|
|
1001
1005
|
}
|
1002
1006
|
|
1003
1007
|
|
1004
|
-
/* .copyright .name, .copyright .address {color: #
|
1008
|
+
/* .copyright .name, .copyright .address {color: #2e81c2;} */
|
1005
1009
|
|
1006
1010
|
|
1007
1011
|
|
@@ -348,7 +348,7 @@ h1
|
|
348
348
|
mso-ansi-language:EN-GB;
|
349
349
|
mso-fareast-language:JA;
|
350
350
|
mso-bidi-font-weight:normal;}
|
351
|
-
.h1Preface
|
351
|
+
.h1Preface, .h1Annex
|
352
352
|
{mso-style-priority:1;
|
353
353
|
mso-style-unhide:no;
|
354
354
|
mso-style-qformat:yes;
|
@@ -448,7 +448,7 @@ h2
|
|
448
448
|
font-family:$headerfont;
|
449
449
|
mso-font-kerning:14.0pt;
|
450
450
|
mso-fareast-font-family:$headerfont;
|
451
|
-
|
451
|
+
color:#000000;
|
452
452
|
mso-ansi-language:EN-GB;
|
453
453
|
mso-fareast-language:JA;
|
454
454
|
font-weight:bold;
|
@@ -477,12 +477,42 @@ h3
|
|
477
477
|
mso-bidi-font-size:10.0pt;
|
478
478
|
font-family:$headerfont;
|
479
479
|
mso-font-kerning:14.0pt;
|
480
|
-
|
480
|
+
color:#000000;
|
481
481
|
mso-fareast-font-family:$headerfont;
|
482
482
|
mso-ansi-language:EN-GB;
|
483
483
|
mso-fareast-language:JA;
|
484
484
|
font-weight:bold;
|
485
485
|
mso-bidi-font-weight:normal;}
|
486
|
+
.h3Annex
|
487
|
+
{mso-style-priority:3;
|
488
|
+
mso-style-unhide:no;
|
489
|
+
mso-style-qformat:yes;
|
490
|
+
mso-style-parent:"Heading 1";
|
491
|
+
mso-style-link:"Heading 3 Char";
|
492
|
+
mso-style-next:Normal;
|
493
|
+
mso-margin-top-alt:auto;
|
494
|
+
margin-right:0in;
|
495
|
+
margin-bottom:12.0pt;
|
496
|
+
margin-left:0in;
|
497
|
+
text-align:left;
|
498
|
+
text-indent:0in;
|
499
|
+
mso-pagination:none;
|
500
|
+
page-break-after:avoid;
|
501
|
+
mso-outline-level:3;
|
502
|
+
mso-hyphenate:none;
|
503
|
+
tab-stops:.5in;
|
504
|
+
mso-layout-grid-align:none;
|
505
|
+
font-size:11.0pt;
|
506
|
+
mso-bidi-font-size:10.0pt;
|
507
|
+
font-family:$headerfont;
|
508
|
+
mso-font-kerning:14.0pt;
|
509
|
+
color:#000000;
|
510
|
+
mso-fareast-font-family:$headerfont;
|
511
|
+
mso-ansi-language:EN-GB;
|
512
|
+
mso-fareast-language:JA;
|
513
|
+
font-weight:bold;
|
514
|
+
mso-bidi-font-weight:normal;}
|
515
|
+
|
486
516
|
h4
|
487
517
|
{mso-style-priority:4;
|
488
518
|
mso-style-unhide:no;
|
@@ -507,12 +537,42 @@ h4
|
|
507
537
|
mso-bidi-font-size:10.0pt;
|
508
538
|
mso-font-kerning:14.0pt;
|
509
539
|
font-family:$headerfont;
|
510
|
-
|
540
|
+
color:#000000;
|
511
541
|
mso-fareast-font-family:$headerfont;
|
512
542
|
mso-ansi-language:EN-GB;
|
513
543
|
mso-fareast-language:JA;
|
514
544
|
font-weight:bold;
|
515
545
|
mso-bidi-font-weight:normal;}
|
546
|
+
.h4Annex
|
547
|
+
{mso-style-priority:4;
|
548
|
+
mso-style-unhide:no;
|
549
|
+
mso-style-qformat:yes;
|
550
|
+
mso-style-parent:"Heading 3";
|
551
|
+
mso-style-link:"Heading 4 Char";
|
552
|
+
mso-style-next:Normal;
|
553
|
+
mso-margin-top-alt:auto;
|
554
|
+
margin-right:0in;
|
555
|
+
margin-bottom:12.0pt;
|
556
|
+
margin-left:.6in;
|
557
|
+
text-align:left;
|
558
|
+
text-indent:-.6in;
|
559
|
+
mso-pagination:widow-orphan;
|
560
|
+
page-break-after:avoid;
|
561
|
+
mso-outline-level:4;
|
562
|
+
mso-hyphenate:none;
|
563
|
+
tab-stops:list .6in left .75in;
|
564
|
+
mso-layout-grid-align:auto;
|
565
|
+
font-size:11.0pt;
|
566
|
+
mso-bidi-font-size:10.0pt;
|
567
|
+
mso-font-kerning:14.0pt;
|
568
|
+
font-family:$headerfont;
|
569
|
+
color:#000000;
|
570
|
+
mso-fareast-font-family:$headerfont;
|
571
|
+
mso-ansi-language:EN-GB;
|
572
|
+
mso-fareast-language:JA;
|
573
|
+
font-weight:bold;
|
574
|
+
mso-bidi-font-weight:normal;}
|
575
|
+
|
516
576
|
h5
|
517
577
|
{mso-style-priority:5;
|
518
578
|
mso-style-unhide:no;
|
@@ -543,6 +603,37 @@ h5
|
|
543
603
|
mso-font-kerning:14.0pt;
|
544
604
|
font-weight:bold;
|
545
605
|
mso-bidi-font-weight:normal;}
|
606
|
+
.h5Annex
|
607
|
+
{mso-style-priority:5;
|
608
|
+
mso-style-unhide:no;
|
609
|
+
mso-style-qformat:yes;
|
610
|
+
mso-style-parent:"Heading 4";
|
611
|
+
mso-style-link:"Heading 5 Char";
|
612
|
+
mso-style-next:Normal;
|
613
|
+
mso-margin-top-alt:auto;
|
614
|
+
margin-right:0in;
|
615
|
+
margin-bottom:12.0pt;
|
616
|
+
margin-left:.7in;
|
617
|
+
text-align:left;
|
618
|
+
text-indent:-.7in;
|
619
|
+
mso-pagination:widow-orphan;
|
620
|
+
page-break-after:avoid;
|
621
|
+
mso-outline-level:5;
|
622
|
+
mso-list:l78 level5 lfo4;
|
623
|
+
mso-hyphenate:none;
|
624
|
+
tab-stops:list .7in left .75in;
|
625
|
+
mso-layout-grid-align:auto;
|
626
|
+
font-size:11.0pt;
|
627
|
+
mso-bidi-font-size:10.0pt;
|
628
|
+
font-family:$headerfont;
|
629
|
+
mso-fareast-font-family:$headerfont;
|
630
|
+
color:#000000;
|
631
|
+
mso-ansi-language:EN-GB;
|
632
|
+
mso-fareast-language:JA;
|
633
|
+
mso-font-kerning:14.0pt;
|
634
|
+
font-weight:bold;
|
635
|
+
mso-bidi-font-weight:normal;}
|
636
|
+
|
546
637
|
h6
|
547
638
|
{mso-style-priority:6;
|
548
639
|
mso-style-unhide:no;
|
@@ -569,13 +660,46 @@ h6
|
|
569
660
|
mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt;
|
570
661
|
font-size:11.0pt;
|
571
662
|
mso-bidi-font-size:10.0pt;
|
572
|
-
|
663
|
+
color:#000000;
|
573
664
|
font-weight:bold;
|
574
665
|
font-family:$headerfont;
|
575
666
|
mso-fareast-font-family:$headerfont;
|
576
667
|
mso-ansi-language:EN-GB;
|
577
668
|
mso-fareast-language:JA;
|
578
669
|
mso-bidi-font-weight:normal;}
|
670
|
+
.h6Annex
|
671
|
+
{mso-style-priority:6;
|
672
|
+
mso-style-unhide:no;
|
673
|
+
mso-style-qformat:yes;
|
674
|
+
mso-style-parent:"Heading 5";
|
675
|
+
mso-style-link:"Heading 6 Char";
|
676
|
+
mso-style-next:Normal;
|
677
|
+
margin-top:0in;
|
678
|
+
margin-right:0in;
|
679
|
+
margin-bottom:12.0pt;
|
680
|
+
margin-left:116.1pt;
|
681
|
+
text-align:justify;
|
682
|
+
text-indent:-.8in;
|
683
|
+
mso-pagination:none;
|
684
|
+
page-break-after:avoid;
|
685
|
+
mso-outline-level:6;
|
686
|
+
mso-list:l78 level6 lfo4;
|
687
|
+
mso-hyphenate:none;
|
688
|
+
background:black;
|
689
|
+
mso-layout-grid-align:none;
|
690
|
+
border:none;
|
691
|
+
mso-border-alt:solid windowtext .5pt;
|
692
|
+
padding:0in;
|
693
|
+
mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt;
|
694
|
+
font-size:11.0pt;
|
695
|
+
mso-bidi-font-size:10.0pt;
|
696
|
+
color:#000000;
|
697
|
+
font-weight:bold;
|
698
|
+
font-family:$headerfont;
|
699
|
+
mso-fareast-font-family:$headerfont;
|
700
|
+
mso-ansi-language:EN-GB;
|
701
|
+
mso-fareast-language:JA;
|
702
|
+
mso-bidi-font-weight:normal;}
|
579
703
|
|
580
704
|
p.TOCTitle, li.TOCTitle, div.TOCTitle
|
581
705
|
{mso-style-name:"TOC Title";
|
@@ -1142,6 +1266,107 @@ p.Tablebody, li.Tablebody, div.Tablebody
|
|
1142
1266
|
margin-left:162.0pt;
|
1143
1267
|
text-indent:-18.0pt;}
|
1144
1268
|
|
1269
|
+
p.ListContLevel1, li.ListContLevel1, div.ListContLevel1
|
1270
|
+
{mso-style-priority:34;
|
1271
|
+
margin-top:0cm;
|
1272
|
+
margin-left:18.0pt;
|
1273
|
+
margin-right:0cm;
|
1274
|
+
margin-bottom:12.0pt;
|
1275
|
+
mso-pagination:widow-orphan;
|
1276
|
+
font-size:11.0pt;
|
1277
|
+
font-family:$bodyfont;
|
1278
|
+
mso-ansi-language:EN-AU;
|
1279
|
+
mso-fareast-language:EN-US;}
|
1280
|
+
p.ListContLevel2, li.ListContLevel2, div.ListContLevel2
|
1281
|
+
{mso-style-priority:34;
|
1282
|
+
margin-top:0cm;
|
1283
|
+
margin-left:36.0pt;
|
1284
|
+
margin-right:0cm;
|
1285
|
+
margin-bottom:12.0pt;
|
1286
|
+
mso-pagination:widow-orphan;
|
1287
|
+
font-size:11.0pt;
|
1288
|
+
font-family:$bodyfont;
|
1289
|
+
mso-ansi-language:EN-AU;
|
1290
|
+
mso-fareast-language:EN-US;}
|
1291
|
+
p.ListContLevel3, li.ListContLevel3, div.ListContLevel3
|
1292
|
+
{mso-style-priority:34;
|
1293
|
+
margin-top:0cm;
|
1294
|
+
margin-left:54.0pt;
|
1295
|
+
margin-right:0cm;
|
1296
|
+
margin-bottom:12.0pt;
|
1297
|
+
mso-pagination:widow-orphan;
|
1298
|
+
font-size:11.0pt;
|
1299
|
+
font-family:$bodyfont;
|
1300
|
+
mso-ansi-language:EN-AU;
|
1301
|
+
mso-fareast-language:EN-US;}
|
1302
|
+
p.ListContLevel4, li.ListContLevel4, div.ListContLevel4
|
1303
|
+
{mso-style-priority:34;
|
1304
|
+
margin-top:0cm;
|
1305
|
+
margin-left:72.0pt;
|
1306
|
+
margin-right:0cm;
|
1307
|
+
margin-bottom:12.0pt;
|
1308
|
+
mso-pagination:widow-orphan;
|
1309
|
+
font-size:11.0pt;
|
1310
|
+
font-family:$bodyfont;
|
1311
|
+
mso-ansi-language:EN-AU;
|
1312
|
+
mso-fareast-language:EN-US;}
|
1313
|
+
p.ListContLevel5, li.ListContLevel5, div.ListContLevel5
|
1314
|
+
{mso-style-priority:34;
|
1315
|
+
margin-top:0cm;
|
1316
|
+
margin-left:90.0pt;
|
1317
|
+
margin-right:0cm;
|
1318
|
+
margin-bottom:12.0pt;
|
1319
|
+
mso-pagination:widow-orphan;
|
1320
|
+
font-size:11.0pt;
|
1321
|
+
font-family:$bodyfont;
|
1322
|
+
mso-ansi-language:EN-AU;
|
1323
|
+
mso-fareast-language:EN-US;}
|
1324
|
+
p.ListContLevel6, li.ListContLevel6, div.ListContLevel6
|
1325
|
+
{mso-style-priority:34;
|
1326
|
+
margin-top:0cm;
|
1327
|
+
margin-left:108.0pt;
|
1328
|
+
margin-right:0cm;
|
1329
|
+
margin-bottom:12.0pt;
|
1330
|
+
mso-pagination:widow-orphan;
|
1331
|
+
font-size:11.0pt;
|
1332
|
+
font-family:$bodyfont;
|
1333
|
+
mso-ansi-language:EN-AU;
|
1334
|
+
mso-fareast-language:EN-US;}
|
1335
|
+
p.ListContLevel7, li.ListContLevel7, div.ListContLevel7
|
1336
|
+
{mso-style-priority:34;
|
1337
|
+
margin-top:0cm;
|
1338
|
+
margin-left:126.0pt;
|
1339
|
+
margin-right:0cm;
|
1340
|
+
margin-bottom:12.0pt;
|
1341
|
+
mso-pagination:widow-orphan;
|
1342
|
+
font-size:11.0pt;
|
1343
|
+
font-family:$bodyfont;
|
1344
|
+
mso-ansi-language:EN-AU;
|
1345
|
+
mso-fareast-language:EN-US;}
|
1346
|
+
p.ListContLevel8, li.ListContLevel8, div.ListContLevel8
|
1347
|
+
{mso-style-priority:34;
|
1348
|
+
margin-top:0cm;
|
1349
|
+
margin-left:144.0pt;
|
1350
|
+
margin-right:0cm;
|
1351
|
+
margin-bottom:12.0pt;
|
1352
|
+
mso-pagination:widow-orphan;
|
1353
|
+
font-size:11.0pt;
|
1354
|
+
font-family:$bodyfont;
|
1355
|
+
mso-ansi-language:EN-AU;
|
1356
|
+
mso-fareast-language:EN-US;}
|
1357
|
+
p.ListContLevel9, li.ListContLevel9, div.ListContLevel9
|
1358
|
+
{mso-style-priority:34;
|
1359
|
+
margin-top:0cm;
|
1360
|
+
margin-left:162.0pt;
|
1361
|
+
margin-right:0cm;
|
1362
|
+
margin-bottom:12.0pt;
|
1363
|
+
mso-pagination:widow-orphan;
|
1364
|
+
font-size:11.0pt;
|
1365
|
+
font-family:$bodyfont;
|
1366
|
+
mso-ansi-language:EN-AU;
|
1367
|
+
mso-fareast-language:EN-US;}
|
1368
|
+
|
1369
|
+
|
1145
1370
|
table.MsoNormalTable
|
1146
1371
|
{mso-style-name:"Table Normal";
|
1147
1372
|
mso-tstyle-rowband-size:0;
|
@@ -91,6 +91,24 @@ module IsoDoc
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
def bibliography(isoxml, out)
|
95
|
+
f = isoxml.at(ns("//bibliography/clause | //bibliography/references")) || return
|
96
|
+
page_break(out)
|
97
|
+
isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f|
|
98
|
+
out.div do |div|
|
99
|
+
div.h1 **{ class: "Section3" } do |h1|
|
100
|
+
f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
|
101
|
+
end
|
102
|
+
f.elements.reject do |e|
|
103
|
+
["reference", "title", "bibitem"].include? e.name
|
104
|
+
end.each { |e| parse(e, div) }
|
105
|
+
biblio_list(f, div, false)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# common from here on
|
111
|
+
|
94
112
|
def abstract(isoxml, out)
|
95
113
|
f = isoxml.at(ns("//preface/abstract")) || return
|
96
114
|
page_break(out)
|
@@ -158,7 +176,8 @@ module IsoDoc
|
|
158
176
|
end
|
159
177
|
|
160
178
|
def requirement_cleanup(docxml)
|
161
|
-
docxml.xpath("//div[@class = 'recommend'
|
179
|
+
docxml.xpath("//div[@class = 'recommend' or @class = 'require' "\
|
180
|
+
"or @class = 'permission'][title]").each do |d|
|
162
181
|
title = d.at("./title")
|
163
182
|
title.name = "b"
|
164
183
|
n = title.next_element
|
@@ -234,7 +253,7 @@ module IsoDoc
|
|
234
253
|
|
235
254
|
def requirement_parse(node, out)
|
236
255
|
name = node["type"]
|
237
|
-
out.div **{ class: "
|
256
|
+
out.div **{ class: "require" } do |t|
|
238
257
|
t.title { |b| b << "Requirement #{get_anchors[node['id']][:label]}:" }
|
239
258
|
node.children.each do |n|
|
240
259
|
parse(n, t)
|
@@ -244,7 +263,7 @@ module IsoDoc
|
|
244
263
|
|
245
264
|
def permission_parse(node, out)
|
246
265
|
name = node["type"]
|
247
|
-
out.div **{ class: "
|
266
|
+
out.div **{ class: "permission" } do |t|
|
248
267
|
t.title { |b| b << "Permission #{get_anchors[node['id']][:label]}:" }
|
249
268
|
node.children.each do |n|
|
250
269
|
parse(n, t)
|
@@ -299,22 +318,6 @@ module IsoDoc
|
|
299
318
|
bibliography isoxml, out
|
300
319
|
end
|
301
320
|
|
302
|
-
def bibliography(isoxml, out)
|
303
|
-
f = isoxml.at(ns("//bibliography/clause | //bibliography/references")) || return
|
304
|
-
page_break(out)
|
305
|
-
isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f|
|
306
|
-
out.div do |div|
|
307
|
-
div.h1 **{ class: "Section3" } do |h1|
|
308
|
-
f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
|
309
|
-
end
|
310
|
-
f.elements.reject do |e|
|
311
|
-
["reference", "title", "bibitem"].include? e.name
|
312
|
-
end.each { |e| parse(e, div) }
|
313
|
-
biblio_list(f, div, false)
|
314
|
-
end
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
321
|
def info(isoxml, out)
|
319
322
|
@meta.keywords isoxml, out
|
320
323
|
super
|
@@ -349,7 +352,6 @@ module IsoDoc
|
|
349
352
|
end
|
350
353
|
end
|
351
354
|
|
352
|
-
|
353
355
|
def prefaceprefix(nodes)
|
354
356
|
i = 0
|
355
357
|
nodes.each do |n|
|
@@ -157,7 +157,8 @@ module IsoDoc
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def requirement_cleanup(docxml)
|
160
|
-
docxml.xpath("//div[@class = 'recommend'
|
160
|
+
docxml.xpath("//div[@class = 'recommend' or @class = 'require' or "\
|
161
|
+
"@class = 'permission'][title]").each do |d|
|
161
162
|
title = d.at("./title")
|
162
163
|
title.name = "b"
|
163
164
|
n = title.next_element
|
@@ -233,7 +234,7 @@ module IsoDoc
|
|
233
234
|
|
234
235
|
def requirement_parse(node, out)
|
235
236
|
name = node["type"]
|
236
|
-
out.div **{ class: "
|
237
|
+
out.div **{ class: "require" } do |t|
|
237
238
|
t.title { |b| b << "Requirement #{get_anchors[node['id']][:label]}:" }
|
238
239
|
node.children.each do |n|
|
239
240
|
parse(n, t)
|
@@ -243,7 +244,7 @@ module IsoDoc
|
|
243
244
|
|
244
245
|
def permission_parse(node, out)
|
245
246
|
name = node["type"]
|
246
|
-
out.div **{ class: "
|
247
|
+
out.div **{ class: "permission" } do |t|
|
247
248
|
t.title { |b| b << "Permission #{get_anchors[node['id']][:label]}:" }
|
248
249
|
node.children.each do |n|
|
249
250
|
parse(n, t)
|
@@ -15,14 +15,17 @@ module IsoDoc
|
|
15
15
|
|
16
16
|
def convert1(docxml, filename, dir)
|
17
17
|
FileUtils.cp html_doc_path("logo.png"), "#{@localdir}/logo.png"
|
18
|
-
FileUtils.cp html_doc_path("deptofcommerce.png"),
|
18
|
+
FileUtils.cp html_doc_path("deptofcommerce.png"),
|
19
|
+
"#{@localdir}/deptofcommerce.png"
|
19
20
|
super
|
20
21
|
end
|
21
22
|
|
22
23
|
def default_fonts(options)
|
23
24
|
{
|
24
|
-
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
25
|
-
|
25
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
26
|
+
'"Times New Roman",serif'),
|
27
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
28
|
+
'"Arial",sans-serif'),
|
26
29
|
monospacefont: '"Courier New",monospace'
|
27
30
|
}
|
28
31
|
end
|
@@ -69,6 +72,7 @@ module IsoDoc
|
|
69
72
|
term_cleanup(docxml)
|
70
73
|
requirement_cleanup(docxml)
|
71
74
|
h1_cleanup(docxml)
|
75
|
+
word_annex_cleanup(docxml) # need it earlier
|
72
76
|
toc_insert(docxml)
|
73
77
|
end
|
74
78
|
|
@@ -79,14 +83,109 @@ module IsoDoc
|
|
79
83
|
end
|
80
84
|
end
|
81
85
|
|
86
|
+
def word_annex_cleanup(docxml)
|
87
|
+
super
|
88
|
+
docxml.xpath("//h1[ancestor::*[@class = 'Section3']]").each do |h2|
|
89
|
+
h2.name = "p"
|
90
|
+
h2["class"] = "h1Annex"
|
91
|
+
end
|
92
|
+
docxml.xpath("//h3[ancestor::*[@class = 'Section3']]").each do |h2|
|
93
|
+
h2.name = "p"
|
94
|
+
h2["class"] = "h3Annex"
|
95
|
+
end
|
96
|
+
docxml.xpath("//h4[ancestor::*[@class = 'Section3']]").each do |h2|
|
97
|
+
h2.name = "p"
|
98
|
+
h2["class"] = "h4Annex"
|
99
|
+
end
|
100
|
+
docxml.xpath("//h5[ancestor::*[@class = 'Section3']]").each do |h2|
|
101
|
+
h2.name = "p"
|
102
|
+
h2["class"] = "h5Annex"
|
103
|
+
end
|
104
|
+
docxml.xpath("//h6[ancestor::*[@class = 'Section3']]").each do |h2|
|
105
|
+
h2.name = "p"
|
106
|
+
h2["class"] = "h6Annex"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
82
110
|
def toc_insert(docxml)
|
83
|
-
insertion = docxml.at("//div[h1 = 'Executive Summary']/
|
84
|
-
|
111
|
+
insertion = docxml.at("//div[h1 = 'Executive Summary']/"\
|
112
|
+
"preceding-sibling::div[h1][1]") ||
|
113
|
+
docxml.at("//div[@class = 'WordSection2']/child::*[last()]")
|
114
|
+
if docxml.at("//p[@class = 'TableTitle']")
|
115
|
+
insertion.next = make_TableWordToC(docxml)
|
116
|
+
insertion.next = %{<p class="TOCTitle">List of Tables</p>}
|
117
|
+
end
|
118
|
+
if docxml.at("//p[@class = 'FigureTitle']")
|
119
|
+
insertion.next = make_FigureWordToC(docxml)
|
120
|
+
insertion.next = %{<p class="TOCTitle">List of Figures</p>}
|
121
|
+
end
|
122
|
+
if docxml.at("//p[@class = 'h1Annex']")
|
123
|
+
insertion.next = make_AppendixWordToC(docxml)
|
124
|
+
insertion.next = %{<p class="TOCTitle">List of Appendices</p>}
|
125
|
+
end
|
85
126
|
insertion.next = make_WordToC(docxml)
|
86
|
-
insertion.next = %{<p class="TOCTitle" style="page-break-before:
|
127
|
+
insertion.next = %{<p class="TOCTitle" style="page-break-before:
|
128
|
+
always;">Table of Contents</p>}
|
87
129
|
docxml
|
88
130
|
end
|
89
131
|
|
132
|
+
WORD_TOC_APPENDIX_PREFACE1 = <<~TOC.freeze
|
133
|
+
<span lang="EN-GB"><span
|
134
|
+
style='mso-element:field-begin'></span><span
|
135
|
+
style='mso-spacerun:yes'> </span>TOC
|
136
|
+
\\h \\z \\t "h1Annex,1,h2Annex,2,h3Annex,3" <span
|
137
|
+
style='mso-element:field-separator'></span></span>
|
138
|
+
TOC
|
139
|
+
|
140
|
+
WORD_TOC_TABLE_PREFACE1 = <<~TOC.freeze
|
141
|
+
<span lang="EN-GB"><span
|
142
|
+
style='mso-element:field-begin'></span><span
|
143
|
+
style='mso-spacerun:yes'> </span>TOC
|
144
|
+
\\h \\z \\t "TableTitle,1" <span
|
145
|
+
style='mso-element:field-separator'></span></span>
|
146
|
+
TOC
|
147
|
+
|
148
|
+
WORD_TOC_FIGURE_PREFACE1 = <<~TOC.freeze
|
149
|
+
<span lang="EN-GB"><span
|
150
|
+
style='mso-element:field-begin'></span><span
|
151
|
+
style='mso-spacerun:yes'> </span>TOC
|
152
|
+
\\h \\z \\t "FigureTitle,1" <span
|
153
|
+
style='mso-element:field-separator'></span></span>
|
154
|
+
TOC
|
155
|
+
|
156
|
+
def header_strip(h)
|
157
|
+
h = h.to_s.gsub(/<\/?p[^>]*>/, "")
|
158
|
+
super
|
159
|
+
end
|
160
|
+
|
161
|
+
def make_TableWordToC(docxml)
|
162
|
+
toc = ""
|
163
|
+
docxml.xpath("//p[@class = 'TableTitle']").each do |h|
|
164
|
+
toc += word_toc_entry(1, header_strip(h))
|
165
|
+
end
|
166
|
+
toc.sub(/(<p class="MsoToc1">)/,
|
167
|
+
%{\\1#{WORD_TOC_TABLE_PREFACE1}}) + WORD_TOC_SUFFIX1
|
168
|
+
end
|
169
|
+
|
170
|
+
def make_FigureWordToC(docxml)
|
171
|
+
toc = ""
|
172
|
+
docxml.xpath("//p[@class = 'FigureTitle']").each do |h|
|
173
|
+
toc += word_toc_entry(1, header_strip(h))
|
174
|
+
end
|
175
|
+
toc.sub(/(<p class="MsoToc1">)/,
|
176
|
+
%{\\1#{WORD_TOC_FIGURE_PREFACE1}}) + WORD_TOC_SUFFIX1
|
177
|
+
end
|
178
|
+
|
179
|
+
def make_AppendixWordToC(docxml)
|
180
|
+
toc = ""
|
181
|
+
docxml.xpath("//p[@class = 'h1Annex'] | //p[@class = 'h2Annex'] | "\
|
182
|
+
"p[@class = 'h3Annex']").each do |h|
|
183
|
+
toc += word_toc_entry(h["class"][1].to_i, header_strip(h))
|
184
|
+
end
|
185
|
+
toc.sub(/(<p class="MsoToc1">)/,
|
186
|
+
%{\\1#{WORD_TOC_APPENDIX_PREFACE1}}) + WORD_TOC_SUFFIX1
|
187
|
+
end
|
188
|
+
|
90
189
|
def make_WordToC(docxml)
|
91
190
|
toc = ""
|
92
191
|
docxml.xpath("//h1[not(ancestor::*[@class = 'WordSection2'])] |"\
|
@@ -100,7 +199,8 @@ module IsoDoc
|
|
100
199
|
end
|
101
200
|
|
102
201
|
def word_preface_cleanup(docxml)
|
103
|
-
docxml.xpath("//h1[@class = 'AbstractTitle'] |
|
202
|
+
docxml.xpath("//h1[@class = 'AbstractTitle'] | "\
|
203
|
+
"//h1[@class = 'IntroTitle']").each do |h2|
|
104
204
|
h2.name = "p"
|
105
205
|
h2["class"] = "h1Preface"
|
106
206
|
end
|
@@ -112,6 +212,24 @@ module IsoDoc
|
|
112
212
|
docxml
|
113
213
|
end
|
114
214
|
|
215
|
+
def bibliography(isoxml, out)
|
216
|
+
f = isoxml.at(ns("//bibliography/clause | "\
|
217
|
+
"//bibliography/references")) || return
|
218
|
+
page_break(out)
|
219
|
+
isoxml.xpath(ns("//bibliography/clause | "\
|
220
|
+
"//bibliography/references")).each do |f|
|
221
|
+
out.div do |div|
|
222
|
+
div.p **{ class: "h1Annex" } do |h1|
|
223
|
+
f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
|
224
|
+
end
|
225
|
+
f.elements.reject do |e|
|
226
|
+
["reference", "title", "bibitem"].include? e.name
|
227
|
+
end.each { |e| parse(e, div) }
|
228
|
+
biblio_list(f, div, false)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
115
233
|
# Henceforth identical to html
|
116
234
|
|
117
235
|
def abstract(isoxml, out)
|
@@ -131,9 +249,11 @@ module IsoDoc
|
|
131
249
|
end
|
132
250
|
end
|
133
251
|
|
134
|
-
FRONT_CLAUSE = "//*[parent::preface]
|
252
|
+
FRONT_CLAUSE = "//*[parent::preface]"\
|
253
|
+
"[not(local-name() = 'abstract')]".freeze
|
135
254
|
|
136
|
-
# All "[preface]" sections should have class "IntroTitle" to prevent
|
255
|
+
# All "[preface]" sections should have class "IntroTitle" to prevent
|
256
|
+
# page breaks
|
137
257
|
# But for the Exec Summary
|
138
258
|
def preface(isoxml, out)
|
139
259
|
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
@@ -142,7 +262,8 @@ module IsoDoc
|
|
142
262
|
out.div **attr_code(id: c["id"]) do |s|
|
143
263
|
clause_name(get_anchors[c['id']][:label],
|
144
264
|
c&.at(ns("./title"))&.content, s,
|
145
|
-
class: c.name == "executivesummary" ? "NormalTitle" :
|
265
|
+
class: c.name == "executivesummary" ? "NormalTitle" :
|
266
|
+
"IntroTitle")
|
146
267
|
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
147
268
|
parse(c1, s)
|
148
269
|
end
|
@@ -183,7 +304,8 @@ module IsoDoc
|
|
183
304
|
end
|
184
305
|
|
185
306
|
def requirement_cleanup(docxml)
|
186
|
-
docxml.xpath("//div[@class = 'recommend'
|
307
|
+
docxml.xpath("//div[@class = 'recommend' or @class = 'require' or "\
|
308
|
+
"@class = 'permission'][title]").each do |d|
|
187
309
|
title = d.at("./title")
|
188
310
|
title.name = "b"
|
189
311
|
n = title.next_element
|
@@ -254,7 +376,8 @@ module IsoDoc
|
|
254
376
|
def recommendation_parse(node, out)
|
255
377
|
name = node["type"]
|
256
378
|
out.div **{ class: "recommend" } do |t|
|
257
|
-
t.title { |b| b << "Recommendation
|
379
|
+
t.title { |b| b << "Recommendation "\
|
380
|
+
"#{get_anchors[node['id']][:label]}:" }
|
258
381
|
node.children.each do |n|
|
259
382
|
parse(n, t)
|
260
383
|
end
|
@@ -263,7 +386,7 @@ module IsoDoc
|
|
263
386
|
|
264
387
|
def requirement_parse(node, out)
|
265
388
|
name = node["type"]
|
266
|
-
out.div **{ class: "
|
389
|
+
out.div **{ class: "require" } do |t|
|
267
390
|
t.title { |b| b << "Requirement #{get_anchors[node['id']][:label]}:" }
|
268
391
|
node.children.each do |n|
|
269
392
|
parse(n, t)
|
@@ -273,7 +396,7 @@ module IsoDoc
|
|
273
396
|
|
274
397
|
def permission_parse(node, out)
|
275
398
|
name = node["type"]
|
276
|
-
out.div **{ class: "
|
399
|
+
out.div **{ class: "permission" } do |t|
|
277
400
|
t.title { |b| b << "Permission #{get_anchors[node['id']][:label]}:" }
|
278
401
|
node.children.each do |n|
|
279
402
|
parse(n, t)
|
@@ -319,7 +442,8 @@ module IsoDoc
|
|
319
442
|
end
|
320
443
|
end
|
321
444
|
|
322
|
-
MIDDLE_CLAUSE = "//clause[parent::sections]
|
445
|
+
MIDDLE_CLAUSE = "//clause[parent::sections] | "\
|
446
|
+
"//terms[parent::sections]".freeze
|
323
447
|
|
324
448
|
def middle(isoxml, out)
|
325
449
|
# NIST documents don't repeat the title
|
@@ -329,30 +453,14 @@ module IsoDoc
|
|
329
453
|
bibliography isoxml, out
|
330
454
|
end
|
331
455
|
|
332
|
-
def bibliography(isoxml, out)
|
333
|
-
f = isoxml.at(ns("//bibliography/clause | //bibliography/references")) || return
|
334
|
-
page_break(out)
|
335
|
-
isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f|
|
336
|
-
out.div do |div|
|
337
|
-
div.h1 **{ class: "Section3" } do |h1|
|
338
|
-
f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
|
339
|
-
end
|
340
|
-
f.elements.reject do |e|
|
341
|
-
["reference", "title", "bibitem"].include? e.name
|
342
|
-
end.each { |e| parse(e, div) }
|
343
|
-
biblio_list(f, div, false)
|
344
|
-
end
|
345
|
-
end
|
346
|
-
end
|
347
|
-
|
348
456
|
def info(isoxml, out)
|
349
457
|
@meta.keywords isoxml, out
|
350
458
|
super
|
351
459
|
end
|
352
460
|
|
353
461
|
SECTIONS_XPATH =
|
354
|
-
"//foreword | //introduction | //reviewnote | //executivesummary |
|
355
|
-
"//sections/clause | //bibliography/references | "\
|
462
|
+
"//foreword | //introduction | //reviewnote | //executivesummary | "\
|
463
|
+
"//annex | //sections/clause | //bibliography/references | "\
|
356
464
|
"//bibliography/clause".freeze
|
357
465
|
|
358
466
|
def initial_anchor_names(d)
|
@@ -430,8 +538,8 @@ module IsoDoc
|
|
430
538
|
def hierarchical_recommendation_names(clause, num)
|
431
539
|
clause.xpath(ns(".//recommendation")).each_with_index do |t, i|
|
432
540
|
next if t["id"].nil? || t["id"].empty?
|
433
|
-
@anchors[t["id"]] = anchor_struct("#{num}.#{i + 1}",
|
434
|
-
|
541
|
+
@anchors[t["id"]] = anchor_struct("#{num}.#{i + 1}", t,
|
542
|
+
"Recommendation", "recommendation")
|
435
543
|
end
|
436
544
|
end
|
437
545
|
|
@@ -443,7 +551,8 @@ module IsoDoc
|
|
443
551
|
end
|
444
552
|
|
445
553
|
def get_linkend(node)
|
446
|
-
link = anchor_linkend(node, docid_l10n(node["target"] ||
|
554
|
+
link = anchor_linkend(node, docid_l10n(node["target"] ||
|
555
|
+
"[#{node['citeas']}]"))
|
447
556
|
link += eref_localities(node.xpath(ns("./locality")), link)
|
448
557
|
contents = node.children.select { |c| c.name != "locality" }
|
449
558
|
return link if contents.nil? || contents.empty?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-nist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.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: 2019-01-
|
11
|
+
date: 2019-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|