source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: drop trailing parentheses in <function> elements
@ 2019-05-01 11:04 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-05-01 11:04 UTC (permalink / raw)
  To: source

Log Message:
-----------
drop trailing parentheses in <function> elements

Modified Files:
--------------
    docbook2mdoc:
        reorg.c

Revision Data
-------------
Index: reorg.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/reorg.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lreorg.c -Lreorg.c -u -p -r1.5 -r1.6
--- reorg.c
+++ reorg.c
@@ -211,6 +211,20 @@ default_title(struct pnode *n, const cha
 }
 
 static void
+reorg_function(struct pnode *n)
+{
+	struct pnode	*nc;
+	size_t		 sz;
+
+	if ((nc = TAILQ_FIRST(&n->childq)) != NULL &&
+	    nc->node == NODE_TEXT &&
+	    TAILQ_NEXT(nc, child) == NULL &&
+	    (sz = strlen(nc->b)) > 2 &&
+	    nc->b[sz - 2] == '(' && nc->b[sz - 1] == ')')
+		nc->b[sz - 2] = '\0';
+}
+
+static void
 reorg_recurse(struct pnode *n)
 {
 	struct pnode	*nc;
@@ -231,6 +245,9 @@ reorg_recurse(struct pnode *n)
 	case NODE_CAUTION:
 		default_title(n, "Caution");
 		n->node = NODE_NOTE;
+		break;
+	case NODE_FUNCTION:
+		reorg_function(n);
 		break;
 	case NODE_LEGALNOTICE:
 		default_title(n, "Legal Notice");
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-01 11:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 11:04 docbook2mdoc: drop trailing parentheses in <function> elements 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).