coradoc-markdown 1.0.12 → 1.0.13
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: feafcf577e982d93fb6b35e8b86e34e4a06dafd717795b64190c4b985dfda324
|
|
4
|
+
data.tar.gz: 688522bf2b9e66ff90687b55454a6d42e1d0ae98e7257b120bb8ce276f011f4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0a84b293daaa0174dadfe91f6bc4f98505e228ea9ab44f3e743ac5eb774140d3a5ddb35c1387fc21168c2427916553e97531427c8484836c04fae7c09d79e35
|
|
7
|
+
data.tar.gz: 64ea0f231ae44a667d0ec77a7e918b25f1b6b5d03dbdbd9200c1b5e6eba1fde81afe22966aec9b2c70471c644a032f11c3d4c9ce3d22a9bf9dfe4367e2bfb139
|
|
@@ -7,6 +7,15 @@ module Coradoc
|
|
|
7
7
|
require_relative 'parsanol_atoms'
|
|
8
8
|
|
|
9
9
|
class BlockParser < Parsanol::Parser
|
|
10
|
+
# The Ruby engine is the required surface for this grammar.
|
|
11
|
+
# The native VM's shadowed-alternative lint rejects our
|
|
12
|
+
# continuation patterns (zero-width lookaheads on dynamic blocks
|
|
13
|
+
# used as guards inside alternations). File: parsanol-ruby#93.
|
|
14
|
+
def parse(input, mode_or_opts = {}, **kwargs)
|
|
15
|
+
opts = mode_or_opts.is_a?(Hash) ? mode_or_opts.merge(kwargs) : {}
|
|
16
|
+
super(input, **opts, mode: opts.fetch(:mode, :ruby))
|
|
17
|
+
end
|
|
18
|
+
|
|
10
19
|
# NOTE: Debug method for parser development. Outputs current parse position
|
|
11
20
|
# and capture context. Only called during parser debugging sessions.
|
|
12
21
|
def debug(msg)
|
|
@@ -63,7 +72,7 @@ module Coradoc
|
|
|
63
72
|
cont_rule
|
|
64
73
|
end
|
|
65
74
|
caps[:block] = kind
|
|
66
|
-
|
|
75
|
+
str('')
|
|
67
76
|
end
|
|
68
77
|
end
|
|
69
78
|
|
|
@@ -71,7 +80,8 @@ module Coradoc
|
|
|
71
80
|
whitespace.repeat(1) >>
|
|
72
81
|
str('#').repeat >>
|
|
73
82
|
whitespace.repeat >>
|
|
74
|
-
|
|
83
|
+
# zero-width "at line end or EOF" — negative lookahead
|
|
84
|
+
match('[^\n\r]').absent?
|
|
75
85
|
end
|
|
76
86
|
|
|
77
87
|
# Escaped hash - not a heading
|
|
@@ -174,8 +184,13 @@ module Coradoc
|
|
|
174
184
|
consume_fenced_indent >>
|
|
175
185
|
(line_verbatim | blank_line_verbatim.output(ln: ''))
|
|
176
186
|
).repeat.as(:code_block) >>
|
|
187
|
+
# tail: close the fence inside a continuation, or assert
|
|
188
|
+
# "not in a continuation with more input" — the former
|
|
189
|
+
# continuation.absent? | any.absent? chain put zero-width
|
|
190
|
+
# branches in non-last slots (shadowed-alternative lint,
|
|
191
|
+
# parsanol 1.3.55+); (A >> any).absent? == A.absent? | any.absent?
|
|
177
192
|
(
|
|
178
|
-
(continuation >> code_fence_close) | continuation
|
|
193
|
+
(continuation >> code_fence_close) | (continuation >> any).absent?
|
|
179
194
|
)
|
|
180
195
|
end
|
|
181
196
|
|
|
@@ -9,7 +9,6 @@ module Coradoc
|
|
|
9
9
|
autoload :HtmlEntities, "#{__dir__}/html_entities"
|
|
10
10
|
|
|
11
11
|
class InlineParser < Parsanol::Parser
|
|
12
|
-
|
|
13
12
|
rule(:line_ending) { (str("\n") | str("\r\n") | str("\r")).ignore }
|
|
14
13
|
rule(:line_ending_or_eof) { line_ending | any.absent? }
|
|
15
14
|
rule(:whitespace) { match[" \t"] }
|
|
@@ -79,16 +78,16 @@ module Coradoc
|
|
|
79
78
|
rule(:both_flanking_delimiter_run) do
|
|
80
79
|
any.precedes? >>
|
|
81
80
|
unicode_whitespace.does_not_precede? >> (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
(
|
|
82
|
+
unicode_punctuation.precedes? >>
|
|
83
|
+
delimiter_run.as(:bfdr) >>
|
|
84
|
+
unicode_punctuation.present?
|
|
85
|
+
) | (
|
|
86
|
+
unicode_punctuation.does_not_precede? >>
|
|
87
|
+
delimiter_run.as(:bfdr) >>
|
|
88
|
+
unicode_punctuation.absent?
|
|
89
|
+
)
|
|
90
|
+
) >> unicode_whitespace.absent?
|
|
92
91
|
end
|
|
93
92
|
|
|
94
93
|
rule(:left_flanking_delimiter_run) do
|
|
@@ -106,15 +105,15 @@ module Coradoc
|
|
|
106
105
|
rule(:right_flanking_delimiter_run) do
|
|
107
106
|
any.precedes? >>
|
|
108
107
|
unicode_whitespace.does_not_precede? >> (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
(
|
|
109
|
+
unicode_punctuation.precedes? >>
|
|
110
|
+
delimiter_run.as(:rfdr) >>
|
|
111
|
+
(unicode_whitespace | unicode_punctuation).present?
|
|
112
|
+
) | (
|
|
113
|
+
unicode_punctuation.does_not_precede? >>
|
|
114
|
+
delimiter_run.as(:rfdr)
|
|
115
|
+
)
|
|
116
116
|
)
|
|
117
|
-
)
|
|
118
117
|
end
|
|
119
118
|
|
|
120
119
|
rule(:non_flanking_delimiter_run) do
|