* texi2mdoc: Allow for @sc{} to properly uppercase as requested by
@ 2015-03-02 18:13 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2015-03-02 18:13 UTC (permalink / raw)
To: source
Log Message:
-----------
Allow for @sc{} to properly uppercase as requested by Baptiste Daroussin--thanks!
Modified Files:
--------------
texi2mdoc:
extern.h
main.c
util.c
Revision Data
-------------
Index: extern.h
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/extern.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -Lextern.h -Lextern.h -u -p -r1.23 -r1.24
--- extern.h
+++ extern.h
@@ -404,6 +404,7 @@ struct texi {
int seenvs; /* newline has been Pp'd */
int ign; /* if >0, don't print anything */
int literal; /* if >0, literal context */
+ int uppercase; /* if >0, uppercase */
};
#define BUF(_p) ((_p)->files[(_p)->filepos - 1].map)
Index: util.c
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/util.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -Lutil.c -Lutil.c -u -p -r1.22 -r1.23
--- util.c
+++ util.c
@@ -184,7 +184,10 @@ texiputchar(struct texi *p, char c)
if ('\'' == c && 0 == p->outcol)
fputs("\\&", p->outfile);
- fputc(c, p->outfile);
+ if (p->uppercase)
+ fputc(toupper((unsigned int)c), p->outfile);
+ else
+ fputc(c, p->outfile);
if ('\\' == c)
fputc('e', p->outfile);
p->seenvs = 0;
@@ -210,7 +213,12 @@ texiputchars(struct texi *p, const char
fputs("\\&", p->outfile);
if ('\'' == *s && 0 == p->outcol)
fputs("\\&", p->outfile);
- p->outcol += fputs(s, p->outfile);
+ if (p->uppercase)
+ for ( ; '\0' != *s; s++)
+ p->outcol += fputc(toupper
+ ((unsigned int)*s), p->outfile);
+ else
+ p->outcol += fputs(s, p->outfile);
p->seenvs = 0;
}
@@ -616,7 +624,7 @@ texicmd(const struct texi *p, size_t pos
return(TEXICMD__MAX);
/* Alphabetic commands are special. */
- if ( ! isalpha((unsigned char)BUF(p)[pos])) {
+ if ( ! isalpha((unsigned int)BUF(p)[pos])) {
if ((*end = pos + 1) == BUFSZ(p))
return(TEXICMD__MAX);
for (i = 0; i < TEXICMD__MAX; i++) {
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -Lmain.c -Lmain.c -u -p -r1.57 -r1.58
--- main.c
+++ main.c
@@ -268,7 +268,7 @@ static const struct texitok __texitoks[T
{ doaccent, "ringaccent", 10 }, /* TEXICMD_RINGACCENT */
{ doinline, "samp", 4 }, /* TEXICMD_SAMP */
{ doinline, "sansserif", 9 }, /* TEXICMD_SANSSERIF */
- { dobracket, "sc", 2 }, /* TEXICMD_SC */
+ { doinline, "sc", 2 }, /* TEXICMD_SC */
{ dosection, "section", 7 }, /* TEXICMD_SECTION */
{ dovalue, "set", 3 }, /* TEXICMD_SET */
{ doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */
@@ -725,13 +725,21 @@ doinline(struct texi *p, enum texicmd cm
}
if (NULL == macro || p->literal || TEXILIST_TABLE == p->list) {
+ if (TEXICMD_SC == cmd)
+ p->uppercase++;
parsebracket(p, pos, 0);
+ if (TEXICMD_SC == cmd)
+ p->uppercase--;
return;
}
teximacroopen(p, macro);
p->seenws = 0;
+ if (TEXICMD_SC == cmd)
+ p->uppercase++;
parsebracket(p, pos, 0);
+ if (TEXICMD_SC == cmd)
+ p->uppercase--;
texipunctuate(p, pos);
teximacroclose(p);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-02 18:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 18:13 texi2mdoc: Allow for @sc{} to properly uppercase as requested by kristaps
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).