metanorma-standoc 1.5.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +66 -0
  3. data/README.adoc +1 -3
  4. data/lib/asciidoctor/standoc/base.rb +6 -1
  5. data/lib/asciidoctor/standoc/basicdoc.rng +23 -0
  6. data/lib/asciidoctor/standoc/cleanup.rb +79 -12
  7. data/lib/asciidoctor/standoc/cleanup_amend.rb +54 -0
  8. data/lib/asciidoctor/standoc/cleanup_block.rb +41 -6
  9. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
  10. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +11 -3
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +11 -2
  12. data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -4
  13. data/lib/asciidoctor/standoc/cleanup_section.rb +1 -2
  14. data/lib/asciidoctor/standoc/converter.rb +6 -2
  15. data/lib/asciidoctor/standoc/front.rb +9 -3
  16. data/lib/asciidoctor/standoc/front_contributor.rb +58 -18
  17. data/lib/asciidoctor/standoc/inline.rb +21 -31
  18. data/lib/asciidoctor/standoc/isodoc.rng +135 -58
  19. data/lib/asciidoctor/standoc/lists.rb +4 -2
  20. data/lib/asciidoctor/standoc/macros.rb +59 -33
  21. data/lib/asciidoctor/standoc/ref.rb +41 -46
  22. data/lib/asciidoctor/standoc/ref_sect.rb +12 -5
  23. data/lib/asciidoctor/standoc/section.rb +11 -10
  24. data/lib/asciidoctor/standoc/table.rb +3 -2
  25. data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +10 -10
  26. data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
  27. data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
  28. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
  29. data/lib/liquid/custom_filters/values.rb +7 -0
  30. data/lib/metanorma/standoc.rb +0 -5
  31. data/lib/metanorma/standoc/version.rb +20 -1
  32. data/metanorma-standoc.gemspec +5 -4
  33. data/spec/asciidoctor-standoc/base_spec.rb +246 -9
  34. data/spec/asciidoctor-standoc/blocks_spec.rb +255 -143
  35. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1498 -0
  36. data/spec/asciidoctor-standoc/cleanup_spec.rb +409 -1572
  37. data/spec/asciidoctor-standoc/inline_spec.rb +128 -4
  38. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +6 -20
  39. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  40. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +10 -0
  41. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  42. data/spec/asciidoctor-standoc/macros_spec.rb +36 -0
  43. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +6 -561
  44. data/spec/asciidoctor-standoc/refs_dl_spec.rb +2 -2
  45. data/spec/asciidoctor-standoc/refs_spec.rb +266 -55
  46. data/spec/asciidoctor-standoc/section_spec.rb +0 -1
  47. data/spec/asciidoctor-standoc/table_spec.rb +112 -112
  48. data/spec/asciidoctor-standoc/validate_spec.rb +5 -1
  49. data/spec/examples/codes_table.html +1365 -1365
  50. data/spec/fixtures/macros_datamodel/address_class_profile.xml +46 -46
  51. data/spec/fixtures/macros_datamodel/address_component_profile.xml +21 -21
  52. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +21 -21
  53. data/spec/fixtures/test.exp +121 -0
  54. data/spec/spec_helper.rb +142 -108
  55. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +781 -0
  56. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -234
  57. data/spec/vcr_cassettes/isobib_get_123.yml +13 -59
  58. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -115
  59. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
  60. data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -57
  61. data/spec/vcr_cassettes/isobib_get_124.yml +13 -59
  62. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  63. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +50 -36
  64. metadata +59 -11
  65. data/.github/workflows/macos.yml +0 -46
  66. data/.github/workflows/ubuntu.yml +0 -49
  67. data/.github/workflows/windows.yml +0 -53
  68. data/lib/asciidoctor/standoc/macros_yaml2text.rb +0 -165
  69. data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
  70. data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -52,93 +52,93 @@
52
52
  <name>AddressClassProfile attributes</name>
53
53
  <thead>
54
54
  <tr>
