From: Stephen Gregoratto <dev@sgregoratto.me>
To: tech@mandoc.bsd.lv
Subject: [PATCH docbook2mdoc] Add markup, computeroutput (WIP)
Date: Fri, 12 Apr 2019 15:57:48 +1000 [thread overview]
Message-ID: <20190412055748.umynmdcylrtp5pbs@BlackBox> (raw)
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
next reply other threads:[~2019-04-12 5:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 5:57 Stephen Gregoratto [this message]
2019-04-12 7:14 ` Ingo Schwarze
2019-04-12 8:55 ` Ingo Schwarze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190412055748.umynmdcylrtp5pbs@BlackBox \
--to=dev@sgregoratto.me \
--cc=tech@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).