coradoc-adoc 2.0.6 → 2.0.7

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: bfa6580ceec41f023bc49501abcd731a8ce2bbe25fb381a083b6595a4ccd7c1e
4
- data.tar.gz: 0fa0c15adc1ed488f4fc0913cc8342551896025065cf543ef2307de95947fa1a
3
+ metadata.gz: a29195095ab66adca7be3bdfcb331f71fdd69954c09ea3fc0cef33c4583b8d8c
4
+ data.tar.gz: 805db091f5043a01ce0b4ff1501c009814c4fdd079ca402a0232b2e3abf073dd
5
5
  SHA512:
6
- metadata.gz: e9276729c16a8084735f487d8faaadc9d64ac81781214c41ff8808bd771eeddfc5d22e726b1fc09add738b3771fcf1902249879fbc91f203d6918f2a42b5509e
7
- data.tar.gz: 07735c28d0a67001c6791420c22558e4a711a08857fe20fe33eade7c3d6f5284a67c6bbc3d3473614e401324dd150abe76aa618150837b0df81967134535ec94
6
+ metadata.gz: a306bb17db95c5732e1a7e76f101c45a00363c356ebdc0b3d699961caa1a82c6ce2be1f69c531922cb83f53eb49c58735ca814e14a0559a431ee8c9a5ed56a00
7
+ data.tar.gz: 42c724be473f6bbdd0b9db339b0ac5a02590fa760f74178088536226380994ef52a812bb7730038e5fe66e25ad888a03b0a4b38c993dbdb5748a4f56e00923df
@@ -108,28 +108,23 @@ module Coradoc
108
108
  rule(
109
109
  definition_list_item: subtree(:item_data)
110
110
  ) do
111
- terms_data = item_data[:terms]
112
- definition = item_data[:definition]
111
+ data = item_data.is_a?(Hash) ? item_data : { terms: Array(item_data), definition: '' }
113
112
 
114
- # Extract terms and optional id from structured dlist_term output
115
113
  item_id = nil
116
- terms = if terms_data.is_a?(Array)
117
- terms_data.map do |t|
118
- if t.is_a?(Hash)
119
- item_id ||= t[:id].to_s if t[:id]
120
- t[:text].to_s
121
- else
122
- t.to_s
123
- end
124
- end
125
- else
126
- [terms_data.to_s]
127
- end
128
-
129
- # Extract definition
130
- contents = definition.to_s
131
-
132
- Model::List::DefinitionItem.new(terms: terms, contents: contents, id: item_id)
114
+ terms_data = data[:terms]
115
+ definition = data[:definition].to_s
116
+
117
+ terms = Array(terms_data).map do |t|
118
+ case t
119
+ when Hash
120
+ item_id ||= t[:id].to_s if t[:id]
121
+ t[:text].to_s
122
+ else
123
+ t.to_s
124
+ end
125
+ end
126
+
127
+ Model::List::DefinitionItem.new(terms: terms, contents: definition, id: item_id)
133
128
  end
134
129
 
135
130
  rule(definition_list: sequence(:list_items)) do
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Coradoc
4
4
  module AsciiDoc
5
- VERSION = '2.0.6'
5
+ VERSION = '2.0.7'
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.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.