metanorma-standoc 1.10.4.1 → 1.10.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +19 -23
  3. data/lib/asciidoctor/standoc/base.rb +11 -13
  4. data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
  5. data/lib/asciidoctor/standoc/blocks.rb +27 -22
  6. data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
  7. data/lib/asciidoctor/standoc/cleanup.rb +38 -71
  8. data/lib/asciidoctor/standoc/cleanup_block.rb +5 -70
  9. data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +27 -98
  11. data/lib/asciidoctor/standoc/cleanup_maths.rb +113 -21
  12. data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
  13. data/lib/asciidoctor/standoc/cleanup_reqt.rb +56 -18
  14. data/lib/asciidoctor/standoc/cleanup_section.rb +1 -0
  15. data/lib/asciidoctor/standoc/cleanup_section_names.rb +31 -14
  16. data/lib/asciidoctor/standoc/cleanup_table.rb +68 -0
  17. data/lib/asciidoctor/standoc/cleanup_terms.rb +1 -1
  18. data/lib/asciidoctor/standoc/cleanup_text.rb +73 -0
  19. data/lib/asciidoctor/standoc/cleanup_xref.rb +107 -0
  20. data/lib/asciidoctor/standoc/converter.rb +13 -0
  21. data/lib/asciidoctor/standoc/isodoc.rng +241 -61
  22. data/lib/asciidoctor/standoc/lists.rb +15 -15
  23. data/lib/asciidoctor/standoc/macros.rb +14 -43
  24. data/lib/asciidoctor/standoc/macros_note.rb +45 -0
  25. data/lib/asciidoctor/standoc/macros_terms.rb +33 -15
  26. data/lib/asciidoctor/standoc/reqt.rb +2 -2
  27. data/lib/asciidoctor/standoc/reqt.rng +23 -2
  28. data/lib/asciidoctor/standoc/table.rb +22 -20
  29. data/lib/asciidoctor/standoc/terms.rb +9 -1
  30. data/lib/asciidoctor/standoc/validate.rb +23 -14
  31. data/lib/asciidoctor/standoc/validate_section.rb +5 -2
  32. data/lib/metanorma/standoc/version.rb +1 -1
  33. data/metanorma-standoc.gemspec +1 -1
  34. data/spec/asciidoctor/base_spec.rb +0 -33
  35. data/spec/asciidoctor/blank_spec.rb +37 -0
  36. data/spec/asciidoctor/blocks_spec.rb +151 -30
  37. data/spec/asciidoctor/cleanup_blocks_spec.rb +1018 -0
  38. data/spec/asciidoctor/cleanup_sections_spec.rb +207 -0
  39. data/spec/asciidoctor/cleanup_spec.rb +193 -1078
  40. data/spec/asciidoctor/inline_spec.rb +36 -0
  41. data/spec/asciidoctor/isobib_cache_spec.rb +8 -8
  42. data/spec/asciidoctor/lists_spec.rb +6 -6
  43. data/spec/asciidoctor/macros_plantuml_spec.rb +1 -1
  44. data/spec/asciidoctor/macros_spec.rb +41 -26
  45. data/spec/asciidoctor/refs_dl_spec.rb +1 -1
  46. data/spec/asciidoctor/refs_spec.rb +220 -444
  47. data/spec/asciidoctor/section_spec.rb +1 -1
  48. data/spec/asciidoctor/validate_spec.rb +51 -0
  49. data/spec/assets/xref_error.adoc +1 -0
  50. data/spec/fixtures/datamodel_description_sections_tree.xml +24 -24
  51. data/spec/spec_helper.rb +5 -7
  52. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +231 -143
  53. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +152 -0
  54. data/spec/vcr_cassettes/isobib_get_123.yml +52 -36
  55. data/spec/vcr_cassettes/isobib_get_123_1.yml +103 -71
  56. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +112 -80
  57. data/spec/vcr_cassettes/isobib_get_123_2001.yml +50 -34
  58. data/spec/vcr_cassettes/isobib_get_124.yml +51 -35
  59. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
  60. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +70 -46
  61. metadata +11 -4
@@ -1202,7 +1202,7 @@ RSpec.describe Asciidoctor::Standoc do
1202
1202
  </annex>
1203
1203
  <annex id='_' obligation='' language='' script=''>
1204
1204
  <references id='app' obligation='informative' normative="false">
1205
- <title>Bibliography</title>
1205
+ <title>Normative Reference</title>
1206
1206
  </references>
1207
1207
  </annex>
1208
1208
  </standard-document>
@@ -340,6 +340,29 @@ RSpec.describe Asciidoctor::Standoc do
340
340
  # INPUT
341
341
  # end
342
342
 
