metanorma-standoc 1.11.0 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/lib/asciidoctor/standoc/base.rb +4 -100
  4. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  5. data/lib/asciidoctor/standoc/cleanup.rb +2 -1
  6. data/lib/asciidoctor/standoc/cleanup_block.rb +1 -2
  7. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -20
  8. data/lib/asciidoctor/standoc/cleanup_inline.rb +14 -4
  9. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +25 -15
  10. data/lib/asciidoctor/standoc/cleanup_reqt.rb +3 -3
  11. data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -2
  12. data/lib/asciidoctor/standoc/cleanup_terms.rb +58 -21
  13. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +50 -19
  14. data/lib/asciidoctor/standoc/cleanup_text.rb +23 -0
  15. data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +6 -6
  16. data/lib/asciidoctor/standoc/front.rb +1 -1
  17. data/lib/asciidoctor/standoc/inline.rb +13 -11
  18. data/lib/asciidoctor/standoc/isodoc.rng +68 -18
  19. data/lib/asciidoctor/standoc/lists.rb +1 -3
  20. data/lib/asciidoctor/standoc/ref.rb +101 -75
  21. data/lib/asciidoctor/standoc/ref_date_id.rb +30 -1
  22. data/lib/asciidoctor/standoc/ref_sect.rb +18 -7
  23. data/lib/asciidoctor/standoc/render.rb +117 -0
  24. data/lib/asciidoctor/standoc/reqt.rb +1 -1
  25. data/lib/asciidoctor/standoc/section.rb +20 -15
  26. data/lib/asciidoctor/standoc/utils.rb +0 -16
  27. data/lib/asciidoctor/standoc/validate.rb +1 -1
  28. data/lib/isodoc/html/htmlstyle.css +1 -1
  29. data/lib/isodoc/html/htmlstyle.scss +1 -1
  30. data/lib/metanorma/standoc/version.rb +1 -1
  31. data/metanorma-standoc.gemspec +3 -3
  32. data/spec/asciidoctor/blocks_spec.rb +99 -17
  33. data/spec/asciidoctor/cleanup_blocks_spec.rb +24 -0
  34. data/spec/asciidoctor/cleanup_sections_spec.rb +1 -1
  35. data/spec/asciidoctor/cleanup_spec.rb +6 -6
  36. data/spec/asciidoctor/cleanup_terms_spec.rb +448 -89
  37. data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
  38. data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
  39. data/spec/asciidoctor/inline_spec.rb +5 -5
  40. data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
  41. data/spec/asciidoctor/macros_spec.rb +2 -2
  42. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  43. data/spec/asciidoctor/refs_spec.rb +858 -498
  44. data/spec/asciidoctor/section_spec.rb +32 -3
  45. data/spec/spec_helper.rb +2 -2
  46. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +179 -179
  47. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +14 -14
  48. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  49. data/spec/vcr_cassettes/isobib_get_123_1.yml +96 -96
  50. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +108 -108
  51. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  52. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  53. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +18 -18
  54. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  55. metadata +9 -8
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
6
- describe '#process' do
7
- context 'when simple models without relations' do
6
+ describe "#process" do
7
+ context "when simple models without relations" do
8
8
  let(:datamodel_file) do
9
- examples_path('datamodel/address_class_profile.adoc')
9
+ examples_path("datamodel/address_class_profile.adoc")
10
10
  end
11
11
  let(:result_file) do
12
- examples_path('datamodel/address_class_profile.xml')
12
+ examples_path("datamodel/address_class_profile.xml")
13
13
  end
14
14
  let(:output) do
15
15
  [
16
16
  BLANK_HDR,
17
- File.read(fixtures_path('macros_datamodel/address_class_profile.xml'))
17
+ File.read(fixtures_path("macros_datamodel/address_class_profile.xml")),
18
18
  ]
19
19
  .join
20
20
  end
@@ -27,7 +27,7 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
27
27
  end
28
28
  end
29
29
 
