From 8e9b070d46078a3f57cfa030685c061df1d194ee Mon Sep 17 00:00:00 2001 From: realaravinth Date: Tue, 2 Nov 2021 22:44:35 +0530 Subject: [PATCH] add explicit width to img and fix render repetition bug when markup.start is 0 --- templates/img.html | 9 +++------ templates/p.html | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/templates/img.html b/templates/img.html index eb56453..f8ed2ec 100644 --- a/templates/img.html +++ b/templates/img.html @@ -1,10 +1,7 @@ <. let metadata = p.metadata.as_ref().unwrap(); .> - -
- +
<.= p.text .>
diff --git a/templates/p.html b/templates/p.html index 87fd397..77d0851 100644 --- a/templates/p.html +++ b/templates/p.html @@ -4,7 +4,9 @@ <.} else {.> <. let mut cur: usize = 0; .> <. for markup in &p.markups {.> + <. if markup.start != 0 {.> <.= &p.text.substring(cur, (markup.start -1) as usize) .> + <.}.> <. cur = (markup.end + 1) as usize; .> <. let text = &p.text.slice(markup.start as usize..markup.end as usize); .> <. if markup.type_ == "A" {.>