summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-11-01 01:12:40 +0000
committerubq323 <ubq323@ubq323.website>2024-11-01 01:12:40 +0000
commit456fce748b6a9e4e41a5508621a002ceb3952416 (patch)
treeae138b81a1749d2dedc7af7b36275822eeb8b9e0
parentd5e53ee2a2b83adf91a0c3bbbc02c450b6747d59 (diff)
hr,fix skip last line
-rw-r--r--init.lua12
1 files changed, 10 insertions, 2 deletions
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)