fix repetition bug

when text contained markup data, unprocessed string was being printed
before all the markup had been processed. This caused a repetition bug.
This commit is contained in:
Aravinth Manivannan 2021-11-02 11:59:13 +05:30
parent 02e158289f
commit 260dcb97e1
Signed by untrusted user: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -6,7 +6,8 @@
<. for markup in &p.markups {.>
<.= &p.text.substring(cur, (markup.start -1) as usize) .>
<. cur = (markup.end + 1) as usize; .>
<. let text = &p.text.substring(markup.start as usize, markup.end as usize); .>
<. let text = &p.text.slice(markup.start as usize..markup.end as usize); .>
<. println!("{}", text); .>
<. if markup.type_ == "A" {.>
<. if let Some(anchor_type) = &markup.anchor_type {.>
<. if anchor_type == "LINK" {.>
@ -33,10 +34,10 @@
<. log::error!("unknown markup.type_: {:?} post id {}", markup.type_, id); .>
<span><.= text .></span>
<.}.>
<.}.>
<. if cur < p.text.len() {.>
<.= p.text.slice(cur..) .>
<.}.>
<. if cur < p.text.len() {.>
<.= p.text.slice(cur..) .>
<.}.>
<.}.>