Commit Diff


commit - 27dce34fb57e3639875005f21f7ed651fad9c2db
commit + 1575cb8a2cf436e843a63afb9370ef059bedafc5
blob - d2e022296c4631c71eaf44cf3904ce86277840b0
blob + de71910054e2c42f0a2ecfa08b90556f4731d53c
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,7 @@
+2021-07-07  Omar Polo  <op@omarpolo.com>
+
+	* gemtext.c (detect_line_type): fix styling of empty lines inside a pre block
+
 2021-07-06  Omar Polo  <op@omarpolo.com>
 
 	* parser.c (parser_foreach_line): deal with BOM
blob - ffff9bad5b5abbed54e6cd22bc6c0d1d5350ddbf
blob + bef15e6af5060568c77da82896559fc8e06c6f17
--- gemtext.c
+++ gemtext.c
@@ -310,9 +310,6 @@ parse_pre_end(struct parser *p, enum line_type t, cons
 static inline enum line_type
 detect_line_type(const char *buf, size_t len, int in_pre)
 {
-	if (len == 0)
-		return LINE_TEXT;
-
 	if (in_pre) {
 		if (len >= 3 &&
 		    buf[0] == '`' && buf[1] == '`' && buf[2] == '`')
@@ -321,6 +318,9 @@ detect_line_type(const char *buf, size_t len, int in_p
 			return LINE_PRE_CONTENT;
 	}
 
+	if (len == 0)
+		return LINE_TEXT;
+
 	switch (*buf) {
 	case '*': return LINE_ITEM;
 	case '>': return LINE_QUOTE;