metanorma-nist 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,7 +80,7 @@ normal'><span lang=EN-US><span style='mso-special-character:footnote-continuatio
80
80
  <div style='mso-element:header' id=eh2>
81
81
 
82
82
  <p class=MsoHeader align=left style='text-align:left;line-height:12.0pt;font-size:9pt;
83
- mso-line-height-rule:exactly'><span lang=EN-US>{{ draft_prefix }}{{ docnumber }}<span style='mso-tab-count:
83
+ mso-line-height-rule:exactly'><span lang=EN-US>{{ draft_prefix }}{{ docidentifier }}<span style='mso-tab-count:
84
84
  1'></span>{{ doctitle_short }}</span>
85
85
  <br/><span lang=EN-US><span style='mso-tab-count:1'></span>{{ docsubtitle_short }}</span>
86
86
  </p>
@@ -90,7 +90,7 @@ mso-line-height-rule:exactly'><span lang=EN-US>{{ draft_prefix }}{{ docnumber }}
90
90
  <div style='mso-element:header' id=h2>
91
91
 
92
92
  <p class=MsoHeader align=left style='text-align:left;line-height:12.0pt;font-size:9pt;
93
- mso-line-height-rule:exactly'><span lang=EN-US>{{ draft_prefix }}{{ docnumber }}<span style='mso-tab-count:
93
+ mso-line-height-rule:exactly'><span lang=EN-US>{{ draft_prefix }}{{ docidentifier }}<span style='mso-tab-count:
94
94
  1'></span>{{ doctitle_short }}</span>
95
95
  <br/><span lang=EN-US><span style='mso-tab-count:1'></span>{{ docsubtitle_short }}</span>
96
96
  </p>
@@ -37,7 +37,7 @@
37
37
  </div>
38
38
 
39
39
  <div class="coverpage-logo" style="float:left">
40
- <span>{{ publisheddate_monthyear }}</span>
40
+ <span>{{ issueddate_monthyear }}</span>
41
41
  {%if confirmeddate and confirmeddate != "XXX" %}
42
42
  <br/>Publication is current as of {{ confirmeddate_mmddyyyy }}
43
43
  {% elsif errata and updateddate and updateddate != "XXX" %}
@@ -562,6 +562,7 @@ color: rgb(123, 168, 18);
562
562
 
563
563
  ul, ol {margin-left: 1.2em;}
564
564
 
565
+ /*
565
566
  ul > li {
566
567
  list-style: none;
567
568
  }
@@ -571,6 +572,7 @@ color: rgb(123, 168, 18);
571
572
  display: inline-block; width: 1em;
572
573
  margin-left: -1.2em;
573
574
  }
575
+ */
574
576
 