55
- <th align='left'>Name</th>
56
- <th align='left'>Definition</th>
57
- <th align='left'>Mandatory/ Optional/ Conditional</th>
58
- <th align='left'>Max Occur</th>
59
- <th align='left'>Data Type</th>
55
+ <th valign='top' align='left'>Name</th>
56
+ <th valign='top' align='left'>Definition</th>
57
+ <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
58
+ <th valign='top' align='left'>Max Occur</th>
59
+ <th valign='top' align='left'>Data Type</th>
60
60
  </tr>
61
61
  </thead>
62
62
  <tbody>
63
63
  <tr>
64
- <td align='left'>id</td>
65
- <td align='left'>Unique identifier of this AddressClassProfile.</td>
66
- <td align='left'>M</td>
67
- <td align='left'>1</td>
68
- <td align='left'>
64
+ <td valign='top' align='left'>id</td>
65
+ <td valign='top' align='left'>Unique identifier of this AddressClassProfile.</td>
66
+ <td valign='top' align='left'>M</td>
67
+ <td valign='top' align='left'>1</td>
68
+ <td valign='top' align='left'>
69
69
  <tt>CharacterString</tt>
70
70
  </td>
71
71
  </tr>
72
72
  <tr>
73
- <td align='left'>type</td>
74
- <td align='left'>Intended usage of this profile.</td>
75
- <td align='left'>M</td>
76
- <td align='left'>1</td>
77
- <td align='left'>
73
+ <td valign='top' align='left'>type</td>
74
+ <td valign='top' align='left'>Intended usage of this profile.</td>
75
+ <td valign='top' align='left'>M</td>
76
+ <td valign='top' align='left'>1</td>
77
+ <td valign='top' align='left'>
78
78
  <tt>CharacterString</tt>
79
79
  </td>
80
80
  </tr>
81
81
  <tr>
82
- <td align='left'>description</td>
83
- <td align='left'>Textual description of this profile.</td>
84
- <td align='left'>M</td>
85
- <td align='left'>1</td>
86
- <td align='left'>
82
+ <td valign='top' align='left'>description</td>
83
+ <td valign='top' align='left'>Textual description of this profile.</td>
84
+ <td valign='top' align='left'>M</td>
85
+ <td valign='top' align='left'>1</td>
86
+ <td valign='top' align='left'>
87
87
  <tt>CharacterString</tt>
88
88
  </td>
89
89
  </tr>
90
90
  <tr>
91
- <td align='left'>localization</td>
92
- <td align='left'>The language and script used within this profile.</td>
93
- <td align='left'>M</td>
94
- <td align='left'>1</td>
95
- <td align='left'>
91
+ <td valign='top' align='left'>localization</td>
92
+ <td valign='top' align='left'>The language and script used within this profile.</td>
93
+ <td valign='top' align='left'>M</td>
94
+ <td valign='top' align='left'>1</td>
95
+ <td valign='top' align='left'>
96
96
  <tt>Localization</tt>
97
97
  </td>
98
98
  </tr>
99
99
  <tr>
100
- <td align='left'>signature</td>
101
- <td align='left'>
100
+ <td valign='top' align='left'>signature</td>
101
+ <td valign='top' align='left'>
102
102
  The digital signature to verify the integrity of this profile, and
103
103
  the identity of the publishing authority.
104
104
  </td>
105
- <td align='left'>O</td>
106
- <td align='left'>1</td>
107
- <td align='left'>
105
+ <td valign='top' align='left'>O</td>
106
+ <td valign='top' align='left'>1</td>
107
+ <td valign='top' align='left'>
108
108
  <tt>Signature</tt>
109
109
  </td>
110
110
  </tr>
111
111
  <tr>
112
- <td align='left'>areaApplicability</td>
113
- <td align='left'>
112
+ <td valign='top' align='left'>areaApplicability</td>
113
+ <td valign='top' align='left'>
114
114
  The geographic representation of which this AddressClassProfile
115
115
  applies to. Overlapping geographic areas are allowed across
116
116
  different profiles.
117
117
  </td>
