libmedium/templates/post.html

91 lines
3.4 KiB
HTML
Raw Normal View History

2021-10-31 23:26:15 +05:30
<!DOCTYPE html>
<html lang="en">
<head>
2021-11-07 13:22:10 +05:30
<. include!("./post_meta.html"); .>
2021-10-31 23:26:15 +05:30
</head>
<body>
2022-01-16 13:20:44 +05:30
<. let mut open_list = false ; .>
2021-10-31 23:26:15 +05:30
<main class="container">
2021-11-02 13:40:13 +05:30
<h1><.= data.title .></h1>
2021-10-31 23:26:15 +05:30
<p class="meta">
2021-11-02 13:40:13 +05:30
<a class="author" href="https://medium.com/u/<.= data.creator.id .>" rel="noreferrer">
<img
src="https://miro.medium.com/<.= data.creator.image_id .>"
class="author__photo"
alt="<.= data.creator.name .>"
/>
2021-10-31 23:26:15 +05:30
<.= data.creator.name .></a
>
2022-02-09 23:38:04 +05:30
on <.= &date .> &#183; <.= reading_time .> min read &#183;&nbsp;
<a class="medium__source"
href="https://medium.com/<.= data.creator.id .>/<.= data.unique_slug .>"
rel="noreferrer"> Open post in medium.com</a>
2021-10-31 23:26:15 +05:30
</p>
<article>
2021-11-04 23:51:59 +05:30
<. let paragraphs = &data.content.body_model.paragraphs; .>
2021-10-31 23:26:15 +05:30
<. for (pindex, p) in paragraphs.iter().enumerate() {.>
2022-01-16 13:20:44 +05:30
<. if open_list && p.type_ != "OLI" { .>
</ol>
<. } .>
2021-11-02 13:40:13 +05:30
<. if pindex == 0 && p.type_ == "H3" {.>
2021-10-31 23:26:15 +05:30
<. continue; .>
<.}.>
2021-11-02 13:40:13 +05:30
<. if p.type_ == "IMG" {.>
2021-10-31 23:26:15 +05:30
<. include!("./img.html"); .>
<.} else if p.type_ == "P" {.>
<p><. include!("./_markup.html"); .></p>
2022-01-05 11:41:30 +05:30
<.} else if p.type_ == "BQ" {.>
<blockquote><. include!("./_markup.html"); .></blockquote>
<.} else if p.type_ == "H2" {.>
<h2><.= p.text .></h2>
<.} else if p.type_ == "H3" {.>
<h3><.= p.text .></h3>
<.} else if p.type_ == "H4" {.>
<h4><.= p.text .></h4>
<.} else if p.type_ == "H5" {.>
<h5><.= p.text .></h5>
<.} else if p.type_ == "H6" {.>
<h6><.= p.text .></h6>
2021-11-02 21:04:02 +05:30
<.} else if p.type_ == "IFRAME" {.>
<. let src = &p.iframe.as_ref().unwrap().media_resource.as_ref().unwrap().href; .>
<. if src.contains("gist.github.com"){.>
2021-11-04 23:51:59 +05:30
<. include!("./gist_insert.html"); .>
<!--
<iframe src="<.#= crate::V1_API_ROUTES.proxy.get_gist(&src) .>" frameborder="0"></iframe>
<a href="<.= src .>">Click here to open gist on GitHub</a>
2021-11-04 23:51:59 +05:30
-->
<.} else {.>
2021-11-02 21:04:02 +05:30
<iframe src="<.= src .>" frameborder="0"></iframe>
<.}.>
2022-01-16 13:20:44 +05:30
<.} else if p.type_ == "OLI" {.>
<. if !open_list { .>
<. open_list = true;.>
<ol>
<. } .>
<li><.= p.text .></li>
<.} else {.>
<p>
<. include!("./_markup.html"); .>
</p>
<p class="libmedium__meta">
<b>From LibMedium:</b> LibMedium is built by reverse
engineering the Meduim's internal API. This post contains
markup(formatting rules) that we are unaware of.
Please report this URL <a
href="https://github.com/realaravinth/libmedium/issues/1"
rel="noreferrer">on our bug tracker</a> so that we can
improve page rendering.
<br />
Alternatively, you can also email me at realaravinth at batsense dot net!
</p>
<.}.>
2021-10-31 23:26:15 +05:30
<.}.>
</article>
</main>
</body>
<style>
<. include!("./main.css"); .>
2021-10-31 23:26:15 +05:30
</style>
</html>