From 1ec72d0e38cddfb8bab8bb0530ccc607d68b624c Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Sun, 7 Mar 2021 14:36:26 +0100 Subject: [PATCH] CSS and flake-ification --- .gitmodules | 3 -- blog/index.org | 3 ++ flake.lock | 41 +++++++++++++++++++++++ flake.nix | 40 +++++++++++++++++++++++ make.el | 28 ++++++++++++++-- org-thtml | 1 - public_html/css/style.css | 69 +++++++++++++++++++++++++++++++++++++-- templates/index.html | 15 +++++++++ 8 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 blog/index.org create mode 100644 flake.lock create mode 100644 flake.nix delete mode 160000 org-thtml create mode 100644 templates/index.html diff --git a/.gitmodules b/.gitmodules index ce4bfd0..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "org-thtml"] - path = org-thtml - url = https://github.com/juanjosegarciaripoll/org-thtml diff --git a/blog/index.org b/blog/index.org new file mode 100644 index 0000000..5c9a955 --- /dev/null +++ b/blog/index.org @@ -0,0 +1,3 @@ +#+INCLUDE: sitemap.inc + +Testing subscript, emacs_is_awesome is not subscripted but F_{g} is. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e05db26 --- /dev/null +++ b/flake.lock @@ -0,0 +1,41 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1614447571, + "narHash": "sha256-kHshBYBAAL0sx7DwwrPyfvtUwidQ9aWXy0XrL5RQFhY=", + "path": "/nix/store/fsfirablmv207i01zz3zsd20nkd0cbcq-source", + "rev": "d303eee16ce8dee5c0b5b8e5f6323f561c189ec5", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "org-thtml": { + "flake": false, + "locked": { + "lastModified": 1609698765, + "narHash": "sha256-+WfRXEhwEV24MSH5Vg0hz0joJkvkQ4Qeqt4BRY0cZSA=", + "owner": "juanjosegarciaripoll", + "repo": "org-thtml", + "rev": "0c84e993a7e9ae9fc1fd5e34f7713d6526f03cd0", + "type": "github" + }, + "original": { + "owner": "juanjosegarciaripoll", + "repo": "org-thtml", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "org-thtml": "org-thtml" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..76130c8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + inputs = { + nixpkgs.url = "nixpkgs"; + org-thtml = { + url = "github:juanjosegarciaripoll/org-thtml"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, org-thtml }: + let + supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); + in + { + website = forAllSystems (system: + let + pkgs = import nixpkgs { inherit system; }; + + in + pkgs.stdenv.mkDerivation { + name = "magic_rb-website"; + version = "0.1"; + src = ./.; + nativeBuildInputs = [ pkgs.emacs ]; + + buildPhase = '' + cp ${org-thtml}/ox-thtml.el ./ox-thtml.el + mkdir tmp && export HOME=$(pwd)/tmp + emacs --script ./make.el + ''; + + installPhase = '' + mkdir -p $out + cp -r public_html/* $out + ''; + } + ); + }; +} diff --git a/make.el b/make.el index e5f18b5..a0581a8 100644 --- a/make.el +++ b/make.el @@ -3,7 +3,7 @@ ;;; ;;; Code: -(load-file "./org-thtml/ox-thtml.el") +(load-file "./ox-thtml.el") (require 'org) (require 'ox) (require 'ox-html) @@ -22,6 +22,8 @@ ;; DOES NOT WORK https://github.com/alphapapa/unpackaged.el#export-to-html-with-useful-anchors +(setq org-export-with-sub-superscripts '{}) + (defvar org-publish-project-alist) (setq org-publish-project-alist `(("blog-org" @@ -35,15 +37,35 @@ :html-template ,(templated-html-load-template "templates/blog.html") :publishing-function org-html-publish-to-templated-html :headline-levels 4 - :auto-preamble t) + :exclude "^\\(index.org\\|*.inc\\)" + :auto-preamble t + :auto-sitemap t + :sitemap-folders ignore + :sitemap-style list + :sitemap-title "Magic_RB's blog") + :sitemap-filename "sitemap.inc" + :sitemap-sort-files anti-chronologically) ("blog-assets" :base-directory ,(expand-file-name "assets/") :publishing-directory ,(expand-file-name "public_html/") :recursive t :base-extension "\\(ttf\\|jpg\\|gif\\|png\\|css\\|js\\|el\\|nb\\|ipynb\\|pdf\\|xml\\)" :publishing-function org-publish-attachment) + ("homepage" + :base-directory ,(expand-file-name "./blog") + :root-directory ,(expand-file-name "./") + :recursive t + :base-extension "org" + :include ("index.org") + :exclude ,(regexp-opt '("blog" "assets" "org-thtml")) + :publishing-directory ,(expand-file-name "public_html/") + :section-numbers nil + :with-toc nil + :with-date nil + :html-template ,(templated-html-load-template "templates/index.html") + :publishing-function org-html-publish-to-templated-html) ("blog" - :components ("blog-org" "blog-assets")))) + :components ("blog-org" "blog-assets" "homepage")))) (org-publish "blog" t) diff --git a/org-thtml b/org-thtml deleted file mode 160000 index 0c84e99..0000000 --- a/org-thtml +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0c84e993a7e9ae9fc1fd5e34f7713d6526f03cd0 diff --git a/public_html/css/style.css b/public_html/css/style.css index aa3cb09..1b9b681 100644 --- a/public_html/css/style.css +++ b/public_html/css/style.css @@ -1,9 +1,72 @@ +@font-face { + font-family: "Ubuntu Medium"; + src: url(../ttf/ubuntu-medium.ttf) format("truetype"); +} + +@font-face { + font-family: "Ubuntu Regular"; + src: url(../ttf/ubuntu-regular.ttf) format("truetype"); +} + * { - font-family: "monospace"; + font-family: "Ubuntu Regular"; +} + +ul { + padding: 0 0 0 1rem; } code { - border-radius: 0.3rem; - background: #ACACAC; + background-color: #eee; + border: 0.01rem solid #999; padding: 0.1rem; } + +pre { + background-color: #eee; + border: 1px solid #999; + display: block; + padding: 0.5rem; +} + +#table-of-contents { + position: sticky; + top: 0; +} + +#content :is(h1, h2, h3, h4, h5, h6) { + display: inline; + border-bottom: 0.15rem solid #165578; + width: 100%; + padding-bottom: 0.1rem; + line-height: 1.75em; +} + +#organizer { + display: flex; + flex-direction: column; +} + +#content p { + flex-basis: auto; + text-align: justify; + text-justify: inter-word; +} + +.sidebar { + flex-basis: auto; +} + +@media only screen and (min-width: 768px) { + #organizer { + flex-direction: row; + } + + #content { + flex-basis: 80%; + } + + .sidebar { + flex-basis: 10%; + } +} diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..f2f9819 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,15 @@ + + + {{:include "head.html"}} + +
+ +
+ {{:if with-title}}

{{title}}

{{:endif}} + {{:if date}}{{:endif}} + {{contents}} +
+ +
+ +