343
+ it "warns and aborts if concept attributes are malformed" do
344
+ FileUtils.rm_f "test.xml"
345
+ FileUtils.rm_f "test.err"
346
+ begin
347
+ input = <<~INPUT
348
+ = Document title
349
+ Author
350
+ :docfile: test.adoc
351
+ :nodoc:
352
+
353
+ == Symbols and Abbreviated Terms
354
+ [[def]]DEF:: def
355
+
356
+ {{<<def>>,term,option="noital"}}
357
+ INPUT
358
+ expect { Asciidoctor.convert(input, *OPTIONS) }.to raise_error(RuntimeError)
359
+ rescue SystemExit, RuntimeError
360
+ end
361
+ expect(File.read("test.err"))
362
+ .to include 'processing {{&lt;&lt;def&gt;&gt;,term,option="noital"}}: error processing ,term,option="noital" as CSV'
363
+ expect(File.exist?("test.xml")).to be false
364
+ end
365
+
343
366
  it "warns and aborts if concept/xref does not point to term or definition" do
344
367
  FileUtils.rm_f "test.xml"
345
368
  FileUtils.rm_f "test.err"
@@ -467,4 +490,32 @@ RSpec.describe Asciidoctor::Standoc do
467
490
  expect(File.read("test.err"))
468
491
  .to include "Could not resolve footnoteblock:[id1]"
469
492
  end
493
+
494
+ it "Warning if xref/@target does not point to a real identifier" do
495
+ FileUtils.rm_f "test.err"
496
+ Asciidoctor.convert(<<~"INPUT", *OPTIONS)
497
+ = Document title
498
+ Author
499
+ :docfile: test.adoc
500
+ :no-pdf:
501
+
502
+ <<id1>>
503
+
504
+ [[id2]]
505
+ [NOTE]
506
+ --
507
+ |===
508
+ |a |b
509
+
510
+ |c |d
511
+ |===
512
+
513
+ * A
514
+ * B
515
+ * C
516
+ --
517
+ INPUT
518
+ expect(File.read("test.err"))
519
+ .to include "Crossreference target id1 is undefined"
520
+ end
470
521
  end
@@ -1,5 +1,6 @@
1
1
  = X
2
2
  A
3
+ :no-pdf:
3
4
 
4
5
  == Clause
5
6
 
@@ -1,13 +1,13 @@
1
- <preface>
2
- <foreword id='_' obligation='informative'>
3
- <title>Foreword</title>
4
- <p id='_'>mine text</p>
5
- </foreword>
6
- </preface>
1
+ <preface>
2
+ <foreword id='_' obligation='informative'>
3
+ <title>Foreword</title>
4
+ <p id='_'>mine text</p>
5
+ </foreword>
6
+ </preface>
7
7
  <sections>
8
8
  <clause id='_' inline-header='false' obligation='normative'>
9
9
  <title>Wrapper nested package package</title>
10
- <clause id='_' inline-header='false' obligation='normative'>
10
+ <clause id='section-EAPK_9C96A88B_E98B_490b_8A9C_24AEDAC64293' inline-header='false' obligation='normative'>
11
11
  <title>Wrapper nested package overview</title>
12
12
  <p id='_'>Diagram text</p>
13
13
  <figure id='figure-EAID_0E029ABF_C35A_49e3_9EEA_FFD4F32780A8'>
@@ -24,7 +24,7 @@
24
24
  </clause>
25
25
  <clause id='_' inline-header='false' obligation='normative'>
26
26
  <title>ISO 19135 Procedures for item registration XML package</title>
27
- <clause id='_' inline-header='false' obligation='normative'>
27
+ <clause id='section-EAPK_9C96A88B_E98B_490b_8A9C_24AEDAC64293' inline-header='false' obligation='normative'>
28
28
  <title>ISO 19135 Procedures for item registration XML overview</title>
29
29
  <p id='_'>Diagram text</p>
30
30
  <figure id='figure-EAID_0E029ABF_C35A_49e3_9EEA_FFD4F32780A8'>
@@ -34,8 +34,11 @@
34
34
  </clause>
35
35
  <clause id='_' inline-header='false' obligation='normative'>
36
36
  <title>Defining tables</title>
37
- <table id='tab-P-iso_19135_procedures_for_item_registration_xml-C-re_register' width='100%'>
38
- <name>Elements of ISO 19135 Procedures for item registration XML::RE_Register</name>
37
+ <table id='section-EAID_82206E96_8D23_48dd_AC2F_31939C484AF2' width='100%'>
38
+ <name>
39
+ Elements of &#8220;ISO 19135 Procedures for item registration
40
+ XML::RE_Register&#8221; (interface)
41
+ </name>
39
42
  <tbody>
40
43
  <tr>
41
44
  <th valign='top' align='left'>Name:</th>
@@ -74,14 +77,14 @@
74
77
  <tr>
75
78
  <th valign='top' align='left'>Abstract:</th>
76
79
  <td colspan='7' valign='top' align='left'>
77
- <p id='_'>false</p>
80
+ <p id='_'>True</p>
78
81
  </td>
79
82
  </tr>
80
83
  <tr>
81
84
  <th valign='top' rowspan='2' align='left'>Associations:</th>
82
85
  <td colspan='4' valign='top' align='left'>
83
86
  <p id='_'>
