source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: handle attributes in single quotes
@ 2019-04-03 11:24 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-04-03 11:24 UTC (permalink / raw)
  To: source

Log Message:
-----------
handle attributes in single quotes

Modified Files:
--------------
    docbook2mdoc:
        parse.c
        statistics.c

Revision Data
-------------
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lparse.c -Lparse.c -u -p -r1.9 -r1.10
--- parse.c
+++ parse.c
@@ -692,14 +692,16 @@ parse_file(struct parse *p, int fd, cons
 			/* Parse an attribute value. */
 
 			if (in_arg) {
-				if (in_quotes == 0 && b[pend] == '"') {
-					in_quotes = 1;
+				if (in_quotes == 0 &&
+				    (b[pend] == '\'' || b[pend] == '"')) {
+					in_quotes = b[pend] == '"' ? 2 : 1;
 					p->ncol++;
 					pend++;
 					continue;
 				}
 				if (advance(p, b, rlen, &pend,
-				    in_quotes ? "\"" : " >") && rsz > 0)
+				    in_quotes == 2 ? "\"" :
+				    in_quotes == 1 ? "'" : " >") && rsz > 0)
 					break;
 				in_arg = in_quotes = elem_end = 0;
 				if (b[pend] == '>') {
Index: statistics.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lstatistics.c -Lstatistics.c -u -p -r1.4 -r1.5
--- statistics.c
+++ statistics.c
@@ -225,13 +225,15 @@ parse_file(int fd, char *fname)
 				continue;
 			}
 			if (in_arg) {
-				if (in_quotes == 0 && b[pend] == '"') {
-					in_quotes = 1;
+				if (in_quotes == 0 &&
+				    (b[pend] == '\'' || b[pend] == '"')) {
+					in_quotes = b[pend] == '"' ? 2 : 1;
 					pend++;
 					continue;
 				}
 				if (advance(b, rlen, &pend,
-				    in_quotes ? "\"" : " >") && rsz > 0)
+				    in_quotes == 2 ? "\"" :
+				    in_quotes == 1 ? "'" : " >") && rsz > 0)
 					break;
 				in_arg = in_quotes = elem_end = 0;
 				if (b[pend] == '>') {
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

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

only message in thread, other threads:[~2019-04-03 11:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 11:24 docbook2mdoc: handle attributes in single quotes 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).