more compatibility fixes
This commit is contained in:
parent
0c7be01e11
commit
4d4d8cfc4c
|
@ -1016,7 +1016,7 @@ module PointBlank
|
|||
# @param before [String, ::PointBlank::DOM::DOMObject]
|
||||
# @param after [String, ::PointBlank::DOM::DOMObject]
|
||||
# @return [Array<Array(String, Class, Symbol), String>]
|
||||
def self.tokenize(string, before, after)
|
||||
def self.tokenize(string, _before, _after)
|
||||
[string]
|
||||
end
|
||||
|
||||
|
@ -1145,17 +1145,10 @@ module PointBlank
|
|||
class CodeInline < NullInline
|
||||
# (see ::PointBlank::Parsing::NullInline#tokenize)
|
||||
def self.tokenize(string, *_lookaround)
|
||||
open = {}
|
||||
iterate_tokens(string, "`") do |_before, current_text, matched|
|
||||
if matched
|
||||
match = current_text.match(/^`+/)[0]
|
||||
if open[match]
|
||||
open[match] = nil
|
||||
[match, self, :close]
|
||||
else
|
||||
open[match] = true
|
||||
[match, self, :open]
|
||||
end
|
||||
[match, self, :open]
|
||||
else
|
||||
current_text[0]
|
||||
end
|
||||
|
@ -1172,9 +1165,9 @@ module PointBlank
|
|||
text = (part.is_a?(Array) ? part.first : part)
|
||||
buffer += text
|
||||
next unless part.is_a? Array
|
||||
next if idx.zero?
|
||||
|
||||
break (cutoff = idx) if part.first == opening &&
|
||||
part.last == :close
|
||||
break (cutoff = idx) if part.first == opening
|
||||
end
|
||||
buffer = construct_literal(buffer[opening.length..(-1 - opening.length)])
|
||||
[cutoff.positive? ? build([buffer]) : opening, parts[(cutoff + 1)..]]
|
||||
|
@ -1345,7 +1338,11 @@ module PointBlank
|
|||
when String
|
||||
bfr[-1]
|
||||
when ::PointBlank::DOM::DOMObject
|
||||
"."
|
||||
if bfr.is_a?(::PointBlank::DOM::Text)
|
||||
bfr.content[-1]
|
||||
else
|
||||
extract_left(bfr.children.last)
|
||||
end
|
||||
when Array
|
||||
bfr.first[-1]
|
||||
end
|
||||
|
@ -1359,7 +1356,11 @@ module PointBlank
|
|||
when String
|
||||
afr[0]
|
||||
when ::PointBlank::DOM::DOMObject
|
||||
"."
|
||||
if afr.is_a?(::PointBlank::DOM::Text)
|
||||
afr.content[0]
|
||||
else
|
||||
extract_left(afr.children.first)
|
||||
end
|
||||
when Array
|
||||
afr.first[0]
|
||||
end
|
||||
|
@ -1428,8 +1429,9 @@ module PointBlank
|
|||
((blk.first.length % 3).zero? &&
|
||||
(closer.first.length % 3).zero?))
|
||||
(open ? capture : before).prepend(blk)
|
||||
next unless blk.is_a?(Array)
|
||||
return backlog unless blk[1].check_contents(capture)
|
||||
next unless blk.is_a?(Array) && !open
|
||||
|
||||
return backlog unless closer[1].check_contents(capture)
|
||||
end
|
||||
return backlog if open
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "mmmd"
|
||||
spec.version = "0.1.1"
|
||||
spec.version = "0.1.2"
|
||||
spec.summary = "Modular, compliant Markdown processor"
|
||||
spec.description = <<~DESC
|
||||
MMMD (short for Mark My Manuscript Down) is a Markdown processor
|
||||
|
|
Loading…
Reference in New Issue