84
- <em>Association with:</em>
87
+ <em>Association with</em>
85
88
  </p>
86
89
  </td>
87
90
  <td valign='top' align='left'>
@@ -96,7 +99,7 @@
96
99
  </td>
97
100
  <td valign='top' align='left'>
98
101
  <p id='_'>
99
- <em>Provides:</em>
102
+ <em>Provides</em>
100
103
  </p>
101
104
  </td>
102
105
  </tr>
@@ -159,14 +162,14 @@
159
162
  languages other than the operating language of the register.
160
163
  The attribute
161
164
  <em>alternativeLanguages</em>
162
- shall be represented as a set of instances of RE_Locale,
165
+ shall be represented as a set of instances of RE_Locale,
163
166
  each specifying an additional unique locale used by items in
164
167
  the register. Every member of the set shall be used by at
165
168
  least one item in the register. The
166
169
  <em>locale</em>
167
- of every
170
+ of every
168
171
  <em>alternativeExpression</em>
169
- used by any item in the register shall be included in this
172
+ used by any item in the register shall be included in this
170
173
  set of RE_Locales. This attribute provides a summary of
171
174
  alternative locales used by items in a register. Register
172
175
  owners shall specify and publish their policy as to whether
@@ -226,7 +229,7 @@
226
229
  within the set of registers maintained by the register
227
230
  owner. In the case of a hierarchical register, the &#8220;
228
231
  <em>name&#8221;</em>
229
- of a subregister shall uniquely identify that subregister
232
+ of a subregister shall uniquely identify that subregister
230
233
  within the scope EXAMPLE &#239;&#191;&#189;ISO/TC 211
231
234
  Register of Feature Data Dictionaries and Feature
232
235
  Catalogues&#239;&#191;&#189; might be the name of the
@@ -285,9 +288,9 @@
285
288
  as its value a set of URI&#8217;s, each referencing
286
289
  information about online resources associated with the
287
290
  register. EXAMPLE
288
- &#239;&#191;&#189;http://www.digest.org/Navigate2.htm&#239;&#191;&#189; and &#239;&#191;&#189;http://www.epa.gov/opppmsd1/PPISdata/index.html&#239;&#191;&#189; are sample valuescorresponding value of the attribute
291
+ &#239;&#191;&#189;http://www.digest.org/Navigate2.htm&#239;&#191;&#189; and &#239;&#191;&#189;http://www.epa.gov/opppmsd1/PPISdata/index.html&#239;&#191;&#189; are sample valuescorresponding value of the attribute
289
292
  <em>OnLineResource.linkage</em>
290
- specifies a resource providing access to the complete
293
+ specifies a resource providing access to the complete
291
294
  content of the register. EXAMPLE
292
295
  &#239;&#191;&#189;http://www.digest.org/Navigate2.htm&#239;&#191;&#189; and &#239;&#191;&#189;http://www.epa.gov/opppmsd1/PPISdata/index.html&#239;&#191;&#189; are sample values of
293
296
  <em>OnLineResource.linkage</em>
@@ -306,14 +309,11 @@
306
309
  </td>
307
310
  </tr>
308
311
  <tr>
309
- <td valign='top' align='left'>
310
- <p id='_'>
311
- <strong>Constraints:</strong>
312
- </p>
313
- </td>
312
+ <th valign='top' align='left'>Constraints:</th>
314
313
  <td colspan='7' valign='top' align='left'>
315
314
  <p id='_'>
316
315
  <tt>count(self.version +self.dateOfLastChange) &gt;= 1</tt>
316
+ : ``
317
317
  </p>
318
318
  </td>
319
319
  </tr>
data/spec/spec_helper.rb CHANGED
@@ -40,11 +40,9 @@ RSpec.configure do |config|
40
40
  end
41
41
 
42
42
  config.around :each do |example|
43
- begin
44
- example.run
45
- rescue SystemExit
46
- fail "Unexpected exit encountered"
47
- end
43
+ example.run
44
+ rescue SystemExit
45
+ fail "Unexpected exit encountered"
48
46
  end
49
47
  end
50
48
 
@@ -231,7 +229,7 @@ def stub_fetch_ref(**opts)
231
229
  xml = ""
232
230
 
233
231
  hit = double("hit")
234
- expect(hit).to receive(:"[]").with("title") do
232
+ expect(hit).to receive(:[]).with("title") do
235
233
  Nokogiri::XML(xml).at("//docidentifier").content
236
234
  end.at_least(:once)
237
235
 
@@ -261,7 +259,7 @@ end
261
259
  private
262
260
 
263
261
  def get_xml(search, code, opts)
264
- c = code.gsub(%r{[\/\s:-]}, "_").sub(%r{_+$}, "").downcase
262
+ c = code.gsub(%r{[/\s:-]}, "_").sub(%r{_+$}, "").downcase
265
263
  o = opts.keys.join "_"
266
264
  file = examples_path("#{[c, o].join '_'}.xml")
267
265
  if File.exist? file