metanorma-plugin-lutaml 0.7.68 → 0.7.69

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7ef65c3a2ef0dabf7b9cec376a1f2c5ee207cb9ca710665462ee99e508495f0
4
- data.tar.gz: b523aded0b2d72a504d1afbd149e9d93b77f6a931fded9f9cc1d1a9f547c8f9f
3
+ metadata.gz: 66af39979d425315f2ec0df8901ccf17f691a53cc44d9fce6b2c47c9427f7cc9
4
+ data.tar.gz: ff163a8fbaa6cd3ab5362ff6173e6e5715108ed7a56f682318a8ac71d4099bb5
5
5
  SHA512:
6
- metadata.gz: a30614c2017d73cc7d4580924ec472138d4c1fef77b9cf1a8b900816002530ed82b3dcf9cbf5b44623731aa2dd20ad5c635e1f39ef9a0a47586ede1b2519f4e5
7
- data.tar.gz: 5bc2b634b31449303ae41e4ed4aad464d9940688371fd682e21fa5f58820b5ec1cae11b7fc52ae86993a1655f4f9e72ffd24d14db51ec082141247aac58fed3d
6
+ metadata.gz: fd8695ec9568498511ad984a9ae1ba0972f4bc8ba7f4cbe50b44edf7378b5e85d8f6cd25f00553c2a08de146a5a3ab70074500013ea848c5988ca45ba22391e0
7
+ data.tar.gz: fb753e85f753de969e1b8568c3a792a1c4f541a6df11900680a431e35d9dcdb964be7a779a1f92eeae86bc097249a97f4362bba89a7dc2671300f09c34bae125
@@ -24,6 +24,11 @@ module Metanorma
24
24
  # only when the preceding line is a list item.
25
25
  LONE_CONTINUATION_REGEXP = /^\+[[:space:]]*$/
26
26
 
27
+ # A `+` glued to a macro line's trailing `[]` (no whitespace): the
28
+ # form asciidoctor renders as literal text in every context.
29
+ GLUED_CONTINUATION_REGEXP = %r{
30
+ ^(?:link|image|video|audio|include):: .+ \[\][+][[:space:]]*$
31
+ }x
27
32
  LIST_ITEM_REGEXP = %r{
28
33
  ^(?:[-*]|\d+[.)]|[A-Za-z][.)])\s # bullets and enumerations
29
34
  | \w[[:alnum:] _-]*::\s # definition lists
@@ -48,6 +53,7 @@ module Metanorma
48
53
 
49
54
  def call
50
55
  result = normalise_dangling_continuations(remark)
56
+ result = normalise_glued_continuations(result)
51
57
  if options["relative_path_prefix"]
52
58
  result = update_relative_paths(result,
53
59
  options["relative_path_prefix"])
@@ -57,6 +63,21 @@ module Metanorma
57
63
 
58
64
  private
59
65
 
66
+ # A `+` GLUED to a macro's closing bracket (`image::x.gif[]+`) is
67
+ # parsed by asciidoctor as literal text in EVERY context — list
68
+ # item or paragraph (TRThurman's trial, iso-10303#862: the
69
+ # kinematic_structure_schema `direction_vectors` continuation) —
70
+ # so it never performs the attachment the author wrote it for.
71
+ # Strip it: the macro renders as its block, and any intended
72
+ # continuation of the following text stays with the following
73
+ # text.
74
+ def normalise_glued_continuations(string)
75
+ strip = lambda do |line|
76
+ line.match?(GLUED_CONTINUATION_REGEXP) ? line[..-2] : line
77
+ end
78
+ string.split("\n").map(&strip).join("\n")
79
+ end
80
+
60
81
  # A lone `+` is asciidoctor's list-item continuation: it attaches
61
82
  # the next block only when the preceding line is a list item.
62
83
  # Authored after plain paragraphs (the corpus's `term - definition`
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.7.68".freeze
4
+ VERSION = "0.7.69".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.68
4
+ version: 0.7.69
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.