[format] replace fputc calls with emit_sanitized_char
This commit is contained in:
parent
5e7662408c
commit
1d11c03fc1
1
TODO.org
1
TODO.org
|
@ -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).
|
||||
|
|
6
format.c
6
format.c
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue