CSS and flake-ification

This commit is contained in:
Magic_RB 2021-03-07 14:36:26 +01:00
parent ee5d885e22
commit 1ec72d0e38
8 changed files with 190 additions and 10 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "org-thtml"]
path = org-thtml
url = https://github.com/juanjosegarciaripoll/org-thtml

3
blog/index.org Normal file
View file

@ -0,0 +1,3 @@
#+INCLUDE: sitemap.inc
Testing subscript, emacs_is_awesome is not subscripted but F_{g} is.

41
flake.lock Normal file
View file

@ -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
}

40
flake.nix Normal file
View file

@ -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
'';
}
);
};
}

28
make.el
View file

@ -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)

@ -1 +0,0 @@
Subproject commit 0c84e993a7e9ae9fc1fd5e34f7713d6526f03cd0

View file

@ -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%;
}
}

15
templates/index.html Normal file
View file

@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
{{:include "head.html"}}
<body>
<div id="organizer">
<div class="sidebar">{{org-html-toc 2 info}}</div>
<div id="content">
{{:if with-title}}<h1>{{title}}</h1>{{:endif}}
{{:if date}}<div class="post-meta">Published on {{format-time-string "%b %d, %Y" date}}</div>{{:endif}}
{{contents}}
</div>
<div class="sidebar"></div>
</div>
</body>
</html>