diff options
author | sanine <sanine.not@pm.me> | 2022-01-13 17:41:02 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-01-13 17:41:02 -0600 |
commit | 0ff62ea7886bdeff160682d3d5713c2c8a6dd4b1 (patch) | |
tree | c70d31f35c1e54a7fc01246eb6740d79aef0ccd0 |
initial commit
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | config.lua | 12 | ||||
-rw-r--r-- | layouts/base.lua | 45 | ||||
-rw-r--r-- | layouts/blog.lua | 8 | ||||
-rw-r--r-- | plugins/navigation.lua | 0 | ||||
-rw-r--r-- | plugins/toolkit.lua | 42 | ||||
-rw-r--r-- | public/about.html | 19 | ||||
-rw-r--r-- | public/blog/announcing_honeysuckle.html | 44 | ||||
-rw-r--r-- | public/index.html | 19 | ||||
-rw-r--r-- | public/projects/index.html | 15 | ||||
-rw-r--r-- | public/rss.xml | 15 | ||||
-rw-r--r-- | public/style.css | 44 | ||||
-rwxr-xr-x | serve-http.sh | 19 | ||||
-rw-r--r-- | site_root/about.lua | 17 | ||||
-rw-r--r-- | site_root/blog/announcing_honeysuckle.lua | 37 | ||||
-rw-r--r-- | site_root/index.lua | 28 | ||||
-rw-r--r-- | site_root/projects/index.lua | 12 | ||||
-rw-r--r-- | site_root/style.css | 44 |
18 files changed, 421 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..1f797ce --- /dev/null +++ b/config.lua @@ -0,0 +1,12 @@ +return { + site_name = 'sanine.net', + site_address = 'https://sanine.net/', + site_directory = 'site_root', + + layout_directory = 'layouts', + plugin_directory = 'plugins', + + exclude = { '.*~' }, + + rss_include = { 'blog' }, +} diff --git a/layouts/base.lua b/layouts/base.lua new file mode 100644 index 0000000..aae2081 --- /dev/null +++ b/layouts/base.lua @@ -0,0 +1,45 @@ +local navigation_table = { + {'home', '/index.html'}, + {'projects', '/projects/'}, + {'git', '/git'}, + {'about', '/about.html'}, +} + +local navlinks = '' + +for _, link in pairs(navigation_table) do + navlinks = navlinks .. + string.format('<a href="%s">%s</a> ', link[2], link[1]) +end +navlinks = string.sub(navlinks, 1, -4) + +local navigation = string.format('<div id="navigation"><pre>%s</pre></div>', navlinks) + +return function(html, page_tbl) + local html = string.gsub( + html, + '<h1>(.-)</h1>', + '<p class="centered">%1<br>================================</p>' + ) + + local fmt = [[ +<!doctype html> + <html> + <meta charset="utf-8"> + <title>%s</title> + <link rel="stylesheet" href="/style.css"> + </html> + <body> + %s + <div id="content"> + %s + </div> + </body> +</html> +]] +return string.format( + fmt, + string.format('%s | %s', page_tbl.title, argent.config.site_name), + navigation, + html) +end diff --git a/layouts/blog.lua b/layouts/blog.lua new file mode 100644 index 0000000..94dc685 --- /dev/null +++ b/layouts/blog.lua @@ -0,0 +1,8 @@ +local base = require('layouts.base') + +return function(html, page_tbl) + local html = string.format( + '<h1>%s</h1>\n<p class="centered">%s</p>\n\n%s', + page_tbl.title, page_tbl.date, html) + return base(html, page_tbl) +end diff --git a/plugins/navigation.lua b/plugins/navigation.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugins/navigation.lua diff --git a/plugins/toolkit.lua b/plugins/toolkit.lua new file mode 100644 index 0000000..e5f162a --- /dev/null +++ b/plugins/toolkit.lua @@ -0,0 +1,42 @@ +local toolkit = {} + +toolkit.file_iterator = function(directory) + local _, files = argent.scanDirectory(directory) + local i = 0 + local n = table.getn(files) + return function() + i = i+1 + if i<=n then return files[i] end + end +end + + +toolkit.basename = function(filename) + return string.gsub(filename, '%.lua$', '') +end + + +local function extract_page(file) + if not string.match(file, '%.lua$') then return nil end + + local success, result = pcall(loadfile(file), 0, 1) + if not success then return nil end + return result +end + +toolkit.pages = function(directory) + page_array = {} + local path = argent.config.site_directory..directory + for file in toolkit.file_iterator(path) do + local page = extract_page(path..file) + if page then + page.href = '/'..directory..toolkit.basename(file)..'.html' + table.insert(page_array, page) + end + end + + return page_array +end + + +return toolkit diff --git a/public/about.html b/public/about.html new file mode 100644 index 0000000..001244f --- /dev/null +++ b/public/about.html @@ -0,0 +1,19 @@ +<!doctype html> + <html> + <meta charset="utf-8"> + <title>about me | sanine.net</title> + <link rel="stylesheet" href="/style.css"> + </html> + <body> + <div id="navigation"><pre><a href="/index.html">home</a> <a href="/projects/">projects</a> <a href="/git">git</a> <a href="/about.html">about</a></pre></div> + <div id="content"> + <p class="centered">about me<br>================================</p> +<p>hey! i'm kate (aka sanine) and i like to write code, hack circuits, and grow plants. +i mostly use this site for documenting and sharing various projects. +i also (very occasionally) make games!! you can see them <a href="https://sanine.itch.io/">over on itch.io</a>.</p> +<p>if you need to get in contact with me, you can send me an email at <code>kate AT sanine DOT net</code>. +i hope you're having a good day. <3</p> + + </div> + </body> +</html> diff --git a/public/blog/announcing_honeysuckle.html b/public/blog/announcing_honeysuckle.html new file mode 100644 index 0000000..9c2ac0c --- /dev/null +++ b/public/blog/announcing_honeysuckle.html @@ -0,0 +1,44 @@ +<!doctype html> + <html> + <meta charset="utf-8"> + <title>announcing honeysuckle | sanine.net</title> + <link rel="stylesheet" href="/style.css"> + </html> + <body> + <div id="navigation"><pre><a href="/index.html">home</a> <a href="/projects/">projects</a> <a href="/git">git</a> <a href="/about.html">about</a></pre></div> + <div id="content"> + <p class="centered">announcing honeysuckle<br>================================</p> +<p class="centered">2021-05-23</p> + +<p>As I’ve been working on various projects for the past couple of years +I have continued to find that a combination of C and Lua is my favorite +way to write code. The ongoing development of <a href="https://honey3d.org/">my game engine honey</a> +uses that pair and I’m planning on using it (whenever I get around to it) for my <a href="https://sanine.net/projects/dream-atlas">dream +atlas project</a>. But, and I’ll be the first +to admit this, the C API is a little clunky. +I don’t generally mind that all too much (after all, one of my favorite things about +both C and Lua is that they’re languages you can carry around in your head, and having +a very explicit API means you only need to understand the fundamental concepts to use it) +but it does mean that dev work goes a bit slower.</p> +<p>I did a good bit of work streamlining the process of writing Lua bindings in C when +tinkering with honey and ever since then I’ve found myself peeking back at that code +and re-implementing it in other projects. A colleague of mine once said that the time +to write a library is when you’ve done something once, you’re doing it now, and you +re pretty sure you’ll do it again, and I think I’ve quite handily cleared that condition +So! I’m splitting that code out and refactoring it into its own library which, due +to its historical roots, I’ve chosen to call honeysuckle.</p> +<p>honeysuckle is still under development – the API is a bit different from the one I +came up with when working on honey and imo is easier to use – but when it’s ready +it will provide a whole host of helpful functions that make integrating Lua scripting +into C applications simple and fast. I am (attempting) to employ readme-driven development +so I’ve written up a readme for honeysuckle. Any feedback on the proposed API and +features would be much appreciated! As of writing, honeysuckle is planned to include +functions for parsing arguments to C functions from Lua, creating and processing tables +throwing and handling Lua errors, using the Lua registry, and creating printf-formatted strings.</p> +<p>I’ve already created a repository for honeysuckle. There’s just a README in there +for now, but that will probably have changed even just later today, since I’m planning +on working on it more this afternoon. :p</p> + + </div> + </body> +</html> diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..f31c9b7 --- /dev/null +++ b/public/index.html @@ -0,0 +1,19 @@ +<!doctype html> + <html> + <meta charset="utf-8"> + <title>home | sanine.net</title> + <link rel="stylesheet" href="/style.css"> + </html> + <body> + <div id="navigation"><pre><a href="/index.html">home</a> <a href="/projects/">projects</a> <a href="/git">git</a> <a href="/about.html">about</a></pre></div> + <div id="content"> + <p class="centered">home<br>================================</p> +<p>welcome to sanine.net!</p> +<ul> +<li><a href="/blog/announcing_honeysuckle.html">[2021-05-23] announcing honeysuckle</a></li> +</ul> +<p><a href="/rss.xml">subscribe via rss</a></p> + + </div> + </body> +</html> diff --git a/public/projects/index.html b/public/projects/index.html new file mode 100644 index 0000000..0e8b6c1 --- /dev/null +++ b/public/projects/index.html @@ -0,0 +1,15 @@ +<!doctype html> + <html> + <meta charset="utf-8"> + <title>projects | sanine.net</title> + <link rel="stylesheet" href="/style.css"> + </html> + <body> + <div id="navigation"><pre><a href="/index.html">home</a> <a href="/projects/">projects</a> <a href="/git">git</a> <a href="/about.html">about</a></pre></div> + <div id="content"> + <p class="centered">projects<br>================================</p> +<p>tl;dr projects go here</p> + + </div> + </body> +</html> diff --git a/public/rss.xml b/public/rss.xml new file mode 100644 index 0000000..2297f97 --- /dev/null +++ b/public/rss.xml @@ -0,0 +1,15 @@ +<rss version="2.0"> +<channel> + <title>sanine.net</title> + <link>https://sanine.net/</link> + <description></description> + <generator>argent v0.1.0</generator> + <docs>https://www.rssboard.org/rss-specification</docs> + + <item> + <title>announcing honeysuckle</title> + <link>https://sanine.net/blog/announcing_honeysuckle.html</link> + <pubDate>23 May 2021 00:00:00 Z</pubDate> + </item> +</channel> +</rss>
\ No newline at end of file diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..f43e73d --- /dev/null +++ b/public/style.css @@ -0,0 +1,44 @@ +body { + color: #eee; + background: #1c1c1c; + font-family: monospace; + font-size: 16px; +} + +#navigation { + text-align: center; +} + +.centered { + text-align: center; +} + +#content { + width: 600px; + max-width: 100%; + margin: auto; +} + +a { + color: #ff3a21; +} + +a:hover { + color: #1c1c1c; + background: #ff3a21; + text-decoration: none; +} + +ul { + list-style: none; +} + +li:before { + content: '* '; +} + +code { + background: black; + padding: 0 6px; + border-radius: 4px; +} diff --git a/serve-http.sh b/serve-http.sh new file mode 100755 index 0000000..874b586 --- /dev/null +++ b/serve-http.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# this script is for previewing site changes ONLY!! it should not be used to +# actually serve a site. use apache or nginx or something for that. + +# launch webserver +python3 -m http.server --directory public/ & +server_pid="$!" +echo "server launched with PID $server_pid" + +# kill server on exit +trap "kill $server_pid && echo && echo \"bye!\"" EXIT + +# rebuild on file changes (inotifywait is from inotify-tools) +while inotifywait -qr --event modify .; do + echo "rebuilding site..." + argent + echo "done." +done diff --git a/site_root/about.lua b/site_root/about.lua new file mode 100644 index 0000000..ea832e1 --- /dev/null +++ b/site_root/about.lua @@ -0,0 +1,17 @@ +local md = [[ +about me +======== + +hey! i'm kate (aka sanine) and i like to write code, hack circuits, and grow plants. +i mostly use this site for documenting and sharing various projects. +i also (very occasionally) make games!! you can see them [over on itch.io](https://sanine.itch.io/). + +if you need to get in contact with me, you can send me an email at `kate AT sanine DOT net`. +i hope you're having a good day. <3 +]] + +return { + title='about me', + layout='base', + markdown=md, +} diff --git a/site_root/blog/announcing_honeysuckle.lua b/site_root/blog/announcing_honeysuckle.lua new file mode 100644 index 0000000..5fb97fb --- /dev/null +++ b/site_root/blog/announcing_honeysuckle.lua @@ -0,0 +1,37 @@ +return { + title='announcing honeysuckle', + layout='blog', + date='2021-05-23', + markdown=[[ +As I’ve been working on various projects for the past couple of years +I have continued to find that a combination of C and Lua is my favorite +way to write code. The ongoing development of [my game engine honey](https://honey3d.org/) +uses that pair and I’m planning on using it (whenever I get around to it) for my [dream +atlas project](https://sanine.net/projects/dream-atlas). But, and I’ll be the first +to admit this, the C API is a little clunky. +I don’t generally mind that all too much (after all, one of my favorite things about +both C and Lua is that they’re languages you can carry around in your head, and having +a very explicit API means you only need to understand the fundamental concepts to use it) +but it does mean that dev work goes a bit slower. + +I did a good bit of work streamlining the process of writing Lua bindings in C when +tinkering with honey and ever since then I’ve found myself peeking back at that code +and re-implementing it in other projects. A colleague of mine once said that the time +to write a library is when you’ve done something once, you’re doing it now, and you +re pretty sure you’ll do it again, and I think I’ve quite handily cleared that condition +So! I’m splitting that code out and refactoring it into its own library which, due +to its historical roots, I’ve chosen to call honeysuckle. + +honeysuckle is still under development – the API is a bit different from the one I +came up with when working on honey and imo is easier to use – but when it’s ready +it will provide a whole host of helpful functions that make integrating Lua scripting +into C applications simple and fast. I am (attempting) to employ readme-driven development +so I’ve written up a readme for honeysuckle. Any feedback on the proposed API and +features would be much appreciated! As of writing, honeysuckle is planned to include +functions for parsing arguments to C functions from Lua, creating and processing tables +throwing and handling Lua errors, using the Lua registry, and creating printf-formatted strings. + +I’ve already created a repository for honeysuckle. There’s just a README in there +for now, but that will probably have changed even just later today, since I’m planning +on working on it more this afternoon. :p +]]} diff --git a/site_root/index.lua b/site_root/index.lua new file mode 100644 index 0000000..cc5f699 --- /dev/null +++ b/site_root/index.lua @@ -0,0 +1,28 @@ +local tk = require 'toolkit' + +function get_blog_links() + local links = '<ul>\n' + for _, page in pairs(tk.pages('blog/')) do + links = links .. + string.format('<li><a href="%s">[%s] %s</a></li>\n', page.href, page.date, page.title) + end + return links..'</ul>' +end + + +local md = string.format([[ +home +==== + +welcome to sanine.net! + +%s + +[subscribe via rss](/rss.xml) +]], get_blog_links()) + +return { + title='home', + layout='base', + markdown=md, +} diff --git a/site_root/projects/index.lua b/site_root/projects/index.lua new file mode 100644 index 0000000..96e3abe --- /dev/null +++ b/site_root/projects/index.lua @@ -0,0 +1,12 @@ +local md = [[ +projects +======== + +tl;dr projects go here +]] + +return { + title='projects', + layout='base', + markdown=md, +} diff --git a/site_root/style.css b/site_root/style.css new file mode 100644 index 0000000..f43e73d --- /dev/null +++ b/site_root/style.css @@ -0,0 +1,44 @@ +body { + color: #eee; + background: #1c1c1c; + font-family: monospace; + font-size: 16px; +} + +#navigation { + text-align: center; +} + +.centered { + text-align: center; +} + +#content { + width: 600px; + max-width: 100%; + margin: auto; +} + +a { + color: #ff3a21; +} + +a:hover { + color: #1c1c1c; + background: #ff3a21; + text-decoration: none; +} + +ul { + list-style: none; +} + +li:before { + content: '* '; +} + +code { + background: black; + padding: 0 6px; + border-radius: 4px; +} |