From 456fce748b6a9e4e41a5508621a002ceb3952416 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 1 Nov 2024 01:12:40 +0000 Subject: hr,fix skip last line --- init.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index e393b13..593e917 100644 --- a/init.lua +++ b/init.lua @@ -59,10 +59,16 @@ local function mode_heading(S) S:emit(html.tag('h'..level, prose(S,line))) end +local function mode_hr(S) + local line = S:line() + S:emit(html.T.hr"") +end + local mode_patterns = { { "^```", mode_code }, { "^*", mode_list }, { "^#", mode_heading }, + { "^%-%-%-", mode_hr }, } local function match_mode_pattern(S, line) @@ -75,8 +81,9 @@ end local function mode_paragraphs(S) local para = "" local function finish() - if para:match("%S") then - S:emit(T.p(prose(S,para))) + local processed = prose(S, para) + if tostring(html.html(processed)):match("%S") then + S:emit(T.p(processed)) end para = "" end @@ -93,6 +100,7 @@ local function mode_paragraphs(S) finish() end end + finish() end local function split_lines(text) -- cgit v1.2.3