From e58224b3f63188bfb6919e320d193a29fcd586fb Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 4 Sep 2010 15:44:46 +0200 Subject: extended punctuation --- rst_parser.lua | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/rst_parser.lua b/rst_parser.lua index c489849..99265bd 100644 --- a/rst_parser.lua +++ b/rst_parser.lua @@ -581,7 +581,8 @@ local parser = P{ -- Paragraphs * Inline Markup -------------------------------------------------------------------------------- - paragraph = -(V"double_dot" + V"double_underscore") -- + V"bullet_indent") + --paragraph = -(V"double_dot" + V"double_underscore") -- + V"bullet_indent") + paragraph = -V"punctuation" * Cs((V"included_literal_block" + V"enclosed_inline" + V"inline_elements" @@ -752,22 +753,63 @@ local parser = P{ groupchars = S"()[]{}", + --- Punctuation + -- Some of the following are used for markup as well as for punctuation. + comma = P",", colon = P":", double_colon = V"colon" * V"colon", escaped_colon = V"backslash" * V"colon", dot = P".", + period = V"dot", double_dot = V"dot" * V"dot", - semicolon = P";", - questionmark = P"?", - exclamationmark = P"!", - punctuation = V"comma" + V"colon" + V"dot" + V"semicolon" + - V"questionmark" + V"exclamationmark",--+ V"dash", - + interpunct = P"·", underscore = P"_", double_underscore = V"underscore" * V"underscore", dash = P"-", double_dash = V"dash" * V"dash", + dashes = V"dash" + P"‒" + P"–" + P"—" + P"―", + hyphen = P"‐", + semicolon = P";", + questionmark = P"?", + exclamationmark = P"!", + inverted_exclamationmark = P"¡", + inverted_questionmark = P"¿", + interrobang = P"‽", + + apostrophe = P"’" + P"'", + --brackets = P"[ ], (",, { }, ⟨ ⟩ ) + ellipsis = P"…" + P"...", + guillemets = P"«" + P"»", + quotationmarks= P"‘" + P"’" + P"“" + P"”", + solidus= P"⁄", + + + punctuation = V"apostrophe" + + V"colon" + + V"comma" + + V"dashes" + + V"dot" + + V"ellipsis" + + V"exclamationmark" + + V"guillemets" + + V"hyphen" + + V"interpunct" + + V"interrobang" + + V"questionmark" + + V"quotationmarks" + + V"semicolon" + + V"slash" + + V"solidus" + + V"underscore" + , + + -- These are treated separately as the might begin a paragraph (sigh!). + inverted_punctuation = V"inverted_exclamationmark" + + V"inverted_questionmark", + + -- End punctuation + letter = R"az" + R"AZ", equals = P"=", -- cgit v1.2.3