WIP: clean up
This commit is contained in:
parent
d854053e34
commit
3e4629d92e
23
site.moon
23
site.moon
@ -13,25 +13,16 @@ split = (str, delimiter="/") ->
|
|||||||
join = (first, last, delimiter="/") -> table.concat({first, last}, delimiter)
|
join = (first, last, delimiter="/") -> table.concat({first, last}, delimiter)
|
||||||
target = (path, prefix) -> join(prefix, rootname(last(split path)))
|
target = (path, prefix) -> join(prefix, rootname(last(split path)))
|
||||||
|
|
||||||
|
-- posts = (path=".") ->
|
||||||
|
-- {join(path, file), target(file, "/posts") for file in lfs.dir path when file != "." and file != ".."}
|
||||||
|
|
||||||
posts = (path=".") ->
|
posts = (path=".") ->
|
||||||
{join(path, file), target(file, "/posts") for file in lfs.dir path when file != "." and file != ".."}
|
files = [file for file in lfs.dir(path) when file != "." and file != ".."]
|
||||||
|
tuples = for _, file in ipairs files
|
||||||
path = "docs"
|
|
||||||
|
|
||||||
names = [file for file in lfs.dir(path) when file != "." and file != ".."]
|
|
||||||
|
|
||||||
tuples = for _, file in ipairs names
|
|
||||||
{join(path, file), target(file, "/posts")}
|
{join(path, file), target(file, "/posts")}
|
||||||
|
{unpack tup for tup in *tuples}
|
||||||
new_posts = (path=".") ->
|
|
||||||
t = for _, file in ipairs names
|
|
||||||
{join(path, file), target(file, "/posts")}
|
|
||||||
t
|
|
||||||
|
|
||||||
news = new_posts("docs")
|
|
||||||
posts = {unpack tup for tup in *news}
|
|
||||||
|
|
||||||
sitegen.create =>
|
sitegen.create =>
|
||||||
@title = "Hello World"
|
@title = "Hello World"
|
||||||
add "index.md"
|
add "index.md"
|
||||||
add path, target: target for path, target in pairs posts
|
add path, target: target for path, target in pairs posts "docs"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user