From c6b023f3c0a8b2bbbb652550522969c74b1ec1cd Mon Sep 17 00:00:00 2001 From: m1kadev <67912368+m1kadev@users.noreply.github.com> Date: Thu, 1 Jan 2026 15:58:40 +0100 Subject: [PATCH] proper title handling:)) finally --- .gitignore | 3 ++- build.exs | 33 +++++++++++++++++++++++++-------- styles/thought.css | 8 +++----- templates/base.html | 2 +- templates/pages/colophon.html | 2 +- templates/pages/index.html | 2 +- templates/paste.html | 2 ++ templates/thought.html | 8 ++++++-- templates/thoughts.html | 2 +- 9 files changed, 42 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index cfb90ebecbc71abdb19d3d72f5cbb75a19e53772..91449377306e78fdbd6c51f262bb195f96b15630 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /build -/static/*.min.* \ No newline at end of file +/static/*.min.* +TODO \ No newline at end of file diff --git a/build.exs b/build.exs index 85f7089f4ac3d19b15177369385122db4758ceee..74bad4f25693586fa56735899194448c1ed76778 100644 --- a/build.exs +++ b/build.exs @@ -114,7 +114,7 @@ defmodule Builders do template, Map.merge( %{ - filename: input_path, + filename: file, about_paste: "Created on " <> time, language: "", codetag: "
 lang <> "\">",
@@ -134,9 +134,15 @@ defmodule Builders do
       String.replace_prefix(input_path, "pages", "build")
       |> String.replace_suffix("fxg", "html")
 
+    name =
+      case Path.basename(input_path) |> Path.rootname() do
+        "index" -> "home"
+        x -> x
+      end
+
     {content, 0} = System.cmd("fxg", [input_path])
 
-    output = Mustache.render(template, Map.merge(%{fxg_content: content}, bricks))
+    output = Mustache.render(template, Map.merge(%{fxg_content: content, location: name}, bricks))
     IO.inspect(output_path)
     :ok = File.write(output_path, output)
   end
@@ -246,7 +252,10 @@ pastes_header = """
 paste_index =
   Mustache.render(
     main_template,
-    Map.merge(bricks, %{fxg_content: pastes_header <> "

" <> paste_data <> "

"}) + Map.merge(bricks, %{ + fxg_content: pastes_header <> "

" <> paste_data <> "

", + location: "pastes" + }) ) File.write("build/pastes/index.html", paste_index) @@ -266,13 +275,21 @@ thoughts = Enum.map(thought_paths, fn {path, date} -> Builders.thought(path, dat thoughts_html = Mustache.render( thoughts_template, - Map.merge(bricks, %{fxg_content: Enum.join(thoughts, "
")}) + Map.merge(bricks, %{fxg_content: Enum.join(thoughts, "
"), location: "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})) +for {thought, {path, time}} <- Enum.zip(thoughts, thought_paths) do + thought = FileX.sanitised_name(path) + output_path = "build/thoughts/" <> thought <> ".html" + + when_said = DateTime.from_unix!(time) |> Calendar.strftime("%H:%M, %d/%m/%y") + + thought_html = + Mustache.render( + thought_template, + Map.merge(bricks, %{fxg_content: File.read!(path), thought: thought, date: when_said}) + ) + File.write(output_path, thought_html) end diff --git a/styles/thought.css b/styles/thought.css index 3d3f312cbde9f7c22d9564a47c9b0d65c65620ad..4ff5e0a681ae766060fe249b19e8f1f9d8f43ffc 100644 --- a/styles/thought.css +++ b/styles/thought.css @@ -1,17 +1,15 @@ -.thought>h3 { - font-size: xx-large; +h2 { margin: 0px; - padding-top: .1em; padding-bottom: .5em; } -.thought>span { +#thought { display: block; padding-left: 1.5em; font-style: italic; } -.thought>small { +small { text-align: right; display: block; } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 03451572af8b9420f545e6970b3711a51292abf6..ae789a9d36beea1a092eead383749055f4bd58cb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,7 +7,7 @@ {{ &highlight }} - home - m1kadev + {{ location }} - m1kadev diff --git a/templates/pages/colophon.html b/templates/pages/colophon.html index 3bef684c06c20ede2d7f1f53ddb0db4addcf89ab..52dc007f1b15896f623f7d2c5cea6cdeb631ef27 100644 --- a/templates/pages/colophon.html +++ b/templates/pages/colophon.html @@ -5,7 +5,7 @@ {{ &base_header }} - colophon - m1kadev.nl + {{ location }} - m1kadev.nl diff --git a/templates/pages/index.html b/templates/pages/index.html index e282377ebfe61d72d9a3c0fd45187263aa8398d1..0020e9e1d8cb0cfd9b44a6ec16fed66a6a5631d4 100644 --- a/templates/pages/index.html +++ b/templates/pages/index.html @@ -11,7 +11,7 @@ - home - m1kadev + {{ location }} - m1kadev diff --git a/templates/paste.html b/templates/paste.html index 82e8c2268c93731ea46f48b0150c78f6f59226ae..8a6cbdc0f9690b6cd8bba2246ca12565484b5d56 100644 --- a/templates/paste.html +++ b/templates/paste.html @@ -6,6 +6,8 @@ {{ &language }} {{ &highlight }} + + {{ filename }} - m1kadev diff --git a/templates/thought.html b/templates/thought.html index bad1be886c6285d5d029b48c875aac867796ce15..b0c66f563f2878861ed757f22ea5da87afd004e7 100644 --- a/templates/thought.html +++ b/templates/thought.html @@ -7,7 +7,7 @@ - home - m1kadev + {{ thought }} - m1kadev @@ -16,7 +16,11 @@
- {{ &fxg_content }} +

{{ thought }}

+ + {{ &fxg_content }} + + -mika, {{ date }}
{{ &footer }}
diff --git a/templates/thoughts.html b/templates/thoughts.html index 51a9f7fb214cd5987099c970f1f867bfec892779..573b5e8a03352743de1f3fdc11ebe7b06826fff0 100644 --- a/templates/thoughts.html +++ b/templates/thoughts.html @@ -9,7 +9,7 @@ - home - m1kadev + {{ location }} - m1kadev