diff --git a/assets/js/data.js b/assets/js/data.js index 275e8de..9894f2b 100644 --- a/assets/js/data.js +++ b/assets/js/data.js @@ -1,11 +1,23 @@ function get_data() { return { - posts: [ - { - title: "Scripts em OCaml", - slug: "scripts-em-ocaml", - }, - ] + pt: { + posts: [ + { + title: "Scripts em OCaml", + slug: "scripts-em-ocaml", + date: "23/03/2024", + }, + ] + }, + en: { + posts: [ + { + title: "Hello, Worldling", + slug: "hello-worldling", + date: "May 20, 2024", + }, + ] + } } } diff --git a/assets/js/main.js b/assets/js/main.js index 1884992..1f82a62 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,13 +1,26 @@ const data = get_data() -const post_list = document.getElementById("posts") +const post_list = document.getElementById('posts') -document.addEventListener("DOMContentLoaded", function() { - data.posts.forEach(post => { - const item = document.createElement("li") - const anchor = document.createElement("a") +const userLang = navigator.language || navigator.userLanguage +let lang = userLang.includes('pt') ? 'pt' : 'en' + +document.addEventListener('DOMContentLoaded', function() { + data[lang].posts.forEach(post => { + const item = document.createElement('li') + const anchor = document.createElement('a') + const date = document.createElement('span') anchor.innerText = post.title anchor.href = 'posts/' + post.slug + '.html' + date.innerText = `${parse_date(post.date)} - ` + item.appendChild(date) item.appendChild(anchor) post_list.appendChild(item) }) }) + +function parse_date(date) { + current_year = new Date().getFullYear() + return date.replace(`, ${current_year}`, '') + .replace(`/${current_year}`, '') +} + diff --git a/assets/js/post-l10n.js b/assets/js/post-l10n.js new file mode 100644 index 0000000..895007c --- /dev/null +++ b/assets/js/post-l10n.js @@ -0,0 +1,9 @@ +const userLang = navigator.language || navigator.userLanguage +let lang = userLang.includes('pt') ? 'pt' : 'en' +console.log('loaded post-l10n.js', lang) + +if (lang != 'pt') { + const footer_back = document.getElementById('footer-back-link') + console.log(footer_back) + footer_back.innerText = 'Back' +} diff --git a/assets/style.css b/assets/style.css index 7ffa2b2..9f3637b 100644 --- a/assets/style.css +++ b/assets/style.css @@ -5,13 +5,17 @@ src: url('Share Tech Mono.ttf'), format('truetype'); } -body { +html { background-color: #222222; font-family: 'ShareTech', monospace; + color: #F1E9E5; +} + +.header-art { + color: #888 } p { - color: #F1E9E5; margin: 30px; } @@ -31,7 +35,7 @@ h1 { font-weight: bold; color: #ccc; font-size: 25px; - margin: 20px 0px 10px 20px; + margin: 40px 0px 10px 20px; } h2 { @@ -53,3 +57,15 @@ li { margin-bottom: 10px; } color: #ccc; padding: 20px; } + +footer { + margin-top: 40px; +} + +.footer-text { + padding: 20px 20px; +} + +.footer-back { + float: right; +} diff --git a/index.html b/index.html index daa1eb7..72fc26a 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,8 @@
+
__ __ __
diff --git a/posts/filters/title.lua b/posts/filters/title.lua
deleted file mode 100755
index cc1e735..0000000
--- a/posts/filters/title.lua
+++ /dev/null
@@ -1,15 +0,0 @@
--- source: https://stackoverflow.com/a/76048743
-
-local title
-
-function Header(e)
- if title then return end
- title = pandoc.utils.stringify(e) .. " • jutty.dev"
-end
-
-function Meta(e)
- if not e.pagetitle then
- e.pagetitle = title
- return e
- end
-end
diff --git a/posts/gen.ml b/posts/gen.ml
index 2c3f2bb..12f68a5 100755
--- a/posts/gen.ml
+++ b/posts/gen.ml
@@ -1,13 +1,14 @@
#!/usr/bin/env utop
-let args = "--css ../../assets/style.css -s --to html5 " ^
- "--highlight-style zenburn " ^ "--lua-filter filters/title.lua "
+let args = "--css ../assets/style.css --standalone " ^
+ "--from markdown+yaml_metadata_block " ^ "--to html5 " ^
+ "--highlight-style zenburn " ^ "--template=template.html "
let vert md = begin
let filename_split = String.split_on_char '.' md in
Sys.command (
- "pandoc " ^ args ^ " md/" ^ md ^ " -o " ^ List.nth filename_split 0
+ "pandoc " ^ args ^ " md/" ^ md ^ " -o " ^ List.nth filename_split 0 ^ ".html"
)
end ;;
diff --git a/posts/hello-worldling.html b/posts/hello-worldling.html
new file mode 100644
index 0000000..12648fb
--- /dev/null
+++ b/posts/hello-worldling.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+ Hello, Worldling • jutty.dev
+
+
+
+
+
+
+
+Hello, Worldling
+
+Oh hi
+
+
+
diff --git a/posts/md/hello-worldling.md b/posts/md/hello-worldling.md
new file mode 100644
index 0000000..a5756bc
--- /dev/null
+++ b/posts/md/hello-worldling.md
@@ -0,0 +1,7 @@
+---
+title: Hello, Worldling
+author: Juno Takano
+date: May 20, 2024
+---
+
+Oh hi
diff --git a/posts/md/scripts-em-ocaml.md b/posts/md/scripts-em-ocaml.md
index f6c081a..f9cb212 100644
--- a/posts/md/scripts-em-ocaml.md
+++ b/posts/md/scripts-em-ocaml.md
@@ -1,4 +1,8 @@
-# Scripts em OCaml
+---
+title: Scripts em OCaml
+author: Juno Takano
+date: 23 de fevereiro de 2024
+---
Este blog gera suas postagens com o Pandoc, mas quem faz o trabalho lógico de identificar os arquivos e montar os comandos é um pequeno script em OCaml.
diff --git a/posts/scripts-em-ocaml.html b/posts/scripts-em-ocaml.html
index b72d4fe..61af01c 100644
--- a/posts/scripts-em-ocaml.html
+++ b/posts/scripts-em-ocaml.html
@@ -4,6 +4,7 @@
+
Scripts em OCaml • jutty.dev
-
+
+
+
-Scripts em OCaml
+
+Scripts em OCaml
+
Este blog gera suas postagens com o Pandoc, mas quem faz o trabalho
lógico de identificar os arquivos e montar os comandos é um pequeno
script em OCaml.
@@ -121,5 +126,15 @@ a directory/Non-recursively - Rosetta Code