Enable line-breaking blockquotes (prefaced by |)

TODO: No indentation on first line
This commit is contained in:
David Baer
2018-07-17 15:56:58 -04:00
parent 44b2187d76
commit 95834f00ff
7 changed files with 57 additions and 13 deletions

View File

@@ -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 } } ;