From dfb336b2fc398ec666195cb8f0c0647d2857fa16 Mon Sep 17 00:00:00 2001 From: m1kadev <67912368+m1kadev@users.noreply.github.com> Date: Fri, 26 Dec 2025 21:14:33 +0100 Subject: [PATCH] add links to full thought page --- build.exs | 23 ++++++++++++++++++----- styles/thought.css | 17 +++++++++++++++++ {static => styles}/thoughts.css | 0 templates/thought.html | 27 +++++++++++++++++++++++++++ templates/thoughts.html | 2 +- 5 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 styles/thought.css rename {static => styles}/thoughts.css (100%) create mode 100644 templates/thought.html diff --git a/build.exs b/build.exs index 66fa6f346b38ec196d47a1f2fba5ea56c2ba34f1..85f7089f4ac3d19b15177369385122db4758ceee 100644 --- a/build.exs +++ b/build.exs @@ -149,7 +149,7 @@ defmodule Builders do """
-

#{name}

+

#{name}

#{thought} -mika, #{date}
@@ -172,6 +172,7 @@ defmodule FileX do Path.basename(path) |> String.trim_trailing(".html") |> String.replace("-", "_") + |> String.replace(" ", "_") end end @@ -253,15 +254,27 @@ File.write("build/pastes/index.html", paste_index) File.mkdir_p("build/thoughts") thoughts_template = File.read!("templates/thoughts.html") +thought_template = File.read!("templates/thought.html") -thoughts = +thought_paths = Path.wildcard("thoughts/**/*") |> Enum.map(fn path -> {path, Git.get_file_commit(path)} end) |> Enum.sort_by(fn {_, t} -> t end, :desc) - |> Enum.map(fn {path, date} -> Builders.thought(path, date) end) - |> Enum.join("
") -thoughts_html = Mustache.render(thoughts_template, Map.merge(bricks, %{fxg_content: thoughts})) +thoughts = Enum.map(thought_paths, fn {path, date} -> Builders.thought(path, date) end) + +thoughts_html = + Mustache.render( + thoughts_template, + Map.merge(bricks, %{fxg_content: Enum.join(thoughts, "
")}) + ) + +for {thought, {path, _}} <- Enum.zip(thoughts, thought_paths) do + output_path = "build/thoughts/" <> FileX.sanitised_name(path) <> ".html" + IO.inspect(output_path) + thought_html = Mustache.render(thought_template, Map.merge(bricks, %{fxg_content: thought})) + File.write(output_path, thought_html) +end File.write("build/thoughts/index.html", thoughts_html) diff --git a/styles/thought.css b/styles/thought.css new file mode 100644 index 0000000000000000000000000000000000000000..3d3f312cbde9f7c22d9564a47c9b0d65c65620ad --- /dev/null +++ b/styles/thought.css @@ -0,0 +1,17 @@ +.thought>h3 { + font-size: xx-large; + margin: 0px; + padding-top: .1em; + padding-bottom: .5em; +} + +.thought>span { + display: block; + padding-left: 1.5em; + font-style: italic; +} + +.thought>small { + text-align: right; + display: block; +} \ No newline at end of file diff --git a/static/thoughts.css b/styles/thoughts.css similarity index 100% rename from static/thoughts.css rename to styles/thoughts.css diff --git a/templates/thought.html b/templates/thought.html new file mode 100644 index 0000000000000000000000000000000000000000..bad1be886c6285d5d029b48c875aac867796ce15 --- /dev/null +++ b/templates/thought.html @@ -0,0 +1,27 @@ + + + + + + {{ &base_header }} + + + + home - m1kadev + + + + + {{ &navbar }} + +
+
+ {{ &fxg_content }} +
+ {{ &footer }} +
+
+ + + + \ No newline at end of file diff --git a/templates/thoughts.html b/templates/thoughts.html index e05278558283037cced8b51023a4720efbe864fd..51a9f7fb214cd5987099c970f1f867bfec892779 100644 --- a/templates/thoughts.html +++ b/templates/thoughts.html @@ -7,7 +7,7 @@ {{ &highlight }} - + home - m1kadev