diff --git a/gemini.c b/gemini.c index 091b550..c0b3461 100644 --- a/gemini.c +++ b/gemini.c @@ -607,7 +607,7 @@ static int rndr(struct lowdown_buf *ob, struct lowdown_metaq *mq, struct gemini *st, const struct lowdown_node *n) { - const struct lowdown_node *child, *prev; + const struct lowdown_node *child, *prev, *nn; struct link *l; void *pp; struct lowdown_buf *tmpbuf; @@ -677,13 +677,31 @@ rndr(struct lowdown_buf *ob, struct lowdown_metaq *mq, break; case LOWDOWN_DEFINITION_TITLE: case LOWDOWN_HRULE: - case LOWDOWN_LINEBREAK: case LOWDOWN_LISTITEM: case LOWDOWN_META: case LOWDOWN_TABLE_ROW: if (!rndr_buf_vspace(st, ob, 1)) return 0; break; + case LOWDOWN_LINEBREAK: + if (!rndr_buf_vspace(st, ob, 1)) + return 0; + + /* + * A linebreak is special if invoked within a + * blockquote, because it means we want to output a + * newline but also continue outputting the blockquote + * marker. + */ + + for (nn = n->parent; nn != NULL; nn = nn->parent) + if (nn->type == LOWDOWN_BLOCKQUOTE) { + if (!HBUF_PUTSL(ob, "> ")) + return 0; + st->last_blank = 0; + break; + } + break; case LOWDOWN_IMAGE: case LOWDOWN_LINK: case LOWDOWN_LINK_AUTO: diff --git a/regress/blockquote-linebreaks.gemini b/regress/blockquote-linebreaks.gemini new file mode 100644 index 0000000..e84a237 --- /dev/null +++ b/regress/blockquote-linebreaks.gemini @@ -0,0 +1,5 @@ +> this is a +> blockquote +> with +> two spaces at the end of +> ever line diff --git a/regress/blockquote-linebreaks.html b/regress/blockquote-linebreaks.html new file mode 100644 index 0000000..9f7f4c1 --- /dev/null +++ b/regress/blockquote-linebreaks.html @@ -0,0 +1,7 @@ +
+diff --git a/regress/blockquote-linebreaks.md b/regress/blockquote-linebreaks.md new file mode 100644 index 0000000..e73499b --- /dev/null +++ b/regress/blockquote-linebreaks.md @@ -0,0 +1,7 @@ + +> this is a +> blockquote +> with +> two spaces at the end of +> ever line + diff --git a/regress/blockquote-linebreaks.term b/regress/blockquote-linebreaks.term new file mode 100644 index 0000000..55e4a71 --- /dev/null +++ b/regress/blockquote-linebreaks.term @@ -0,0 +1,5 @@ + [93m | [0mthis is a + [93m | [0mblockquote + [93m | [0mwith + [93m | [0mtwo spaces at the end of + [93m | [0mever line diff --git a/regress/simple.gemini b/regress/simple.gemini index 40d051c..837e1d9 100644 --- a/regress/simple.gemini +++ b/regress/simple.gemini @@ -26,20 +26,23 @@ Here’s a numbered list: Note again how the actual text starts at 4 columns in (4 characters from the left side). Here’s a code sample: -```# Let me re-iterate ... +``` +# Let me re-iterate ... for i in 1 .. 10 { do-something(i) } ``` As you probably guessed, indented 4 spaces. By the way, instead of indenting the block, you can use delimited blocks, if you like: -```define foobar() { +``` +define foobar() { print "Welcome to flavor country!"; } ``` (which makes copying & pasting easier). You can optionally mark the delimited block for Pandoc to syntax highlight it: -```import time +``` +import time # Quick, count to ten! for i in range(10): # (but not *too* quick) @@ -61,7 +64,8 @@ Now a nested list: 3. Dump everything in the pot and follow this algorithm: -```find wooden spoon +``` +find wooden spoon uncover pot stir cover pot @@ -82,7 +86,7 @@ Here’s a link to a website[a], to a local doc[b], and to a section heading in Tables can look like this: -``` +``` size | material | color -----|-------------|------------- 9 | leather | brownthis is a
+
+blockquote
+with
+two spaces at the end of
+ever line