source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Cope with another one of the many kinds of DocBook stupidity:
@ 2015-02-17 18:09 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-02-17 18:09 UTC (permalink / raw)
  To: source

Log Message:
-----------
Cope with another one of the many kinds of DocBook stupidity:

Instead of just using .br, DocBook sometimes fiddles with the
utterly unportable internal register \n[an-break-flag] that is
only available in the GNU implementation of man(7) and then arms
an input line trap to call the equally unportable internal macro
.an-trap that, in the GNU implementation, inspects that variable;
all the world is GNU, isn't it?

Since naddy@ reports that quite a few ports manuals suffer from
this insanity, let's just translate it to the intended .br.

Et ceterum censeo DocBookem esse delendam.

Modified Files:
--------------
    mdocml:
        roff.c

Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.261
retrieving revision 1.262
diff -Lroff.c -Lroff.c -u -p -r1.261 -r1.262
--- roff.c
+++ roff.c
@@ -2337,10 +2337,19 @@ roff_it(ROFF_ARGS)
 		return(ROFF_IGN);
 	}
 
-	/* Arm the input line trap. */
+	while (isspace((unsigned char)buf->buf[pos]))
+		pos++;
+
+	/*
+	 * Arm the input line trap.
+	 * Special-casing "an-trap" is an ugly workaround to cope
+	 * with DocBook stupidly fiddling with man(7) internals.
+	 */
 
 	roffit_lines = iv;
-	roffit_macro = mandoc_strdup(buf->buf + pos);
+	roffit_macro = mandoc_strdup(iv != 1 ||
+	    strcmp(buf->buf + pos, "an-trap") ?
+	    buf->buf + pos : "br");
 	return(ROFF_IGN);
 }
 
--
 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:[~2015-02-17 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17 18:09 mdocml: Cope with another one of the many kinds of DocBook stupidity: 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).