From ed3ce3ec850b416d449c32f000467c83cbe2fe20 Mon Sep 17 00:00:00 2001 From: Thomas Letan Date: Tue, 4 Feb 2020 20:58:25 +0100 Subject: Various fixes related to absolute URLs --- .gitignore | 3 ++- plugins/site-prefix.lua | 28 ++++++++++++++++++++++++++++ site/index.html | 4 ++-- site/posts/lisp-journey-getting-started.org | 4 +++- site/style/main.css | 4 ++-- soupault.conf | 11 +++++++++-- templates/main.html | 2 +- 7 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 plugins/site-prefix.lua diff --git a/.gitignore b/.gitignore index 96db5e5..94c05db 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ build/ *.vok *.vo .*.aux -*.glob \ No newline at end of file +*.glob +*.html~ \ No newline at end of file diff --git a/plugins/site-prefix.lua b/plugins/site-prefix.lua new file mode 100644 index 0000000..e64f839 --- /dev/null +++ b/plugins/site-prefix.lua @@ -0,0 +1,28 @@ +site_url = config["site_url"] + +if not site_url then + Log.warning("site_url is not configured, using default") + site_url = "" +end + +if not Regex.match(site_url, "(.*)/$") then + site_url = site_url .. "/" +end + +links = HTML.select(page, "a") + +index, link = next(links) + +while index do + href = HTML.get_attribute(link, "href") + if href then + -- Check if URL starts with a leading "/" + if Regex.match(href, "^/") then + -- Remove leading slashes + href = Regex.replace(href, "^/*", "") + href = site_url .. href + HTML.set_attribute(link, "href", href) + end + end + index, link = next(links, index) +end diff --git a/site/index.html b/site/index.html index 442f5a5..b0e3609 100644 --- a/site/index.html +++ b/site/index.html @@ -6,7 +6,7 @@ - + @@ -38,7 +38,7 @@
-
@lthms@mastodon.social
+
@lthms@mastodon.social
My personal account on the fediverse. I mostly toot about functional programming languages, formal methods, and my Emacs configuration. diff --git a/site/posts/lisp-journey-getting-started.org b/site/posts/lisp-journey-getting-started.org index b354034..3d8a6c1 100644 --- a/site/posts/lisp-journey-getting-started.org +++ b/site/posts/lisp-journey-getting-started.org @@ -219,7 +219,9 @@ file: To bundle the game, we can use ~sbcl~ from our command line interface. #+BEGIN_SRC bash -sbcl --eval "(ql:quickload :lysk/bundle)" --eval "(lysk.bundle:deliver)" --quit +sbcl --eval "(ql:quickload :lysk/bundle)" \ + --eval "(lysk.bundle:deliver)" \ + --quit #+END_SRC * Conclusion diff --git a/site/style/main.css b/site/style/main.css index 39b41c0..f997fd2 100644 --- a/site/style/main.css +++ b/site/style/main.css @@ -55,8 +55,8 @@ body#default .paragraph { /* org-mode output */ .footpara { - display: inline-block; - margin-left: .4em; + display: inline; + margin-left: .2em; } /* index */ diff --git a/soupault.conf b/soupault.conf index a4d55c0..52f9fee 100644 --- a/soupault.conf +++ b/soupault.conf @@ -6,7 +6,7 @@ build_dir = "build" page_file_extensions = ["html"] - ignore_extensions = ["draft"] + ignore_extensions = ["draft", "vo", "vok", "vos", "glob", "html~", "org", "aux"] generator_mode = true complete_page_selector = "html" @@ -37,4 +37,11 @@ selector = "div#generate-toc" action = "replace_element" min_level = 2 - numbered_list = true \ No newline at end of file + numbered_list = true + +[plugins.site-prefix] + file = "plugins/site-prefix.lua" + +[widgets.set-site-prefix] + widget = "site-prefix" + site_url = "/~lthms" \ No newline at end of file diff --git a/templates/main.html b/templates/main.html index 1e5ae50..0a6e3f8 100644 --- a/templates/main.html +++ b/templates/main.html @@ -9,7 +9,7 @@ - +