[PATCH] xnc.hlp converted to mandoc format
Grigory Trenin
gtrenin at gmail.com
Thu Feb 22 16:49:53 UTC 2007
Hello,
I converted binary xnc.hlp to mandoc format and merged it with mc.1.in.
Here are the patches to src/man2hlp.c, doc/mc.1.in (English version),
and doc/Makefile.am.
You can do
$ diff mc.hlp.old mc.hlp
to see that nothing was broken by the patch...
Of course, there are some minor differences in the output, but they
occur *only* with preformatted text that was in xnc.hlp.
Let me describe the patch to man2hlp:
1) New commands:
.ti - Temporary indent
.ce - Center lines
.ex - Used to exclude from the man page the text from xnc.hlp
.\"BOOKMARK
With the .\"BOOKMARK command you can place a 'bookmark' inside the
node, and reference it with a link (this is used in 'NO WARRANTY'
link, I already posted about this on the maillist).
2) Small change in handling .TP label to be compatible with new
.ti command. The old implementation assumed that the next input
line following .TP command is a paragraph label. This assumption is
wrong: the next line could be a comment or another troff's command.
So I did a small change - I moved that code out of the main reading
loop to a better place.
This also allowed to simplify the logic a bit:
'tp_flag' was triple-state (0,1,2), now it has only two states (0,1).
3) Added support of troff commands in no-fill mode.
When handling .nf (no-fill command) man2hlp used a simple solution:
the input was copied to output verbatim, and troff commands were
ignored in that mode. For example, for the following input:
.nf
.B Sample text
the output was ".B Sample text".
My patch emulates no-fill mode more closely to groff:
for the input shown above the output will be "Sample text"
in bold font. mc.1.in now takes advantage of that feature.
4) New function - unescaperise(), to remove backslash-quoting.
The old implementation did it by pasting the same piece of code
in 4 various parts of the program.
5) Modified string_len() function:
a) Added handling of TAB character: it is assumed 8 chars
in length.
b) Removed that mysterious code:
/* Ugly hack to prevent loss of one space */
len++;
I really don't understand what this 'ugly hack' is used for.
I tried to find an answer in ChangeLogs and original version
of man2hlp.c from mc-4.1.35... No success.
Anyway, this code is never used because printing of node headers
is done directly via fprintf(), and not via print_string().
Since it has never been actually used I decided to remove it
to prevent confusion.
Regards,
Grigory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mc-xnc_hlp_gone.patch.gz
Type: application/gzip
Size: 12907 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20070222/847914e6/attachment.bin>
More information about the mc-devel
mailing list