diff --git a/client/gen.exs b/client/gen.exs index 415332b..e0c0072 100644 --- a/client/gen.exs +++ b/client/gen.exs @@ -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 "

" <> paragraph <> "

" 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 = diff --git a/client/posts_custom/ExamplePostCustomFormat b/client/posts_custom/ExamplePostCustomFormat deleted file mode 100644 index 54a3b9f..0000000 --- a/client/posts_custom/ExamplePostCustomFormat +++ /dev/null @@ -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. diff --git a/client/upload.sh b/client/upload.sh index bb9deff..995634c 100755 --- a/client/upload.sh +++ b/client/upload.sh @@ -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