feat(gws.fyi): Make title work properly in index
This is remarkably silly, but it gets the job done Change-Id: Ifbc57988a59c4f51a3bba0ed8ad397cb9855d8ab Reviewed-on: https://cl.tvl.fyi/c/depot/+/423 Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
5ae449dccc
commit
098bbb4d67
4 changed files with 32 additions and 8 deletions
|
@ -1,3 +1,6 @@
|
||||||
(require 'org)
|
(require 'org)
|
||||||
|
|
||||||
(setq org-html-postamble nil)
|
(setq org-html-postamble nil)
|
||||||
|
|
||||||
|
(defadvice org-export-grab-title-from-buffer
|
||||||
|
(around org-export-grab-title-from-buffer-disable activate))
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#+OPTIONS: title:nil
|
||||||
|
#+HTML_HEAD: <title>griffin smith</title>
|
||||||
|
|
||||||
my name is griffin ward smith (aka grfn, glittershark, gws) and i'm a software
|
my name is griffin ward smith (aka grfn, glittershark, gws) and i'm a software
|
||||||
engineer and musician
|
engineer and musician
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs ? import <nixpkgs> {}, ... }:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -20,14 +20,29 @@ let
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
src:
|
opts:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
src = if isAttrs opts then opts.src else opts;
|
||||||
|
headline = if isAttrs opts then opts.headline else null;
|
||||||
|
|
||||||
|
bn = builtins.baseNameOf src;
|
||||||
|
filename = elemAt (splitString "." bn) 0;
|
||||||
|
|
||||||
outName =
|
outName =
|
||||||
let bn = builtins.baseNameOf src;
|
if isNull headline
|
||||||
filename = elemAt (splitString "." bn) 0;
|
then
|
||||||
in filename + ".html";
|
let bn = builtins.baseNameOf src;
|
||||||
|
filename = elemAt (splitString "." bn) 0;
|
||||||
|
in filename + ".html"
|
||||||
|
else "${filename}-${replaceStrings [" "] ["-"] filename}.html";
|
||||||
|
|
||||||
|
escapeDoubleQuotes = replaceStrings ["\""] ["\\\""];
|
||||||
|
|
||||||
|
navToHeadline = optionalString (! isNull headline) ''
|
||||||
|
(search-forward "${escapeDoubleQuotes headline}")
|
||||||
|
(org-narrow-to-subtree)
|
||||||
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -38,8 +53,9 @@ runCommand outName {} ''
|
||||||
--load ${./config.el} \
|
--load ${./config.el} \
|
||||||
--visit file.org \
|
--visit file.org \
|
||||||
--eval "(progn
|
--eval "(progn
|
||||||
(require 'org)
|
${escapeDoubleQuotes navToHeadline}
|
||||||
(org-html-export-to-html))" \
|
(org-html-export-to-html))" \
|
||||||
--kill
|
--kill
|
||||||
cp file.html $out
|
substitute file.html $out \
|
||||||
|
--replace '<title>‎</title>' ""
|
||||||
''
|
''
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
args@{ pkgs, depot, ... }:
|
args@{ pkgs ? import <nixpkgs> {}, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
orgExportHTML = import ./orgExportHTML.nix args;
|
orgExportHTML = import ./orgExportHTML.nix args;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue