diff options
-rw-r--r-- | flake.lock | 62 | ||||
-rw-r--r-- | flake.nix | 43 | ||||
-rw-r--r-- | shell.nix | 20 | ||||
-rw-r--r-- | source/01_data/articles.xsl | 3 | ||||
-rw-r--r-- | source/01_data/tags.xsl | 2 | ||||
-rw-r--r-- | source/99_result/favicon.ico | bin | 1150 -> 0 bytes | |||
-rw-r--r-- | source/99_result/main.css | 3 | ||||
-rw-r--r-- | utility/formatter.xsl | 23 | ||||
-rw-r--r-- | utility/master.xsl | 2 |
9 files changed, 129 insertions, 29 deletions
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3eb910f --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1629379628, + "narHash": "sha256-dI8wpEo7wIVWoTUk2oyWFUnlVHNKLs+ren1TqITN1mI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a1007637cea374bd1bafd754cfd5388894c49129", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1629271619, + "narHash": "sha256-by9D3OkEKk4rOzJIMbC0uP2wP3Bt81auP5xmbmPg2a8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7bbca9877caed472c6b5866ea09302cfcdce3dbf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pkgs-personal": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1629652608, + "narHash": "sha256-eNcsdqMyK/Q3P0Tj16uDNcQzKIFf4CJkM7qTq3BdtF0=", + "ref": "master", + "rev": "fb63603b5eec859c84464e1a7f6f14931303f679", + "revCount": 52, + "type": "git", + "url": "https://code.kummerlaender.eu/pkgs" + }, + "original": { + "type": "git", + "url": "https://code.kummerlaender.eu/pkgs" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "pkgs-personal": "pkgs-personal" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5914731 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "static site generator for blog.kummerlaender.eu"; + + inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-21.05; + pkgs-personal.url = git+https://code.kummerlaender.eu/pkgs; + }; + + outputs = { self, nixpkgs, pkgs-personal, ... }: let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in { + devShell.x86_64-linux = pkgs.mkShell { + buildInputs = [ + pkgs.pandoc + pkgs.highlight + pkgs-personal.katex-wrapper + pkgs-personal.make-xslt + ]; + }; + + generate = content: pkgs.stdenv.mkDerivation { + name = "blog.kummerlaender.eu"; + + src = ./.; + + LANG = "en_US.UTF-8"; + + buildInputs = [ + pkgs.pandoc + pkgs.highlight + pkgs-personal.katex-wrapper + pkgs-personal.make-xslt + ]; + + installPhase = '' + cp -r ${content} source/00_content + make-xslt + mkdir $out + cp -Lr target/99_result/* $out + ''; + }; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 719b8df..0000000 --- a/shell.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ system ? builtins.currentSystem }: - -let - pkgs = import <nixpkgs> { inherit system; }; - mypkgs = import (fetchTarball "https://pkgs.kummerlaender.eu/nixexprs.tar.gz") { }; - -in pkgs.stdenv.mkDerivation rec { - name = "blog.kummerlaender.eu"; - - buildInputs = [ - pkgs.pandoc - pkgs.highlight - mypkgs.katex-wrapper - mypkgs.make-xslt - ]; - - shellHook = '' - export NIX_SHELL_NAME="${name}" - ''; -} diff --git a/source/01_data/articles.xsl b/source/01_data/articles.xsl index c25fe2a..2c4fa72 100644 --- a/source/01_data/articles.xsl +++ b/source/01_data/articles.xsl @@ -27,10 +27,11 @@ </xsl:apply-templates> </xsl:template> -<xsl:template match="files/directory[@name = 'articles']/file[@extension = '.md']"> +<xsl:template match="files/directory[@name = 'articles']/file[@extension = '.md' or @extension = '.org']"> <xsl:variable name="content"> <xsl:call-template name="formatter"> <xsl:with-param name="source" select="InputXSLT:read-file(./full)/text()"/> + <xsl:with-param name="format" select="substring(@extension,2)"/> </xsl:call-template> </xsl:variable> diff --git a/source/01_data/tags.xsl b/source/01_data/tags.xsl index 51bbf24..f055513 100644 --- a/source/01_data/tags.xsl +++ b/source/01_data/tags.xsl @@ -19,7 +19,7 @@ </entry> </xsl:template> -<xsl:template match="directory[@name = 'tags']/*/file[@extension = '.md']"> +<xsl:template match="directory[@name = 'tags']/*/file[@extension = '.md' or @extension = '.org']"> <article handle="{substring(@name, 12, string-length(@name))}"/> </xsl:template> diff --git a/source/99_result/favicon.ico b/source/99_result/favicon.ico Binary files differdeleted file mode 100644 index f5a9ac4..0000000 --- a/source/99_result/favicon.ico +++ /dev/null diff --git a/source/99_result/main.css b/source/99_result/main.css index 2572d5f..6ce7006 100644 --- a/source/99_result/main.css +++ b/source/99_result/main.css @@ -49,6 +49,9 @@ sub{vertical-align:baseline;position:relative;top:0.4em} #content .info a:hover{text-decoration:underline} #content .footnotes{border-top:.3em dotted #e3e8e8} #content video{padding:.2em;border:.1em solid #e3e8e8;display:block;margin:1em auto;max-width:95%} +#content .flexcolumns{display:flex;flex-direction:row;flex-wrap:wrap;width:100%;margin-bottom:1em} +#content .flexcolumns > div{display:flex;flex-direction:column;flex-basis:100%;flex:1} +#content .flexcolumns > div > span{text-align:center} #pagination{font:normal 1em 'Oswald',sans-serif;height:1.5em;margin-top:.5em} #pagination span.disabled{display:none} diff --git a/utility/formatter.xsl b/utility/formatter.xsl index 606a764..fb4acec 100644 --- a/utility/formatter.xsl +++ b/utility/formatter.xsl @@ -107,7 +107,7 @@ <xsl:when test="contains(@class, 'display')"> <p class="math"> <xsl:call-template name="math_highlighter"> - <xsl:with-param name="source" select="substring(text(),3,string-length(text())-4)"/> + <xsl:with-param name="source" select="text()"/> <xsl:with-param name="arguments"> <xsl:text>--display-mode</xsl:text> </xsl:with-param> @@ -117,7 +117,7 @@ <xsl:otherwise> <span class="math"> <xsl:call-template name="math_highlighter"> - <xsl:with-param name="source" select="substring(text(),3,string-length(text())-4)"/> + <xsl:with-param name="source" select="text()"/> </xsl:call-template> </span> </xsl:otherwise> @@ -126,12 +126,23 @@ <xsl:template name="formatter"> <xsl:param name="source"/> + <xsl:param name="format"/> <xsl:variable name="content"> - <xsl:call-template name="plain_formatter"> - <xsl:with-param name="format">pandoc -f markdown -t html4 --katex --no-highlight -fmarkdown-implicit_figures</xsl:with-param> - <xsl:with-param name="source" select="$source"/> - </xsl:call-template> + <xsl:choose> + <xsl:when test="contains($format, 'md')"> + <xsl:call-template name="plain_formatter"> + <xsl:with-param name="format">pandoc -f markdown -t html4 --katex --no-highlight -fmarkdown-implicit_figures</xsl:with-param> + <xsl:with-param name="source" select="$source"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="plain_formatter"> + <xsl:with-param name="format">pandoc -f <xsl:value-of select="$format"/> -t html4 --katex --no-highlight</xsl:with-param> + <xsl:with-param name="source" select="$source"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> </xsl:variable> <xsl:apply-templates select="xalan:nodeset($content)" mode="embellish"/> diff --git a/utility/master.xsl b/utility/master.xsl index cf348e3..0358627 100644 --- a/utility/master.xsl +++ b/utility/master.xsl @@ -26,8 +26,8 @@ <meta name="viewport" content="width=device-width,initial-scale=1.0"/> <link rel="stylesheet" type="text/css" href="/main.css" /> - <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> <link rel='alternate' type='application/atom+xml' href='/atom.xml'/> + <link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIHJ4PSIyMCIgZmlsbD0iI2ZmODgwMCI+PC9yZWN0PjxwYXRoIGZpbGw9IiNmZmYiIGQ9IiI+PC9wYXRoPjwvc3ZnPg=="/> <xsl:if test="//*[(self::p or self::span) and @class = 'math']"> <link rel="stylesheet" type="text/css" href="https://static.kummerlaender.eu/katex/katex.min.css" /> |