mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-20 06:37:59 +01:00
markup lexer
This commit is contained in:
parent
61def278b5
commit
9cfc426103
2 changed files with 33 additions and 9 deletions
|
@ -172,5 +172,36 @@ defmodule Textile.Lexer do
|
||||||
unbracketed_link
|
unbracketed_link
|
||||||
])
|
])
|
||||||
|
|
||||||
defparsec :link, link
|
|
||||||
|
# Textile
|
||||||
|
|
||||||
|
|
||||||
|
{markup_start, markup_element} = markup_ending_in(eos())
|
||||||
|
|
||||||
|
textile_main =
|
||||||
|
choice([
|
||||||
|
bracketed_literal,
|
||||||
|
blockquote_open_cite,
|
||||||
|
blockquote_open,
|
||||||
|
blockquote_close,
|
||||||
|
spoiler_open,
|
||||||
|
spoiler_close,
|
||||||
|
link,
|
||||||
|
image,
|
||||||
|
markup_element
|
||||||
|
])
|
||||||
|
|
||||||
|
textile_start =
|
||||||
|
choice([
|
||||||
|
textile_main,
|
||||||
|
markup_start
|
||||||
|
])
|
||||||
|
|
||||||
|
textile =
|
||||||
|
optional(textile_start)
|
||||||
|
|> repeat(textile_main)
|
||||||
|
|> eos()
|
||||||
|
|
||||||
|
|
||||||
|
defparsec :lex, textile
|
||||||
end
|
end
|
|
@ -133,14 +133,6 @@ defmodule Textile.MarkupLexer do
|
||||||
sub_close
|
sub_close
|
||||||
])
|
])
|
||||||
|
|
||||||
markup_tags =
|
|
||||||
choice([
|
|
||||||
bracketed_markup_opening_tags,
|
|
||||||
bracketed_markup_closing_tags,
|
|
||||||
markup_opening_tags,
|
|
||||||
markup_closing_tags
|
|
||||||
])
|
|
||||||
|
|
||||||
markup_at_start =
|
markup_at_start =
|
||||||
choice([
|
choice([
|
||||||
markup_opening_tags,
|
markup_opening_tags,
|
||||||
|
@ -150,6 +142,7 @@ defmodule Textile.MarkupLexer do
|
||||||
markup_element =
|
markup_element =
|
||||||
lookahead_not(ending_sequence)
|
lookahead_not(ending_sequence)
|
||||||
|> choice([
|
|> choice([
|
||||||
|
literal,
|
||||||
bracketed_markup_closing_tags,
|
bracketed_markup_closing_tags,
|
||||||
bracketed_markup_opening_tags |> lookahead_not(space()),
|
bracketed_markup_opening_tags |> lookahead_not(space()),
|
||||||
special_characters() |> concat(markup_opening_tags),
|
special_characters() |> concat(markup_opening_tags),
|
||||||
|
|
Loading…
Reference in a new issue