source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: There is no need to ever use the eqn(7) inline syntax
Date: Fri, 12 Apr 2019 06:37:40 -0500 (EST)	[thread overview]
Message-ID: <e3fdb5c1ef9b8da1@fantadrom.bsd.lv> (raw)

Log Message:
-----------
There is no need to ever use the eqn(7) inline syntax ($$):
Its purpose it to inline eqn(7) source code in the *input* file.
On the *output* side, equations are inlined by default.
To display them, the .EQ block needs to be wrapped in .Bd.
This patch gets rid of another user of "sv".

Modified Files:
--------------
    docbook2mdoc:
        docbook2mdoc.c
        node.h
        parse.c

Revision Data
-------------
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -Lparse.c -Lparse.c -u -p -r1.37 -r1.38
--- parse.c
+++ parse.c
@@ -558,9 +558,6 @@ xml_elem_start(struct parse *p, const ch
 		/* FALLTHROUGH */
 	case NODE_IGNORE:
 		return;
-	case NODE_INLINEEQUATION:
-		p->tree->flags |= TREE_EQN;
-		break;
 	default:
 		break;
 	}
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.110 -r1.111
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -657,12 +657,6 @@ pnode_printprologue(struct format *f, st
 	} else
 		pnode_printrefmeta(f, refmeta);
 	macro_line(f, "Os");
-
-	if (tree->flags & TREE_EQN) {
-		macro_line(f, "EQ");
-		print_text(f, "delim $$", 0);
-		macro_line(f, "EN");
-	}
 }
 
 /*
@@ -910,12 +904,10 @@ pnode_print(struct format *f, struct pno
 		macro_open(f, "Fd");
 		break;
 	case NODE_INFORMALEQUATION:
-		macro_line(f, "EQ");
-		break;
+		macro_line(f, "Bd -ragged -offset indent");
+		/* FALLTHROUGH */
 	case NODE_INLINEEQUATION:
-		if (f->linestate == LINE_NEW)
-			f->linestate = LINE_TEXT;
-		putchar('$');
+		macro_line(f, "EQ");
 		break;
 	case NODE_ITEMIZEDLIST:
 		pnode_printlist(f, n);
@@ -1054,10 +1046,10 @@ pnode_print(struct format *f, struct pno
 		return;
 	case NODE_INFORMALEQUATION:
 		macro_line(f, "EN");
+		macro_line(f, "Ed");
 		break;
 	case NODE_INLINEEQUATION:
-		fputs("$ ", stdout);
-		f->linestate = sv;
+		macro_line(f, "EN");
 		break;
 	case NODE_MEMBER:
 		if ((nn = TAILQ_NEXT(n, child)) != NULL &&
Index: node.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lnode.h -Lnode.h -u -p -r1.18 -r1.19
--- node.h
+++ node.h
@@ -222,7 +222,6 @@ struct	ptree {
 	int		 flags;
 #define	TREE_ERROR	 (1 << 0)  /* A parse error occurred. */
 #define	TREE_WARN	 (1 << 1)  /* A parser warning occurred. */
-#define	TREE_EQN	 (1 << 2)  /* The document needs inline eqn(7). */
 #define	TREE_CLOSED	 (1 << 3)  /* The document element was closed. */
 };
 
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2019-04-12 11:37 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=e3fdb5c1ef9b8da1@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@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).