Codebase list lua-ldoc / aad096d
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. Steve J Donovan 10 years ago
1 changed file(s) with 2 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
399399
400400 local upat = "http://www.kernel.org/doc/man-pages/online/pages/man%s/%s.%s.html"
401401
402 custom_see_handler('^(%a+)%((%d)%)$',function(name,section)
402 custom_see_handler('^([%w_]+)%((%d)%)$',function(name,section)
403403 local url = upat:format(section,name,section)
404404 local name = name .. '(' ..section..')'
405405 return name, url
406406 end)
407407
408 '^(%a+)%((%d)%)$' both matches the pattern and extracts the name and its section. Then it's
408 '^([%w_]+)%((%d)%)$' both matches the pattern and extracts the name and its section. Then it's
409409 a simple matter of building up the appropriate URL. The function is expected to
410410 return _link text_ and _link source_ and the patterns are checked before LDoc tries to resolve
411411 project references. So it is best to make them match as exactly as possible.