metanorma-iso 1.10.1 → 1.10.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ubuntu.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/lib/asciidoctor/iso/base.rb +1 -1
  5. data/lib/asciidoctor/iso/basicdoc.rng +1 -11
  6. data/lib/asciidoctor/iso/biblio.rng +0 -2
  7. data/lib/asciidoctor/iso/front.rb +17 -4
  8. data/lib/asciidoctor/iso/front_id.rb +20 -17
  9. data/lib/asciidoctor/iso/isodoc.rng +61 -19
  10. data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
  11. data/lib/asciidoctor/iso/isostandard.rng +15 -3
  12. data/lib/asciidoctor/iso/reqt.rng +1 -1
  13. data/lib/asciidoctor/iso/section.rb +1 -1
  14. data/lib/asciidoctor/iso/validate.rb +1 -1
  15. data/lib/asciidoctor/iso/validate_image.rb +1 -1
  16. data/lib/asciidoctor/iso/validate_section.rb +1 -1
  17. data/lib/isodoc/iso/base_convert.rb +14 -31
  18. data/lib/isodoc/iso/html/isodoc.css +0 -1
  19. data/lib/isodoc/iso/html/isodoc.scss +0 -1
  20. data/lib/isodoc/iso/html/style-human.css +40 -9
  21. data/lib/isodoc/iso/html/style-human.scss +36 -9
  22. data/lib/isodoc/iso/html/style-iso.css +35 -6
  23. data/lib/isodoc/iso/html/style-iso.scss +31 -6
  24. data/lib/isodoc/iso/html/wordstyle.css +10 -8
  25. data/lib/isodoc/iso/html/wordstyle.scss +10 -8
  26. data/lib/isodoc/iso/html_convert.rb +81 -22
  27. data/lib/isodoc/iso/index.rb +53 -45
  28. data/lib/isodoc/iso/iso.amendment.xsl +333 -113
  29. data/lib/isodoc/iso/iso.international-standard.xsl +333 -113
  30. data/lib/isodoc/iso/isosts_convert.rb +6 -2
  31. data/lib/isodoc/iso/metadata.rb +27 -22
  32. data/lib/isodoc/iso/presentation_xml_convert.rb +60 -25
  33. data/lib/isodoc/iso/sts_convert.rb +3 -2
  34. data/lib/isodoc/iso/word_convert.rb +0 -2
  35. data/lib/metanorma/iso/processor.rb +2 -2
  36. data/lib/metanorma/iso/version.rb +1 -1
  37. data/metanorma-iso.gemspec +3 -3
  38. data/spec/asciidoctor/base_spec.rb +397 -545
  39. data/spec/asciidoctor/blocks_spec.rb +4 -4
  40. data/spec/asciidoctor/cleanup_spec.rb +15 -12
  41. data/spec/asciidoctor/refs_spec.rb +87 -84
  42. data/spec/isodoc/amd_spec.rb +261 -250
  43. data/spec/isodoc/i18n_spec.rb +7 -7
  44. data/spec/isodoc/inline_spec.rb +242 -216
  45. data/spec/isodoc/iso_spec.rb +3 -1
  46. data/spec/isodoc/postproc_spec.rb +111 -28
  47. data/spec/isodoc/section_spec.rb +3 -3
  48. data/spec/isodoc/terms_spec.rb +34 -41
  49. data/spec/isodoc/xref_spec.rb +3 -3
  50. data/spec/metanorma/processor_spec.rb +110 -14
  51. data/spec/vcr_cassettes/docrels.yml +37 -427
  52. metadata +8 -8
@@ -75,6 +75,12 @@ code *, pre *, tt *, kbd *, samp * {
75
75
  font-family: {{monospacefont}} !important;
76
76
  font-variant-ligatures: none; }
77
77
 