30
- it 'correctly renders input' do
30
+ it "correctly renders input" do
31
31
  Asciidoctor.convert_file(datamodel_file,
32
32
  backend: :standoc,
33
33
  safe: :safe,
@@ -37,18 +37,18 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
37
37
  end
38
38
  end
39
39
 
40
- context 'when complex relations' do
40
+ context "when complex relations" do
41
41
  let(:datamodel_file) do
42
- examples_path('datamodel/address_component_profile.adoc')
42
+ examples_path("datamodel/address_component_profile.adoc")
43
43
  end
44
44
  let(:result_file) do
45
- examples_path('datamodel/address_component_profile.xml')
45
+ examples_path("datamodel/address_component_profile.xml")
46
46
  end
47
47
  let(:output) do
48
- path = fixtures_path('macros_datamodel/address_component_profile.xml')
48
+ path = fixtures_path("macros_datamodel/address_component_profile.xml")
49
49
  [
50
50
  BLANK_HDR,
51
- File.read(path)
51
+ File.read(path),
52
52
  ]
53
53
  .join("\n")
54
54
  end
@@ -56,14 +56,14 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
56
56
  after do
57
57
  %w[doc html xml err].each do |extention|
58
58
  path = examples_path(
59
- "datamodel/address_component_profile.#{extention}"
59
+ "datamodel/address_component_profile.#{extention}",
60
60
  )
61
61
  FileUtils.rm_f(path)
62
62
  FileUtils.rm_f("address_component_profile.#{extention}")
63
63
  end
64
64
  end
65
65
 
66
- it 'correctly renders input' do
66
+ it "correctly renders input" do
67
67
  Asciidoctor.convert_file(datamodel_file,
68
68
  backend: :standoc,
69
69
  safe: :safe,
@@ -73,32 +73,32 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor do
73
73
  end
74
74
  end
75
75
 
76
- context 'when missing definition' do
76
+ context "when missing definition" do
77
77
  let(:datamodel_file) do
78
- examples_path('datamodel/blank_definition_profile.adoc')
78
+ examples_path("datamodel/blank_definition_profile.adoc")
79
79
  end
80
80
  let(:result_file) do
81
- examples_path('datamodel/blank_definition_profile.xml')
81
+ examples_path("datamodel/blank_definition_profile.xml")
82
82
  end
83
83
  let(:output) do
84
- path = fixtures_path('macros_datamodel/blank_definition_profile.xml')
84
+ path = fixtures_path("macros_datamodel/blank_definition_profile.xml")
85
85
  [
86
86
  BLANK_HDR,
87
- File.read(path)
87
+ File.read(path),
88
88
  ].join("\n")
89
89
  end
90
90
 
91
91
  after do
92
92
  %w[doc html xml err].each do |extention|
93
93
  path = examples_path(
94
- "datamodel/blank_definition_profile.#{extention}"
94
+ "datamodel/blank_definition_profile.#{extention}",
95
95
  )
96
96
  FileUtils.rm_f(path)
97
97
  FileUtils.rm_f("blank_definition_profile.#{extention}")
98
98
  end
99
99
  end
100
100
 
101
- it 'correctly renders input' do
101
+ it "correctly renders input" do
102
102
  Asciidoctor.convert_file(datamodel_file,
103
103
  backend: :standoc,
104
104
  safe: :safe,
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
6
- describe '#process' do
7
- context 'when simple models without relations' do
6
+ describe "#process" do
7
+ context "when simple models without relations" do
8
8
  let(:datamodel_file) do
9
- examples_path('datamodel/common_models_diagram.adoc')
9
+ examples_path("datamodel/common_models_diagram.adoc")
10
10
  end
11
11
  let(:result_file) do
12
- examples_path('datamodel/common_models_diagram.xml')
12
+ examples_path("datamodel/common_models_diagram.xml")
13
13
  end
14
14
  let(:output) do
15
15
  [
16
16
  BLANK_HDR,
17
17
  File.read(
18
- fixtures_path('macros_datamodel/common_models_diagram.xml')
19
- )
18
+ fixtures_path("macros_datamodel/common_models_diagram.xml"),
19
+ ),
20
20
  ].join
21
21
  end
22
22
 
@@ -26,10 +26,10 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
26
26
  FileUtils.rm_f(path)
27
27
  FileUtils.rm_f("common_models_diagram.#{extention}")
28
28
  end
29
- FileUtils.rm_rf('common_models_diagram_htmlimages')
29
+ FileUtils.rm_rf("common_models_diagram_htmlimages")
30
30
  end
31
31
 
32
- it 'correctly renders input' do
32
+ it "correctly renders input" do
33
33
  Asciidoctor.convert_file(datamodel_file,
34
34
  backend: :standoc,
35
35
  safe: :safe,
@@ -39,13 +39,13 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
39
39
  end
40
40
  end
41
41
 
42
- context 'when complex relations' do
43
- let(:datamodel_file) { examples_path('datamodel/top_down_diagram.adoc') }
44
- let(:result_file) { examples_path('datamodel/top_down_diagram.xml') }
42
+ context "when complex relations" do
43
+ let(:datamodel_file) { examples_path("datamodel/top_down_diagram.adoc") }
44
+ let(:result_file) { examples_path("datamodel/top_down_diagram.xml") }
45
45
  let(:output) do
46
46
  [
47
47
  BLANK_HDR,
48
- File.read(fixtures_path('macros_datamodel/top_down_diagram.xml'))
48
+ File.read(fixtures_path("macros_datamodel/top_down_diagram.xml")),
49
49
  ].join("\n")
50
50
  end
51
51
 
@@ -55,11 +55,11 @@ RSpec.describe Asciidoctor::Standoc::Datamodel::DiagramPreprocessor do
55
55
  FileUtils.rm_f(path)
56
56
  FileUtils.rm_f("top_down_diagram.#{extention}")
57
57
  end
58
- FileUtils.rm_rf(examples_path('datamodel/plantuml'))
59
- FileUtils.rm_rf('top_down_diagram_htmlimages')
58
+ FileUtils.rm_rf(examples_path("datamodel/plantuml"))
59
+ FileUtils.rm_rf("top_down_diagram_htmlimages")
60
60
  end
61
61
 
62
- it 'correctly renders input' do
62
+ it "correctly renders input" do
63
63
  Asciidoctor.convert_file(datamodel_file,
64
64
  backend: :standoc,
65
65
  safe: :safe,
@@ -294,9 +294,9 @@ RSpec.describe Asciidoctor::Standoc do
294
294
  http://example.com[Link]
295
295
  http://example.com[Link,title="tip"]
296
296
  link:++https://asciidoctor.org/now_this__link_works.html++[]
297
- http://example.com[Link,updatetype=true]
297
+ http://example.com[Link,update-type=true]
298
298
  link:../example[updatetype=true]
299
- link:../example[Link,updatetype=true]
299
+ link:../example[Link,update-type=true]
300
300
  INPUT
301
301
  output = <<~OUTPUT
302
302
  #{BLANK_HDR}
@@ -306,9 +306,9 @@ RSpec.describe Asciidoctor::Standoc do
306
306
  <link target="http://example.com">Link</link>
307
307
  <link target="http://example.com" alt="tip">Link</link>
308
308
  <link target='https://asciidoctor.org/now_this__link_works.html'/>
309
- <link target="http://example.com" updatetype="true">Link</link>
310
- <link target="../example" updatetype="true"/>
311
- <link target="../example" updatetype="true">Link</link></p>
309
+ <link target="http://example.com" update-type="true">Link</link>
310
+ <link target="../example" update-type="true"/>
311
+ <link target="../example" update-type="true">Link</link></p>
312
312
  </p>
313
313
  </sections>
314
314
  </standard-document>
@@ -716,29 +716,25 @@ RSpec.describe Asciidoctor::Standoc do
716
716
 
717
717
  def mock_isobib_get_123
718
718
  expect(RelatonIso::IsoBibliography).to receive(:get)
719
- .with("ISO 123", "2001",
720
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
719
+ .with("ISO 123", "2001", anything)
721
720
  .and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_DATED))
722
721
  end
723
722
 
724
723
  def mock_isobib_get_123_undated
725
724
  expect(RelatonIso::IsoBibliography).to receive(:get)
726
- .with("ISO 123", nil,
727
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
725
+ .with("ISO 123", nil, anything)
728
726
  .and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_UNDATED))
729
727
  end
730
728
 
731
729
  def mock_isobib_get_124
732
730
  expect(RelatonIso::IsoBibliography).to receive(:get)
733
- .with("ISO 124", "2014",
734
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
731
+ .with("ISO 124", "2014", anything)
735
732
  .and_return(RelatonIsoBib::XMLParser.from_xml(ISO_124_DATED))
736
733
  end
737
734
 
738
735
  def mock_ietfbib_get_123
739
736
  expect(RelatonIetf::IetfBibliography).to receive(:get)
740
- .with("RFC 123", nil,
741
- { lang: "en", title: "<em>Standard</em>", usrlbl: nil })
737
+ .with("RFC 123", nil, anything)
742
738
  .and_return(RelatonIsoBib::XMLParser.from_xml(IETF_123_SHORT))
743
739
  end
744
740
  end
@@ -1562,7 +1562,7 @@ RSpec.describe Asciidoctor::Standoc do
1562
1562
  <tt>missing</tt>
1563
1563
  </strong>
1564
1564
  </related>
1565
- <definition><verbaldefinition>
1565
+ <definition><verbal-definition>
1566
1566
  <p id='_'>paragraph</p>
1567
1567
  <p id='_'>
1568
1568
  <concept>
@@ -1620,7 +1620,7 @@ RSpec.describe Asciidoctor::Standoc do
1620
1620
  </concept>
1621
1621
  is a term
1622
1622
  </p>
1623
- </verbaldefinition></definition>
1623
+ </verbal-definition></definition>
1624
1624
  </term>
1625
1625
  </terms>
1626
1626
  </sections>
@@ -42,7 +42,7 @@ RSpec.describe Asciidoctor::Standoc do
42
42
  <title>Normative references</title>
43
43
  #{NORM_REF_BOILERPLATE}
44
44
  <bibitem id="iso123" type="standard">
45
- <fetched>#{Date.today}</fetched>
45
+ <fetched/>
46
46
  <title type='title-main' format='text/plain'>Standard</title>
47
47
  <title type='main' format='text/plain'>Standard</title>
48
48
  <docidentifier type="ISO">ISO 123</docidentifier>
@@ -304,7 +304,7 @@ formattedref::
304
304
  <title>Normative references</title>
305
305
  #{NORM_REF_BOILERPLATE}
306
306
  <bibitem id="ISOTC211" type="standard">
307
- <fetched>2019-06-30</fetched>
307
+ <fetched/>
308
308
  <title type="main" format="text/plain">Geographic information</title>
309
309
  <title type="subtitle" format="text/plain" language="en" script="Latn">Geographic information subtitle</title>
310
310
  <title type='title-main' format='text/plain'>Other Title</title>
@@ -624,7 +624,7 @@ series.formattedref.script:: Latn
624
624
  <title>Normative references</title>
625
625
  #{NORM_REF_BOILERPLATE}
626
626
  <bibitem id="ISOTC211" type="standard">
627
- <fetched>2019-06-30</fetched>
627
+ <fetched/>
628
628
  <title type="main" format="text/plain">Geographic information</title>
629
629
  <title type="subtitle" format="text/plain" language="en" script="Latn">Geographic information subtitle</title>
630
630
  <uri type="src">https://www.iso.org/standard/53798.html</uri>
@@ -827,7 +827,7 @@ OUTPUT
827
827
  <docidentifier>B</docidentifier>
828
828
  </bibitem>
829
829
  <bibitem id='iso123' type='standard'>
830
- <fetched>#{Date.today.to_s}</fetched>
830
+ <fetched/>
831
831
  <title type='title-main' format='text/plain'>Standard</title>
832
832
  <title type='main' format='text/plain'>Standard</title>
833
833
  <docidentifier type='ISO'>ISO 123</docidentifier>