metanorma-standoc 1.4.4 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +4 -9
  3. data/.github/workflows/ubuntu.yml +1 -5
  4. data/.github/workflows/windows.yml +2 -12
  5. data/.rubocop.yml +1 -1
  6. data/lib/asciidoctor/standoc/base.rb +11 -5
  7. data/lib/asciidoctor/standoc/base_structured_text_preprocessor.rb +123 -0
  8. data/lib/asciidoctor/standoc/basicdoc.rng +23 -0
  9. data/lib/asciidoctor/standoc/cleanup.rb +32 -12
  10. data/lib/asciidoctor/standoc/cleanup_amend.rb +54 -0
  11. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -2
  12. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +11 -24
  13. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -3
  14. data/lib/asciidoctor/standoc/cleanup_inline.rb +62 -1
  15. data/lib/asciidoctor/standoc/cleanup_ref.rb +10 -7
  16. data/lib/asciidoctor/standoc/cleanup_section.rb +91 -8
  17. data/lib/asciidoctor/standoc/cleanup_terms.rb +12 -2
  18. data/lib/asciidoctor/standoc/converter.rb +3 -3
  19. data/lib/asciidoctor/standoc/front.rb +0 -12
  20. data/lib/asciidoctor/standoc/front_contributor.rb +51 -10
  21. data/lib/asciidoctor/standoc/inline.rb +21 -31
  22. data/lib/asciidoctor/standoc/isodoc.rng +137 -21
  23. data/lib/asciidoctor/standoc/json2_text_preprocessor.rb +44 -0
  24. data/lib/asciidoctor/standoc/log.rb +10 -1
  25. data/lib/asciidoctor/standoc/macros.rb +45 -33
  26. data/lib/asciidoctor/standoc/ref.rb +45 -45
  27. data/lib/asciidoctor/standoc/section.rb +39 -30
  28. data/lib/asciidoctor/standoc/table.rb +3 -2
  29. data/lib/asciidoctor/standoc/utils.rb +18 -1
  30. data/lib/asciidoctor/standoc/validate.rb +30 -18
  31. data/lib/asciidoctor/standoc/validate_section.rb +1 -1
  32. data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +10 -10
  33. data/lib/asciidoctor/standoc/yaml2_text_preprocessor.rb +46 -0
  34. data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
  35. data/lib/liquid/custom_filters/values.rb +7 -0
  36. data/lib/metanorma/standoc.rb +0 -5
  37. data/lib/metanorma/standoc/version.rb +20 -1
  38. data/metanorma-standoc.gemspec +4 -5
  39. data/spec/asciidoctor-standoc/base_spec.rb +140 -7
  40. data/spec/asciidoctor-standoc/blocks_spec.rb +275 -149
  41. data/spec/asciidoctor-standoc/cleanup_spec.rb +1372 -56
  42. data/spec/asciidoctor-standoc/inline_spec.rb +133 -6
  43. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +9 -7
  44. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +10 -0
  45. data/spec/asciidoctor-standoc/macros_spec.rb +43 -23
  46. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +5 -560
  47. data/spec/asciidoctor-standoc/refs_dl_spec.rb +9 -7
  48. data/spec/asciidoctor-standoc/refs_spec.rb +43 -34
  49. data/spec/asciidoctor-standoc/section_spec.rb +42 -39
  50. data/spec/asciidoctor-standoc/table_spec.rb +119 -113
  51. data/spec/asciidoctor-standoc/validate_spec.rb +45 -1
  52. data/spec/assets/i18n.yaml +17 -2
  53. data/spec/examples/codes_table.html +1365 -1365
  54. data/spec/fixtures/macros_datamodel/address_class_profile.xml +46 -46
  55. data/spec/fixtures/macros_datamodel/address_component_profile.xml +21 -21
  56. data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +21 -21
  57. data/spec/metanorma/processor_spec.rb +1 -2
  58. data/spec/spec_helper.rb +110 -109
  59. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +629 -0
  60. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +71 -71
  61. data/spec/vcr_cassettes/isobib_get_123.yml +16 -16
  62. data/spec/vcr_cassettes/isobib_get_123_1.yml +36 -36
  63. data/spec/vcr_cassettes/isobib_get_123_2001.yml +16 -16
  64. data/spec/vcr_cassettes/isobib_get_124.yml +17 -17
  65. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  66. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +39 -37
  67. metadata +29 -14
  68. data/lib/asciidoctor-yaml/i18n-en.yaml +0 -20
  69. data/lib/asciidoctor-yaml/i18n-fr.yaml +0 -13
  70. data/lib/asciidoctor-yaml/i18n-zh-Hans.yaml +0 -15
  71. data/lib/asciidoctor/standoc/i18n.rb +0 -39
  72. data/lib/asciidoctor/standoc/macros_yaml2text.rb +0 -165
  73. data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
  74. data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -1,62 +0,0 @@
1
- require_relative "./requirement"
2
-
3
- module Metanorma
4
- module Standoc
5
- class LatexmlRequirement < Requirement
6
- @recommended_version = '0.8.4'
7
- @minimal_version = '0.8.0'
8
-
9
- def initialize
10
- version_output, = Open3.capture2e("latexml --VERSION")
11
- version = version_output&.match(%r{\d+(.\d+)*})
12
-
13
- if version.to_s.empty?
14
- @error_message = "LaTeXML is not available. (Or is PATH not setup properly?)"\
15
- " You must upgrade/install LaTeXML to a version higher than `#{@recommended_version}`"
16
-
17
- elsif Gem::Version.new(version) < Gem::Version.new(@minimal_version)
18
- @error_message = "Minimal supported LaTeXML version is `#{@minimal_version}` "\
19
- "Version `#{version}` found; recommended version is `#{@recommended_version}`"
20
-
21
- elsif Gem::Version.new(version) < Gem::Version.new(@recommended_version)
22
- version = "unknown" if version.to_s.empty?
23
- header_msg = "latexmlmath version `#{version}` below `#{@recommended_version}`!"
24
- suggestion = if Gem.win_platform?
25
- "cmd encoding is set to UTF-8 with `chcp 65001`"
26
- else
27
- "terminal encoding is set to UTF-8 with `export LANG=en_US.UTF-8`"
28
- end
29
-
30
- @error_message = "WARNING #{header_msg} Please sure that #{suggestion} command."
31
-
32
- @cmd = 'latexmlmath --strict --preload=amsmath -- -'
33
- @cmd2 = 'latexmlmath --strict -- -'
34
- else
35
- @cmd = 'latexmlmath --strict --preload=amsmath --inputencoding=UTF-8 -- -'
36
- @cmd2 = 'latexmlmath --strict --inputencoding=UTF-8 -- -'
37
- end
38
- rescue
39
- @error_message = "LaTeXML is not available. (Or is PATH not setup properly?)"\
40
- " You must upgrade/install LaTeXML to a version higher than `#{@recommended_version}`"
41
- end
42
-
43
- def satisfied(abort = false)
44
- unless @error_message.nil?
45
- if abort
46
- abort @error_message
47
- else
48
- warn @error_message
49
- end
50
- end
51
-
52
- @error_message.nil?
53
- end
54
-
55
- def cmd
56
- abort @error_message unless @error_message.nil?
57
-
58
- [@cmd, @cmd2]
59
- end
60
- end
61
- end
62
- end
@@ -1,13 +0,0 @@
1
- module Metanorma
2
- module Standoc
3
- class Requirement
4
- def satisfied
5
- raise NotImplementedError("abstract method")
6
- end
7
-
8
- def cmd
9
- raise NotImplementedError("abstract method")
10
- end
11
- end
12
- end
13
- end