575
577
  ul > li p:first-child {
576
578
  display: inline;
@@ -21,6 +21,10 @@ div.authority5 {
21
21
  text-align: center;
22
22
  }
23
23
 
24
+ div.authority1 p, div.authority2 p, div.authority3 p, div.authority4 p, div.authority5 p {
25
+ font-size:11.0pt;
26
+ }
27
+
24
28
  p.Default, li.Default, div.Default
25
29
  {mso-style-name:Default;
26
30
  mso-style-unhide:no;
@@ -473,7 +473,7 @@ style='font-size:14.0pt'><o:p>&#xa0;</o:p></span></p>
473
473
  <td width="456" valign="top" style='width:342.0pt;padding:0cm 5.4pt 0cm 5.4pt'>
474
474
  <p class="Default" style='margin-top:6.0pt;margin-right:0cm;margin-bottom:6.0pt;
475
475
  margin-left:0cm'><span lang="EN-US" style='font-size:12.0pt;font-family:"Times New Roman",serif;
476
- color:black;mso-themecolor:text1'>{{ superseding_published_date_monthyear }}<o:p></o:p></span></p>
476
+ color:black;mso-themecolor:text1'>{{ superseding_issued_date_monthyear }}{% if superseding_updated_date_MMMddyyyy %}(including updates as of {{superseding_updated_date_MMMddyyyy}}){% endif %} <o:p></o:p></span></p>
477
477
  </td>
478
478
  </tr>
479
479
  <tr style='mso-yfti-irow:5'>
@@ -667,7 +667,13 @@ style='width:477.0pt;margin-left:-5.25pt;border-collapse:collapse;border:none;ms
667
667
  padding:0cm 5.4pt 0cm 5.4pt'>
668
668
  <p class="Default"><span lang="EN-US" style='font-size:11.0pt;font-family:"Calibri",sans-serif;
669
669
  mso-ascii-theme-font:major-latin;mso-hansi-theme-font:major-latin;mso-bidi-font-family:
670
- "Times New Roman";color:black;mso-themecolor:text1'>{{ publisheddate_monthyear }}<o:p></o:p></span></p>
670
+ "Times New Roman";color:black;mso-themecolor:text1'>{{ issueddate_monthyear }}<o:p></o:p></span>
671
+ {% if confirmeddate and confirmeddate != "XXX" %}
672
+ <span style="font-size:11.0pt;color:black;font-family:"Calibri",sans-serif;">(publication is current as of {{ confirmeddate_mmddyyyy }})</span>
673
+ {% elsif errata and updateddate and updateddate != "XXX" %}
674
+ <span style="font-size:14.0pt;color:black;font-family:"Calibri",sans-serif;">(including updates as of {{ updateddate_mmddyyyy }})</span>
675
+ {% endif %}
676
+ </p>
671
677
  </td>
672
678
  </tr>
673
679
  <tr style='mso-yfti-irow:5'>
@@ -1420,12 +1426,12 @@ d25yZXYueG1sUEsFBgAAAAAEAAQA8wAAAMQFAAAAAA==
1420
1426
  <v:fill o:detectmouseclick="t"/>
1421
1427
  <v:textbox style='mso-fit-shape-to-text:t'>
1422
1428
  <div>
1423
- {% if url %}
1429
+ {% if doi %}
1424
1430
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1425
1431
  lang="EN-US" style='font-size:14.0pt;color:black'>This publication is available
1426
1432
  free of charge from:</span></p>
1427
1433
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1428
- lang="EN-US" style='font-size:14.0pt;color:black'>{{ url }}</span></p>
1434
+ lang="EN-US" style='font-size:14.0pt;color:black'>{{ doi }}</span></p>
1429
1435
  {% else %}
1430
1436
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'></p>
1431
1437
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'></p>
@@ -1434,17 +1440,20 @@ free of charge from:</span></p>
1434
1440
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1435
1441
  lang="EN-US" style='font-size:14.0pt;color:black'>&#xa0;</span></p>
1436
1442
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1437
- lang="EN-US" style='font-size:14.0pt;color:black'>{{ publisheddate_monthyear }}</span>
1443
+ lang="EN-US" style='font-size:14.0pt;color:black'>{{ issueddate_monthyear }}</span>
1438
1444
  <br/>
1439
1445
  {% if confirmeddate and confirmeddate != "XXX" %}
1440
1446
  <span style="font-variant:small-caps;font-size:14.0pt;color:black;">Publication is current as of {{ confirmeddate_mmddyyyy }}</span>
1441
1447
  {% elsif errata and updateddate and updateddate != "XXX" %}
1442
- <span style="font-variant:small-caps;font-size:14.0pt;color:black;">Includes updates as of {{ updateddate_mmddyyyy }}; see page <span style='mso-element:field-begin'></span><span
1443
- style='mso-spacerun:yes'> </span>PAGEREF errata_XYZZY \h <span style='mso-element:field-separator'></span>2<span
1444
- style='mso-element:field-end'></span> </span>
1448
+ <span style="font-variant:small-caps;font-size:14.0pt;color:black;"><a href="#errata_XYZZY">Includes updates as of {{ updateddate_mmddyyyy }}</a></span>
1445
1449
  {% endif %}
1446
1450
  </p>
1447
1451
 
1452
+ <!--
1453
+ <span style="font-variant:small-caps;font-size:14.0pt;color:black;">Includes updates as of {{ updateddate_mmddyyyy }}; see page <span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'> </span>PAGEREF errata_XYZZY \h <span style='mso-element:field-separator'></span>2<span style='mso-element:field-end'></span> </span>
1454
+ -->
1455
+
1456
+
1448
1457
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1449
1458
  lang="EN-US" style='font-size:14.0pt;color:black'>&#xa0;</span></p>
1450
1459
 
@@ -1491,12 +1500,12 @@ lang="EN-US" style='font-size:14.0pt;color:black'>&#xa0;</span></p>
1491
1500
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1492
1501
  lang="EN-US" style='font-size:14.0pt;color:black'>&#xa0;</span></p>
1493
1502
 
1494
- {% if url %}
1503
+ {% if doi %}
1495
1504
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1496
1505
  lang="EN-US" style='font-size:14.0pt;color:black'>This publication is available
1497
1506
  free of charge from:</span></p>
1498
1507
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1499
- lang="EN-US" style='font-size:14.0pt;color:black'>{{ url }}</span></p>
1508
+ lang="EN-US" style='font-size:14.0pt;color:black'>{{ doi }}</span></p>
1500
1509
  {% endif %}
1501
1510
 
1502
1511
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
@@ -1505,7 +1514,7 @@ lang="EN-US" style='font-size:14.0pt;color:black'>&#xa0;</span></p>
1505
1514
  lang="EN-US" style='font-size:14.0pt;color:black'>&#xa0;</span></p>
1506
1515
 
1507
1516
  <p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
1508
- lang="EN-US" style='font-size:14.0pt;color:black'>{{ publisheddate_monthyear }}</span>
1517
+ lang="EN-US" style='font-size:14.0pt;color:black'>{{ issueddate_monthyear }}</span>
1509
1518
  {%if confirmeddate and confirmeddate != "XXX" %}
1510
1519
  <br/><span style="font-variant:small-caps;font-size:14.0pt;color:black;">Publication is current as of {{ confirmeddate }}</span>
1511
1520
  {% endif %}
@@ -403,6 +403,7 @@ h1.Annex {
403
403
  mso-style-parent:"Heading 1";
404
404
  mso-style-link:"Heading 2 Char";
405
405
  mso-style-next:Normal;
406
+ text-align:center;
406
407
  margin-top:3.0pt;
407
408
  margin-right:0cm;
408
409
  margin-bottom:12.0pt;
@@ -411,7 +412,6 @@ h1.Annex {
411
412
  line-height:12.5pt;
412
413
  mso-pagination:widow-orphan;
413
414
  page-break-after:avoid;
414
- mso-outline-level:2;
415
415
  mso-hyphenate:none;
416
416
  tab-stops:27.0pt 35.0pt;
417
417
  font-size:12.0pt;
@@ -1026,7 +1026,7 @@ p.Tablebody, li.Tablebody, div.Tablebody
1026
1026
  @list l0:level7
1027
1027
  {mso-level-reset-level:level2;
1028
1028
  mso-level-suffix:space;
1029
- mso-level-text:"Figure\00A0%1\.%7\00A0";
1029
+ mso-level-text:"Figure\00A0%1\.%7\00A0";
1030
1030
  mso-level-tab-stop:none;
1031
1031
  mso-level-number-position:left;
1032
1032
  margin-left:0cm;
@@ -1035,7 +1035,7 @@ p.Tablebody, li.Tablebody, div.Tablebody
1035
1035
  @list l0:level8
1036
1036
  {mso-level-reset-level:level2;
1037
1037
  mso-level-suffix:space;
1038
- mso-level-text:"Table\00A0%1\.%8\00A0";
1038
+ mso-level-text:"Table\00A0%1\.%8\00A0";
1039
1039
  mso-level-tab-stop:none;
1040
1040
  mso-level-number-position:left;
1041
1041
  margin-left:0cm;
@@ -1205,63 +1205,63 @@ p.Tablebody, li.Tablebody, div.Tablebody
1205
1205
  mso-list-template-ids:-277327948 -457018030 67633155 67633157 67633153 67633155 67633157 67633153 67633155 67633157;}
1206
1206
  @list l3:level1
1207
1207
  {mso-level-number-format:bullet;
1208
- mso-level-text:—;
1208
+ mso-level-text:•;
1209
1209
  mso-level-tab-stop:none;
1210
1210
  mso-level-number-position:left;
1211
1211
  margin-left:18.0pt;
1212
1212
  text-indent:-18.0pt;}
1213
1213
  @list l3:level2
1214
1214
  {mso-level-number-format:bullet;
1215
- mso-level-text:—;
1215
+ mso-level-text:•;
1216
1216
  mso-level-tab-stop:none;
1217
1217
  mso-level-number-position:left;
1218
1218
  margin-left:36.0pt;
1219
1219
  text-indent:-18.0pt;}
1220
1220
  @list l3:level3
1221
1221
  {mso-level-number-format:bullet;
1222
- mso-level-text:—;
1222
+ mso-level-text:•;
1223
1223
  mso-level-tab-stop:none;
1224
1224
  mso-level-number-position:left;
1225
1225
  margin-left:54.0pt;
1226
1226
  text-indent:-18.0pt;}
1227
1227
  @list l3:level4
1228
1228
  {mso-level-number-format:bullet;
1229
- mso-level-text:—;
1229
+ mso-level-text:•;
1230
1230
  mso-level-tab-stop:none;
1231
1231
  mso-level-number-position:left;
1232
1232
  margin-left:72.0pt;
1233
1233
  text-indent:-18.0pt;}
1234
1234
  @list l3:level5
1235
1235
  {mso-level-number-format:bullet;
1236
- mso-level-text:—;
1236
+ mso-level-text:•;
1237
1237
  mso-level-tab-stop:none;
1238
1238
  mso-level-number-position:left;
1239
1239
  margin-left:90.0pt;
1240
1240
  text-indent:-18.0pt;}
1241
1241
  @list l3:level6
1242
1242
  {mso-level-number-format:bullet;
1243
- mso-level-text:—;
1243
+ mso-level-text:•;
1244
1244
  mso-level-tab-stop:none;
1245
1245
  mso-level-number-position:left;
1246
1246
  margin-left:108.0pt;
1247
1247
  text-indent:-18.0pt;}
1248
1248
  @list l3:level7
1249
1249
  {mso-level-number-format:bullet;
1250
- mso-level-text:—;
1250
+ mso-level-text:•;
1251
1251
  mso-level-tab-stop:none;
1252
1252
  mso-level-number-position:left;
1253
1253
  margin-left:126.0pt;
1254
1254
  text-indent:-18.0pt;}
1255
1255
  @list l3:level8
1256
1256
  {mso-level-number-format:bullet;
1257
- mso-level-text:—;
1257
+ mso-level-text:•;
1258
1258
  mso-level-tab-stop:none;
1259
1259
  mso-level-number-position:left;
1260
1260
  margin-left:144.0pt;
1261
1261
  text-indent:-18.0pt;}
1262
1262
  @list l3:level9
1263
1263
  {mso-level-number-format:bullet;
1264
- mso-level-text:—;
1264
+ mso-level-text:•;
1265
1265
  mso-level-tab-stop:none;
1266
1266
  mso-level-number-position:left;
1267
1267
  margin-left:162.0pt;
@@ -68,6 +68,11 @@ module IsoDoc
68
68
  dest = docxml.at("//div[@id = 'authority']") || return
69
69
  auth = docxml.at("//div[@class = 'authority']") || return
70
70
  dest.replace(auth.remove)
71
+ a = docxml.at("//div[@id = 'authority1']") and a["class"] = "authority1"
72
+ a = docxml.at("//div[@id = 'authority2']") and a["class"] = "authority2"
73
+ a = docxml.at("//div[@id = 'authority3']") and a["class"] = "authority3"
74
+ a = docxml.at("//div[@id = 'authority4']") and a["class"] = "authority4"
75
+ a = docxml.at("//div[@id = 'authority5']") and a["class"] = "authority5"
71
76
  end
72
77
 
73
78
  def cleanup(docxml)
@@ -84,8 +89,10 @@ module IsoDoc
84
89
 
85
90
  def make_body3(body, docxml)
86
91
  body.div **{ class: "main-section" } do |div3|
92
+ foreword docxml, div3
87
93
  abstract docxml, div3
88
94
  keywords docxml, div3
95
+ boilerplate docxml, div3
89
96
  preface docxml, div3
90
97
  middle docxml, div3
91
98
  footnotes div3
@@ -124,18 +131,6 @@ module IsoDoc
124
131
  end
125
132
  end
126
133
 
127
- def pseudocode_parse(node, out)
128
- @in_figure = true
129
- name = node.at(ns("./name"))
130
- out.div **attr_code(id: node["id"], class: "pseudocode") do |div|
131
- node.children.each do |n|
132
- parse(n, div) unless n.name == "name"
133
- end
134
- figure_name_parse(node, div, name) if name
135
- end
136
- @in_figure = false
137
- end
138
-
139
134
  def termdef_parse(node, out)
140
135
  pref = node.at(ns("./preferred"))
141
136
  out.dl **{ class: "terms_dl" } do |dl|
@@ -3,73 +3,114 @@ require "twitter_cldr"
3
3
 
4
4
  module IsoDoc
5
5
  module NIST
6
-
7
6
  class Metadata < IsoDoc::Metadata
8
7
  def initialize(lang, script, labels)
9
8
  super
10
- set(:status, "XXX")
11
9
  end
12
10
 
13
- def title(isoxml, out)
14
- main = isoxml&.at(ns("//bibdata/title[@type = 'main']"))&.text
11
+ def iter_abbr(stage, iter)
12
+ return "F" if iter&.downcase == "final" &&
13
+ %w(draft-wip draft-prelim draft-public).include?(stage)
14
+ case stage
15
+ when "draft-wip", "draft-prelim"
16
+ iter || ""
17
+ when "draft-public"
18
+ iter ||= "1"
19
+ iter == "1" ? "I" : iter
20
+ else
21
+ ""
22
+ end
23
+ end
24
+
25
+ def stage_abbr(stage, iter)
26
+ case stage
27
+ when "draft-internal" then "Internal"
28
+ when "draft-wip" then "#{iter_abbr(stage, iter)}WD"
29
+ when "draft-prelim" then "#{iter_abbr(stage, iter)}PreD"
30
+ when "draft-public" then "#{iter_abbr(stage, iter)}PD"
31
+ else
32
+ nil
33
+ end
34
+ end
35
+
36
+ def title(ixml, out)
37
+ main = ixml&.at(ns("//bibdata/title[@type = 'main']"))&.text
15
38
  set(:doctitle, main)
16
- short = isoxml&.at(ns("//bibdata/title[@type = 'short-title']"))&.text
39
+ short = ixml&.at(ns("//bibdata/title[@type = 'short-title']"))&.text
17
40
  set(:doctitle_short, short || main)
18
41
  end
19
42
 
20
- def subtitle(isoxml, _out)
21
- main = isoxml&.at(ns("//bibdata/title[@type = 'subtitle']"))&.text
43
+ def subtitle(ixml, _out)
44
+ main = ixml&.at(ns("//bibdata/title[@type = 'subtitle']"))&.text
22
45
  set(:docsubtitle, main) if main
23
- short = isoxml&.at(ns("//bibdata/title[@type = 'short-subtitle']"))&.text
46
+ short = ixml&.at(ns("//bibdata/title[@type = 'short-subtitle']"))&.text
24
47
  set(:docsubtitle_short, short || main) if (short || main)
25
- main = isoxml&.at(ns("//bibdata/title[@type = 'document-class']"))&.text
48
+ main = ixml&.at(ns("//bibdata/title[@type = 'document-class']"))&.text
26
49
  set(:docclasstitle, main) if main
27
50
  end
28
51
 
29
- def author(isoxml, _out)
30
- tc = isoxml.at(ns("//bibdata/editorialgroup/committee"))
52
+ def author(ixml, _out)
53
+ tc = ixml.at(ns("//bibdata/editorialgroup/committee"))
31
54
  set(:tc, tc.text.upcase) if tc
32
- personal_authors(isoxml)
33
- subdiv = isoxml.at(ns("//bibdata/contributor[role/@type = 'publisher']/organization/subdivision"))
55
+ personal_authors(ixml)
56
+ subdiv = ixml.at(ns("//bibdata/contributor[role/@type = 'publisher']/"\
57
+ "organization/subdivision"))
34
58
  set(:nist_subdiv, subdiv.text) if subdiv
35
59
  end
36
60
 
37
- def docid(isoxml, _out)
38
- docid = isoxml.at(ns("//bibdata/docidentifier[@type = 'nist']"))&.text
39
- docid_long = isoxml.at(ns("//bibdata/docidentifier"\
40
- "[@type = 'nist-long']"))&.text
41
- docnumber = isoxml.at(ns("//bibdata/docnumber"))&.text
61
+ def docid(ixml, _out)
62
+ docid = ixml.at(ns("//bibdata/docidentifier[@type = 'nist']"))&.text
63
+ docid_long = ixml.at(ns("//bibdata/docidentifier"\
64
+ "[@type = 'nist-long']"))&.text
65
+ docnumber = ixml.at(ns("//bibdata/docnumber"))&.text
42
66
  set(:docidentifier, docid)
43
67
  set(:docidentifier_long, docid_long)
44
- d = draft_prefix(isoxml) and set(:draft_prefix, d)
45
- d = iter_code(isoxml) and set(:iteration_code, d)
46
- d = iter_ordinal(isoxml) and set(:iteration_ordinal, d)
68
+ set(:docidentifier_undated, stripdate(docid))
69
+ set(:docidentifier_long_undated, stripdate(docid_long))
70
+ d = draft_prefix(ixml) and set(:draft_prefix, d)
71
+ d = iter_code(ixml) and set(:iteration_code, d)
72
+ d = iter_ordinal(ixml) and set(:iteration_ordinal, d)
47
73
  set(:docnumber, docnumber)
48
74
  end
49
75
 
50
- def draft_prefix(isoxml)
51
- docstatus = isoxml.at(ns("//bibdata/status/stage"))&.text
76
+ def stripdate(id)
77
+ return if id.nil?
78
+ id.sub(/ \((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[^)]+\)$/,
79
+ "")
80
+ end
81
+
82
+ def draft_prefix(ixml)
83
+ docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
52
84
  return nil unless docstatus && /^draft/.match(docstatus)
53
- iter = iter_code(isoxml)
85
+ iter = iter_code(ixml)
54
86
  prefix = "DRAFT "
55
87
  iter and prefix += "(#{iter}) "
56
88
  prefix
57
89
  end
58
90
 
59
- def iter_code(isoxml)
60
- docstatus = isoxml.at(ns("//bibdata/status/stage"))&.text
91
+ def iter_code(ixml)
92
+ docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
61
93
  return nil unless docstatus == "draft-public"
62
- iter = isoxml.at(ns("//bibdata/status/iteration"))&.text || "1"
94
+ iter = ixml.at(ns("//bibdata/status/iteration"))&.text || "1"
63
95
  return "IPD" if iter == "1"
64
96
  return "FPD" if iter.downcase == "final"
65
97
  "#{iter}PD"
66
98
  end
67
99
 
68
- def iter_ordinal(isoxml)
69
- docstatus = isoxml.at(ns("//bibdata/status/stage"))&.text
70
- return nil unless docstatus == "draft-public"
71
- iter = isoxml.at(ns("//bibdata/status/iteration"))&.text || "1"
72
- return "Initial" if iter == "1"
100
+ # override the above
101
+ def iter_code(ixml)
102
+ docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
103
+ iter = ixml.at(ns("//bibdata/status/iteration"))&.text
104
+ stage_abbr(docstatus, iter)
105
+ end
106
+
107
+ def iter_ordinal(ixml)
108
+ docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
109
+ #return nil unless docstatus == "draft-public"
110
+ iter = ixml.at(ns("//bibdata/status/iteration"))&.text
111
+ iter ||= "1" if docstatus == "draft-public"
112
+ return if iter.nil?
113
+ return "Initial" if iter == "1" && docstatus == "draft-public"
73
114
  return "Final" if iter.downcase == "final"
74
115
  iter.to_i.localize.to_rbnf_s("SpelloutRules", "spellout-ordinal")
75
116
  end
@@ -82,15 +123,15 @@ module IsoDoc
82
123
  IsoDoc::Function::I18n::l10n(draftinfo, @lang, @script)
83
124
  end
84
125
 
85
- def docstatus(isoxml, _out)
86
- docstatus = isoxml.at(ns("//bibdata/status/stage"))&.text
126
+ def docstatus(ixml, _out)
127
+ docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
87
128
  set(:unpublished, !/^draft/.match(docstatus).nil?)
88
- substage = isoxml.at(ns("//bibdata/status/substage"))&.text
129
+ substage = ixml.at(ns("//bibdata/status/substage"))&.text
89
130
  substage and set(:substage, substage)
90
- iter = isoxml.at(ns("//bibdata/status/iteration"))&.text
131
+ iter = ixml.at(ns("//bibdata/status/iteration"))&.text
91
132
  set(:iteration, iter) if iter
92
133
  set(:status, status_print(docstatus || "final"))
93
- set(:errata, true) if isoxml.at(ns("//errata"))
134
+ set(:errata, true) if ixml.at(ns("//errata"))
94
135
  end
95
136
 
96
137
  def status_print(status)
@@ -99,36 +140,52 @@ module IsoDoc
99
140
  when "draft-wip" then "Work-in-Progress Draft"
100
141
  when "draft-prelim" then "Preliminary Draft"
101
142
  when "draft-public" then "Public Draft"
102
- when "draft-retire" then "Retired Draft"
103
- when "draft-withdrawn" then "Withdrawn Draft"
104
143
  when "final" then "Final"
105
144
  when "final-review" then "Under Review"
106
145
  when "final-withdrawn" then "Withdrawn"
107
146
  end
108
147
  end
109
148
 
110
- def version(isoxml, _out)
149
+ def version(ixml, _out)
111
150
  super
112
- set(:revision, isoxml&.at(ns("//bibdata/revision"))&.text)
151
+ set(:revision, ixml&.at(ns("//bibdata/revision"))&.text)
113
152
  revdate = get[:revdate]
114
153
  set(:revdate_monthyear, monthyr(revdate))
115
154
  set(:revdate_MMMddyyyy, MMMddyyyy(revdate))
116
155
  end
117
156
 
118
- def bibdate(isoxml, _out)
157
+ def bibdate(ixml, _out)
119
158
  super
120
- isoxml.xpath(ns("//bibdata/date")).each do |d|
159
+ ixml.xpath(ns("//bibdata/date")).each do |d|
121
160
  val = Common::date_range(d)
122
161
  next if val == "XXX"
123
162
  set("#{d['type']}date_monthyear".to_sym, daterange_proc(val, :monthyr))
124
163
  set("#{d['type']}date_mmddyyyy".to_sym, daterange_proc(val, :mmddyyyy))
125
164
  set("#{d['type']}date_MMMddyyyy".to_sym, daterange_proc(val, :MMMddyyyy))
126
165
  end
127
- withdrawal_pending(isoxml)
166
+ withdrawal_pending(ixml)
167
+ most_recent_date(ixml)
128
168
  end
129
169
 
130
- def withdrawal_pending(isoxml)
131
- d = isoxml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text or return
170
+ def most_recent_date(ixml)
171
+ date = most_recent_date1(ixml) || return
172
+ val = Common::date_range(date)
173
+ return if val == "XXX"
174
+ set(:most_recent_date_monthyear, daterange_proc(val, :monthyr))
175
+ set(:most_recent_date_mmddyyyy, daterange_proc(val, :mmddyyyy))
176
+ set(:most_recent_date_MMMddyyyy, daterange_proc(val, :MMMddyyyy))
177
+ end
178
+
179
+ def most_recent_date1(ixml)
180
+ docstatus = ixml.at(ns("//bibdata/status/stage"))&.text
181
+ /^draft/.match(docstatus) ?
182
+ (ixml.at(ns("//bibdata/date[@type = 'circulated']")) ||
183
+ ixml.at(ns("//version/revision-date"))) :
184
+ ( ixml.at(ns("//bibdata/date[@type = 'issued']")))
185
+ end
186
+
187
+ def withdrawal_pending(ixml)
188
+ d = ixml&.at(ns("//bibdata/date[@type = 'obsoleted']"))&.text or return
132
189
  date = Date.parse(d) or return
133
190
  set(:withdrawal_pending, true) if date > Date.today
134
191
  end
@@ -141,11 +198,11 @@ module IsoDoc
141
198
  val_monthyear
142
199
  end
143
200
 
144
- def series(isoxml, _out)
145
- series = isoxml.at(ns("//bibdata/series[@type = 'main']/title"))&.text
201
+ def series(ixml, _out)
202
+ series = ixml.at(ns("//bibdata/series[@type = 'main']/title"))&.text
146
203
  set(:series, series) if series
147
- subseries = isoxml.at(ns("//bibdata/series[@type = 'secondary']/"\
148
- "title"))&.text
204
+ subseries = ixml.at(ns("//bibdata/series[@type = 'secondary']/"\
205
+ "title"))&.text
149
206
  set(:subseries, subseries) if subseries
150
207
  end
151
208
 
@@ -164,18 +221,18 @@ module IsoDoc
164
221
  Date.parse(isodate).strftime("%B %d, %Y")
165
222
  end
166
223
 
167
- def keywords(isoxml, _out)
224
+ def keywords(ixml, _out)
168
225
  keywords = []
169
- isoxml.xpath(ns("//bibdata/keyword")).each do |kw|
226
+ ixml.xpath(ns("//bibdata/keyword")).each do |kw|
170
227
  keywords << kw.text
171
228
  end
172
229
  set(:keywords, keywords)
173
230
  end
174
231
 
175
- def commentperiod(isoxml, _out)
176
- from = isoxml.at(ns("//bibdata/commentperiod/from"))&.text
177
- to = isoxml.at(ns("//bibdata/commentperiod/to"))&.text
178
- extended = isoxml.at(ns("//bibdata/commentperiod/extended"))&.text
232
+ def commentperiod(ixml, _out)
233
+ from = ixml.at(ns("//bibdata/commentperiod/from"))&.text
234
+ to = ixml.at(ns("//bibdata/commentperiod/to"))&.text
235
+ extended = ixml.at(ns("//bibdata/commentperiod/extended"))&.text
179
236
  set(:comment_from, from) if from
180
237
  set(:comment_to, to) if to
181
238
  set(:comment_extended, extended) if extended
@@ -189,28 +246,28 @@ module IsoDoc
189
246
  set(:url, a.text)
190
247
  end
191
248
 
192
- def relations1(isoxml, type)
249
+ def relations1(ixml, type)
193
250
  ret = []
194
- isoxml.xpath(ns("//bibdata/relation[@type = '#{type}']")).each do |x|
251
+ ixml.xpath(ns("//bibdata/relation[@type = '#{type}']")).each do |x|
195
252
  id = x&.at(ns(".//docidentifier"))&.text and ret << id
196
253
  end
197
254
  ret
198
255
  end
199
256
 
200
- def relations(isoxml, _out)
201
- ret = relations1(isoxml, "obsoletes")
257
+ def relations(ixml, _out)
258
+ ret = relations1(ixml, "obsoletes")
202
259
  set(:obsoletes, ret) unless ret.empty?
203
- ret = relations1(isoxml, "obsoletedBy")
260
+ ret = relations1(ixml, "obsoletedBy")
204
261
  set(:obsoletedby, ret) unless ret.empty?
205
- ret = relations1(isoxml, "supersedes")
262
+ ret = relations1(ixml, "supersedes")
206
263
  set(:supersedes, ret) unless ret.empty?
207
- ret = relations1(isoxml, "supersededBy")
264
+ ret = relations1(ixml, "supersededBy")
208
265
  set(:supersededby, ret) unless ret.empty?
209
- superseding_doc(isoxml)
266
+ superseding_doc(ixml)
210
267
  end
211
268
 
212
- def superseding_doc(isoxml)
213
- d = isoxml.at(ns("//bibdata/relation[@type = 'obsoletedBy']/bibitem"))
269
+ def superseding_doc(ixml)
270
+ d = ixml.at(ns("//bibdata/relation[@type = 'obsoletedBy']/bibitem"))
214
271
  return unless d
215
272
  set(:superseding_status,
216
273
  status_print(d.at(ns("./status/stage"))&.text || "final"))
@@ -224,20 +281,20 @@ module IsoDoc
224
281
  set(:superseding_doi, doi)
225
282
  uri = d.at(ns("./uri[@type = 'uri']"))&.text and
226
283
  set(:superseding_uri, uri)
227
- superseding_titles(isoxml, d)
284
+ superseding_titles(ixml, d)
228
285
  authors = d.xpath(ns("./contributor[role/@type = 'author']/person"))
229
- authors = isoxml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person")) if authors.empty?
286
+ authors = ixml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person")) if authors.empty?
230
287
  set(:superseding_authors, extract_person_names(authors))
231
288
  end
232
289
 
233
- def superseding_titles(isoxml, d)
290
+ def superseding_titles(ixml, d)
234
291
  title = d.at(ns("./title[@type = 'main']"))&.text
235
292
  if title
236
293
  set(:superseding_title, d.at(ns("./title[@type = 'main']"))&.text)
237
294
  set(:superseding_subtitle, d.at(ns("./title[@type = 'subtitle']"))&.text)
238
295
  else
239
- set(:superseding_title, isoxml.at(ns("//bibdata/title[@type = 'main']"))&.text)
240
- set(:superseding_subtitle, isoxml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
296
+ set(:superseding_title, ixml.at(ns("//bibdata/title[@type = 'main']"))&.text)
297
+ set(:superseding_subtitle, ixml.at(ns("//bibdata/title[@type = 'subtitle']"))&.text)
241
298
  end
242
299
  end
243
300
 
@@ -263,9 +320,14 @@ module IsoDoc
263
320
  set(:superseding_circulated_date, cdate)
264
321
  set(:superseding_circulated_date_monthyear, monthyr(cdate))
265
322
  end
266
- if cdate = d.at(ns("./date[@type = 'published']/on"))&.text
267
- set(:superseding_published_date, cdate)
268
- set(:superseding_published_date_monthyear, monthyr(cdate))
323
+ if cdate = d.at(ns("./date[@type = 'issued']/on"))&.text
324
+ set(:superseding_issued_date, cdate)
325
+ set(:superseding_issued_date_monthyear, monthyr(cdate))
326
+ end
327
+ if cdate = d.at(ns("./date[@type = 'updated']/on"))&.text
328
+ set(:superseding_updated_date, cdate)
329
+ set(:superseding_updated_date_monthyear, monthyr(cdate))
330
+ set(:superseding_updated_date_MMMddyyyy, MMMddyyyy(cdate))
269
331
  end
270
332
  end
271
333