Merge pull request #129 from gvvaughan/pull-request/custom_see_hander-doc-fix

doc: improve match pattern for manual page references with custom_see_handler.
This commit is contained in:
Steve J Donovan 2014-01-05 05:05:07 -08:00
commit aad096dced
1 changed files with 2 additions and 2 deletions

View File

@ -400,13 +400,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" 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 url = upat:format(section,name,section)
local name = name .. '(' ..section..')' local name = name .. '(' ..section..')'
return name, url return name, url
end) 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 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 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. project references. So it is best to make them match as exactly as possible.