From 1acb0d8394e38bd030f358481228e416567e7531 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Mon, 20 Dec 2021 01:10:38 -0500 Subject: [PATCH] Remove extra newlines from lists/list items I'm not sure why I convinced myself these were necessary... it *is* necessary to render the newlines in the list item content (because the spaces are NOT rendered -> no smush), but it's not necessary to have newlines between the tags :) Saving internet bandwidth one newline at a time! --- blag.c | 8 ++++---- test/big.html | 12 ------------ test/listwrap.html | 15 +++++++++++++++ test/listwrap.txt | 6 ++++++ test/ulist.html | 10 ---------- 5 files changed, 25 insertions(+), 26 deletions(-) create mode 100644 test/listwrap.html create mode 100644 test/listwrap.txt diff --git a/blag.c b/blag.c index 48a8194..aecee58 100644 --- a/blag.c +++ b/blag.c @@ -54,14 +54,14 @@ void putesc(int c) { void newlist(state *s) { s->in = LIST; s->previndent = s->indent; - printf("\n<%s>\n
  • \n", s->ol ? "ol" : "ul"); + printf("<%s>\n
  • \n", s->ol ? "ol" : "ul"); s->listdepth++; } int endlist(state *s) { s->in = LIST; s->previndent = s->indent; - printf("\n
  • \n\n", s->ol ? "ol" : "ul"); + printf("\n\n", s->ol ? "ol" : "ul"); return --s->listdepth; } @@ -183,10 +183,10 @@ int parse() { newlist(&s); } else if (s.previndent > s.indent) { endlist(&s); - printf("\n\n
  • \n"); + printf("
  • \n
  • \n"); } else { s.in = LIST; - printf("\n
  • \n
  • \n"); + printf("
  • \n
  • \n"); } } } else { diff --git a/test/big.html b/test/big.html index 4cf19ae..8c43f9f 100644 --- a/test/big.html +++ b/test/big.html @@ -13,52 +13,40 @@ This is an example blag file!

    Sub Header 2

    Woah a third header?

    -

    This is a new paragraph that wraps nicely

    -
    1. This is a numbered list -
    2. Cool, huh? -
      1. yes! -
      -

    diff --git a/test/listwrap.html b/test/listwrap.html new file mode 100644 index 0000000..da339b2 --- /dev/null +++ b/test/listwrap.html @@ -0,0 +1,15 @@ +

    +

    +cool! +

    diff --git a/test/listwrap.txt b/test/listwrap.txt new file mode 100644 index 0000000..67d31fe --- /dev/null +++ b/test/listwrap.txt @@ -0,0 +1,6 @@ +- this is a list + with a wrapped item + - and a subitem + that wraps too! + +cool! diff --git a/test/ulist.html b/test/ulist.html index adbafd6..75ffdf0 100644 --- a/test/ulist.html +++ b/test/ulist.html @@ -1,36 +1,26 @@ - - -- libgit2 1.1.1