WIP: Wrap posts in an article tag
This commit is contained in:
63
site.moon
63
site.moon
@@ -3,6 +3,11 @@ tools = require "sitegen.tools"
|
||||
site = require "sitegen.site"
|
||||
lfs = require "lfs"
|
||||
|
||||
date = require "date"
|
||||
path = require "sitegen.path"
|
||||
-- import slugify from "sitegen.common"
|
||||
common = require "sitegen.common"
|
||||
|
||||
rootname = (str) ->
|
||||
result = string.gsub str, "%..+", ""
|
||||
result
|
||||
@@ -22,7 +27,7 @@ posts = (path=".") ->
|
||||
-- site = site!
|
||||
site.config.out_dir = "html/"
|
||||
|
||||
css = tools.system_command "cat < %s > %s", "css"
|
||||
css = tools.system_command "cp %s %s", "css"
|
||||
|
||||
ps = posts("docs")
|
||||
|
||||
@@ -49,8 +54,27 @@ one = () ->
|
||||
tag.a { href: "momo", "yayaya" }
|
||||
tag.a { href: "momo", "yayaya" }
|
||||
|
||||
require("sitegen.renderers.markdown").render = (page, md_source) =>
|
||||
discount = require "discount"
|
||||
|
||||
md_source = page\pipe "renderer.markdown.pre_render", md_source
|
||||
md_source, escapes = escape_cosmo md_source
|
||||
|
||||
html_source = assert discount md_source
|
||||
html_source = unescape_cosmo html_source, escapes
|
||||
print("DDDDDDDDDDDDDD")
|
||||
|
||||
super page, html_source
|
||||
|
||||
-- require("moon").p require("sitegen.renderers.markdown")
|
||||
|
||||
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
|
||||
|
||||
sitegen.create =>
|
||||
@title = "WebDevCat.me · Catalin Mititiuc"
|
||||
@site_title = "WebDevCat.me · Catalin Mititiuc"
|
||||
@app_name = "stasis"
|
||||
@version = "0.2.12"
|
||||
@val = "yes"
|
||||
@@ -82,21 +106,44 @@ sitegen.create =>
|
||||
-- require("moon").p get_site
|
||||
@test = (page) -> {{"b": 1, "c": 2}, {"d": 3, "e": 4}}
|
||||
@what = (page) ->
|
||||
page
|
||||
-- require("moon").p [{ln, lv} for ln, lv in pairs debug.getlocal(2, idx)]
|
||||
-- require("moon").p
|
||||
"what?"
|
||||
|
||||
-- require("moon").p @
|
||||
|
||||
-- require("moon").p @site
|
||||
-- @what = (page) =>
|
||||
-- require("moon").p @
|
||||
|
||||
-- require("moon").p site.pages
|
||||
|
||||
-- @what!
|
||||
|
||||
add "index.html", o: one
|
||||
add path, target: out, template: "blog" for path, out in pairs posts "docs"
|
||||
-- add "test.html", id: "test"
|
||||
add path, target: out, template: "blog", is_a: "post", post: {
|
||||
publish_date: publish_date(path)
|
||||
}, id: extract_id(path) for path, out in pairs posts "docs"
|
||||
|
||||
add "test.html", id: "test"
|
||||
-- feed "posts.moon", "feed.xml"
|
||||
|
||||
-- require("moon").p site
|
||||
|
||||
build css, "app.css"
|
||||
-- build css, "app.css"
|
||||
copy "app.css"
|
||||
|
||||
-- require("moon").p site
|
||||
-- filter "docs", (body) =>
|
||||
-- require("moon").p body
|
||||
|
||||
-- require("moon").p search "start", "docs"
|
||||
|
||||
-- filter "2023%-08%-03", (body) =>
|
||||
-- table.concat { body, "<p>hey there</p>" }
|
||||
|
||||
-- require("moon").p body
|
||||
-- body\gsub "<h1>.-</h1>", (header) ->
|
||||
-- table.concat { body, "yoyoasdf" }
|
||||
-- body .. "yoyo"
|
||||
-- body\gsub "{.-}", (header) ->
|
||||
-- require("moon").p header
|
||||
-- table.concat { '</div>', header, '<div class="main">' }
|
||||
|
||||
Reference in New Issue
Block a user