source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: implement .An -split and -nosplit
Date: Tue, 7 Mar 2017 08:09:59 -0500 (EST)	[thread overview]
Message-ID: <949375188616207937.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
implement .An -split and -nosplit

Modified Files:
--------------
    mdocml:
        mdoc_markdown.c
    mdocml/regress/mdoc/An:
        Makefile
    mdocml/regress/mdoc/Aq:
        Makefile

Added Files:
-----------
    mdocml/regress/mdoc/An:
        break.out_markdown
    mdocml/regress/mdoc/Aq:
        author.out_markdown

Revision Data
-------------
Index: mdoc_markdown.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_markdown.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lmdoc_markdown.c -Lmdoc_markdown.c -u -p -r1.4 -r1.5
--- mdoc_markdown.c
+++ mdoc_markdown.c
@@ -51,6 +51,7 @@ static	int	 md_pre_raw(struct roff_node 
 static	int	 md_pre_word(struct roff_node *);
 static	int	 md_pre_skip(struct roff_node *);
 static	void	 md_pre_syn(struct roff_node *);
+static	int	 md_pre_An(struct roff_node *);
 static	int	 md_pre_Ap(struct roff_node *);
 static	int	 md_pre_Bd(struct roff_node *);
 static	int	 md_pre_Bk(struct roff_node *);
@@ -115,7 +116,7 @@ static	const struct md_act md_acts[MDOC_
 	{ NULL, NULL, NULL, NULL, NULL }, /* El */
 	{ NULL, md_pre_It, md_post_It, NULL, NULL }, /* It */
 	{ NULL, md_pre_raw, md_post_raw, "*", "*" }, /* Ad */
-	{ NULL, NULL, NULL, NULL, NULL }, /* An */
+	{ NULL, md_pre_An, NULL, NULL, NULL }, /* An */
 	{ NULL, md_pre_raw, md_post_raw, "*", "*" }, /* Ar */
 	{ NULL, md_pre_raw, md_post_raw, "**", "**" }, /* Cd */
 	{ NULL, md_pre_raw, md_post_raw, "**", "**" }, /* Cm */
@@ -235,6 +236,8 @@ static	int	 outflags;
 #define	MD_sp		 (1 << 5)  /* Insert a paragraph break. */
 #define	MD_Sm		 (1 << 6)  /* Horizontal spacing mode. */
 #define	MD_Bk		 (1 << 7)  /* Word keep mode. */
+#define	MD_An_split	 (1 << 8)  /* Author mode is "split". */
+#define	MD_An_nosplit	 (1 << 9)  /* Author mode is "nosplit". */
 
 static	int	 escflags; /* Escape in generated markdown code: */
 #define	ESC_BOL	 (1 << 0)  /* "#*+-" near the beginning of a line. */
@@ -782,6 +785,28 @@ md_pre_syn(struct roff_node *n)
 }
 
 static int
+md_pre_An(struct roff_node *n)
+{
+	switch (n->norm->An.auth) {
+	case AUTH_split:
+		outflags &= ~MD_An_nosplit;
+		outflags |= MD_An_split;
+		return 0;
+	case AUTH_nosplit:
+		outflags &= ~MD_An_split;
+		outflags |= MD_An_nosplit;
+		return 0;
+	default:
+		if (outflags & MD_An_split)
+			outflags |= MD_br;
+		else if (n->sec == SEC_AUTHORS &&
+		    ! (outflags & MD_An_nosplit))
+			outflags |= MD_An_split;
+		return 1;
+	}
+}
+
+static int
 md_pre_Ap(struct roff_node *n)
 {
 	outflags &= ~MD_spc;
@@ -1347,6 +1372,10 @@ static int
 md_pre_Sh(struct roff_node *n)
 {
 	switch (n->type) {
+	case ROFFT_BLOCK:
+		if (n->sec == SEC_AUTHORS)
+			outflags &= ~(MD_An_split | MD_An_nosplit);
+		break;
 	case ROFFT_HEAD:
 		outflags |= MD_sp;
 		md_rawword(n->tok == MDOC_Sh ? "#" : "##");
--- /dev/null
+++ regress/mdoc/An/break.out_markdown
@@ -0,0 +1,47 @@
+AN-BREAK(1) - General Commands Manual
+
+# NAME
+
+**An-break** - line breaking of the author macro
+
+# DESCRIPTION
+
+inline is the default:
+Kristaps,
+Ingo,
+and
+Joerg.
+empty
+trailing
+.
+
+split mode:  
+Kristaps  
+Ingo  
+Joerg
+
+empty  
+trailing  
+.
+
+# AUTHORS
+
+split mode is the default:
+Kristaps  
+Ingo  
+Joerg
+
+empty  
+trailing  
+.
+
+inline:
+Kristaps,
+Ingo,
+and
+Joerg.
+empty
+trailing
+.
+
+OpenBSD - February 5, 2015
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/mdoc/An/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/An/Makefile -Lregress/mdoc/An/Makefile -u -p -r1.1 -r1.2
--- regress/mdoc/An/Makefile
+++ regress/mdoc/An/Makefile
@@ -2,5 +2,6 @@
 
 REGRESS_TARGETS	= break
 LINT_TARGETS	= break
+MARKDOWN_TARGETS = break
 
 .include <bsd.regress.mk>
--- /dev/null
+++ regress/mdoc/Aq/author.out_markdown
@@ -0,0 +1,16 @@
+AQ-AUTHOR(1) - General Commands Manual
+
+# NAME
+
+**Aq-author** - angle brackets after an author name macro
+
+# DESCRIPTION
+
+Name &lt;<addr>&gt; Name &lt;<addr>&gt;
+
+# AUTHORS
+
+Name &lt;<addr>&gt;  
+Name &lt;<addr>&gt;
+
+OpenBSD - November 19, 2014
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/mdoc/Aq/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lregress/mdoc/Aq/Makefile -Lregress/mdoc/Aq/Makefile -u -p -r1.2 -r1.3
--- regress/mdoc/Aq/Makefile
+++ regress/mdoc/Aq/Makefile
@@ -2,6 +2,6 @@
 
 REGRESS_TARGETS	= author empty
 UTF8_TARGETS	= author empty
-MARKDOWN_TARGETS = empty
+MARKDOWN_TARGETS = author empty
 
 .include <bsd.regress.mk>
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2017-03-07 13:09 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=949375188616207937.enqueue@fantadrom.bsd.lv \
    --to=schwarze@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).