coradoc-adoc 2.0.32 → 2.0.33
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70861dce3318bead6c8153bfa44090dc2da49a1f9889cb517dcdb559a4eaeb9c
|
|
4
|
+
data.tar.gz: 94b397c634354792bb99678f71d3fc15221cb1f7feb42894d514e96c644f47f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f2283331458aaae5a07cd9f135aa3e8e2a6b09f9e7df12336233dd43313c2dc4775e988ef49ef23428a131019fb00c3feaaf0127b9f7521e222fc460c12b5c83
|
|
7
|
+
data.tar.gz: 7c0cc22f6919a661e4d17adf687611ae7c2194bd4bf3dd7184ba073bc44e7e38ab716e20764affab27d97b7536f4caac02151ad170dde5c531871588ea7f643f
|
|
@@ -17,21 +17,56 @@ module Coradoc
|
|
|
17
17
|
line_start? >> str("+\n")
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# Single source of truth for "what can appear between consecutive
|
|
21
|
+
# list items without ending the list". Asciidoctor treats blank
|
|
22
|
+
# lines and `//` comment lines as non-terminating inside every
|
|
23
|
+
# list type. Comments are consumed without capture — they are
|
|
24
|
+
# structurally invisible inside a list (no CommentLine node is
|
|
25
|
+
# emitted). Tag directives (`// tag::`) keep their separate
|
|
26
|
+
# handling via `comment_line_content`'s `tag.absent?` guard.
|
|
27
|
+
def list_item_separator
|
|
28
|
+
(comment_line_content | empty_line).repeat(0)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Single source of truth for "what block can attach to a list
|
|
32
|
+
# item via a `+` continuation marker". The `+` line is consumed
|
|
33
|
+
# by {#list_item_attached}; this rule expresses only the block
|
|
34
|
+
# that follows. Definition lists are intentionally excluded —
|
|
35
|
+
# `+` before a continuing dlist run is handled inside
|
|
36
|
+
# `dlist_item` as a continuation marker so the run nests by
|
|
37
|
+
# delimiter depth (see there).
|
|
38
|
+
def list_attached_block
|
|
39
|
+
admonition_line | unordered_list(1) | ordered_list(1) | paragraph | block
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Shared `+`-continuation attachment for every list item type
|
|
43
|
+
# (ulist, olist, dlist). A `+` line directly followed by an
|
|
44
|
+
# attached block becomes a child of the current item. The
|
|
45
|
+
# `list_continuation.present?` lookahead prevents greedy
|
|
46
|
+
# over-match when the `+` actually belongs to surrounding
|
|
47
|
+
# context.
|
|
48
|
+
def list_item_attached
|
|
49
|
+
(list_continuation.present? >>
|
|
50
|
+
list_continuation >>
|
|
51
|
+
list_attached_block
|
|
52
|
+
).repeat(0).as(:attached)
|
|
53
|
+
end
|
|
54
|
+
|
|
20
55
|
def ordered_list(nesting_level = 1)
|
|
21
56
|
attrs = (attribute_list >> newline).maybe
|
|
22
57
|
r = olist_item(nesting_level)
|
|
23
|
-
attrs >> (
|
|
58
|
+
attrs >> (list_item_separator >> r).repeat(1).as(:ordered)
|
|
24
59
|
end
|
|
25
60
|
|
|
26
61
|
def unordered_list(nesting_level = 1)
|
|
27
62
|
attrs = (attribute_list >> newline).maybe
|
|
28
63
|
r = ulist_item(nesting_level)
|
|
29
|
-
attrs >> (
|
|
64
|
+
attrs >> (list_item_separator >> r).repeat(1).as(:unordered)
|
|
30
65
|
end
|
|
31
66
|
|
|
32
67
|
def definition_list(_delimiter = nil)
|
|
33
68
|
(attribute_list >> newline).maybe >>
|
|
34
|
-
dlist_item.repeat(1).as(:definition_list) >>
|
|
69
|
+
(list_item_separator >> dlist_item).repeat(1).as(:definition_list) >>
|
|
35
70
|
dlist_item.absent?
|
|
36
71
|
end
|
|
37
72
|
|
|
@@ -56,11 +91,7 @@ module Coradoc
|
|
|
56
91
|
(list_body_text_line >>
|
|
57
92
|
list_item_continuation_lines).as(:lines)
|
|
58
93
|
|
|
59
|
-
|
|
60
|
-
list_continuation >>
|
|
61
|
-
(admonition_line | paragraph | block)
|
|
62
|
-
).repeat(0).as(:attached)
|
|
63
|
-
item >>= att.maybe
|
|
94
|
+
item >>= list_item_attached.maybe
|
|
64
95
|
|
|
65
96
|
if nesting_level <= 4
|
|
66
97
|
item >>= (list_marker(nesting_level + 1).present? >>
|
|
@@ -108,11 +139,7 @@ module Coradoc
|
|
|
108
139
|
(list_body_text_line >>
|
|
109
140
|
list_item_continuation_lines).as(:lines)
|
|
110
141
|
|
|
111
|
-
|
|
112
|
-
list_continuation >>
|
|
113
|
-
(admonition_line | paragraph | block)
|
|
114
|
-
).repeat(0).as(:attached)
|
|
115
|
-
item >>= att.maybe
|
|
142
|
+
item >>= list_item_attached.maybe
|
|
116
143
|
|
|
117
144
|
if nesting_level <= 4
|
|
118
145
|
item >>= (list_marker(nesting_level + 1).present? >>
|
|
@@ -273,11 +300,14 @@ module Coradoc
|
|
|
273
300
|
|
|
274
301
|
item = multi_line | inline
|
|
275
302
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
303
|
+
item >>= list_item_attached.maybe
|
|
304
|
+
|
|
305
|
+
# A `+` line directly before a continuing dlist run is a
|
|
306
|
+
# list-continuation marker (asciidoctor semantics): consume it
|
|
307
|
+
# so the following items stay in the current list and nest by
|
|
308
|
+
# delimiter depth. Without this, the `+` dangles and the run
|
|
309
|
+
# splits off as a detached sibling list.
|
|
310
|
+
item >>= (list_continuation >> dlist_item.present?).repeat(0)
|
|
281
311
|
|
|
282
312
|
item.as(:definition_list_item)
|
|
283
313
|
end
|
|
@@ -121,6 +121,26 @@ module Coradoc
|
|
|
121
121
|
).as(:block_image)
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
+
# Non-capturing form of {#comment_line}. Same shape (a `//`
|
|
125
|
+
# comment line, excluding tag directives like `// tag::`), but
|
|
126
|
+
# consumes without producing an AST node.
|
|
127
|
+
#
|
|
128
|
+
# Used by list rules to absorb inter-item comments so the list
|
|
129
|
+
# continues across them — asciidoctor treats `//` comments inside
|
|
130
|
+
# any list as structurally invisible. Uses raw character matchers
|
|
131
|
+
# instead of `text` so no inner captures leak into the consuming
|
|
132
|
+
# rule's AST.
|
|
133
|
+
#
|
|
134
|
+
# Single source of truth for the comment-line shape: any future
|
|
135
|
+
# adjustment to the `//`-line grammar happens here and both the
|
|
136
|
+
# capturing and non-capturing forms stay in sync.
|
|
137
|
+
def comment_line_content
|
|
138
|
+
tag.absent? >>
|
|
139
|
+
str('//') >> str('/').absent? >>
|
|
140
|
+
space? >>
|
|
141
|
+
match('[^\n]').repeat(0) >> line_ending
|
|
142
|
+
end
|
|
143
|
+
|
|
124
144
|
def comment_line
|
|
125
145
|
tag.absent? >>
|
|
126
146
|
(str('//') >> str('/').absent? >>
|
|
@@ -114,14 +114,17 @@ module Coradoc
|
|
|
114
114
|
|
|
115
115
|
def transform_list_item(item)
|
|
116
116
|
content_val = item.content
|
|
117
|
-
|
|
117
|
+
inline_children = ToCoreModel.transform_inline_content(content_val)
|
|
118
|
+
attached_children = Array(item.attached).filter_map do |block|
|
|
119
|
+
ToCoreModel.transform(block)
|
|
120
|
+
end
|
|
118
121
|
|
|
119
122
|
li = Coradoc::CoreModel::ListItem.new(
|
|
120
123
|
content: ToCoreModel.extract_text_content(content_val),
|
|
121
124
|
marker: item.marker,
|
|
122
125
|
source_line: item.source_line
|
|
123
126
|
)
|
|
124
|
-
li.children =
|
|
127
|
+
li.children = inline_children + attached_children
|
|
125
128
|
|
|
126
129
|
nested_lists = extract_nested_lists(item)
|
|
127
130
|
li.nested_list = nested_lists.first if nested_lists.size == 1
|