Fix blurb encoding
This commit is contained in:
parent
72b771a0cb
commit
c5c4c493e1
32
site.moon
32
site.moon
@ -50,7 +50,10 @@ reverse = (list={}) -> [item for item in *list[#list, 1, -1]]
|
||||
extract_id = (source) -> string.match Path.filename(source), "%a[%w%-]+"
|
||||
extract_date = (source) -> string.match Path.filename(source), "%d+%-%d%d%-%d%d"
|
||||
format_date = (str) -> date(str)\fmt "%b %d, %Y"
|
||||
publish_date = (path) -> format_date extract_date path
|
||||
|
||||
publish_date = (path using nil) ->
|
||||
date = extract_date path
|
||||
date, format_date date
|
||||
|
||||
strip_date = (filename) ->
|
||||
filename\gsub "#{escape_patt(extract_date(filename) .. "-")}/?", ""
|
||||
@ -75,12 +78,6 @@ html_renderer.cosmo_helpers.titleize = (slug) => titleize_slug slug
|
||||
files_from = (path=".") ->
|
||||
[Path.join path, file for file in *reverse get_files path]
|
||||
|
||||
listing_info = (page) ->
|
||||
{ :title, :id, publish_date: pub_date, :blurb } = page.meta
|
||||
title = title or titleize_slug id
|
||||
url = rootname page\url_for!
|
||||
{ title: title, publish_date: pub_date, blurb: blurb, url: url }
|
||||
|
||||
get_posts = (limit) =>
|
||||
pages = @site\query_pages { is_a: "post" }
|
||||
table.sort pages, (a, b) -> a.source > b.source
|
||||
@ -93,25 +90,30 @@ sitegen.create =>
|
||||
@version = "0.2.12"
|
||||
|
||||
@just_render_the_damn_list = (arg={}, _) =>
|
||||
posts = [listing_info post for post in *get_posts @, arg.limit]
|
||||
posts = [post for post in *get_posts @, arg.limit]
|
||||
|
||||
html.build ->
|
||||
import section, h3, time, a from tag
|
||||
|
||||
[section {
|
||||
h3 { a { title, href: url }}
|
||||
return for post in *posts
|
||||
{:title, :blurb, :id, publish_date: {iso, pretty}} = post.meta
|
||||
url = rootname post\url_for!
|
||||
blurb = html.builders.raw!(html.build -> blurb) if blurb
|
||||
|
||||
section {
|
||||
h3 { a { title or titleize_slug(id), href: url }}
|
||||
time { pretty, datetime: iso }
|
||||
"—", blurb, a { "Read post →", class: "read-post-link", href: url }
|
||||
} for { :title, :url, :blurb, publish_date: { iso, pretty }} in *posts]
|
||||
}
|
||||
|
||||
add_all = (files) ->
|
||||
for path in *files
|
||||
add path,
|
||||
target: target(path, "/posts")
|
||||
add path, {
|
||||
target: target path, "/posts"
|
||||
template: "post"
|
||||
is_a: "post"
|
||||
publish_date: { extract_date(path), publish_date path }
|
||||
publish_date: { publish_date path }
|
||||
id: extract_id path
|
||||
} for path in *files
|
||||
|
||||
add "index.html", title: "Catalin Mititiuc"
|
||||
add "blog.html", title: "Posts", target: "posts/index", template: "blog"
|
||||
|
Loading…
x
Reference in New Issue
Block a user