summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-09-14 01:18:50 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-09-14 01:18:50 +0200
commit1fa5b90dbad108fdd8fa2a80fef4214c3183ec84 (patch)
treea3e8e30af773569e958fc43a339c9aac28c03ef1
parent2a44ddb4c5572451436ea59d702c507cf5de4739 (diff)
downloadcontext-rst-1fa5b90dbad108fdd8fa2a80fef4214c3183ec84.tar.gz
references: minor fixes
-rw-r--r--rst_context.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/rst_context.lua b/rst_context.lua
index 5bd16bd..35ef40c 100644
--- a/rst_context.lua
+++ b/rst_context.lua
@@ -147,7 +147,7 @@ function rst_context.link_standalone (str)
end
function rst_context.reference (str)
- str = str:match("[^_]*")
+ str = str:match("^`?([^`]+)`?_$") -- LPEG could render this gibberish legible but not time
local link = rst_context.collected_references[str] or rst_context.context_references[str]
if not link then -- assume internal
return [[\\goto{]] .. str .. [[}[__target_]] .. str .. "]"
@@ -213,11 +213,11 @@ local inline_parser = P{
inline_element = Cs((V"strong_emphasis"
+ + V"reference"
+ V"emphasis"
+ V"inline_literal"
+ V"interpreted_text"
-- + V"inline_internal_target" -- TODO
- + V"reference"
+ V"footnote_reference"
-- + V"substitution_reference" -- TODO
+ V"link_standalone")
@@ -336,10 +336,15 @@ local inline_parser = P{
link_standalone = C(V"uri")
/ rst_context.link_standalone,
- reference = Cs(V"_reference")
+ reference = Cs(V"normal_reference" + V"phrase_reference")
/ rst_context.reference,
- _reference = (1 - V"underscore" - V"spacing" - V"eol" - V"punctuation" - V"groupchars")^1 * V"underscore",
+ normal_reference = (1 - V"underscore" - V"spacing" - V"eol" - V"punctuation" - V"groupchars")^1 * V"underscore",
+
+ phrase_reference = (V"bareia" - V"double_bareia")
+ * C((1 - V"bareia")^1)
+ * V"bareia" * V"underscore"
+ ,
footnote_reference = V"lsquare"
* Cs(V"footnote_label" + V"citation_reference_label")