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 <gary@gnu.org>
Gary V. Vaughan
10 years ago
327 | 327 | |
328 | 328 | local upat = "http://www.kernel.org/doc/man-pages/online/pages/man%s/%s.%s.html" |
329 | 329 | |
330 | custom_see_handler('^(%a+)%((%d)%)$',function(name,section) | |
330 | custom_see_handler('^([%w_]+)%((%d)%)$',function(name,section) | |
331 | 331 | local url = upat:format(section,name,section) |
332 | 332 | local name = name .. '(' ..section..')' |
333 | 333 | return name, url |
334 | 334 | end) |
335 | 335 | |
336 | '^(%a+)%((%d)%)$' both matches the pattern and extracts the name and its section. Then it's | |
336 | '^([%w_]+)%((%d)%)$' both matches the pattern and extracts the name and its section. Then it's | |
337 | 337 | a simple matter of building up the appropriate URL. The function is expected to |
338 | 338 | return _link text_ and _link source_ and the patterns are checked before LDoc tries to resolve |
339 | 339 | project references. So it is best to make them match as exactly as possible. |