118
- <td align='left'>O</td>
119
- <td align='left'>N</td>
120
- <td align='left'>
118
+ <td valign='top' align='left'>O</td>
119
+ <td valign='top' align='left'>N</td>
120
+ <td valign='top' align='left'>
121
121
  <tt>iso19115MD_SpatialRepresentation</tt>
122
122
  </td>
123
123
  </tr>
124
124
  <tr>
125
- <td align='left'>timeToLive</td>
126
- <td align='left'>
125
+ <td valign='top' align='left'>timeToLive</td>
126
+ <td valign='top' align='left'>
127
127
  The maximum time interval between refreshing of this profile via
128
128
  an authoritative source, in seconds.
129
129
  </td>
130
- <td align='left'>M</td>
131
- <td align='left'>1</td>
132
- <td align='left'>
130
+ <td valign='top' align='left'>M</td>
131
+ <td valign='top' align='left'>1</td>
132
+ <td valign='top' align='left'>
133
133
  <tt>Integer</tt>
134
134
  </td>
135
135
  </tr>
136
136
  <tr>
137
- <td align='left'>validity</td>
138
- <td align='left'>The period of date and time that this profile should be considered as valid.</td>
139
- <td align='left'>M</td>
140
- <td align='left'>1</td>
141
- <td align='left'>
137
+ <td valign='top' align='left'>validity</td>
138
+ <td valign='top' align='left'>The period of date and time that this profile should be considered as valid.</td>
139
+ <td valign='top' align='left'>M</td>
140
+ <td valign='top' align='left'>1</td>
141
+ <td valign='top' align='left'>
142
142
  <tt>Validity</tt>
143
143
  </td>
144
144
  </tr>
@@ -146,4 +146,4 @@
146
146
  </table>
147
147
  </clause>
148
148
  </sections>
149
- </standard-document>
149
+ </standard-document>
@@ -23,44 +23,44 @@
23
23
  <name>AddressComponentProfile attributes</name>
24
24
  <thead>
25
25
  <tr>
26
- <th align='left'>Name</th>
27
- <th align='left'>Definition</th>
28
- <th align='left'>Mandatory/ Optional/ Conditional</th>
29
- <th align='left'>Max Occur</th>
30
- <th align='left'>Data Type</th>
26
+ <th valign='top' align='left'>Name</th>
27
+ <th valign='top' align='left'>Definition</th>
28
+ <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
29
+ <th valign='top' align='left'>Max Occur</th>
30
+ <th valign='top' align='left'>Data Type</th>
31
31
  </tr>
32
32
  </thead>
33
33
  <tbody>
34
34
  <tr>
35
- <td align='left'>key</td>
36
- <td align='left'>
35
+ <td valign='top' align='left'>key</td>
36
+ <td valign='top' align='left'>
37
37
  An identifier of this
38
38
  <tt>AddressComponentProfile</tt>
39
39
  , shall be unique within the
40
40
  <tt>AddressProfile</tt>
41
41
  .
42
42
  </td>
43
- <td align='left'>M</td>
44
- <td align='left'>1</td>
45
- <td align='left'>
43
+ <td valign='top' align='left'>M</td>
44
+ <td valign='top' align='left'>1</td>
45
+ <td valign='top' align='left'>
46
46
  <tt>CharacterString</tt>
47
47
  </td>
48
48
  </tr>
49
49
  <tr>
50
- <td align='left'>description</td>
51
- <td align='left'>Textual description of this component.</td>
52
- <td align='left'>M</td>
53
- <td align='left'>1</td>
54
- <td align='left'>
50
+ <td valign='top' align='left'>description</td>
51
+ <td valign='top' align='left'>Textual description of this component.</td>
52
+ <td valign='top' align='left'>M</td>
53
+ <td valign='top' align='left'>1</td>
54
+ <td valign='top' align='left'>
55
55
  <tt>CharacterString</tt>
56
56
  </td>
57
57
  </tr>
58
58
  <tr>
