coradoc-adoc 2.0.11 → 2.0.12

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: 791dca3b794e199e6d856458c3399946545f54a26a98cc4e8aee07de8b7aa21f
4
- data.tar.gz: 6fd4f6457098075c4ad3f98238ab56c4eb5359271f2024e3b75b0caee3791372
3
+ metadata.gz: 8e7f028d984f0019578e97882169ce2be502e17fcfdeb376766f088d1af23958
4
+ data.tar.gz: 68533e4e500d008b4fc37f1beecc1fd160318adb6f9a6ed43fdf87a97ffedb31
5
5
  SHA512:
6
- metadata.gz: d8c7eb7672609651c3152ce468727f638cd5e9b5bd73b25b1334697710b8083391db13e9d6d030f97a288a7fe28e33567a2dd934b6a455c0e5279fe4fe183455
7
- data.tar.gz: 003e62344acf12212216306ad211330464866862dc5876d2caf7a4812c3c120a041b1da11d7ae83668b15e4a0c96a80e08984b9b7a3686de451fa548c444b0e0
6
+ metadata.gz: 6c386bcee2e9a2bc1f3e47f2fca189b92bb7ef568fdb5105c2b59da916a43cc27bf912699c92e850c4f782e3e7575c5472a42262cb57a8da63ba14a5d1de88a3
7
+ data.tar.gz: 45e2116e5532d41b0f76a855c12e51066d26b648b947f3b6a95f817c7772794d0af57ee1b57fb402e7579d9b620e2eb61d44c99962b1030d6de74319f27920ff
@@ -28,7 +28,13 @@ module Coradoc
28
28
  # admonition.content = "Be careful!"
29
29
  #
30
30
  class Admonition < Attached
31
- attribute :content, :string
31
+ attribute :content,
32
+ Lutaml::Model::Serializable,
33
+ collection: true,
34
+ polymorphic: [
35
+ Lutaml::Model::Type::String,
36
+ Coradoc::AsciiDoc::Model::TextElement
37
+ ]
32
38
  attribute :type, :string
33
39
  attribute :line_break, :string, default: -> { '' }
34
40
  end
@@ -36,9 +36,12 @@ module Coradoc
36
36
  # Coerce a raw parser AST value into the canonical ref_text string.
37
37
  # Accepts the shapes produced by Parser::Bibliography for `:ref_text`:
38
38
  # nil, Parslet::Slice, plain String, single Model::Base, or an Array
39
- # of any of these. Keeping this coercion on the model that owns
40
- # ref_text (rather than in a transformer rule) keeps the transformer
41
- # declarative and lets callers build entries from any source shape.
39
+ # of any of these. Model objects (TextElement, Inline::Italic, etc.)
40
+ # are flattened via TextExtractVisitor so their text content is
41
+ # preserved instead of leaking `#<Class:0x...>` inspect strings.
42
+ # Keeping this coercion on the model that owns ref_text (rather than
43
+ # in a transformer rule) keeps the transformer declarative and lets
44
+ # callers build entries from any source shape.
42
45
  # @param raw [Object, nil]
43
46
  # @return [String]
44
47
  def self.coerce_ref_text(raw)
@@ -47,6 +50,8 @@ module Coradoc
47
50
  case raw
48
51
  when Array then raw.map { |e| coerce_ref_text(e) }.join
49
52
  when String then raw
53
+ when Coradoc::AsciiDoc::Model::Base
54
+ Coradoc::AsciiDoc::Transform::TextExtractVisitor.new.extract(raw).to_s
50
55
  else raw.to_s
51
56
  end
52
57
  end
@@ -15,7 +15,7 @@ module Coradoc
15
15
 
16
16
  def admonition_line
17
17
  admonition_type.as(:admonition_type) >> str(': ') >>
18
- (text.as(:text) >>
18
+ (text_any.as(:text) >>
19
19
  line_ending.as(:line_break)
20
20
  ).repeat(1)
21
21
  .as(:content)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Coradoc
4
4
  module AsciiDoc
5
- VERSION = '2.0.11'
5
+ VERSION = '2.0.12'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coradoc-adoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.11
4
+ version: 2.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.