* mdocml: Three portability improvements by millert@: * Use "\\ " not
@ 2012-11-19 2:08 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2012-11-19 2:08 UTC (permalink / raw)
To: source
Log Message:
-----------
Three portability improvements by millert@:
* Use "\\ " not "\\~" as the non-breaking space as historic nroff
doesn't support the latter.
* The '-' before the flags needs to be quoted to prevent nroff
from putting a line break between the '-' and the flag character.
* Disable hyphenation and, for nroff, disable justification which is
consistent with how mdoc behaves (and produces more readable manuals).
(OpenBSD rev. 1.39, 1.40 and 1.41)
Modified Files:
--------------
mdocml:
mdoc_man.c
Revision Data
-------------
Index: mdoc_man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.44 -r1.45
--- mdoc_man.c
+++ mdoc_man.c
@@ -334,11 +334,9 @@ print_word(const char *s)
*/
if (MMAN_spc_force & outflags || '\0' == s[0] ||
NULL == strchr(".,:;)]?!", s[0]) || '\0' != s[1]) {
- if (MMAN_Bk & outflags) {
+ if (MMAN_Bk & outflags)
putchar('\\');
- putchar('~');
- } else
- putchar(' ');
+ putchar(' ');
if (TPremain)
TPremain--;
}
@@ -358,7 +356,7 @@ print_word(const char *s)
for ( ; *s; s++) {
switch (*s) {
case (ASCII_NBRSP):
- printf("\\~");
+ printf("\\ ");
break;
case (ASCII_HYPH):
putchar('-');
@@ -535,10 +533,13 @@ man_mdoc(void *arg, const struct mdoc *m
meta = mdoc_meta(mdoc);
n = mdoc_node(mdoc);
- printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
+ printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n",
meta->title, meta->msec, meta->date,
meta->os, meta->vol);
+ /* Disable hyphenation and if nroff, disable justification. */
+ printf(".nh\n.if n .ad l");
+
outflags = MMAN_nl | MMAN_Sm;
if (0 == fontqueue.size) {
fontqueue.size = 8;
@@ -1053,7 +1054,7 @@ pre_fl(DECL_ARGS)
{
font_push('B');
- print_word("-");
+ print_word("\\-");
outflags &= ~MMAN_spc;
return(1);
}
@@ -1531,7 +1532,7 @@ pre_ux(DECL_ARGS)
if (NULL == n->child)
return(0);
outflags &= ~MMAN_spc;
- print_word("\\~");
+ print_word("\\ ");
outflags &= ~MMAN_spc;
return(1);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-11-19 2:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19 2:08 mdocml: Three portability improvements by millert@: * Use "\\ " not schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).