libmedium/templates/post.html

60 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<. include!("./post_meta.html"); .>
</head>
<body>
<main class="container">
<h1><.= data.title .></h1>
<p class="meta">
<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 .>"
/>
<.= data.creator.name .></a
>
on <.= &date .> &#183; <.= reading_time .> min read
</p>
<article>
<. let paragraphs = &data.content.body_model.paragraphs; .>
<. for (pindex, p) in paragraphs.iter().enumerate() {.>
<. if pindex == 0 && p.type_ == "H3" {.>
<. continue; .>
<.}.>
<. if p.type_ == "IMG" {.>
<. include!("./img.html"); .>
<.} else if p.type_ == "P" {.>
<. include!("./p.html"); .>
<.} 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>
<.} else if p.type_ == "IFRAME" {.>
<. let src = &p.iframe.as_ref().unwrap().media_resource.as_ref().unwrap().href; .>
<. if src.contains("gist.github.com"){.>
<. 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>
-->
<.} else {.>
<iframe src="<.= src .>" frameborder="0"></iframe>
<.}.>
<.}.>
<.}.>
</article>
</main>
</body>
<style>
<. include!("./main.css"); .>
</style>
</html>