summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-09-04 15:44:46 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-09-04 15:44:46 +0200
commite58224b3f63188bfb6919e320d193a29fcd586fb (patch)
tree9db7197d90395ea5d07b0702380657ae0a98255c
parent97647fd120edfe0c226ac8b51f12e19a1a325535 (diff)
downloadcontext-rst-e58224b3f63188bfb6919e320d193a29fcd586fb.tar.gz
extended punctuation
-rw-r--r--rst_parser.lua56
1 files 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"=",