metanorma-standoc 1.11.0.1 → 1.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) 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 +58 -21
  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 +13 -9
  17. data/lib/asciidoctor/standoc/inline.rb +13 -11
  18. data/lib/asciidoctor/standoc/isodoc.rng +73 -19
  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 +16 -6
  23. data/lib/asciidoctor/standoc/render.rb +115 -0
  24. data/lib/asciidoctor/standoc/reqt.rb +1 -1
  25. data/lib/asciidoctor/standoc/section.rb +33 -15
  26. data/lib/asciidoctor/standoc/terms.rb +7 -1
  27. data/lib/asciidoctor/standoc/utils.rb +0 -16
  28. data/lib/asciidoctor/standoc/validate.rb +1 -1
  29. data/lib/isodoc/html/htmlstyle.css +20 -11
  30. data/lib/isodoc/html/htmlstyle.scss +11 -11
  31. data/lib/metanorma/standoc/version.rb +1 -1
  32. data/metanorma-standoc.gemspec +3 -3
  33. data/spec/asciidoctor/base_spec.rb +48 -0
  34. data/spec/asciidoctor/blocks_spec.rb +99 -17
  35. data/spec/asciidoctor/cleanup_blocks_spec.rb +24 -0
  36. data/spec/asciidoctor/cleanup_sections_spec.rb +1 -1
  37. data/spec/asciidoctor/cleanup_spec.rb +6 -6
  38. data/spec/asciidoctor/cleanup_terms_spec.rb +556 -89
  39. data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
  40. data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
  41. data/spec/asciidoctor/inline_spec.rb +174 -5
  42. data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
  43. data/spec/asciidoctor/macros_spec.rb +2 -2
  44. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  45. data/spec/asciidoctor/refs_spec.rb +889 -495
  46. data/spec/asciidoctor/section_spec.rb +64 -2
  47. data/spec/spec_helper.rb +2 -2
  48. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +182 -182
  49. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  50. data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
  51. data/spec/vcr_cassettes/isobib_get_123_1.yml +99 -99
  52. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +107 -107
  53. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -14
  54. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  55. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  56. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  57. metadata +9 -8
@@ -686,6 +686,36 @@ RSpec.describe Asciidoctor::Standoc do
686
686
  .to be_equivalent_to xmlpp(output)
687
687
  end
688
688
 
689
+ it "tag and multilingual processing attributes on term" do
690
+ input = <<~INPUT
691
+ #{ASCIIDOC_BLANK_HDR}
692
+ [heading="terms, definitions, symbols and abbreviated terms"]
693
+ == Terms, Definitions, Symbols Section
694
+
695
+ [language=en,tag=x123,multilingual-rendering=all-columns]
696
+ === Term
697
+ INPUT
698
+ output = <<~OUTPUT
699
+ #{BLANK_HDR}
700
+ <sections>
701
+ <terms id='_' obligation='normative'>
702
+ <title>Terms and definitions</title>
703
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
704
+ <term id='term-term' language='en' tag='x123' multilingual-rendering='all-columns'>
705
+ <preferred>
706
+ <expression>
707
+ <name>Term</name>
708
+ </expression>
709
+ </preferred>
710
+ </term>
711
+ </terms>
712
+ </sections>
713
+ </standard-document>
714
+ OUTPUT
715
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
716
+ .to be_equivalent_to xmlpp(output)
717
+ end
718
+
689
719
  it "varies terms & symbols title" do
690
720
  input = <<~INPUT
691
721
  #{ASCIIDOC_BLANK_HDR}
@@ -1137,7 +1167,7 @@ RSpec.describe Asciidoctor::Standoc do
1137
1167
  <title>Basic concepts</title>
1138
1168
  <term id='term-date'>
1139
1169
  <preferred><expression><name>date</name></expression></preferred>
1140
- <definition><verbaldefinition>
1170
+ <definition><verbal-definition>
1141
1171
  <p id='_'>
1142
1172
  <em>time</em>
1143
1173
  (
@@ -1152,7 +1182,7 @@ RSpec.describe Asciidoctor::Standoc do
1152
1182
  <xref target='term-time-scale'/>
1153
1183
  )
1154
1184
  </p>
1155
- </verbaldefinition></definition>
1185
+ </verbal-definition></definition>
1156
1186
  </term>
1157
1187
  </terms>
1158
1188
  </clause>
@@ -1230,4 +1260,36 @@ RSpec.describe Asciidoctor::Standoc do
1230
1260
  .to be_equivalent_to xmlpp(output)
1231
1261
  end
1232
1262
 
1263
+ it "handles floating titles" do
1264
+ input = <<~INPUT
1265
+ #{ASCIIDOC_BLANK_HDR}
1266
+
1267
+ == Clause 1
1268
+
1269
+ [discrete]
1270
+ == I am a _floating_ title
1271
+
1272
+ === Clause 2
1273
+
1274
+ INPUT
1275
+ output = <<~OUTPUT
1276
+ #{BLANK_HDR}
1277
+ <sections>
1278
+ <clause id="_" inline-header="false" obligation="normative">
1279
+ <title>Clause 1</title>
1280
+ <p id='_' type='floating-title'>
1281
+ I am a
1282
+ <em>floating</em>
1283
+ title
1284
+ </p>
1285
+ <clause id='_' inline-header='false' obligation='normative'>
1286
+ <title>Clause 2</title>
1287
+ </clause>
1288
+ </clause>
1289
+ </sections>
1290
+ </standard-document>
1291
+ OUTPUT
1292
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1293
+ .to be_equivalent_to xmlpp(output)
1294
+ end
1233
1295
  end
data/spec/spec_helper.rb CHANGED
@@ -23,7 +23,6 @@ require "equivalent-xml"
23
23
  require "metanorma"
24
24
  require "metanorma/standoc"
25
25
  require "rexml/document"
26
- require "byebug"
27
26
 
28
27
  Dir[File.expand_path("./support/**/**/*.rb", __dir__)]
29
28
  .sort.each { |f| require f }
@@ -61,7 +60,8 @@ def xmlpp(xml)
61
60
  s = ""
62
61
  f = REXML::Formatters::Pretty.new(2)
63
62
  f.compact = true
64
- f.write(REXML::Document.new(xml), s)
63
+ f.write(REXML::Document.new(xml
64
+ .gsub(%r{<fetched>[^<]+</fetched>}, "<fetched/>")), s)
65
65
  s
66
66
  end
67
67