metanorma-standoc 1.6.0 → 1.6.5

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 (63) 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 +8 -16
  5. data/lib/asciidoctor/standoc/basicdoc.rng +32 -0
  6. data/lib/asciidoctor/standoc/cleanup.rb +52 -4
  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 +18 -25
  12. data/lib/asciidoctor/standoc/cleanup_terms.rb +3 -0
  13. data/lib/asciidoctor/standoc/converter.rb +61 -3
  14. data/lib/asciidoctor/standoc/front.rb +9 -3
  15. data/lib/asciidoctor/standoc/front_contributor.rb +34 -10
  16. data/lib/asciidoctor/standoc/isodoc.rng +29 -44
  17. data/lib/asciidoctor/standoc/lists.rb +4 -2
  18. data/lib/asciidoctor/standoc/macros.rb +45 -63
  19. data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
  20. data/lib/asciidoctor/standoc/ref.rb +24 -36
  21. data/lib/asciidoctor/standoc/ref_sect.rb +16 -8
  22. data/lib/asciidoctor/standoc/section.rb +5 -9
  23. data/lib/asciidoctor/standoc/table.rb +12 -0
  24. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +86 -0
  25. data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
  26. data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
  27. data/lib/metanorma/standoc/version.rb +1 -1
  28. data/metanorma-standoc.gemspec +6 -3
  29. data/spec/asciidoctor-standoc/base_spec.rb +127 -8
  30. data/spec/asciidoctor-standoc/blocks_spec.rb +8 -8
  31. data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1514 -0
  32. data/spec/asciidoctor-standoc/cleanup_spec.rb +450 -1554
  33. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +22 -31
  34. data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
  35. data/spec/asciidoctor-standoc/macros_json2text_spec.rb +1 -1
  36. data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
  37. data/spec/asciidoctor-standoc/macros_plantuml_spec.rb +307 -0
  38. data/spec/asciidoctor-standoc/macros_spec.rb +378 -169
  39. data/spec/asciidoctor-standoc/macros_yaml2text_spec.rb +1 -1
  40. data/spec/asciidoctor-standoc/refs_dl_spec.rb +8 -8
  41. data/spec/asciidoctor-standoc/refs_spec.rb +350 -101
  42. data/spec/asciidoctor-standoc/section_spec.rb +11 -11
  43. data/spec/asciidoctor-standoc/table_spec.rb +86 -0
  44. data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
  45. data/spec/fixtures/diagram_definitions.lutaml +22 -0
  46. data/spec/fixtures/test.exp +121 -0
  47. data/spec/spec_helper.rb +33 -0
  48. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +156 -4
  49. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +49 -233
  50. data/spec/vcr_cassettes/isobib_get_123.yml +12 -58
  51. data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -119
  52. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +361 -0
  53. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -58
  54. data/spec/vcr_cassettes/isobib_get_124.yml +11 -57
  55. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  56. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +276 -158
  57. metadata +61 -14
  58. data/.github/workflows/macos.yml +0 -41
  59. data/.github/workflows/ubuntu.yml +0 -45
  60. data/.github/workflows/windows.yml +0 -43
  61. data/lib/asciidoctor/standoc/base_structured_text_preprocessor.rb +0 -123
  62. data/lib/asciidoctor/standoc/json2_text_preprocessor.rb +0 -44
  63. data/lib/asciidoctor/standoc/yaml2_text_preprocessor.rb +0 -46
@@ -1,44 +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
- encoding: "UTF-8"))
41
- end
42
- end
43
- end
44
- end
@@ -1,46 +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(
40
- File.read(relative_file_path(document, file_path),
41
- encoding: "UTF-8"),
42
- [Date, Time])
43
- end
44
- end
45
- end
46
- end