Mercurial > hg > mlmmj
changeset 817:9caf15c6ae31
Skip lines with directives which end up being whitespace-only.
author | Ben Schmidt |
---|---|
date | Tue, 17 Jan 2012 14:14:21 +1100 |
parents | ed446ead03bd |
children | 24bf028aa8a0 |
files | ChangeLog src/prepstdreply.c |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jan 17 14:14:16 2012 +1100 +++ b/ChangeLog Tue Jan 17 14:14:21 2012 +1100 @@ -1,3 +1,4 @@ + o Automatically skip lines with only whitespace and directives in list texts o Add support for conditionals in list texts o Add %wrap% and %wrap W% formatting directives o Add %digestthreads%, %gatekeepers%, %listsubs%, %digestsubs%, %nomailsubs%,
--- a/src/prepstdreply.c Tue Jan 17 14:14:16 2012 +1100 +++ b/src/prepstdreply.c Tue Jan 17 14:14:21 2012 +1100 @@ -950,6 +950,7 @@ char *prev = NULL; int incision; size_t len, i; + int directive; for (;;) { while (txt->src != NULL) { @@ -1032,6 +1033,7 @@ incision = txt->skip != NULL ? pos - line : -1; spc = NULL; + directive = 0; while (*pos != '\0') { if (txt->wrapwidth != 0 && len > txt->wrapwidth && txt->skip == NULL) break; @@ -1062,6 +1064,7 @@ * to process, so continue straight away. */ continue; } else if (*pos == '%') { + directive = 1; handle_directive(txt, &line, &pos, listdir); len = pos - line; spc = NULL; @@ -1155,6 +1158,14 @@ tmp = mystrdup(line); myfree(line); line = tmp; + } else if (directive) { + pos = line; + while (*pos == ' ' || *pos == '\t') pos++; + if (*pos == '\0') { + /* Omit whitespace-only line with directives */ + myfree(line); + continue; + } } if (txt->src->suffix != NULL) {