source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: pod2mdoc: use .Fa to mark up function arguments mentioned in the
Date: Fri, 13 Feb 2015 07:41:24 -0500 (EST)	[thread overview]
Message-ID: <3667354462673124002.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
use .Fa to mark up function arguments mentioned in the SYNOPSIS

Modified Files:
--------------
    pod2mdoc:
        dict.h
        pod2mdoc.c

Revision Data
-------------
Index: dict.h
===================================================================
RCS file: /home/cvs/mdocml/pod2mdoc/dict.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ldict.h -Ldict.h -u -p -r1.1 -r1.2
--- dict.h
+++ dict.h
@@ -16,7 +16,8 @@
  */
 
 enum mdoc_type {
-	MDOC_Fo = 0,
+	MDOC_Fa = 0,
+	MDOC_Fo,
 	MDOC_MAX
 };
 
Index: pod2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/pod2mdoc/pod2mdoc.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -Lpod2mdoc.c -Lpod2mdoc.c -u -p -r1.37 -r1.38
--- pod2mdoc.c
+++ pod2mdoc.c
@@ -615,8 +615,16 @@ formatcode(struct state *st, const char 
 			} 
 			if (0 == strncmp(buf + *start, "NULL", 4) &&
 			    ('=' == buf[*start + 4] ||
-			     '>' == buf[*start + 4]))
+			     '>' == buf[*start + 4])) {
 				printf("Dv ");
+				break;
+			}
+			i = 0;
+			while (isalnum((unsigned char)buf[*start + i]) ||
+			    '_' == buf[*start + i])
+				i++;
+			if (i && MDOC_Fa == dict_get(buf + *start, i))
+				printf("Fa ");
 			else
 				printf("Sy ");
 			break;
@@ -1014,7 +1022,7 @@ static void
 verbatim(struct state *st, char *buf, size_t start, size_t end)
 {
 	size_t		 i, ift, ifo, ifa, ifc, inl;
-	char		*cp;
+	char		*cp, *cp2;
 	int		 nopen;
 
 	if ( ! st->parsing || st->paused || start == end)
@@ -1114,8 +1122,16 @@ again:
 			buf[ifc++] = '\0';
 			for (;;) {
 				cp = strchr(buf + ifa, ',');
-				if (cp != NULL)
+				if (cp != NULL) {
+					cp2 = cp;
 					*cp++ = '\0';
+				} else
+					cp2 = strchr(buf + ifa, '\0');
+				while (isalnum((unsigned char)cp2[-1]) ||
+				    '_' == cp2[-1])
+					cp2--;
+				if ('\0' != *cp2)
+					dict_put(cp2, MDOC_Fa);
 				printf(".Fa \"%s\"\n", buf + ifa);
 				if (cp == NULL)
 					break;
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2015-02-13 12:41 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=3667354462673124002.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).