Remove custom post format
This commit is contained in:
+1
-19
@@ -13,24 +13,6 @@ end
|
||||
|
||||
fill_template_pretemplated = fn template -> &fill_template.(template, &1) end
|
||||
|
||||
wrapInParagraphs = fn content -> content
|
||||
|> String.split("\\n")
|
||||
|> Enum.reject(fn(x) -> x == "" end)
|
||||
|> Enum.map(fn paragraph -> if String.starts_with?(paragraph, "<") do paragraph else "<p>" <> paragraph <> "</p>" end end)
|
||||
|> Enum.join("")
|
||||
end
|
||||
post_contents_custom = File.ls!("./posts_custom")
|
||||
|> Enum.reject(fn(x) -> String.starts_with?(x, ".") end)
|
||||
|> Enum.map(fn f -> File.read!("./posts_custom/" <> f) end)
|
||||
|> Enum.map(fn c -> String.split(c, "\n") end)
|
||||
|> Enum.map(fn c -> Enum.reject(c, fn(x) -> x == "" end) end)
|
||||
|> Enum.map(fn c -> Enum.chunk_every(c, 2) end)
|
||||
|> Enum.map(fn c ->
|
||||
Enum.map(c, fn [k, v] -> %{String.to_atom(k) => v} end)
|
||||
|> Enum.reduce(%{}, fn(x, acc) -> Map.merge(x, acc) end)
|
||||
end)
|
||||
|> Enum.map(fn m -> Map.update!(m, :content, wrapInParagraphs) end)
|
||||
|
||||
filterCutFileExtension = fn files ->
|
||||
fn ext ->
|
||||
Enum.filter(files, &String.ends_with?(&1, "." <> ext))
|
||||
@@ -78,7 +60,7 @@ normalize_title = fn title -> String.replace(String.downcase(title), " ", "-") e
|
||||
|
||||
constructLocalPath = fn p -> dateFolder.(p) <> normalize_title.(Map.get(p, :title)) end
|
||||
|
||||
post_contents = Enum.concat(post_contents_custom, post_contents_org)
|
||||
post_contents = post_contents_org
|
||||
|> Enum.map(fn postMap -> Map.merge(postMap, %{localpath: (constructLocalPath.(postMap))}) end)
|
||||
|
||||
index_file =
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
title
|
||||
Example post for my new custom-gen post page!
|
||||
date
|
||||
Mon, 11 May 2020 13:25:00 GMT
|
||||
content
|
||||
My new posts page is live, this post has been generated from a custom format.
|
||||
@@ -1,4 +1,3 @@
|
||||
rsync -avz public/assets/images/ raymon.dev:~/Personal-Website/client/public/assets/images
|
||||
rsync -avz public/gen/ raymon.dev:~/Personal-Website/client/public/gen/
|
||||
rsync -avz posts_org/ raymon.dev:~/Personal-Website/client/posts_org
|
||||
rsync -avz posts_custom/ raymon.dev:~/Personal-Website/client/posts_custom
|
||||
|
||||
Reference in New Issue
Block a user