diff options
author | June McEnroe <june@causal.agency> | 2020-04-23 17:39:24 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-04-23 17:39:24 -0400 |
commit | dfaf5cc9043b8bce6f1edfd55a6bf696ce445052 (patch) | |
tree | 5705b0dd73c0ac2adb68158827755457431f15c1 | |
parent | Add default.html (diff) | |
download | bubger-dfaf5cc9043b8bce6f1edfd55a6bf696ce445052.tar.gz bubger-dfaf5cc9043b8bce6f1edfd55a6bf696ce445052.zip |
Wrap quoted lines in <q>
-rw-r--r-- | default.html | 6 | ||||
-rw-r--r-- | html.c | 23 |
2 files changed, 15 insertions, 14 deletions
diff --git a/default.html b/default.html index 6954dea..f32d808 100644 --- a/default.html +++ b/default.html @@ -64,6 +64,12 @@ ul.cc::before { pre { white-space: pre-wrap; } +pre q::before, pre q::after { + content: none; +} +pre q { + color: navy; +} pre del { text-decoration: none; color: red; diff --git a/html.c b/html.c index 200032a..fe2f6db 100644 --- a/html.c +++ b/html.c @@ -204,11 +204,7 @@ static int htmlInlineAttrs(FILE *file, const struct BodyPart *part) { return 0; } -static bool isPatch(const char *content) { - return !strncmp(content, "---\n", 4) || strstr(content, "\n---\n"); -} - -static int htmlPatch(FILE *file, const char *content) { +static int htmlHighlight(FILE *file, const char *content) { int error = 0; size_t cap = 0; char *buf = NULL; @@ -245,6 +241,10 @@ static int htmlPatch(FILE *file, const char *content) { error = templateRender( file, TEMPLATE(<ins>[line]</ins>), vars, escapeXML ); + } else if (buf[0] == '>') { + error = templateRender( + file, TEMPLATE(<q>[line]</q>), vars, escapeXML + ); } else { error = escapeXML(file, buf); } @@ -255,17 +255,12 @@ static int htmlPatch(FILE *file, const char *content) { } int htmlInline(FILE *file, const struct BodyPart *part, const char *content) { - int error = 0 + return 0 || templateRender(file, TEMPLATE(<pre), NULL, NULL) || htmlInlineAttrs(file, part) - || templateRender(file, TEMPLATE(>), NULL, NULL); - if (error) return error; - if (isPatch(content)) { - error = htmlPatch(file, content); - } else { - error = escapeXML(file, content); - } - return error || templateRender(file, TEMPLATE(</pre>), NULL, NULL); + || templateRender(file, TEMPLATE(>), NULL, NULL) + || htmlHighlight(file, content) + || templateRender(file, TEMPLATE(</pre>), NULL, NULL); } int htmlAttachmentOpen(FILE *file) { |