[format] replace fputc calls with emit_sanitized_char

This commit is contained in:
opfez 2021-08-06 21:01:46 +02:00
parent 5e7662408c
commit 1d11c03fc1
3 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,6 @@ Writan:
- Image support.
- Additional error handling in the formatter.
- Remove extraneous <p> tags in output.
- Swap fputc for emit_sanitized_char everywhere.
Pages:
- Add a category theory page (more general, math).

View File

@ -69,7 +69,7 @@ emit_heading(FILE *input, FILE *output)
char c;
while ((c = fgetc(input)) != '\n')
fputc(c, output);
emit_sanitized_char(c, output);
fprintf(output, "</h%d>", level);
@ -226,7 +226,7 @@ emit_code_block(FILE *input, FILE *output)
while ((c = fgetc(input)) != ']') {
if (c == EOF)
die("Unexpected EOF while converting code block.");
fputc(c, output);
emit_sanitized_char(c, output);
}
fprintf(output, "</pre>");
@ -264,7 +264,7 @@ format(FILE *input, FILE *output)
while ((c = fgetc(input)) != EOF) {
if (c == '\\') { /* escaped character */
fputc(fgetc(input), output);
emit_sanitized_char(fgetc(input), output);
}
else if (c == '*' && lastc == '\n') { /* heading */
emit_heading(input, output);

View File

@ -22,3 +22,6 @@ Underneath is a code block.
(define (frob x)
(frobnicate x))
]
> Some profound text someone said once. This is a blockquote. It can occupy
> multiple lines.