[writan] add emphasis [format.c] comply with new writan
This commit is contained in:
parent
e06ad22217
commit
2ddd255454
7
format.c
7
format.c
|
@ -283,6 +283,9 @@ format(FILE *input, FILE *output)
|
|||
{
|
||||
char c, lastc = '\n';
|
||||
|
||||
char *em_tags[] = {"<em>", "</em>"};
|
||||
int in_em = 0; /* boolean used as index, therefore it's an int */
|
||||
|
||||
while ((c = fgetc(input)) != EOF) {
|
||||
if (c == '\\') { /* escaped character */
|
||||
emit_sanitized_char(fgetc(input), output);
|
||||
|
@ -295,6 +298,10 @@ format(FILE *input, FILE *output)
|
|||
fprintf(output, "<p>");
|
||||
emit_link(input, output);
|
||||
}
|
||||
else if (c == '_') {
|
||||
fprintf(output, "%s", em_tags[in_em]);
|
||||
in_em = !in_em;
|
||||
}
|
||||
else if (c == '`') { /* code block */
|
||||
if (fgetc(input) == '`')
|
||||
emit_code_block(lastc, input, output);
|
||||
|
|
|
@ -32,3 +32,5 @@ You can inline ``code`` blocks.
|
|||
|
||||
> Some profound text someone said once. This is a blockquote. It can occupy
|
||||
> multiple lines.
|
||||
|
||||
One can mark emphasis by surrounding a word with _underscores_.
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
> [Lisp] has assisted a number of our most gifted fellow humans in thinking
|
||||
> previously impossible thoughts.
|
||||
|
||||
**** - Edsger Dijkstra
|
||||
_- Edsger Dijkstra_
|
||||
|
||||
Lisp is a family of {programming-languages} which uses s-expressions for
|
||||
expressing both source code and data. Its syntax is fully parenthesized and
|
||||
|
|
Loading…
Reference in New Issue