59
- <td align='left'>example</td>
60
- <td align='left'>A textual example to demonstrate the correct use of this component.</td>
61
- <td align='left'>O</td>
62
- <td align='left'>1</td>
63
- <td align='left'>
59
+ <td valign='top' align='left'>example</td>
60
+ <td valign='top' align='left'>A textual example to demonstrate the correct use of this component.</td>
61
+ <td valign='top' align='left'>O</td>
62
+ <td valign='top' align='left'>1</td>
63
+ <td valign='top' align='left'>
64
64
  <tt>CharacterString</tt>
65
65
  </td>
66
66
  </tr>
@@ -68,4 +68,4 @@
68
68
  </table>
69
69
  </clause>
70
70
  </sections>
71
- </standard-document>
71
+ </standard-document>
@@ -9,38 +9,38 @@
9
9
  <name>Signature attributes</name>
10
10
  <thead>
11
11
  <tr>
12
- <th align='left'>Name</th>
13
- <th align='left'>Definition</th>
14
- <th align='left'>Mandatory/ Optional/ Conditional</th>
15
- <th align='left'>Max Occur</th>
16
- <th align='left'>Data Type</th>
12
+ <th valign='top' align='left'>Name</th>
13
+ <th valign='top' align='left'>Definition</th>
14
+ <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
15
+ <th valign='top' align='left'>Max Occur</th>
16
+ <th valign='top' align='left'>Data Type</th>
17
17
  </tr>
18
18
  </thead>
19
19
  <tbody>
20
20
  <tr>
21
- <td align='left'>algorithm</td>
22
- <td align='left'>TODO: enum algorithm’s definition</td>
23
- <td align='left'>M</td>
24
- <td align='left'>1</td>
25
- <td align='left'>
21
+ <td valign='top' align='left'>algorithm</td>
22
+ <td valign='top' align='left'>TODO: enum algorithm’s definition</td>
23
+ <td valign='top' align='left'>M</td>
24
+ <td valign='top' align='left'>1</td>
25
+ <td valign='top' align='left'>
26
26
  <tt>iso14888Oid</tt>
27
27
  </td>
28
28
  </tr>
29
29
  <tr>
30
- <td align='left'>publicKey</td>
31
- <td align='left'>TODO: enum publicKey’s definition</td>
32
- <td align='left'>M</td>
33
- <td align='left'>1</td>
34
- <td align='left'>
30
+ <td valign='top' align='left'>publicKey</td>
31
+ <td valign='top' align='left'>TODO: enum publicKey’s definition</td>
32
+ <td valign='top' align='left'>M</td>
33
+ <td valign='top' align='left'>1</td>
34
+ <td valign='top' align='left'>
35
35
  <tt>Uri</tt>
36
36
  </td>
37
37
  </tr>
38
38
  <tr>
39
- <td align='left'>signature</td>
40
- <td align='left'>The actual digital signature value encoded in Base64 format.</td>
41
- <td align='left'>M</td>
42
- <td align='left'>1</td>
43
- <td align='left'>
39
+ <td valign='top' align='left'>signature</td>
40
+ <td valign='top' align='left'>The actual digital signature value encoded in Base64 format.</td>
41
+ <td valign='top' align='left'>M</td>
42
+ <td valign='top' align='left'>1</td>
43
+ <td valign='top' align='left'>
44
44
  <tt>CharacterString</tt>
45
45
  </td>
46
46
  </tr>
@@ -48,4 +48,4 @@
48
48
  </table>
49
49
  </clause>
50
50
  </sections>
