source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: texi2mdoc: Prevent empty Bd/Ed listing after type definition.
Date: Mon, 9 Mar 2015 13:55:08 -0500 (EST)	[thread overview]
Message-ID: <6418902506878635453.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
Prevent empty Bd/Ed listing after type definition.
This also includes some ifdef'd menu generation.

Modified Files:
--------------
    texi2mdoc:
        main.c

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -Lmain.c -Lmain.c -u -p -r1.64 -r1.65
--- main.c
+++ main.c
@@ -65,6 +65,9 @@ static	void domath(struct texi *, enum t
 static	void domenu(struct texi *, enum texicmd, size_t *);
 #endif
 static	void domultitable(struct texi *, enum texicmd, size_t *);
+#if 0
+static	void donode(struct texi *, enum texicmd, size_t *);
+#endif
 static	void doquotation(struct texi *, enum texicmd, size_t *);
 static	void dotable(struct texi *, enum texicmd, size_t *);
 static	void dotop(struct texi *, enum texicmd, size_t *);
@@ -234,12 +237,20 @@ static	const struct texitok __texitoks[T
 	{ domacro, "macro", 5 }, /* TEXICMD_MACRO */
 	{ doaccent, "=", 1 }, /* TEXICMD_MACRON */
 	{ domath, "math", 4 }, /* TEXICMD_MATH */
+#if 0
+	{ domenu, "menu", 4 }, /* TEXICMD_MENU */
+#else
 	{ doignblock, "menu", 4 }, /* TEXICMD_MENU */
+#endif
 	{ dosymbol, "minus", 5 }, /* TEXICMD_MINUS */
 	{ domultitable, "multitable", 10 }, /* TEXICMD_MULTITABLE */
 	{ doignline, "need", 4 }, /* TEXICMD_NEED */
 	{ dosymbol, "\n", 1 }, /* TEXICMD_NEWLINE */
+#if 0
+	{ donode, "node", 4 }, /* TEXICMD_NODE */
+#else
 	{ doignline, "node", 4 }, /* TEXICMD_NODE */
+#endif
 	{ doignline, "noindent", 8 }, /* TEXICMD_NOINDENT */
 	{ dosymbol, "O", 1 }, /* TEXICMD_O */
 	{ dosymbol, "OE", 2 }, /* TEXICMD_OE */
@@ -546,6 +557,12 @@ dodefn(struct texi *p, enum texicmd cmd,
 		}
 		break;
 	}
+
+	if (TEXICMD_END == peekcmd(p, *pos)) {
+		parseto(p, pos, blk);
+		return;
+	}
+
 	teximacro(p, "Bd -filled -offset indent");
 	parseto(p, pos, blk);
 	teximacro(p, "Ed");
@@ -1456,9 +1473,30 @@ doquotation(struct texi *p, enum texicmd
 
 #if 0
 static void
+donode(struct texi *p, enum texicmd cmd, size_t *pos)
+{
+
+	teximacroopen(p, "Ix");
+	texiputchars(p, "Node");
+	while (*pos < BUFSZ(p) && isspace(BUF(p)[*pos]))
+		advance(p, pos);
+	while (*pos < BUFSZ(p)) {
+		if (BUF(p)[*pos] == ',')
+			break;
+		else if (BUF(p)[*pos] == '\n')
+			break;
+		texiputchar(p, BUF(p)[*pos]);
+		advance(p, pos);
+	}
+
+	teximacroclose(p);
+	advanceeoln(p, pos, 1);
+}
+
+static void
 domenu(struct texi *p, enum texicmd cmd, size_t *pos)
 {
-	size_t	 start;
+	size_t	 start, sv;
 
 	if (NULL != p->chapters) {
 		doignblock(p, cmd, pos);
@@ -1467,7 +1505,8 @@ domenu(struct texi *p, enum texicmd cmd,
 
 	advanceeoln(p, pos, 1);
 
-	teximacro(p, "Bl -tag -width Ds");
+	texivspace(p);
+	teximacro(p, "Bl -tag -width Ds -compact");
 	while (*pos < BUFSZ(p)) {
 		/* Read to next menu item. */
 		while (*pos < BUFSZ(p) && ismspace(BUF(p)[*pos]))
@@ -1479,7 +1518,7 @@ domenu(struct texi *p, enum texicmd cmd,
 		advance(p, pos);
 		while (*pos < BUFSZ(p) && ismspace(BUF(p)[*pos]))
 			advance(p, pos);
-		start = *pos;
+		sv = start = *pos;
 		while (*pos < BUFSZ(p) && ':' != BUF(p)[*pos])
 			advance(p, pos);
 		if (*pos == BUFSZ(p) || *pos == start) {
@@ -1487,9 +1526,15 @@ domenu(struct texi *p, enum texicmd cmd,
 			break;
 		}
 		teximacroopen(p, "It");
-		teximacroopen(p, "Sx");
-		for ( ; start < *pos; start++)
+		teximacroopen(p, "Lkx");
+		texiputchar(p, '"');
+		texiputchars(p, "Node");
+		for (start = sv; start < *pos; start++)
+			texiputchar(p, BUF(p)[start]);
+		texiputchars(p, "\" \"");
+		for (start = sv; start < *pos; start++)
 			texiputchar(p, BUF(p)[start]);
+		texiputchar(p, '"');
 		teximacroclose(p);
 		teximacroclose(p);
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2015-03-09 18:55 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=6418902506878635453.enqueue@fantadrom.bsd.lv \
    --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).