From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: texi2mdoc: Convert `--' and `---' to en-dash and em-dash, respectively,
Date: Thu, 5 Mar 2015 10:18:43 -0500 (EST) [thread overview]
Message-ID: <5998770763061380646.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
Convert `--' and `---' to en-dash and em-dash, respectively, and ensure that
this (and the other conversations) don't occur in literal mode.
Also make sure that @code{} switches on literal mode.
Modified Files:
--------------
texi2mdoc:
main.c
util.c
Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -Lmain.c -Lmain.c -u -p -r1.62 -r1.63
--- main.c
+++ main.c
@@ -755,11 +755,15 @@ doinline(struct texi *p, enum texicmd cm
teximacroopen(p, macro);
p->seenws = 0;
+ if (TEXICMD_CODE == cmd)
+ p->literal++;
if (TEXICMD_SC == cmd)
p->uppercase++;
parsebracket(p, pos, 0);
if (TEXICMD_SC == cmd)
p->uppercase--;
+ if (TEXICMD_CODE == cmd)
+ p->literal--;
texipunctuate(p, pos);
teximacroclose(p);
}
Index: util.c
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/util.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lutil.c -Lutil.c -u -p -r1.27 -r1.28
--- util.c
+++ util.c
@@ -597,7 +597,26 @@ parseword(struct texi *p, size_t *pos, c
}
if ('\0' != extra && BUF(p)[*pos] == extra)
return;
- if (*pos < BUFSZ(p) - 1 &&
+
+ if (p->literal) {
+ texiputchar(p, BUF(p)[*pos]);
+ advance(p, pos);
+ continue;
+ }
+
+ if (*pos < BUFSZ(p) - 2 &&
+ '-' == BUF(p)[*pos] &&
+ '-' == BUF(p)[*pos + 1] &&
+ '-' == BUF(p)[*pos + 2]) {
+ texiputchars(p, "\\(em");
+ advance(p, pos);
+ advance(p, pos);
+ } else if (*pos < BUFSZ(p) - 1 &&
+ '-' == BUF(p)[*pos] &&
+ '-' == BUF(p)[*pos + 1]) {
+ texiputchars(p, "\\(en");
+ advance(p, pos);
+ } else if (*pos < BUFSZ(p) - 1 &&
'`' == BUF(p)[*pos] &&
'`' == BUF(p)[*pos + 1]) {
texiputchars(p, "\\(lq");
@@ -609,6 +628,7 @@ parseword(struct texi *p, size_t *pos, c
advance(p, pos);
} else
texiputchar(p, BUF(p)[*pos]);
+
advance(p, pos);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2015-03-05 15:18 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=5998770763061380646.enqueue@fantadrom.bsd.lv \
--to=kristaps@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).