general cleanup

This commit is contained in:
Felix Van der Jeugt 2024-07-24 08:35:41 +02:00
parent ffced8fca4
commit 3ffb35cc2e
No known key found for this signature in database
GPG key ID: 58B209295023754D
25 changed files with 149 additions and 120 deletions

View file

@ -40,25 +40,25 @@ local hr = token('hr', lpeg.Cmt(l.starts_line(S(' \t')^0 * lpeg.C(S('*-_'))),
end))
-- Span elements.
local dq_str = token(l.STRING, l.delimited_range('"', false, true))
local sq_str = token(l.STRING, l.delimited_range("'", false, true))
local paren_str = token(l.STRING, l.delimited_range('()'))
local link = token('link', P('!')^-1 * l.delimited_range('[]') *
local dq_str = token(l.STRING, l.range('"', false, true))
local sq_str = token(l.STRING, l.range("'", false, true))
local paren_str = token(l.STRING, l.range('()'))
local link = token('link', P('!')^-1 * l.range('[]') *
(P('(') * (l.any - S(') \t'))^0 *
(S(' \t')^1 *
l.delimited_range('"', false, true))^-1 * ')' +
S(' \t')^0 * l.delimited_range('[]')) +
l.range('"', false, true))^-1 * ')' +
S(' \t')^0 * l.range('[]')) +
P('http://') * (l.any - l.space)^1)
local link_label = token('link_label', l.delimited_range('[]') * ':') * ws *
local link_label = token('link_label', l.range('[]') * ':') * ws *
token('link_url', (l.any - l.space)^1) *
(ws * (dq_str + sq_str + paren_str))^-1
local strong = token('strong', (P('**') * (l.any - '**')^0 * P('**')^-1) +
(P('__') * (l.any - '__')^0 * P('__')^-1))
local em = token('em',
l.delimited_range('*', true) + l.delimited_range('_', true))
l.range('*', true) + l.range('_', true))
local code = token('code', (P('``') * (l.any - '``')^0 * P('``')^-1) +
l.delimited_range('`', true, true))
l.range('`', true, true))
local escape = token(l.DEFAULT, P('\\') * 1)