78
+ p code, dt code, li code, label code, legend code, caption code, th code, td code,
79
+ p tt, dt tt, li tt, label tt, legend tt, caption tt, th tt, td tt,
80
+ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
81
+ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
82
+ font-size: {{monospacefontsize}}; }
83
+
78
84
  article, aside, details, figcaption, figure,
79
85
  footer, header, hgroup, menu, nav, section {
80
86
  display: block; }
@@ -86,6 +92,9 @@ table {
86
92
  h1, h2, h3, h4, h5, h6 {
87
93
  font-family: {{headerfont}}; }
88
94
 
95
+ .h1, .h2, .h3, .h4, .h5, .h6 {
96
+ font-family: {{headerfont}}; }
97
+
89
98
  blockquote, q {
90
99
  quotes: none; }
91
100
  blockquote:before, blockquote:after, q:before, q:after {
@@ -338,23 +347,24 @@ span.title {
338
347
  font-size: 0.9em; }
339
348
 
340
349
  /* TYPOGRAPHY */
341
- h1 {
350
+ h1, .h1 {
342
351
  font-weight: 900; }
343
352
 
344
353
  h2,
345
354
  h3,
346
355
  h4,
347
356
  h5,
348
- h6 {
357
+ h6,
358
+ .h2, .h3, .h4, .h5, .h6 {
349
359
  font-weight: 700; }
350
360
 
351
- h1 {
361
+ h1, .h1 {
352
362
  font-size: 1.5em;
353
363
  line-height: 2em;
354
364
  margin-top: 2em;
355
365
  margin-bottom: 1em; }
356
366
 
357
- h2 {
367
+ h2, .h2 {
358
368
  font-size: 1.2em;
359
369
  line-height: 1.5em;
360
370
  margin-top: 2em;
@@ -365,12 +375,13 @@ h2,
365
375
  h3,
366
376
  h4,
367
377
  h5,
368
- h6 {
378
+ h6,
379
+ .h1, .h2, .h3, .h4, .h5, .h6 {
369
380
  line-height: 1.2; }
370
381
 
371
382
  /* override for amendments */
372
383
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
373
- h1, h2, h3, h4, h5, h6 {
384
+ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
374
385
  font-weight: normal;
375
386
  font-size: initial;
376
387
  font-style: italic;
@@ -379,7 +390,7 @@ h1, h2, h3, h4, h5, h6 {
379
390
  margin-bottom: 1em; }
380
391
 
381
392
  {% endif %}
382
- h2 p {
393
+ h2 p, .h2 p {
383
394
  display: inline; }
384
395
 
385
396
  p {
@@ -401,7 +412,7 @@ a {
401
412
  color: black;
402
413
  text-decoration-color: black; }
403
414
 
404
- h2 p {
415
+ h2 p, .h2 p {
405
416
  display: inline; }
406
417
 
407
418
  ul > li {
@@ -429,7 +440,6 @@ p.AltTerms {
429
440
  margin-left: 2em; }
430
441
 
431
442
  p.Terms {
432
- font-weight: bold;
433
443
  margin-top: 0em; }
434
444
 
435
445
  /* Navigation*/
@@ -977,3 +987,24 @@ span.keyword {
977
987
  .Admonition p,
978
988
  .admonition p {
979
989
  margin: 0; }
990
+
991
+ /* Collapse TOC */
992
+ .collapse-group {
993
+ display: flex;
994
+ align-items: center;
995
+ position: relative; }
996
+
997
+ .collapse-button {
998
+ position: absolute;
999
+ right: 0;
1000
+ display: inline-block;
1001
+ height: 20px;
1002
+ width: 20px;
1003
+ cursor: pointer;
1004
+ background-image: url('data:image/svg+xml,<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgba(0,0,0,.54)" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></svg>'); }
1005
+
1006
+ .collapse {
1007
+ display: none; }
1008
+
1009
+ .expand {
1010
+ transform: rotateZ(-180deg); }
@@ -140,7 +140,7 @@ span.title {
140
140
 
141
141
  /* TYPOGRAPHY */
142
142
 
143
- h1 {
143
+ h1, .h1 {
144
144
  font-weight: 900;
145
145
  }
146
146
 
@@ -148,18 +148,19 @@ h2,
148
148
  h3,
149
149
  h4,
150
150
  h5,
151
- h6 {
151
+ h6,
152
+ .h2, .h3, .h4, .h5, .h6{
152
153
  font-weight: 700;
153
154
  }
154
155
 
155
- h1 {
156
+ h1, .h1 {
156
157
  font-size: 1.5em;
157
158
  line-height: 2em;
158
159
  margin-top: 2em;
159
160
  margin-bottom: 1em;
160
161
  }
161
162
 
162
- h2 {
163
+ h2, .h2 {
163
164
  font-size: 1.2em;
164
165
  line-height: 1.5em;
165
166
  margin-top: 2em;
@@ -171,7 +172,8 @@ h2,
171
172
  h3,
172
173
  h4,
173
174
  h5,
174
- h6 {
175
+ h6,
176
+ .h1, .h2, .h3, .h4, .h5, .h6 {
175
177
  line-height: 1.2;
176
178
  }
177
179
 
@@ -179,7 +181,7 @@ h6 {
179
181
 
180
182
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
181
183
 
182
- h1, h2, h3, h4, h5, h6 {
184
+ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
183
185
  font-weight: normal;
184
186
  font-size: initial;
185
187
  font-style: italic;
@@ -190,7 +192,7 @@ h1, h2, h3, h4, h5, h6 {
190
192
 
191
193
  {% endif %}
192
194
 
193
- h2 p {
195
+ h2 p, .h2 p {
194
196
  display: inline;
195
197
  }
196
198
 
@@ -218,7 +220,7 @@ a {
218
220
  text-decoration-color: black;
219
221
  }
220
222
 
221
- h2 p {
223
+ h2 p, .h2 p {
222
224
  display: inline;
223
225
  }
224
226
 
@@ -252,7 +254,6 @@ p.AltTerms {
252
254
  }
253
255
 
254
256
  p.Terms {
255
- font-weight: bold;
256
257
  margin-top: 0em;
257
258
  }
258
259
 
@@ -693,3 +694,29 @@ span.keyword {
693
694
  .admonition p {
694
695
  margin: 0;
695
696
  }
697
+
698
+ /* Collapse TOC */
699
+
700
+ .collapse-group {
701
+ display: flex;
702
+ align-items: center;
703
+ position: relative;
704
+ }
705
+
706
+ .collapse-button {
707
+ position: absolute;
708
+ right: 0;
709
+ display: inline-block;
710
+ height: 20px;
711
+ width: 20px;
712
+ cursor: pointer;
713
+ background-image: url('data:image/svg+xml,<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgba(0,0,0,.54)" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></svg>');
714
+ }
715
+
716
+ .collapse {
717
+ display: none;
718
+ }
719
+
720
+ .expand {
721
+ transform: rotateZ(-180deg);
722
+ }
@@ -75,6 +75,12 @@ code *, pre *, tt *, kbd *, samp * {
75
75
  font-family: {{monospacefont}} !important;
76
76
  font-variant-ligatures: none; }
77
77
 
78
+ p code, dt code, li code, label code, legend code, caption code, th code, td code,
79
+ p tt, dt tt, li tt, label tt, legend tt, caption tt, th tt, td tt,
80
+ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
81
+ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
82
+ font-size: {{monospacefontsize}}; }
83
+
78
84
  article, aside, details, figcaption, figure,
79
85
  footer, header, hgroup, menu, nav, section {
80
86
  display: block; }
@@ -86,6 +92,9 @@ table {
86
92
  h1, h2, h3, h4, h5, h6 {
87
93
  font-family: {{headerfont}}; }
88
94
 
95
+ .h1, .h2, .h3, .h4, .h5, .h6 {
96
+ font-family: {{headerfont}}; }
97
+
89
98
  blockquote, q {
90
99
  quotes: none; }
91
100
  blockquote:before, blockquote:after, q:before, q:after {
@@ -315,23 +324,23 @@ span.partlabel {
315
324
  font-size: 0.9em; }
316
325
 
317
326
  /* TYPOGRAPHY */
318
- h1 {
327
+ h1, .h1 {
319
328
  font-size: 1.5em;
320
329
  line-height: 2em;
321
330
  margin-top: 2em;
322
331
  margin-bottom: 1em; }
323
332
 
324
- h2 {
333
+ h2, .h2 {
325
334
  font-size: 1.2em;
326
335
  line-height: 1.5em;
327
336
  margin-top: 2em;
328
337
  margin-bottom: 1em; }
329
338
 
330
- h1, h2, h3, h4, h5, h6 {
339
+ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
331
340
  line-height: 1.2; }
332
341
 
333
342
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
334
- h1, h2, h3, h4, h5, h6 {
343
+ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
335
344
  font-weight: normal;
336
345
  font-size: initial;
337
346
  font-style: italic; }
@@ -355,7 +364,7 @@ a {
355
364
  color: black;
356
365
  text-decoration-color: black; }
357
366
 
358
- h2 p {
367
+ h2 p, .h2 p {
359
368
  display: inline; }
360
369
 
361
370
  ul > li {
@@ -378,7 +387,6 @@ p.AltTerms {
378
387
  margin-left: 2em; }
379
388
 
380
389
  p.Terms {
381
- font-weight: bold;
382
390
  margin-top: 0em; }
383
391
 
384
392
  /* Navigation*/
@@ -1005,3 +1013,24 @@ span.keyword {
1005
1013
 
1006
1014
  .Admonition p, .admonition p {
1007
1015
  margin: 0; }
1016
+
1017
+ /* Collapse TOC */
1018
+ .collapse-group {
1019
+ display: flex;
1020
+ align-items: center;
1021
+ position: relative; }
1022
+
1023
+ .collapse-button {
1024
+ position: absolute;
1025
+ right: 0;
1026
+ display: inline-block;
1027
+ height: 20px;
1028
+ width: 20px;
1029
+ cursor: pointer;
1030
+ background-image: url('data:image/svg+xml,<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgba(0,0,0,.54)" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></svg>'); }
1031
+
1032
+ .collapse {
1033
+ display: none; }
1034
+
1035
+ .expand {
1036
+ transform: rotateZ(-180deg); }
@@ -112,27 +112,27 @@ span.partlabel {
112
112
 
113
113
  /* TYPOGRAPHY */
114
114
 
115
- h1 {
115
+ h1, .h1 {
116
116
  font-size: 1.5em;
117
117
  line-height: 2em;
118
118
  margin-top: 2em;
119
119
  margin-bottom: 1em;
120
120
  }
121
121
 
122
- h2 {
122
+ h2, .h2 {
123
123
  font-size: 1.2em;
124
124
  line-height: 1.5em;
125
125
  margin-top: 2em;
126
126
  margin-bottom: 1em;
127
127
  }
128
128
 
129
- h1, h2, h3, h4, h5, h6 {
129
+ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
130
130
  line-height: 1.2;
131
131
  }
132
132
 
133
133
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
134
134
 
135
- h1, h2, h3, h4, h5, h6 {
135
+ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
136
136
  font-weight: normal;
137
137
  font-size: initial;
138
138
  font-style: italic;
@@ -164,7 +164,7 @@ a {
164
164
  text-decoration-color: black;
165
165
  }
166
166
 
167
- h2 p {
167
+ h2 p, .h2 p {
168
168
  display: inline;
169
169
  }
170
170
 
@@ -193,7 +193,6 @@ p.AltTerms {
193
193
  }
194
194
 
195
195
  p.Terms {
196
- font-weight: bold;
197
196
  margin-top: 0em;
198
197
  }
199
198
 
@@ -710,3 +709,29 @@ font-weight: 600;
710
709
  .Admonition p, .admonition p {
711
710
  margin: 0;
712
711
  }
712
+
713
+ /* Collapse TOC */
714
+
715
+ .collapse-group {
716
+ display: flex;
717
+ align-items: center;
718
+ position: relative;
719
+ }
720
+
721
+ .collapse-button {
722
+ position: absolute;
723
+ right: 0;
724
+ display: inline-block;
725
+ height: 20px;
726
+ width: 20px;
727
+ cursor: pointer;
728
+ background-image: url('data:image/svg+xml,<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgba(0,0,0,.54)" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></svg>');
729
+ }
730
+
731
+ .collapse {
732
+ display: none;
733
+ }
734
+
735
+ .expand {
736
+ transform: rotateZ(-180deg);
737
+ }
@@ -289,7 +289,7 @@ p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxS
289
289
  div.figure, p.figure {
290
290
  text-align: center; }
291
291
 
292
- h1 {
292
+ h1, .h1 {
293
293
  mso-style-priority: 1;
294
294
  mso-style-unhide: no;
295
295
  mso-style-qformat: yes;
@@ -304,8 +304,6 @@ h1 {
304
304
  line-height: 13.5pt;
305
305
  mso-pagination: widow-orphan;
306
306
  page-break-after: avoid;
307
- mso-outline-level: 1;
308
- mso-list: l1 level1 lfo6;
309
307
  mso-hyphenate: none;
310
308
  tab-stops: 20.0pt list 21.6pt left 28.0pt;
311
309
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
@@ -324,6 +322,10 @@ h1 {
324
322
  mso-fareast-language: JA;
325
323
  mso-bidi-font-weight: normal; }
326
324
 
325
+ h1 {
326
+ mso-outline-level: 1;
327
+ mso-list: l1 level1 lfo6; }
328
+
327
329
  h1.ForewordTitle {
328
330
  font-size: 13.0pt;
329
331
  font-style: normal;
@@ -358,7 +360,7 @@ h1.Annex {
358
360
  mso-fareast-language: JA;
359
361
  mso-bidi-font-weight: normal; }
360
362
 
361
- .h2Annex, h2 {
363
+ .h2Annex, h2, .h2 {
362
364
  mso-style-priority: 2;
363
365
  mso-style-unhide: no;
364
366
  mso-style-qformat: yes;
@@ -395,7 +397,7 @@ h2 {
395
397
  mso-list: l1 level2 lfo6;
396
398
  mso-outline-level: 2; }
397
399
 
398
- .h3Annex, h3 {
400
+ .h3Annex, h3, .h3 {
399
401
  mso-style-priority: 3;
400
402
  mso-style-unhide: no;
401
403
  mso-style-qformat: yes;
@@ -432,7 +434,7 @@ h3 {
432
434
  mso-list: l1 level3 lfo6;
433
435
  mso-outline-level: 3; }
434
436
 
435
- .h4Annex, h4 {
437
+ .h4Annex, h4, .h4 {
436
438
  mso-style-priority: 4;
437
439
  mso-style-unhide: no;
438
440
  mso-style-qformat: yes;
@@ -467,7 +469,7 @@ h4 {
467
469
  mso-list: l1 level4 lfo6;
468
470
  mso-outline-level: 4; }
469
471
 
470
- .h5Annex, h5 {
472
+ .h5Annex, h5, .h5 {
471
473
  mso-style-priority: 5;
472
474
  mso-style-unhide: no;
473
475
  mso-style-qformat: yes;
@@ -502,7 +504,7 @@ h5 {
502
504
  mso-list: l1 level5 lfo6;
503
505
  mso-outline-level: 5; }
504
506
 
505
- h6 {
507
+ h6, .h6 {
506
508
  mso-style-priority: 6;
507
509
  mso-style-unhide: no;
508
510
  mso-style-qformat: yes;
@@ -269,7 +269,7 @@ p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxS
269
269
  div.figure, p.figure
270
270
  {text-align: center;}
271
271
 
272
- h1
272
+ h1, .h1
273
273
  {mso-style-priority:1;
274
274
  mso-style-unhide:no;
275
275
  mso-style-qformat:yes;
@@ -284,8 +284,6 @@ h1
284
284
  line-height:13.5pt;
285
285
  mso-pagination:widow-orphan;
286
286
  page-break-after:avoid;
287
- mso-outline-level:1;
288
- mso-list:l1 level1 lfo6;
289
287
  mso-hyphenate:none;
290
288
  tab-stops:20.0pt list 21.6pt left 28.0pt;
291
289
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
@@ -303,6 +301,10 @@ h1
303
301
  mso-ansi-language:EN-GB;
304
302
  mso-fareast-language:JA;
305
303
  mso-bidi-font-weight:normal;}
304
+ h1 {
305
+ mso-outline-level:1;
306
+ mso-list:l1 level1 lfo6;
307
+ }
306
308
  h1.ForewordTitle {
307
309
  font-size:13.0pt;
308
310
  font-style: normal ;
@@ -336,7 +338,7 @@ h1.Annex
336
338
  mso-ansi-language:EN-GB;
337
339
  mso-fareast-language:JA;
338
340
  mso-bidi-font-weight:normal;}
339
- .h2Annex, h2
341
+ .h2Annex, h2, .h2
340
342
  {mso-style-priority:2;
341
343
  mso-style-unhide:no;
342
344
  mso-style-qformat:yes;
@@ -372,7 +374,7 @@ h2
372
374
  { mso-list:l1 level2 lfo6;
373
375
  mso-outline-level:2;
374
376
  }
375
- .h3Annex, h3
377
+ .h3Annex, h3, .h3
376
378
  {mso-style-priority:3;
377
379
  mso-style-unhide:no;
378
380
  mso-style-qformat:yes;
@@ -407,7 +409,7 @@ h2
407
409
  h3 {mso-list:l1 level3 lfo6;
408
410
  mso-outline-level:3;
409
411
  }
410
- .h4Annex, h4
412
+ .h4Annex, h4, .h4
411
413
  {mso-style-priority:4;
412
414
  mso-style-unhide:no;
413
415
  mso-style-qformat:yes;
@@ -440,7 +442,7 @@ h3 {mso-list:l1 level3 lfo6;
440
442
  h4 {mso-list:l1 level4 lfo6;
441
443
  mso-outline-level:4;
442
444
  }
443
- .h5Annex, h5
445
+ .h5Annex, h5, .h5
444
446
  {mso-style-priority:5;
445
447
  mso-style-unhide:no;
446
448
  mso-style-qformat:yes;
@@ -473,7 +475,7 @@ h4 {mso-list:l1 level4 lfo6;
473
475
  h5 {mso-list:l1 level5 lfo6;
474
476
  mso-outline-level:5;
475
477
  }
476
- h6
478
+ h6, .h6
477
479
  {mso-style-priority:6;
478
480
  mso-style-unhide:no;
479
481
  mso-style-qformat:yes;
@@ -10,39 +10,98 @@ module IsoDoc
10
10
  super
11
11
  end
12
12
 
13
- def googlefonts()
14
- <<~HEAD.freeze
15
- <link href="https://fonts.googleapis.com/css?family=Space+Mono:400,400i,700,700i&display=swap" rel="stylesheet">
16
- <link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,900" rel="stylesheet">
17
- HEAD
18
- end
13
+ def googlefonts
14
+ <<~HEAD.freeze
15
+ <link href="https://fonts.googleapis.com/css?family=Space+Mono:400,400i,700,700i&display=swap" rel="stylesheet">
16
+ <link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,900" rel="stylesheet">
17
+ HEAD
18
+ end
19
19
 
20
20
  def default_fonts(options)
21
21
  {
22
- bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' :
23
- options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
24
- headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
25
- options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
26
- monospacefont: (options[:alt] ? '"Space Mono",monospace' :
27
- '"Courier New",monospace'),
28
- normalfontsize: "1.0em",
29
- smallerfontsize: "0.9em",
30
- footnotefontsize: "0.9em",
31
- monospacefontsize: "0.8em",
22
+ bodyfont: (if options[:script] == "Hans"
23
+ '"Source Han Sans",serif'
24
+ else
25
+ options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'
26
+ end),
27
+ headerfont: (if options[:script] == "Hans"
28
+ '"Source Han Sans",sans-serif'
29
+ else
30
+ options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'
31
+ end),
32
+ monospacefont: (if options[:alt]
33
+ '"Space Mono",monospace'
34
+ else
35
+ '"Courier New",monospace'
36
+ end),
37
+ normalfontsize: "1.0em",
38
+ smallerfontsize: "0.9em",
39
+ footnotefontsize: "0.9em",
40
+ monospacefontsize: "0.8em",
32
41
  }
33
42
  end
34
43
 
35
44
  def default_file_locations(options)
36
45
  {
37
- htmlstylesheet: (options[:alt] ? html_doc_path("style-human.scss") :
38
- html_doc_path("style-iso.scss")),
39
- htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
40
- htmlintropage: html_doc_path("html_iso_intro.html"),
46
+ htmlstylesheet: (if options[:alt]
47
+ html_doc_path("style-human.scss")
48
+ else
49
+ html_doc_path("style-iso.scss")
50
+ end),
51
+ htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
52
+ htmlintropage: html_doc_path("html_iso_intro.html"),
41
53
  }
42
54
  end
43
55
 
44
- def footnote_reference_format(a)
45
- a.content = a.content + ")"
56
+ def footnote_reference_format(link)
57
+ link.content += ")"
58
+ end
59
+
60
+ def html_toc_entry(level, header)
61
+ if level == "h1" && header.parent.at(".//h2[not(@class = 'TermNum')]"\
62
+ "[not(@class = 'noTOC')][text()]")
63
+ <<~HDR
64
+ <li class="#{level}"><div class="collapse-group"><a href="##{header['id']}">#{header_strip(header)}</a></li>
65
+ <div class="collapse-button"></div></div>
66
+ HDR
67
+ else
68
+ %(<li class="#{level}"><a href="##{header['id']}">\
69
+ #{header_strip(header)}</a></li>)
70
+ end
71
+ end
72
+
73
+ def html_toc(docxml)
74
+ super
75
+ docxml.xpath("//div[@id = 'toc']/ul[li[@class = 'h2']]").each do |u|
76
+ html_toc1(u)
77
+ end
78
+ docxml
79
+ end
80
+
81
+ def html_toc1(ulist)
82
+ u2 = nil
83
+ ulist.xpath("./li").each do |l|
84
+ if l["class"] != "h2"
85
+ u2 = nil
86
+ elsif u2 then u2.add_child(l.remove)
87
+ else
88
+ u2 = l.replace("<ul class='content collapse'>#{l}</ul>").first
89
+ p = u2.previous_element and p << u2
90
+ end
91
+ end
92
+ end
93
+
94
+ def inject_script(doc)
95
+ scr = <<~HEAD.freeze
96
+ <script>
97
+ $(".collapse-button").click(function () {
98
+ $(this).toggleClass('expand'); // expand: the class to change the collapse button shape
99
+ // collapse: the class to collapse/expand the li elements with the h2 class
100
+ $(this).closest('li').children(".content").toggleClass('collapse');})
101
+ </script>
102
+ HEAD
103
+ a = super.split(%r{</body>})
104
+ "#{a[0]}#{scr}</body>#{a[1]}"
46
105
  end
47
106
 
48
107
  def table_th_center(docxml)