51
- </standard-document>
51
+ </standard-document>
@@ -0,0 +1,121 @@
1
+ (*
2
+ $Id: test.exp,v 1.3 2020/07/30 05:18:54 ftanaka Exp $
3
+ ISO 10303 TC184/SC4/WG12 N10658
4
+
5
+ EXPRESS Source:
6
+ ISO 10303-59 ed3 Quality of product shape data - Annotated 3d model data quality criteria schema
7
+
8
+ The following permission notice and disclaimer shall be included in all copies of this EXPRESS schema ("the Schema"),
9
+ and derivations of the Schema:
10
+
11
+ Copyright ISO 2020 All rights reserved
12
+ Permission is hereby granted, free of charge in perpetuity, to any person obtaining a copy of the Schema,
13
+ to use, copy, modify, merge and distribute free of charge, copies of the Schema for the purposes of developing,
14
+ implementing, installing and using software based on the Schema, and to permit persons to whom the Schema is furnished to do so,
15
+ subject to the following conditions:
16
+
17
+ THE SCHEMA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SCHEMA OR THE
22
+ USE OR OTHER DEALINGS IN THE SCHEMA.
23
+
24
+ In addition, any modified copy of the Schema shall include the following notice:
25
+
26
+ THIS SCHEMA HAS BEEN MODIFIED FROM THE SCHEMA DEFINED IN
27
+ ISO 10303-59 ed3 Quality of product shape data - Annotated 3d model data quality criteria schema
28
+ AND SHOULD NOT BE INTERPRETED AS COMPLYING WITH THAT STANDARD
29
+ *)
30
+
31
+ SCHEMA annotated_3d_model_data_quality_criteria_schema '{iso standard 10303 part(59) version(3) object(1) annotated_3d_model_data_quality_criteria_schema(6)}';
32
+
33
+ (* Need select eleemnts for measure_value *)
34
+ REFERENCE FROM measure_schema
35
+ (measure_value);
36
+
37
+ REFERENCE FROM product_data_quality_criteria_schema
38
+ (data_quality_criteria_representation,
39
+ data_quality_criterion,
40
+ data_quality_measurement_requirement,
41
+ detailed_report_request_with_number_of_data,
42
+ summary_report_request);
43
+
44
+ REFERENCE FROM representation_schema
45
+ (representation,
46
+ representation_item);
47
+
48
+ REFERENCE FROM shape_data_quality_criteria_schema
49
+ (shape_data_quality_assessment_specification_select,
50
+ shape_measurement_accuracy);
51
+
52
+ REFERENCE FROM support_resource_schema
53
+ (identifier,
54
+ label,
55
+ text);
56
+
57
+ TYPE a3m_accuracy_associated_target_select = EXTENSIBLE SELECT;
58
+ END_TYPE;
59
+
60
+ TYPE a3m_data_quality_accuracy_type_name = EXTENSIBLE ENUMERATION;
61
+ END_TYPE;
62
+
63
+ TYPE a3m_data_quality_inspected_element_type_name = EXTENSIBLE ENUMERATION;
64
+ END_TYPE;
65
+
66
+ TYPE a3m_data_quality_measured_data_type_name = EXTENSIBLE ENUMERATION;
67
+ END_TYPE;
68
+
69
+ TYPE a3m_data_quality_type_name_for_location_of_extreme_value = EXTENSIBLE ENUMERATION;
70
+ END_TYPE;
71
+
72
+ TYPE summary_stats_value_type = ENUMERATION OF
73
+ (average_value,
74
+ max_value,
75
+ min_value);
76
+ END_TYPE;
77
+
78
+ ENTITY a3m_data_quality_criteria_representation
79
+ SUBTYPE OF (data_quality_criteria_representation);
80
+ WHERE
81
+ WR1: SIZEOF( QUERY( q <* SELF\representation.items|
82
+ 'ANNOTATED_3D_MODEL_DATA_QUALITY_CRITERIA_SCHEMA.' +
83
+ 'A3M_DATA_QUALITY_CRITERION' IN TYPEOF(q))) > 0;
84
+ END_ENTITY;
85
+
86
+ ENTITY a3m_data_quality_criterion
87
+ ABSTRACT SUPERTYPE
88
+ SUBTYPE OF(data_quality_criterion, data_quality_measurement_requirement);
89
+ assessment_specification : shape_data_quality_assessment_specification_select;
90
+ measured_data_type : a3m_data_quality_measured_data_type_name;
91
+ inspected_elements_types: LIST[1:?] OF a3m_data_quality_inspected_element_type_name;
92
+ accuracy_types : LIST [0:?] OF a3m_data_quality_accuracy_type_name;
93
+ location_of_extreme_value_types: LIST[0:?] OF a3m_data_quality_type_name_for_location_of_extreme_value;
94
+ END_ENTITY;
95
+
96
+ ENTITY a3m_data_quality_criterion_specific_applied_value
97
+ ABSTRACT SUPERTYPE
98
+ SUBTYPE OF(representation_item);
99
+ criterion_to_assign_the_value: a3m_data_quality_criterion;
100
+ applied_value : measure_value;
101
+ END_ENTITY;
102
+
103
+ ENTITY a3m_data_quality_target_accuracy_association;
104
+ id : identifier;
105
+ name : label;
106
+ description : OPTIONAL text;
107
+ accuracy_specification : shape_measurement_accuracy;
108
+ target_to_associate : a3m_accuracy_associated_target_select;
109
+ END_ENTITY;
110
+
111
+ ENTITY a3m_detailed_report_request
112
+ SUBTYPE OF(detailed_report_request_with_number_of_data);
113
+ value_type_requested : summary_stats_value_type;
114
+ END_ENTITY;
115
+
116
+ ENTITY a3m_summary_report_request_with_representative_value
117
+ SUBTYPE OF(summary_report_request);
118
+ value_type_requested : summary_stats_value_type;
119
+ END_ENTITY;
120
+
121
+ END_SCHEMA;
@@ -3,6 +3,11 @@ require "vcr"
3
3
  VCR.configure do |config|
