Enable line-breaking blockquotes (prefaced by |)
TODO: No indentation on first line
This commit is contained in:
12
src/format.c
12
src/format.c
@@ -45,6 +45,7 @@ typedef enum {
|
||||
TOK_STAR,
|
||||
TOK_REF,
|
||||
TOK_URL,
|
||||
TOK_BREAK,
|
||||
/*
|
||||
TOK_DASH,
|
||||
TOK_OPEN_DOUBLE_QUOTE,
|
||||
@@ -115,6 +116,11 @@ nextToken(Tokenizer tokenizer) {
|
||||
result.toktype = TOK_STAR;
|
||||
result.toktext = NULL;
|
||||
return result;
|
||||
} else if (ch == '\n') {
|
||||
utf8Advance(tokenizer);
|
||||
result.toktype = TOK_BREAK;
|
||||
result.toktext = NULL;
|
||||
return result;
|
||||
} else if (greekChar(ch)) {
|
||||
while ((ch != 0) &&
|
||||
(greekChar(ch) || (ch == ' ') || (ch == ',') || (ch == '.'))) {
|
||||
@@ -158,7 +164,7 @@ nextToken(Tokenizer tokenizer) {
|
||||
result.toktext = strndup(tokenizer->txt + startIndex, endIndex - startIndex);
|
||||
return result;
|
||||
} else if (latinChar(ch)) {
|
||||
while ((ch != 0) && latinChar(ch) && (ch != '*')) {
|
||||
while ((ch != 0) && latinChar(ch) && (ch != '*') && (ch != '\n')) {
|
||||
utf8Advance(tokenizer);
|
||||
ch = utf8CharAt(tokenizer);
|
||||
if (ch == '^') {
|
||||
@@ -206,6 +212,10 @@ int formatText(const char* txt, FormatElement** dst, CitationRecordQueue* citati
|
||||
REINIT_QUEUE(formatElementQ);
|
||||
em = 1;
|
||||
}
|
||||
} else if (tok.toktype == TOK_BREAK) {
|
||||
FormatElement elt = { .elementType = FORMAT_BR, .elementContentLength = 0,
|
||||
.elementContent = { .textContent = NULL } };
|
||||
APPEND_QUEUE(FormatElementQueue, formatElementQ, elt);
|
||||
} else {
|
||||
FormatElementType t;
|
||||
FormatElement elt = { .elementContent = { .textContent = tok.toktext } } ;
|
||||
|
||||
Reference in New Issue
Block a user