forked from realaravinth/libmedium
feat: ordered list rendering
This commit is contained in:
parent
25abc19161
commit
df14f8b0b8
2 changed files with 16 additions and 0 deletions
|
@ -72,6 +72,8 @@ code {
|
||||||
|
|
||||||
.code-block {
|
.code-block {
|
||||||
display: block;
|
display: block;
|
||||||
|
margin: 5px 0;
|
||||||
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
|
@ -145,3 +147,7 @@ blockquote {
|
||||||
border-left: 4px solid #333;
|
border-left: 4px solid #333;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ol, ul {
|
||||||
|
margin-left: 40px;
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<. include!("./post_meta.html"); .>
|
<. include!("./post_meta.html"); .>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<. let mut open_list = false ; .>
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<h1><.= data.title .></h1>
|
<h1><.= data.title .></h1>
|
||||||
<p class="meta">
|
<p class="meta">
|
||||||
|
@ -20,6 +21,9 @@
|
||||||
<article>
|
<article>
|
||||||
<. let paragraphs = &data.content.body_model.paragraphs; .>
|
<. let paragraphs = &data.content.body_model.paragraphs; .>
|
||||||
<. for (pindex, p) in paragraphs.iter().enumerate() {.>
|
<. for (pindex, p) in paragraphs.iter().enumerate() {.>
|
||||||
|
<. if open_list && p.type_ != "OLI" { .>
|
||||||
|
</ol>
|
||||||
|
<. } .>
|
||||||
<. if pindex == 0 && p.type_ == "H3" {.>
|
<. if pindex == 0 && p.type_ == "H3" {.>
|
||||||
<. continue; .>
|
<. continue; .>
|
||||||
<.}.>
|
<.}.>
|
||||||
|
@ -50,6 +54,12 @@
|
||||||
<.} else {.>
|
<.} else {.>
|
||||||
<iframe src="<.= src .>" frameborder="0"></iframe>
|
<iframe src="<.= src .>" frameborder="0"></iframe>
|
||||||
<.}.>
|
<.}.>
|
||||||
|
<.} else if p.type_ == "OLI" {.>
|
||||||
|
<. if !open_list { .>
|
||||||
|
<. open_list = true;.>
|
||||||
|
<ol>
|
||||||
|
<. } .>
|
||||||
|
<li><.= p.text .></li>
|
||||||
<.} else {.>
|
<.} else {.>
|
||||||
<p>
|
<p>
|
||||||
<. include!("./_markup.html"); .>
|
<. include!("./_markup.html"); .>
|
||||||
|
|
Loading…
Reference in a new issue