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 c3eadac9; for ; Mon, 23 Feb 2015 07:40:30 -0500 (EST) Date: Mon, 23 Feb 2015 07:40:30 -0500 (EST) Message-Id: <7073735814298695780.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: Add @verb{} support. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Add @verb{} support. Modified Files: -------------- texi2mdoc: extern.h main.c texi2mdoc.1 Revision Data ------------- Index: extern.h =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/extern.h,v retrieving revision 1.7 retrieving revision 1.8 diff -Lextern.h -Lextern.h -u -p -r1.7 -r1.8 --- extern.h +++ extern.h @@ -207,6 +207,7 @@ enum texicmd { TEXICMD_URL, TEXICMD_VALUE, TEXICMD_VAR, + TEXICMD_VERB, TEXICMD_VERBATIM, TEXICMD_VERBATIMINCLUDE, TEXICMD_VINDEX, Index: main.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v retrieving revision 1.32 retrieving revision 1.33 diff -Lmain.c -Lmain.c -u -p -r1.32 -r1.33 --- main.c +++ main.c @@ -74,6 +74,7 @@ static void dotab(struct texi *, enum te static void dotitle(struct texi *, enum texicmd, const char *, size_t, size_t *); static void dovalue(struct texi *, enum texicmd, const char *, size_t, size_t *); static void doverb(struct texi *, enum texicmd, const char *, size_t, size_t *); +static void doverbatim(struct texi *, enum texicmd, const char *, size_t, size_t *); static void doverbinclude(struct texi *, enum texicmd, const char *, size_t, size_t *); static const struct texitok __texitoks[TEXICMD__MAX] = { @@ -262,7 +263,8 @@ static const struct texitok __texitoks[T { dolink, "url", 3 }, /* TEXICMD_URL */ { dovalue, "value", 5 }, /* TEXICMD_VALUE */ { doinline, "var", 3 }, /* TEXICMD_VAR */ - { doverb, "verbatim", 8 }, /* TEXICMD_VERBATIM */ + { doverb, "verb", 4 }, /* TEXICMD_VERB */ + { doverbatim, "verbatim", 8 }, /* TEXICMD_VERBATIM */ { doverbinclude, "verbatiminclude", 15 }, /* TEXICMD_VERBATIMINCLUDE */ { doignline, "vindex", 6 }, /* TEXICMD_VINDEX */ { dosp, "vskip", 5 }, /* TEXICMD_VSKIP */ @@ -586,6 +588,42 @@ doinline(struct texi *p, enum texicmd cm static void doverb(struct texi *p, enum texicmd cmd, + const char *buf, size_t sz, size_t *pos) +{ + char delim; + + while (*pos < sz && isws(buf[*pos])) + advance(p, buf, pos); + if (*pos == sz || '{' != buf[*pos]) + return; + advance(p, buf, pos); + if (*pos == sz) + return; + + delim = buf[*pos]; + advance(p, buf, pos); + /* Make sure we flush out our initial whitespace... */ + if (p->seenws && p->outcol && 0 == p->literal) + texiputchar(p, ' '); + p->seenws = 0; + /* Read until we see the delimiter then end-brace. */ + while (*pos < sz - 1) { + if (buf[*pos] == delim && buf[*pos + 1] == '}') + break; + texiputchar(p, buf[*pos]); + advance(p, buf, pos); + } + if (*pos == sz - 1) + return; + /* Make sure we read after the end-brace. */ + assert(delim == buf[*pos]); + advance(p, buf, pos); + assert('}' == buf[*pos]); + advance(p, buf, pos); +} + +static void +doverbatim(struct texi *p, enum texicmd cmd, const char *buf, size_t sz, size_t *pos) { const char *end, *term; Index: texi2mdoc.1 =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/texi2mdoc.1,v retrieving revision 1.6 retrieving revision 1.7 diff -Ltexi2mdoc.1 -Ltexi2mdoc.1 -u -p -r1.6 -r1.7 --- texi2mdoc.1 +++ texi2mdoc.1 @@ -84,13 +84,17 @@ The utility was written by .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv . .Sh CAVEATS -Amongst others, the -.Li @macro -and macro-related commands, -.Li @verb , -and -.Li @footnote -are not supported. +The output of +.Nm +doesn't play entirely nicely with +.Xr mdoc 7 . +It doesn't detect whether a line trailing slash is properly escaped, nor +does it properly account for how it mingles +.Sq \&Pp +with the text. +Moreover, many commands that might contain useful information (such as +.Li @footnote ) +are thrown away. .\" .Sh BUGS .Sh SECURITY CONSIDERATIONS As a security precaution, -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv