source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* pod2mdoc: use .Fa to mark up function arguments mentioned in the
@ 2015-02-13 12:41 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-02-13 12:41 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-13 12:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 12:41 pod2mdoc: use .Fa to mark up function arguments mentioned in the schwarze

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).