diff options
author | Nicholas Johnson <nick@nicksphere.ch> | 2022-01-18 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicksphere.ch> | 2022-01-18 00:00:00 +0000 |
commit | aa3d1f599d1338eea7f2e1f7b3a935082ff6bee4ab22e5e2ea2a69d0143a7f4f (patch) | |
tree | 7e9bbcc6eceb713dd1689f8e4d3eab66f30ec272ab62954953ddebefb5c4e0b7 | |
parent | 81ce175def12590fb7b93e825fa2fe7ef05338373d2892e7101a0cd65ea9e849 (diff) |
Use escape_text_add_tags() everywhere I can for consistency
-rw-r--r-- | src/gemini2html.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gemini2html.c b/src/gemini2html.c index 52ddd72..565250f 100644 --- a/src/gemini2html.c +++ b/src/gemini2html.c @@ -223,7 +223,7 @@ char* convert_h1_line(const char* line, const size_t size) { size_t pos = 1; skip_whitespace(line, &pos); - if (line[pos] == '\0') return strdup("<h1></h1>\n"); + if (line[pos] == '\0') return escape_text_add_tags("<h1>", "", "</h1>", 0); else return escape_text_add_tags("<h1>", line + pos, "</h1>", size - pos); } @@ -231,7 +231,7 @@ char* convert_h2_line(const char* line, const size_t size) { size_t pos = 2; skip_whitespace(line, &pos); - if (line[pos] == '\0') return strdup("<h2></h2>\n"); + if (line[pos] == '\0') return escape_text_add_tags("<h2>", "", "</h2>", 0); else return escape_text_add_tags("<h2>", line + pos, "</h2>", size - pos); } @@ -239,7 +239,7 @@ char* convert_h3_line(const char* line, const size_t size) { size_t pos = 3; skip_whitespace(line, &pos); - if (line[pos] == '\0') return strdup("<h3></h3>\n"); + if (line[pos] == '\0') return escape_text_add_tags("<h3>", "", "</h3>", 0); else return escape_text_add_tags("<h3>", line + pos, "</h3>", size - pos); } @@ -247,7 +247,7 @@ char* convert_ul_line(const char* line, const size_t size) { size_t pos = 1; skip_whitespace(line, &pos); - if (line[pos] == '\0') return strdup("<li></li>\n"); + if (line[pos] == '\0') return escape_text_add_tags("<li>", "", "</li>", 0); else return escape_text_add_tags("<li>", line + pos, "</li>", size - pos); } @@ -255,7 +255,7 @@ char* convert_quote_line(const char* line, const size_t size) { size_t pos = 1; skip_whitespace(line, &pos); - if (line[pos] == '\0') return strdup("\n"); + if (line[pos] == '\0') return escape_text_add_tags("", "", "", 0); else return escape_text_add_tags("", line + pos, "", size - pos); } |