source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: handle attributes in single quotes
Date: Wed, 3 Apr 2019 06:24:18 -0500 (EST)	[thread overview]
Message-ID: <e3fd30ada97f0380@fantadrom.bsd.lv> (raw)

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

                 reply	other threads:[~2019-04-03 11:24 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=e3fd30ada97f0380@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).