source@mandoc.bsd.lv
 help / color / 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, back to index

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

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git