metanorma-standoc 1.5.3 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) 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 +4 -11
  6. data/lib/asciidoctor/standoc/cleanup.rb +78 -12
  7. data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
  8. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +14 -0
  9. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +25 -0
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +6 -2
  11. data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -4
  12. data/lib/asciidoctor/standoc/converter.rb +58 -3
  13. data/lib/asciidoctor/standoc/front.rb +9 -3
  14. data/lib/asciidoctor/standoc/front_contributor.rb +43 -11
  15. data/lib/asciidoctor/standoc/inline.rb +18 -40
  16. data/lib/asciidoctor/standoc/isodoc.rng +27 -50
  17. data/lib/asciidoctor/standoc/lists.rb +4 -2
  18. data/lib/asciidoctor/standoc/macros.rb +28 -2
  19. data/lib/asciidoctor/standoc/ref.rb +46 -48
  20. data/lib/asciidoctor/standoc/ref_sect.rb +16 -8
  21. data/lib/asciidoctor/standoc/section.rb +5 -9
  22. data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
  23. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
  24. data/lib/metanorma/standoc.rb +0 -5
  25. data/lib/metanorma/standoc/version.rb +20 -1
  26. data/metanorma-standoc.gemspec +7 -3
  27. data/spec/asciidoctor-standoc/base_spec.rb +246 -9
  28. data/spec/asciidoctor-standoc/blocks_spec.rb +1 -1
  29. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1514 -0
  30. data/spec/asciidoctor-standoc/cleanup_spec.rb +384 -1547
  31. data/spec/asciidoctor-standoc/inline_spec.rb +128 -4
  32. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +15 -22
  33. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  34. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +1 -1
  35. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  36. data/spec/asciidoctor-standoc/macros_spec.rb +258 -0
  37. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +1 -1
  38. data/spec/asciidoctor-standoc/refs_dl_spec.rb +8 -8
  39. data/spec/asciidoctor-standoc/refs_spec.rb +362 -104
  40. data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
  41. data/spec/fixtures/diagram_definitions.lutaml +22 -0
  42. data/spec/fixtures/test.exp +121 -0
  43. data/spec/spec_helper.rb +34 -1
  44. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +201 -3
  45. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +47 -231
  46. data/spec/vcr_cassettes/isobib_get_123.yml +14 -60
  47. data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -116
  48. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
  49. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
  50. data/spec/vcr_cassettes/isobib_get_124.yml +12 -58
  51. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  52. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +292 -162
  53. metadata +59 -17
  54. data/.github/workflows/macos.yml +0 -46
  55. data/.github/workflows/ubuntu.yml +0 -49
  56. data/.github/workflows/windows.yml +0 -53
  57. data/lib/asciidoctor/standoc/base_structured_text_preprocessor.rb +0 -123
  58. data/lib/asciidoctor/standoc/json2_text_preprocessor.rb +0 -43
  59. data/lib/asciidoctor/standoc/yaml2_text_preprocessor.rb +0 -43
  60. data/lib/metanorma/standoc/latexml_requirement.rb +0 -62
  61. data/lib/metanorma/standoc/requirement.rb +0 -13
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "asciidoctor/standoc/base_structured_text_preprocessor"
4
-
5
- module Asciidoctor
6
- module Standoc
7
- class Json2TextPreprocessor < BaseStructuredTextPreprocessor
8
- # search document for block `yaml2text`
9
- # after that take template from block and read file into this template
10
- # example:
11
- # [yaml2text,foobar.yaml]
12
- # ----
13
- # === {item.name}
14
- # {item.desc}
15
- #
16
- # {item.symbol}:: {item.symbol_def}
17
- # ----
18
- #
19
- # with content of `foobar.yaml` file equal to:
20
- # - name: spaghetti
21
- # desc: wheat noodles of 9mm diameter
22
- # symbol: SPAG
23
- # symbol_def: the situation is message like spaghetti at a kid's
24
- #
25
- # will produce:
26
- # === spaghetti
27
- # wheat noodles of 9mm diameter
28
- #
29
- # SPAG:: the situation is message like spaghetti at a kid's meal
30
-
31
- def initialize(config = {})
32
- super
33
- @config[:block_name] = "json2text"
34
- end
35
-
36
- protected
37
-
38
- def content_from_file(document, file_path)
39
- JSON.parse(File.read(relative_file_path(document, file_path)))
40
- end
41
- end
42
- end
43
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "asciidoctor/standoc/base_structured_text_preprocessor"
4
-
5
- module Asciidoctor
6
- module Standoc
7
- class Yaml2TextPreprocessor < BaseStructuredTextPreprocessor
8
- # search document for block `yaml2text`
9
- # after that take template from block and read file into this template
10
- # example:
11
- # [yaml2text,foobar.yaml]
12
- # ----
13
- # === {item.name}
14
- # {item.desc}
15
- #
16
- # {item.symbol}:: {item.symbol_def}
17
- # ----
18
- #
19
- # with content of `foobar.yaml` file equal to:
20
- # - name: spaghetti
21
- # desc: wheat noodles of 9mm diameter
22
- # symbol: SPAG
23
- # symbol_def: the situation is message like spaghetti at a kid's
24
- #
25
- # will produce:
26
- # === spaghetti
27
- # wheat noodles of 9mm diameter
28
- #
29
- # SPAG:: the situation is message like spaghetti at a kid's meal
30
-
31
- def initialize(config = {})
32
- super
33
- @config[:block_name] = "yaml2text"
34
- end
35
-
36
- protected
37
-
38
- def content_from_file(document, file_path)
39
- YAML.safe_load(File.read(relative_file_path(document, file_path)))
40
- end
41
- end
42
- end
43
- end
@@ -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