From 80e2e1e1127fcb47f85a3fd19d32b3f2e4c4bca2 Mon Sep 17 00:00:00 2001 From: steve donovan Date: Sun, 21 Aug 2011 17:25:28 +0200 Subject: [PATCH] lorenzo's suggestion; may optionally provide text for the reference link using a colon --- ldoc/markup.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ldoc/markup.lua b/ldoc/markup.lua index 61421b4..abade26 100644 --- a/ldoc/markup.lua +++ b/ldoc/markup.lua @@ -76,7 +76,11 @@ function markup.add_sections(F, txt) end local function handle_reference (ldoc, name) - local ref,err = markup.process_reference(name) + local qname,label = utils.splitv(name,':') + if not qname then + qname = name + end + local ref,err = markup.process_reference(qname) if not ref then if ldoc.item then ldoc.item:warning(err) else @@ -84,7 +88,9 @@ local function handle_reference (ldoc, name) end return '' end - local label = ref.label + if not label then + label = ref.label + end if not ldoc.plain then -- a nastiness with markdown.lua and underscores label = label:gsub('_','\\_') end @@ -96,7 +102,7 @@ local ldoc_handle_reference -- inline use same lookup as @see local function resolve_inline_references (ldoc, txt) - return (txt:gsub('@{([%w_%.%-]-)}',ldoc_handle_reference)) + return (txt:gsub('@{([^}]-)}',ldoc_handle_reference)) end function markup.create (ldoc, format)