handle adjacent markup rules correctly

This commit is contained in:
byte[] 2019-11-30 11:59:51 -05:00
parent 84bba9062b
commit e24c3e812f
2 changed files with 13 additions and 7 deletions

View file

@ -192,16 +192,22 @@ defmodule Textile.Lexer do
# Textile
markup_ends =
choice([
spoiler_close,
blockquote_close,
eos()
])
{markup_start, markup_element} = markup_ending_in(eos())
{markup_start, markup_element} = markup_ending_in(markup_ends)
textile_default =
choice([
bracketed_literal,
blockquote_open_cite,
blockquote_open,
blockquote_open_cite |> optional(markup_start),
blockquote_open |> optional(markup_start),
blockquote_close,
spoiler_open,
spoiler_open |> optional(markup_start),
spoiler_close,
link,
image

View file

@ -149,7 +149,7 @@ defmodule Textile.MarkupLexer do
markup_at_start =
choice([
markup_opening_tags,
times(markup_opening_tags, min: 1),
bracketed_markup_opening_tags
])
@ -159,8 +159,8 @@ defmodule Textile.MarkupLexer do
literal,
bracketed_markup_closing_tags,
bracketed_markup_opening_tags |> lookahead_not(space()),
preceding_whitespace |> concat(markup_opening_tags),
markup_closing_tags |> lookahead(choice([special_characters(), ending_sequence])),
preceding_whitespace |> times(markup_opening_tags, min: 1),
times(markup_closing_tags, min: 1) |> lookahead(choice([special_characters(), ending_sequence])),
double_newline,
newline,
utf8_char([])