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 */
|
||||
div.sourceCode { margin: inherit; }
|
||||
div.sourceCode {
|
||||
margin: inherit;
|
||||
}
|
||||
|
||||
div.sourceCode, div.highlight {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
main * {
|
||||
text-align: left;
|
||||
@ -309,17 +315,10 @@ figure figcaption {
|
||||
}
|
||||
|
||||
pre {
|
||||
/* background-color: aliceblue; */
|
||||
padding: 1em;
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 3px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
:not(pre) > code {
|
||||
background-color: rgb(230, 232, 245);
|
||||
}
|
||||
|
||||
.code-filename-label, .filename-for-code-block > p {
|
||||
font-weight: bold;
|
||||
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) ->
|
||||
filename\gsub "#{escape_patt(extract_date(filename) .. "-")}/?", ""
|
||||
|
||||
publish_date = (path using extract_date, format_date) ->
|
||||
date = extract_date path
|
||||
date, format_date date
|
||||
publish_date = (dt using format_date) -> { pretty: format_date(dt), iso: dt }
|
||||
|
||||
target = (path, prefix=".") ->
|
||||
filename = rootname last common.split path, "/"
|
||||
@ -98,7 +96,7 @@ sitegen.create =>
|
||||
md = @site\get_renderer "sitegen.renderers.markdown"
|
||||
|
||||
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!
|
||||
|
||||
if blurb
|
||||
@ -107,30 +105,34 @@ sitegen.create =>
|
||||
|
||||
section {
|
||||
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 }
|
||||
}
|
||||
|
||||
add_all = (files) ->
|
||||
add path, {
|
||||
target: target path, "/posts"
|
||||
template: "post"
|
||||
is_a: "post"
|
||||
publish_date: { publish_date path }
|
||||
id: extract_id path
|
||||
} for path in *files
|
||||
for path in *files
|
||||
add path, {
|
||||
target: target path, "/posts"
|
||||
template: "post"
|
||||
is_a: "post"
|
||||
publish_date: publish_date extract_date path
|
||||
id: extract_id path
|
||||
}
|
||||
|
||||
add "index.html", title: "Catalin Mititiuc"
|
||||
add "blog.html", title: "Posts", target: "posts/index", template: "blog"
|
||||
|
||||
add "example.moon.md",
|
||||
template: "post"
|
||||
title: "MoonScript Example"
|
||||
publish_date: format_date date true
|
||||
publish_date: publish_date date true
|
||||
|
||||
add "code.md",
|
||||
template: "post"
|
||||
title: "Code Syntax Highlight Samples"
|
||||
publish_date: format_date date true
|
||||
-- add_all files_from "docs"
|
||||
publish_date: publish_date date true
|
||||
|
||||
add_all files_from "docs"
|
||||
|
||||
copy "app.css"
|
||||
copy "pygments.css"
|
||||
|
@ -4,7 +4,7 @@ $wrap{"blog"}
|
||||
<header>
|
||||
<div>
|
||||
<h2>$(title or titleize(id))</h2>
|
||||
<time>$publish_date</time>
|
||||
<time datetime="$(publish_date.iso)">$(publish_date.pretty)</time>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user