nihdoc

WIP markup parser (txt -> html)
git clone git://git.alexkarle.com.com/blag
Log | Files | Refs | README | LICENSE

commit db1d1cb328a53fa466c9f53e8c84e0f2b8befca3 (patch)
parent 8566a933a3acda2e6beecebbc8f6e558993bf354
Author: Alex Karle <alex@alexkarle.com>
Date:   Tue, 21 Dec 2021 00:09:22 -0500

Remove leading newline in <pre> blocks

Since we're in the <pre> block, the newline matters! It's less
pretty HTML, but otherwise we end up with an extraneous newline
at the start of the code block!

Diffstat:
Mblag.c | 2+-
Mtest/big.html | 6++----
2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/blag.c b/blag.c @@ -239,7 +239,7 @@ int parse() { case '>': if (s.in == NONE) { s.in = c == '>' ? QUOTE : CODE; - printf("%s\n", c == '>' ? "<blockquote>" : "<pre><code>"); + printf("%s", c == '>' ? "<blockquote>" : "<pre><code>"); } else if (s.lastc == '\n' && c == (s.in == CODE ? '\t' : '>')) { /* no op */ } else { diff --git a/test/big.html b/test/big.html @@ -54,12 +54,10 @@ This is a <em>paragraph</em> <strong>dangit</strong> with links to <a href="https://alexkarle.com">https://alexkarle.com</a> and my <a href="gopher://alexkarle.com">gopherhole</a>. </p> -<blockquote> - this is a block quote +<blockquote> this is a block quote that wraps! </blockquote> -<pre><code> -$ this is a code block +<pre><code>$ this is a code block $ *bold* and _italics_ and `code` have no effect! $ git status </code></pre>