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 # 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 = textile_default =
choice([ choice([
bracketed_literal, bracketed_literal,
blockquote_open_cite, blockquote_open_cite |> optional(markup_start),
blockquote_open, blockquote_open |> optional(markup_start),
blockquote_close, blockquote_close,
spoiler_open, spoiler_open |> optional(markup_start),
spoiler_close, spoiler_close,
link, link,
image image

View file

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