Fix dates on posts
This commit is contained in:
parent
e06d75f82f
commit
57074caae9
15
app.css
15
app.css
@ -173,7 +173,13 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Overrule pandoc style */
|
/* Overrule pandoc style */
|
||||||
div.sourceCode { margin: inherit; }
|
div.sourceCode {
|
||||||
|
margin: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sourceCode, div.highlight {
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
main * {
|
main * {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@ -309,17 +315,10 @@ figure figcaption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
/* background-color: aliceblue; */
|
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border: 1px solid lightgray;
|
|
||||||
border-radius: 3px;
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
:not(pre) > code {
|
|
||||||
background-color: rgb(230, 232, 245);
|
|
||||||
}
|
|
||||||
|
|
||||||
.code-filename-label, .filename-for-code-block > p {
|
.code-filename-label, .filename-for-code-block > p {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
32
site.moon
32
site.moon
@ -56,9 +56,7 @@ format_date = (str) -> date(str)\fmt "%b %d, %Y"
|
|||||||
strip_date = (filename) ->
|
strip_date = (filename) ->
|
||||||
filename\gsub "#{escape_patt(extract_date(filename) .. "-")}/?", ""
|
filename\gsub "#{escape_patt(extract_date(filename) .. "-")}/?", ""
|
||||||
|
|
||||||
publish_date = (path using extract_date, format_date) ->
|
publish_date = (dt using format_date) -> { pretty: format_date(dt), iso: dt }
|
||||||
date = extract_date path
|
|
||||||
date, format_date date
|
|
||||||
|
|
||||||
target = (path, prefix=".") ->
|
target = (path, prefix=".") ->
|
||||||
filename = rootname last common.split path, "/"
|
filename = rootname last common.split path, "/"
|
||||||
@ -98,7 +96,7 @@ sitegen.create =>
|
|||||||
md = @site\get_renderer "sitegen.renderers.markdown"
|
md = @site\get_renderer "sitegen.renderers.markdown"
|
||||||
|
|
||||||
return for post in *posts
|
return for post in *posts
|
||||||
{:title, :blurb, :id, publish_date: {iso, pretty}} = post.meta
|
{:title, :blurb, :id, :publish_date} = post.meta
|
||||||
url = rootname post\url_for!
|
url = rootname post\url_for!
|
||||||
|
|
||||||
if blurb
|
if blurb
|
||||||
@ -107,30 +105,34 @@ sitegen.create =>
|
|||||||
|
|
||||||
section {
|
section {
|
||||||
h3 { a { title or titleize_slug(id), href: url }}
|
h3 { a { title or titleize_slug(id), href: url }}
|
||||||
time { pretty, datetime: iso }
|
time { publish_date.pretty, datetime: publish_date.iso }
|
||||||
"—", blurb, a { "Read post →", class: "read-post-link", href: url }
|
"—", blurb, a { "Read post →", class: "read-post-link", href: url }
|
||||||
}
|
}
|
||||||
|
|
||||||
add_all = (files) ->
|
add_all = (files) ->
|
||||||
add path, {
|
for path in *files
|
||||||
target: target path, "/posts"
|
add path, {
|
||||||
template: "post"
|
target: target path, "/posts"
|
||||||
is_a: "post"
|
template: "post"
|
||||||
publish_date: { publish_date path }
|
is_a: "post"
|
||||||
id: extract_id path
|
publish_date: publish_date extract_date path
|
||||||
} for path in *files
|
id: extract_id path
|
||||||
|
}
|
||||||
|
|
||||||
add "index.html", title: "Catalin Mititiuc"
|
add "index.html", title: "Catalin Mititiuc"
|
||||||
add "blog.html", title: "Posts", target: "posts/index", template: "blog"
|
add "blog.html", title: "Posts", target: "posts/index", template: "blog"
|
||||||
|
|
||||||
add "example.moon.md",
|
add "example.moon.md",
|
||||||
template: "post"
|
template: "post"
|
||||||
title: "MoonScript Example"
|
title: "MoonScript Example"
|
||||||
publish_date: format_date date true
|
publish_date: publish_date date true
|
||||||
|
|
||||||
add "code.md",
|
add "code.md",
|
||||||
template: "post"
|
template: "post"
|
||||||
title: "Code Syntax Highlight Samples"
|
title: "Code Syntax Highlight Samples"
|
||||||
publish_date: format_date date true
|
publish_date: publish_date date true
|
||||||
-- add_all files_from "docs"
|
|
||||||
|
add_all files_from "docs"
|
||||||
|
|
||||||
copy "app.css"
|
copy "app.css"
|
||||||
copy "pygments.css"
|
copy "pygments.css"
|
||||||
|
@ -4,7 +4,7 @@ $wrap{"blog"}
|
|||||||
<header>
|
<header>
|
||||||
<div>
|
<div>
|
||||||
<h2>$(title or titleize(id))</h2>
|
<h2>$(title or titleize(id))</h2>
|
||||||
<time>$publish_date</time>
|
<time datetime="$(publish_date.iso)">$(publish_date.pretty)</time>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user