4
4
  config.cassette_library_dir = "spec/vcr_cassettes"
5
5
  config.hook_into :webmock
6
+ config.default_cassette_options = {
7
+ clean_outdated_http_interactions: true,
8
+ re_record_interval: 1512000,
9
+ record: :once,
10
+ }
6
11
  end
7
12
 
8
13
  require "simplecov"
@@ -18,7 +23,9 @@ require "equivalent-xml"
18
23
  require "metanorma"
19
24
  require "metanorma/standoc"
20
25
  require "rexml/document"
21
- require 'byebug'
26
+ require "byebug"
27
+
28
+ Dir[File.expand_path("./support/**/**/*.rb", __dir__)].each { |f| require f }
22
29
 
23
30
  RSpec.configure do |config|
24
31
  # Enable flags like --only-failures and --next-failure
@@ -44,150 +51,168 @@ def xmlpp(x)
44
51
  s = ""
45
52
  f = REXML::Formatters::Pretty.new(2)
46
53
  f.compact = true
47
- f.write(REXML::Document.new(x),s)
54
+ f.write(REXML::Document.new(x), s)
48
55
  s
49
56
  end
50
57
 
51
- ASCIIDOC_BLANK_HDR = <<~"HDR"
52
- = Document title
53
- Author
54
- :docfile: test.adoc
55
- :nodoc:
56
- :novalid:
57
- :no-isobib:
58
+ ASCIIDOC_BLANK_HDR = <<~"HDR".freeze
59
+ = Document title
60
+ Author
61
+ :docfile: test.adoc
62
+ :nodoc:
63
+ :novalid:
64
+ :no-isobib:
58
65
 
59
66
  HDR
60
67
 
61
- DUMBQUOTE_BLANK_HDR = <<~"HDR"
62
- = Document title
63
- Author
64
- :docfile: test.adoc
65
- :nodoc:
66
- :novalid:
67
- :no-isobib:
68
- :smartquotes: false
68
+ DUMBQUOTE_BLANK_HDR = <<~"HDR".freeze
69
+ = Document title
70
+ Author
71
+ :docfile: test.adoc
72
+ :nodoc:
73
+ :novalid:
74
+ :no-isobib:
75
+ :smartquotes: false
69
76
 
70
77
  HDR
71
78
 
72
- ISOBIB_BLANK_HDR = <<~"HDR"
73
- = Document title
74
- Author
75
- :docfile: test.adoc
76
- :nodoc:
77
- :novalid:
78
- :no-isobib-cache:
79
+ ISOBIB_BLANK_HDR = <<~"HDR".freeze
80
+ = Document title
81
+ Author
82
+ :docfile: test.adoc
83
+ :nodoc:
84
+ :novalid:
85
+ :no-isobib-cache:
79
86
 
80
87
  HDR
81
88
 
