commit - 4d930a2a591067b00a784d473d6057852c0db015
commit + ceb3f79c2c41bff56bd6e889c994f4dd0f50b4ed
blob - 247227d68b9b71846c482dfc9b1561bb73d928ee
blob + 12121d55c13c8b7a7fed84a1d5d9ac1da19d43ce
--- fragments.tmpl
+++ fragments.tmpl
</figure>
{{ end }}
+{{ define tp_pre_open(struct template *tp, const char *label) }}
+<figure>
+ {{ if label && *label != '\0' }}
+ <figcaption>{{ label }}</figcaption>
+ {{ end }}
+ <pre>
+{{ end }}
+
+{{ define tp_pre_close(struct template *tp) }}
+ </pre>
+</figure>
+{{ end }}
+
{{ define tp_error(struct template *tp, int code, const char *reason) }}
{!
char scode[32];
blob - 7b231a37a5d7a9b18b2f512531ade949da367f18
blob + 780ecc4358beca7c292d1792d131340fec64f4aa
--- galileo.h
+++ galileo.h
int tp_head(struct template *, const char *, const char *);
int tp_foot(struct template *);
int tp_figure(struct template *, const char *, const char *);
+int tp_pre_open(struct template *, const char *);
+int tp_pre_close(struct template *);
int tp_error(struct template *, int, const char *);
int tp_inputpage(struct template *, const char *);
blob - 2a6a5d4605f6a2ed7b0287124aee17c8f761a728
blob + 5dee18352a5f4d3df78485a655871e955d224508
--- proxy.c
+++ proxy.c
if (clt->clt_translate & TR_PRE) {
if (!strncmp(line, "```", 3)) {
clt->clt_translate &= ~TR_PRE;
- return (clt_puts(clt, "</pre>"));
+ return (tp_pre_close(clt->clt_tp));
}
if (tp_htmlescape(clt->clt_tp, line) == -1)
/* pre opening */
if (!strncmp(line, "```", 3)) {
+ line += 3;
+ line += strspn(line, " \t");
+
clt->clt_translate |= TR_PRE;
- return (clt_puts(clt, "<pre>"));
+ return (tp_pre_open(clt->clt_tp, line));
}
/* citation block */
return;
} else if (status == 0) {
if (clt->clt_translate & TR_PRE) {
- if (clt_puts(clt, "</pre>"))
+ if (tp_pre_close(clt->clt_tp))
return;
clt->clt_translate &= ~TR_PRE;
}