add explicit width to img and fix render repetition bug when

markup.start is 0
This commit is contained in:
Aravinth Manivannan 2021-11-02 22:44:35 +05:30
parent 7fdf255678
commit 8e9b070d46
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 5 additions and 6 deletions

View file

@ -1,10 +1,7 @@
<. let metadata = p.metadata.as_ref().unwrap(); .> <. let metadata = p.metadata.as_ref().unwrap(); .>
<!-- TODO deal with layouts
height="<.# metadata.original_height.>"
width="<.# metadata.original_width.>"
-->
<figure> <figure>
<img src="<.= crate::V1_API_ROUTES.proxy.get_medium_asset(&metadata.id).>" /> <img
width="<.= metadata.original_width.as_ref().unwrap() .>"
src="<.= crate::V1_API_ROUTES.proxy.get_medium_asset(&metadata.id).>" />
<figcaption><.= p.text .></figcaption> <figcaption><.= p.text .></figcaption>
</figure> </figure>

View file

@ -4,7 +4,9 @@
<.} else {.> <.} else {.>
<. let mut cur: usize = 0; .> <. let mut cur: usize = 0; .>
<. for markup in &p.markups {.> <. for markup in &p.markups {.>
<. if markup.start != 0 {.>
<.= &p.text.substring(cur, (markup.start -1) as usize) .> <.= &p.text.substring(cur, (markup.start -1) as usize) .>
<.}.>
<. cur = (markup.end + 1) as usize; .> <. cur = (markup.end + 1) as usize; .>
<. let text = &p.text.slice(markup.start as usize..markup.end as usize); .> <. let text = &p.text.slice(markup.start as usize..markup.end as usize); .>
<. if markup.type_ == "A" {.> <. if markup.type_ == "A" {.>