82
- FLUSH_CACHE_ISOBIB_BLANK_HDR = <<~"HDR"
83
- = Document title
84
- Author
85
- :docfile: test.adoc
86
- :nodoc:
87
- :novalid:
88
- :flush-caches:
89
+ FLUSH_CACHE_ISOBIB_BLANK_HDR = <<~"HDR".freeze
90
+ = Document title
91
+ Author
92
+ :docfile: test.adoc
93
+ :nodoc:
94
+ :novalid:
95
+ :flush-caches:
89
96
 
90
97
  HDR
91
98
 
92
- CACHED_ISOBIB_BLANK_HDR = <<~"HDR"
93
- = Document title
94
- Author
95
- :docfile: test.adoc
96
- :nodoc:
97
- :novalid:
99
+ CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
100
+ = Document title
101
+ Author
102
+ :docfile: test.adoc
103
+ :nodoc:
104
+ :novalid:
98
105
 
99
106
  HDR
100
107
 
101
- LOCAL_CACHED_ISOBIB_BLANK_HDR = <<~"HDR"
102
- = Document title
103
- Author
104
- :docfile: test.adoc
105
- :nodoc:
106
- :novalid:
107
- :local-cache:
108
+ LOCAL_CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
109
+ = Document title
110
+ Author
111
+ :docfile: test.adoc
112
+ :nodoc:
113
+ :novalid:
114
+ :local-cache:
108
115
 
109
116
  HDR
110
117
 
111
- LOCAL_ONLY_CACHED_ISOBIB_BLANK_HDR = <<~"HDR"
112
- = Document title
113
- Author
114
- :docfile: test.adoc
115
- :nodoc:
116
- :novalid:
117
- :local-cache-only:
118
+ LOCAL_ONLY_CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
119
+ = Document title
120
+ Author
121
+ :docfile: test.adoc
122
+ :nodoc:
123
+ :novalid:
124
+ :local-cache-only:
118
125
 
119
126
  HDR
120
127
 
121
- VALIDATING_BLANK_HDR = <<~"HDR"
122
- = Document title
123
- Author
124
- :docfile: test.adoc
125
- :nodoc:
126
- :no-isobib:
128
+ VALIDATING_BLANK_HDR = <<~"HDR".freeze
129
+ = Document title
130
+ Author
131
+ :docfile: test.adoc
132
+ :nodoc:
133
+ :no-isobib:
134
+
135
+ HDR
127
136
 
137
+ NORM_REF_BOILERPLATE = <<~"HDR".freeze
138
+ <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
128
139
  HDR
129
140
 
130
- NORM_REF_BOILERPLATE = <<~"HDR"
131
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
141
+ BLANK_HDR = <<~"HDR".freeze
142
+ <?xml version="1.0" encoding="UTF-8"?>
143
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" version="#{Metanorma::Standoc::VERSION}" type="semantic">
144
+ <bibdata type="standard">
145
+ <title language="en" format="text/plain">Document title</title>
146
+ <language>en</language>
147
+ <script>Latn</script>
148
+ <status><stage>published</stage></status>
149
+ <copyright>
150
+ <from>#{Time.new.year}</from>
151
+ </copyright>
152
+ <ext>
153
+ <doctype>article</doctype>
154
+ </ext>
155
+ </bibdata>
132
156
  HDR
133
157
 
134
- BLANK_HDR = <<~"HDR"
135
- <?xml version="1.0" encoding="UTF-8"?>
136
- <standard-document xmlns="https://www.metanorma.org/ns/standoc">
137
- <bibdata type="standard">
138
- <title language="en" format="text/plain">Document title</title>
139
- <language>en</language>
140
- <script>Latn</script>
141
- <status><stage>published</stage></status>
142
- <copyright>
143
- <from>#{Time.new.year}</from>
144
- </copyright>
145
- <ext>
146
- <doctype>article</doctype>
147
- </ext>
148
- </bibdata>
158
+ BLANK_METANORMA_HDR = <<~"HDR".freeze
159
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
160
+ <?xml version="1.0" encoding="UTF-8"?><html><body>
161
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" version="#{Metanorma::Standoc::VERSION}" type="semantic">
162
+ <bibdata type="standard">
163
+ <title language="en" format="text/plain">Document title</title>
164
+ <language>en</language>
165
+ <script>Latn</script>
166
+ <status><stage>published</stage></status>
167
+ <copyright>
168
+ <from>#{Time.new.year}</from>
169
+ </copyright>
170
+ <ext>
171
+ <doctype>article</doctype>
172
+ </ext>
173
+ </bibdata>
149
174
  HDR
