From 1fa5b90dbad108fdd8fa2a80fef4214c3183ec84 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 14 Sep 2010 01:18:50 +0200 Subject: references: minor fixes --- rst_context.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'rst_context.lua') 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") -- cgit v1.2.3