[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting more out of man pages with less(1)
From: |
Steffen Nurpmeso |
Subject: |
Re: getting more out of man pages with less(1) |
Date: |
Sun, 23 May 2021 02:48:36 +0200 |
User-agent: |
s-nail v14.9.22-142-gaff7807ec7 |
Hello.
|> Good idea. I've further changed the Subject: to reflect the flow of the
|> discussion.
...
|> I also wonder if the pager wars are basically over and less(1) won them.
|
|That's certainly what I thought...
..
Ever since less(1) started supporting OSC 8 "Hyperlinks in
Terminal Emulators" as of version 566 i wanted to rewrite my
mdocmx(7) extension to be based upon the OSC 8 sequences that now
become more and more common.
So the last two days i finally made the great and implemented
OSC 8 for my mdoxmx macro package extension, as well as for grotty
v1.22.3 and less v586. Yay.
grotty was a bit hard because i wanted to implement all sorts of
OSC 8 things, even those they did not invent there in that github
repo, like document-local anchors and document-local "URI"s (i
used the usual "#REF" syntax used by eg HTML).
+ // Place a document-local anchor; arg(s): 1=ID
+ // (An OSC8 sequence without URI and INNER-TEXT.)
+ {"anchor", sizeof("anchor") -1, a_ANCHOR, 1},
+ // Link with inner text; arg(s): 1=URI, 2=INNER-TEXT
+ {"link", sizeof("link") -1, a_LINK, 2},
+ // Reference a document-local anchor; arg(s): 1=ID [2=INNER-TEXT]
+ // If INNER-TEXT is missing ID is reused for that.
+ {"link-anchor", sizeof("link-anchor") -1, a_LINK_ANCHOR, 2},
+ // Reference a manual page; arg(s): 1=NAME 2=SECTION-NR [3=ID]
+ // ID is optional, SECTION is manual section (eg "idle 2 55", "vi 1p").
+ // This ends up as "man://NAME.SECTION", the inner text will be ID if ID
+ // was given, otherwise "NAME(ID)".
+ {"link-manual\0", sizeof("link-manual") -1, a_LINK_MANUAL, 3},
+ // Link with externally controlled inner text; arg(s): 1=URI
+ {"link-start", sizeof("link-start") -1, a_LINK_START, 1},
+ // No arguments
+ {"link-end", sizeof("link-end") -1, a_LINK_END, 0}
Eg \X'tty osc8 link-anchor 50' or \X'tty osc8 link-manual awk 79'.
The latter ends up like (here in blue as my mdocmx does it):
awk(1)^[[34m[^[]8;id=79;man://awk.1^[\79^[]8;;^[\]^[[0m
So for example (here formatted by my mdocmx macro extension):
SEE ALSO
awk(1)[79], ...
then in less(1) with the OSC 8 anchor-search patch, typing ^A:
[OSC 8 anchor]:
then typing 79 and return and one sees
Read external manual: !man 1 awk
and if you return return again that comes up.
One could think about dropping link-manual and simply offering
a $LESS_BROWSER or so hook, but like this some security checks can
be applied more easily. (Only fewest yet.)
I pushed the git mail-patch boxes to the git repo of my roff clone
that is still awaiting any actions. On Monday i will apply some
more content checking on the link-manual content in less(1) (in
grotty we already check cisprint before we create the OSC
8 sequence).
The nice thing with OSC 8 is that generators like docbook or so
could simply enwrap things like
.BR cat (1)
with \X'tty: osc8 link-start cat 1' and \X'tty: osc8 link-end'.
For my search patch for less(1) however this would not work out.
For now the less(1) OSC 8 search patch requires an id= though.
A nice sunday i wish from Germany.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
- Re: man-intro, (continued)
- Re: man-intro, Ulrich Lauther, 2021/05/22
- Re: man-intro, Steffen Nurpmeso, 2021/05/22
- Re: man-intro, Clarke Echols, 2021/05/22
- Why no cd(1) man page in Ubuntu? (was: man-intro), G. Branden Robinson, 2021/05/22
- Re: Why no cd(1) man page in Ubuntu? (was: man-intro), James K. Lowden, 2021/05/29
- Re: man-intro, Oliver Corff, 2021/05/23
- Re: man-intro, Oliver Corff, 2021/05/23
- Re: man-intro, Peter Schaffter, 2021/05/23
- Re: man-intro, Dave Kemper, 2021/05/27
- Re: man-intro (was: getting more out of man pages with less(1) ), Larry Kollar, 2021/05/29
- Re: getting more out of man pages with less(1),
Steffen Nurpmeso <=
- Re: getting more out of man pages with less(1), Steffen Nurpmeso, 2021/05/23
- Re: getting more out of man pages with less(1), Steffen Nurpmeso, 2021/05/23
- Re: getting more out of man pages with less(1), Steffen Nurpmeso, 2021/05/24
- Re: getting more out of man pages with less(1) (was: [bug #59962] soelim(1) man page uses pic diagram--should it?), Dave Kemper, 2021/05/17
- Re: getting more out of man pages with less(1) (was: [bug #59962] soelim(1) man page uses pic diagram--should it?), Nate Bargmann, 2021/05/17
- Re: getting more out of man pages with less(1) (was: [bug #59962] soelim(1) man page uses pic diagram--should it?), Mike, 2021/05/26