150
175
 
151
- HTML_HDR = <<~END
152
- <html xmlns:epub="http://www.idpf.org/2007/ops">
153
- <head>
154
- <title>test</title>
155
- </head>
156
- <body lang="EN-US" link="blue" vlink="#954F72">
157
- <div class="title-section">
158
- <p>&#160;</p>
159
- </div>
160
- <br/>
161
- <div class="prefatory-section">
162
- <p>&#160;</p>
163
- </div>
164
- <br/>
165
- <div class="main-section">
176
+ HTML_HDR = <<~END.freeze
177
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
178
+ <head>
179
+ <title>test</title>
180
+ </head>
181
+ <body lang="EN-US" link="blue" vlink="#954F72">
182
+ <div class="title-section">
183
+ <p>&#160;</p>
184
+ </div>
185
+ <br/>
186
+ <div class="prefatory-section">
187
+ <p>&#160;</p>
188
+ </div>
189
+ <br/>
190
+ <div class="main-section">
166
191
  END
167
192
 
168
- WORD_HDR = <<~END
169
- <html xmlns:epub="http://www.idpf.org/2007/ops">
170
- <head>
171
- <title>test</title>
172
- </head>
173
- <body lang="EN-US" link="blue" vlink="#954F72">
174
- <div class="WordSection1">
175
- <p>&#160;</p>
176
- </div>
177
- <br clear="all" class="section"/>
178
- <div class="WordSection2">
179
- <p>&#160;</p>
180
- </div>
181
- <br clear="all" class="section"/>
182
- <div class="WordSection3">
193
+ WORD_HDR = <<~END.freeze
194
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
195
+ <head>
196
+ <title>test</title>
197
+ </head>
198
+ <body lang="EN-US" link="blue" vlink="#954F72">
199
+ <div class="WordSection1">
200
+ <p>&#160;</p>
201
+ </div>
202
+ <br clear="all" class="section"/>
203
+ <div class="WordSection2">
204
+ <p>&#160;</p>
205
+ </div>
206
+ <br clear="all" class="section"/>
207
+ <div class="WordSection3">
183
208
  END
184
209
 
185
210
  def examples_path(path)
186
- File.join(File.expand_path('./examples', __dir__), path)
211
+ File.join(File.expand_path("./examples", __dir__), path)
187
212
  end
188
213
 
189
214
  def fixtures_path(path)
190
- File.join(File.expand_path('./fixtures', __dir__), path)
215
+ File.join(File.expand_path("./fixtures", __dir__), path)
191
216
  end
192
217
 
193
218
  def stub_fetch_ref(**opts)
@@ -212,8 +237,8 @@ def stub_fetch_ref(**opts)
212
237
  hit_pages = double("hit_pages")
213
238
  expect(hit_pages).to receive(:first).and_return(hit_page).at_least :once
214
239
 
215
- expect(Isobib::IsoBibliography).to receive(:search).
216
- and_wrap_original do |search, *args|
240
+ expect(Isobib::IsoBibliography).to receive(:search)
241
+ .and_wrap_original do |search, *args|
217
242
  code = args[0]
218
243
  expect(code).to be_instance_of String
219
244
  xml = get_xml(search, code, opts)
@@ -247,3 +272,12 @@ def mock_open_uri(code)
247
272
  end.at_least :once
248
273
  end
249
274
 
275
+ def metanorma_process(input)
276
+ Metanorma::Input::Asciidoc
277
+ .new
278
+ .process(input, "test.adoc", :standoc)
279
+ end
280
+
281
+ def xml_string_conent(xml)
282
+ strip_guid(Nokogiri::HTML(xml).to_s)
283
+ end