[PATCH 0/3] Add links to man pages
- From: Rupert Swarbrick <rswarbrick gmail com>
- To: gnome-doc-devel-list gnome org
- Subject: [PATCH 0/3] Add links to man pages
- Date: Wed, 22 Dec 2010 00:19:14 +0000
The first patch is sort of unrelated, but I wanted to work with the
warnings quieted!
Then the second patch is the massive one. It works by adding a
post-processing step. After we've chopped everything nicely into
<sheet>s containing <span>s, it goes through each sheet looking for
something matching the regex. When we get a hit, we work out the
correct url and then defer to the difficult function:
do_node_replacement, which does all the work. I can't work out a way
to factor that function differently to make it clearer what's going
on: the repetition is sort of on purpose!
Finally, the last patch uses the framework from above to add support
for a different type of link (http://) urls, which turned out to be
really easy. Yay!
There are some problems with this approach. Firstly, the code doesn't
currently deal with linebreaks. One could do so, but I thought that
was something to put in after the fact (getting rid of all the pesky
nbsps and doing indentation "properly" would probably make this easier
too).
The second problem is that we decorate some links that we
shouldn't. For example in the manpage for man(1), we decorate a list
of preprocessors listed under the "-p" argument. I'm not sure how to
distinguish these from "real" links (programmatically or no!). I can
see three possibilities:
(1) Meh. Ignore the problem.
(2) Check something I missed with the formatting. I don't *think* the
information's there, but maybe I'm being stupid. Note that not all
correct links follow the bold(regular) formatting.
(3) Check that the section seems plausible. This might be difficult:
how do we know what sections are installed?
(4) Check (using "man -w"?) whether a page is installed before
linkifying.
I like the last option best, but not sure about the performance
cost. Comments?
Rupert Swarbrick (3):
Fix some compiler warnings.
Make links from strings of the form "blah(2)" in man pages.
Add support for http:// urls.
libyelp/yelp-man-parser.c | 379 +++++++++++++++++++++++++++++++++++++++++--
stylesheets/man2html.xsl.in | 12 ++-
2 files changed, 377 insertions(+), 14 deletions(-)
--
1.7.2.3
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]