<. if p.markups.is_empty() {.>
<.= p.text .>
<.} 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" {.>
<. if let Some(anchor_type) = &markup.anchor_type {.>
<. if anchor_type == "LINK" {.>
<.= text .>
<.} else if anchor_type == "USER" {.>
<.= text .>
<.} else {.>
<. log::error!("unknown markup.anchor_type: {:?} post id {}", anchor_type, id); .>
<.= text .>
<.}.>
<.}.>
<.} else if markup.type_ == "EM" {.>
<.= text .>
<.} else if markup.type_ == "STRONG" {.>
<.= text .>
<.} else if markup.type_ == "CODE" {.>
<.= text .>
<.} else {.>
<. log::error!("unknown markup.type_: {:?} post id {}", markup.type_, id); .>
<.= text .>
<.}.>
<.}.>
<. if cur < p.text.len() {.>
<.= p.text.slice(cur..) .>
<.}.>
<.}.>