libmedium/templates/post.html

54 lines
1.7 KiB
HTML
Raw Normal View History

2021-10-31 23:26:15 +05:30
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><.= data.title .></title>
</head>
<body>
<main class="container">
<. use chrono::{TimeZone, Utc}; .>
<. let dt = Utc.timestamp_millis(data.created_at); .>
2021-11-02 13:40:13 +05:30
<. let date = dt.format("%b %e, %Y").to_string(); .>
<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
>
2021-11-02 13:40:13 +05:30
on <.= &date .>
2021-10-31 23:26:15 +05:30
</p>
<article>
<. let paragraphs = data.content.body_model.paragraphs; .>
<. for (pindex, p) in paragraphs.iter().enumerate() {.>
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" {.>
<. 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>
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>