From d5e623e8d73d927af7aad0590f2af67a7e6a9abe Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Thu, 12 Dec 2013 09:42:44 +1300 Subject: [PATCH] doc: improve match pattern for manual page references with custom_see_handler. * doc/doc.md: Use '[%w_]+' instead of '%a+' so that references to, say, _exit(2) and dup2(2) work too. Signed-off-by: Gary V. Vaughan --- doc/doc.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/doc.md b/doc/doc.md index 3248c2e..9bfc50a 100644 --- a/doc/doc.md +++ b/doc/doc.md @@ -328,13 +328,13 @@ online references to the Linux manpages. So in `config.ld` we have: local upat = "http://www.kernel.org/doc/man-pages/online/pages/man%s/%s.%s.html" - custom_see_handler('^(%a+)%((%d)%)$',function(name,section) + custom_see_handler('^([%w_]+)%((%d)%)$',function(name,section) local url = upat:format(section,name,section) local name = name .. '(' ..section..')' return name, url end) -'^(%a+)%((%d)%)$' both matches the pattern and extracts the name and its section. Then it's +'^([%w_]+)%((%d)%)$' both matches the pattern and extracts the name and its section. Then it's a simple matter of building up the appropriate URL. The function is expected to return _link text_ and _link source_ and the patterns are checked before LDoc tries to resolve project references. So it is best to make them match as exactly as possible.