tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [PATCH docbook2mdoc] Add markup, computeroutput (WIP)
@ 2019-04-12  5:57 Stephen Gregoratto
  2019-04-12  7:14 ` Ingo Schwarze
  2019-04-12  8:55 ` Ingo Schwarze
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Gregoratto @ 2019-04-12  5:57 UTC (permalink / raw)
  To: tech

Both of these are frequently used in the doclifter manpage.

First up, <markup>. The docs say:
> A markup element contains a string of formatting markup that is to be 
> represented literally in the text. The utility of this element is 
> almost wholly constrained to books about document formatting tools.

doclifter uses it to designate troff macros, e.g <markup>.Pp</markup>.  
Since this is similar to <sgmltag>, I decided to set NODE_SGMLTAG to the 
new NODE_MARKUP.

The only problem is that using macro_open(f, "Ic") doesn't escape the 
markup like pnode_printtext does (worst case would format as: .Ic Pp). 

Secondly, <computerlayout>. The docs say:
> A computeroutput identifies lines of text generated by a computer 
> program (messages, results, or other output).

Setting this to NODE_LITERAL

Index: docbook2mdoc.c
===================================================================
RCS file: /cvs/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.105
diff -u -p -r1.105 docbook2mdoc.c
--- docbook2mdoc.c	12 Apr 2019 04:17:11 -0000	1.105
+++ docbook2mdoc.c	12 Apr 2019 05:53:31 -0000
@@ -914,6 +914,9 @@ pnode_print(struct format *f, struct pno
 		macro_argline(f, "Bd", pnode_getattr(n, ATTRKEY_CLASS) ==
 		    ATTRVAL_MONOSPACED ? "-literal" : "-unfilled");
 		break;
+	case NODE_MARKUP:
+		macro_open(f, "Ic");
+		break;
 	case NODE_MML_MFENCED:
 		pnode_printmathfenced(f, n);
 		break;
@@ -988,9 +991,6 @@ pnode_print(struct format *f, struct pno
 		break;
 	case NODE_SBR:
 		macro_line(f, "br");
-		break;
-	case NODE_SGMLTAG:
-		macro_open(f, "Ic");
 		break;
 	case NODE_TEXT:
 	case NODE_ESCAPE:
Index: node.h
===================================================================
RCS file: /cvs/docbook2mdoc/node.h,v
retrieving revision 1.17
diff -u -p -r1.17 node.h
--- node.h	12 Apr 2019 04:39:24 -0000	1.17
+++ node.h	12 Apr 2019 05:53:31 -0000
@@ -82,6 +82,7 @@ enum	nodeid {
 	NODE_LITERAL,
 	NODE_LITERALLAYOUT,
 	NODE_MANVOLNUM,
+	NODE_MARKUP,
 	NODE_MEMBER,
 	NODE_MML_MATH,
 	NODE_MML_MFENCED,
@@ -123,7 +124,6 @@ enum	nodeid {
 	NODE_SBR,
 	NODE_SCREEN,
 	NODE_SECTION,
-	NODE_SGMLTAG,
 	NODE_SIMPLELIST,
 	NODE_SPANSPEC,
 	NODE_SUBTITLE,
Index: parse.c
===================================================================
RCS file: /cvs/docbook2mdoc/parse.c,v
retrieving revision 1.34
diff -u -p -r1.34 parse.c
--- parse.c	12 Apr 2019 04:39:24 -0000	1.34
+++ parse.c	12 Apr 2019 05:53:31 -0000
@@ -89,6 +89,7 @@ static	const struct element elements[] =
 	{ "code",		NODE_LITERAL },
 	{ "colspec",		NODE_COLSPEC },
 	{ "command",		NODE_COMMAND },
+	{ "computeroutput",	NODE_LITERAL },
 	{ "constant",		NODE_CONSTANT },
 	{ "contrib",		NODE_CONTRIB },
 	{ "copyright",		NODE_COPYRIGHT },
@@ -134,6 +135,7 @@ static	const struct element elements[] =
 	{ "literal",		NODE_LITERAL },
 	{ "literallayout",	NODE_LITERALLAYOUT },
 	{ "manvolnum",		NODE_MANVOLNUM },
+	{ "markup",		NODE_MARKUP },
 	{ "member",		NODE_MEMBER },
 	{ "mml:math",		NODE_MML_MATH },
 	{ "mml:mfenced",	NODE_MML_MFENCED },
@@ -186,7 +188,7 @@ static	const struct element elements[] =
 	{ "sect1",		NODE_SECTION },
 	{ "sect2",		NODE_SECTION },
 	{ "section",		NODE_SECTION },
-	{ "sgmltag",		NODE_SGMLTAG },
+	{ "sgmltag",		NODE_MARKUP },
 	{ "simpara",		NODE_PARA },
 	{ "simplelist",		NODE_SIMPLELIST },
 	{ "spanspec",		NODE_SPANSPEC },
-- 
Stephen Gregoratto
PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8:q
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-12  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12  5:57 [PATCH docbook2mdoc] Add markup, computeroutput (WIP) Stephen Gregoratto
2019-04-12  7:14 ` Ingo Schwarze
2019-04-12  8:55 ` Ingo 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).