From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id ac095849; for ; Thu, 5 Mar 2015 10:18:43 -0500 (EST) Date: Thu, 5 Mar 2015 10:18:43 -0500 (EST) Message-Id: <5998770763061380646.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: texi2mdoc: Convert `--' and `---' to en-dash and em-dash, respectively, X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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