From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: docbook2mdoc: Add holder, copyright, and year elements.
Date: Wed, 30 Apr 2014 05:04:41 -0400 (EDT) [thread overview]
Message-ID: <201404300904.s3U94fO6001192@krisdoz.my.domain> (raw)
Log Message:
-----------
Add holder, copyright, and year elements.
Fix parameter to suppress trailing newline (puts -> fputs).
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
extern.h
rules.c
Revision Data
-------------
Index: extern.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/docbook2mdoc/extern.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -Lextern.h -Lextern.h -u -p -r1.17 -r1.18
--- extern.h
+++ extern.h
@@ -16,6 +16,8 @@ enum nodeid {
NODE_CMDSYNOPSIS,
NODE_CODE,
NODE_COMMAND,
+ NODE_CONSTANT,
+ NODE_COPYRIGHT,
NODE_DATE,
NODE_EMPHASIS,
NODE_ENTRY,
@@ -26,8 +28,10 @@ enum nodeid {
NODE_FUNCSYNOPSIS,
NODE_FUNCSYNOPSISINFO,
NODE_FUNCTION,
- NODE_ITEMIZEDLIST,
NODE_GROUP,
+ NODE_HOLDER,
+ NODE_INFO,
+ NODE_ITEMIZEDLIST,
NODE_LINK,
NODE_LISTITEM,
NODE_LITERAL,
@@ -79,6 +83,7 @@ enum nodeid {
NODE_VARNAME,
NODE_WARNING,
NODE_WORDASWORD,
+ NODE_YEAR,
NODE__MAX
};
Index: docbook2mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.31 -r1.32
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -96,6 +96,8 @@ static const struct node nodes[NODE__MAX
{ "cmdsynopsis", NODE_IGNTEXT },
{ "code", 0 },
{ "command", 0 },
+ { "constant", 0 },
+ { "copyright", NODE_IGNTEXT },
{ "date", 0 },
{ "emphasis", 0 },
{ "entry", 0 },
@@ -106,8 +108,10 @@ static const struct node nodes[NODE__MAX
{ "funcsynopsis", NODE_IGNTEXT },
{ "funcsynopsisinfo", 0 },
{ "function", 0 },
- { "itemizedlist", NODE_IGNTEXT },
{ "group", NODE_IGNTEXT },
+ { "holder", NODE_IGNTEXT },
+ { "info", NODE_IGNTEXT },
+ { "itemizedlist", NODE_IGNTEXT },
{ "link", 0 },
{ "listitem", NODE_IGNTEXT },
{ "literal", 0 },
@@ -159,6 +163,7 @@ static const struct node nodes[NODE__MAX
{ "varname", 0 },
{ "warning", NODE_IGNTEXT },
{ "wordasword", 0 },
+ { "year", NODE_IGNTEXT },
};
static void
@@ -521,6 +526,7 @@ pnode_findfirst(struct pnode *pn, enum n
#define MACROLINE_NORM 0
#define MACROLINE_UPPER 1
+#define MACROLINE_NOWS 2
/*
* Recursively print text presumably on a macro line.
* Convert all whitespace to regular spaces.
@@ -530,7 +536,7 @@ pnode_printmacrolinetext(struct parse *p
{
char *cp;
- if (0 == p->newln)
+ if (0 == p->newln && ! (MACROLINE_NOWS & fl))
putchar(' ');
bufclear(p);
@@ -784,7 +790,7 @@ pnode_printparamdef(struct parse *p, str
fputs(".Fa \"", stdout);
p->newln = 0;
if (NULL != ptype) {
- pnode_printmacrolinepart(p, ptype);
+ pnode_printmacrolinetext(p, ptype, MACROLINE_NOWS);
putchar(' ');
}
@@ -1149,8 +1155,8 @@ pnode_print(struct parse *p, struct pnod
/* Suppress non-text children... */
pnode_printmopen(p);
fputs("Fa \"", stdout);
- pnode_printmacrolinepart(p, pn);
- puts("\"");
+ pnode_printmacrolinetext(p, pn, MACROLINE_NOWS);
+ fputs("\"", stdout);
pnode_unlinksub(pn);
break;
case (NODE_QUOTE):
Index: rules.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/docbook2mdoc/rules.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -Lrules.c -Lrules.c -u -p -r1.17 -r1.18
--- rules.c
+++ rules.c
@@ -240,11 +240,44 @@ isparent(enum nodeid node, enum nodeid p
break;
}
return(0);
+ case (NODE_CONSTANT):
+ switch (parent) {
+ case (NODE_EMPHASIS):
+ case (NODE_ENTRY):
+ case (NODE_FUNCSYNOPSISINFO):
+ case (NODE_LINK):
+ case (NODE_ULINK):
+ case (NODE_PARA):
+ case (NODE_PROGRAMLISTING):
+ case (NODE_QUOTE):
+ case (NODE_REFDESCRIPTOR):
+ case (NODE_REFENTRYTITLE):
+ case (NODE_REFNAME):
+ case (NODE_REFPURPOSE):
+ case (NODE_SCREEN):
+ case (NODE_SYNOPSIS):
+ case (NODE_TERM):
+ case (NODE_TITLE):
+ case (NODE_USERINPUT):
+ return(1);
+ default:
+ break;
+ }
+ return(0);
+ case (NODE_COPYRIGHT):
+ switch (parent) {
+ case (NODE_INFO):
+ return(1);
+ default:
+ break;
+ }
+ return(0);
case (NODE_DATE):
switch (parent) {
case (NODE_EMPHASIS):
case (NODE_ENTRY):
case (NODE_FUNCSYNOPSISINFO):
+ case (NODE_INFO):
case (NODE_LINK):
case (NODE_PARA):
case (NODE_PROGRAMLISTING):
@@ -389,21 +422,44 @@ isparent(enum nodeid node, enum nodeid p
break;
}
return(0);
- case (NODE_ITEMIZEDLIST):
+ case (NODE_GROUP):
+ switch (parent) {
+ case (NODE_ARG):
+ case (NODE_CMDSYNOPSIS):
+ case (NODE_GROUP):
+ return(1);
+ default:
+ break;
+ }
+ return(0);
+ case (NODE_HOLDER):
+ switch (parent) {
+ case (NODE_COPYRIGHT):
+ return(1);
+ default:
+ break;
+ }
+ return(0);
+ case (NODE_INFO):
switch (parent) {
case (NODE_CAUTION):
- case (NODE_ENTRY):
+ case (NODE_CMDSYNOPSIS):
+ case (NODE_FUNCSYNOPSIS):
+ case (NODE_FUNCSYNOPSISINFO):
case (NODE_ITEMIZEDLIST):
- case (NODE_LISTITEM):
case (NODE_NOTE):
case (NODE_ORDEREDLIST):
case (NODE_PARA):
+ case (NODE_PROGRAMLISTING):
+ case (NODE_REFENTRY):
case (NODE_REFSECT1):
case (NODE_REFSECT2):
case (NODE_REFSECT3):
case (NODE_REFSECTION):
case (NODE_REFSYNOPSISDIV):
- case (NODE_TIP):
+ case (NODE_SCREEN):
+ case (NODE_SYNOPSIS):
+ case (NODE_TABLE):
case (NODE_VARIABLELIST):
case (NODE_WARNING):
return(1);
@@ -411,11 +467,23 @@ isparent(enum nodeid node, enum nodeid p
break;
}
return(0);
- case (NODE_GROUP):
+ case (NODE_ITEMIZEDLIST):
switch (parent) {
- case (NODE_ARG):
- case (NODE_CMDSYNOPSIS):
- case (NODE_GROUP):
+ case (NODE_CAUTION):
+ case (NODE_ENTRY):
+ case (NODE_ITEMIZEDLIST):
+ case (NODE_LISTITEM):
+ case (NODE_NOTE):
+ case (NODE_ORDEREDLIST):
+ case (NODE_PARA):
+ case (NODE_REFSECT1):
+ case (NODE_REFSECT2):
+ case (NODE_REFSECT3):
+ case (NODE_REFSECTION):
+ case (NODE_REFSYNOPSISDIV):
+ case (NODE_TIP):
+ case (NODE_VARIABLELIST):
+ case (NODE_WARNING):
return(1);
default:
break;
@@ -429,6 +497,7 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_ARG):
case (NODE_CODE):
case (NODE_COMMAND):
+ case (NODE_CONSTANT):
case (NODE_EMPHASIS):
case (NODE_ENTRY):
case (NODE_ENVAR):
@@ -436,6 +505,7 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_FUNCDEF):
case (NODE_FUNCSYNOPSISINFO):
case (NODE_FUNCTION):
+ case (NODE_HOLDER):
case (NODE_LINK):
case (NODE_LITERAL):
case (NODE_MANVOLNUM):
@@ -458,6 +528,7 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_USERINPUT):
case (NODE_VARNAME):
case (NODE_WORDASWORD):
+ case (NODE_YEAR):
return(1);
default:
break;
@@ -751,6 +822,7 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_ARG):
case (NODE_CODE):
case (NODE_COMMAND):
+ case (NODE_CONSTANT):
case (NODE_EMPHASIS):
case (NODE_ENTRY):
case (NODE_ENVAR):
@@ -759,6 +831,7 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_FUNCSYNOPSISINFO):
case (NODE_FUNCTION):
case (NODE_GROUP):
+ case (NODE_HOLDER):
case (NODE_LINK):
case (NODE_LITERAL):
case (NODE_MANVOLNUM):
@@ -784,6 +857,7 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_USERINPUT):
case (NODE_VARNAME):
case (NODE_WORDASWORD):
+ case (NODE_YEAR):
default:
return(1);
}
@@ -934,6 +1008,7 @@ isparent(enum nodeid node, enum nodeid p
return(NODE_TGROUP == parent);
case (NODE_TITLE):
switch (parent) {
+ case (NODE_INFO):
case (NODE_ITEMIZEDLIST):
case (NODE_ORDEREDLIST):
case (NODE_REFENTRYINFO):
@@ -1086,6 +1161,14 @@ isparent(enum nodeid node, enum nodeid p
case (NODE_TERM):
case (NODE_TITLE):
case (NODE_ULINK):
+ return(1);
+ default:
+ break;
+ }
+ return(0);
+ case (NODE_YEAR):
+ switch (parent) {
+ case (NODE_COPYRIGHT):
return(1);
default:
break;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2014-04-30 9:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=201404300904.s3U94fO6001192@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@mdocml.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).