Use HTML a tags to allow external links to subsections of man pages

Bug #1355271 reported by Volker Siegel
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Ubuntu Manpage Repository
New
Undecided
Unassigned

Bug Description

It would be very useful if the Ubuntu online man pages in HTML would have section anchors.

For a detailed use case description, see this question:
http://askubuntu.com/questions/509799/online-man-pages-with-links-to-subsections

What is needed it to add an anchor tag <a> with a file-relative url to all kinds of headers,
 ideally including command and option names of the defining paragraphs.

As intuitive anchor names are central, I propose to use the item text without spaces,
and cleaned up preferring stripping chars over escaping.

For the section "Parameter Expansion", the derived anchor url would be
"#ParameterExpansion".

This method will lead to some fraction of duplicate anchor names, for example if the
cleaned-up form is the same for two distinct items.
I think that should be explicitly tollerated.
Ambiguous anchors are prety common in general HTML, the browser may decide which to use.

As an example, the HTML code of the header of section "Parameter Expansion" from
http://manpages.ubuntu.com/bash
which kind-of-redirects to
http://manpages.ubuntu.com/manpages/trusty/en/man1/bash.1.html
currently looks like this:

     [ ... ]
     tildes in assignments to <b>PATH</b>, <b>MAILPATH</b>, and ...      assigns the expanded value.

 <b>Parameter</b> <b>Expansion</b>
     The `<b>$</b>' character introduces parameter expansion, command...
     or arithmetic expansion. The parameter name or symbol to be ...
     [ ... ]

To be able to link directly to this section, we need something like:

     [ ... ]
     tildes in assignments to <b>PATH</b>, <b>MAILPATH</b>, and ...      assigns the expanded value.

 <a href="#ParameterExpansion"><b>Parameter</b> <b>Expansion</b></a>
     The `<b>$</b>' character introduces parameter expansion, command...      or arithmetic expansion. The parameter name or symbol to be ...
     [ ... ]

This adds one tag to the HTML code, and one attribute, the anchor URL:

`<b>Parameter</b> <b>Expansion</b>`
to
`<a href="#ParameterExpansion"><b>Parameter</b> <b>Expansion</b></a>`

Now, we can link to the section "Parameter Expansion" of "man bash" like

http://manpages.ubuntu.com/manpages/trusty/en/man1/bash.1.html#ParameterExpansion

or even

http://manpages.ubuntu.com/bash#ParameterExpansion

----
See also:

http://askubuntu.com/questions/509799/online-man-pages-with-links-to-subsections
https://bugs.launchpad.net/ubuntu-manpage-repository/+bug/871815

Volker Siegel (vsiegel)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.