summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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")