From c35df275211bda38dae766a175a1272098a4d600 Mon Sep 17 00:00:00 2001 From: wuyoli Date: Mon, 23 Jan 2023 23:43:09 +0100 Subject: [PATCH] add talk_org_revealjs tamplate --- README.md | 5 +++ flake.nix | 4 +++ talk_org_revealjs/flake.lock | 44 +++++++++++++++++++++++++ talk_org_revealjs/flake.nix | 61 +++++++++++++++++++++++++++++++++++ talk_org_revealjs/handout.org | 9 ++++++ talk_org_revealjs/slides.org | 9 ++++++ 6 files changed, 132 insertions(+) create mode 100644 talk_org_revealjs/flake.lock create mode 100644 talk_org_revealjs/flake.nix create mode 100644 talk_org_revealjs/handout.org create mode 100644 talk_org_revealjs/slides.org diff --git a/README.md b/README.md index 84b9b91..0ff71bd 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,8 @@ $ git add . You will have to replace all occurances of `TEMPLATE_NAME` with your ``. ## Provided Templates +### `talk_org_revealjs` + +A template for a talk built with org-mode, Pandoc and reveal.js +It will generate a preveal-js html file in `result/index.html` from `slides.org` +and a `result/handout.pdf` from `handout.org` (if it exists). diff --git a/flake.nix b/flake.nix index ddac042..d9824a5 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,10 @@ outputs = { official-templates, ... }: rec { templates = { + talk_org_revealjs = { + path = ./talk_org_revealjs; + description = "A template for a talk built with org-mode, Pandoc and reveal.js"; + }; } // official-templates.templates; defaultTemplate = templates.trivial; diff --git a/talk_org_revealjs/flake.lock b/talk_org_revealjs/flake.lock new file mode 100644 index 0000000..8d1028f --- /dev/null +++ b/talk_org_revealjs/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1673606088, + "narHash": "sha256-wdYD41UwNwPhTdMaG0AIe7fE1bAdyHe6bB4HLUqUvck=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "37b97ae3dd714de9a17923d004a2c5b5543dfa6d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "revealjs": { + "flake": false, + "locked": { + "lastModified": 1673876630, + "narHash": "sha256-xeEgKj2HtggtY0tAaSSsqqX2NCIXAKzzI1Ysx2283jY=", + "ref": "refs/heads/master", + "rev": "282680e1635b13734a7fc39693fc054aac564414", + "revCount": 2939, + "type": "git", + "url": "https://github.com/hakimel/reveal.js?tag=4.4.0" + }, + "original": { + "type": "git", + "url": "https://github.com/hakimel/reveal.js?tag=4.4.0" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "revealjs": "revealjs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/talk_org_revealjs/flake.nix b/talk_org_revealjs/flake.nix new file mode 100644 index 0000000..a3129fb --- /dev/null +++ b/talk_org_revealjs/flake.nix @@ -0,0 +1,61 @@ +{ + description = "A template for a talk built with org-mode, Pandoc and reveal.js"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + revealjs = { + url = "git+https://github.com/hakimel/reveal.js?tag=4.4.0"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, revealjs }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + buildInputs = with pkgs; [ + pandoc-katex + haskellPackages.pandoc-crossref + texlive.combined.scheme-small + ]; + in { + packages.${system}.report = ( + pkgs.stdenv.mkDerivation { + name = "talkSlides"; + src = ./.; + inherit buildInputs; + phases = ["unpackPhase" "buildPhase"]; + buildPhase = '' + mkdir -p $out + + pandoc --embed-resources \ + --standalone \ + --filter pandoc-katex \ + --css ${pkgs.nodePackages_latest.katex}/lib/node_modules/katex/dist/katex.min.css \ + --incremental \ + -t revealjs \ + -V revealjs-url=${revealjs} \ + slides.org -o $out/index.html + + if [ -f handout.org ]; then + cat << EOF > header.tex + \usepackage{fancyhdr} + \pagestyle{fancy} + \fancyhf{} + \fancyhead[L]{TEMPLATE_NAME} + \fancyhead[C]{} + \fancyhead[R]{YOUR_NAME} + EOF + + pandoc --include-in-header=header.tex \ + --pdf-engine=xelatex \ + handout.org -o $out/handout.pdf + fi + ''; + } + ); + + defaultPackage.${system} = self.packages.x86_64-linux.report; + }; +} diff --git a/talk_org_revealjs/handout.org b/talk_org_revealjs/handout.org new file mode 100644 index 0000000..21d0628 --- /dev/null +++ b/talk_org_revealjs/handout.org @@ -0,0 +1,9 @@ +#+TITLE: TEMPLATE_NAME +#+AUTHOR: YOUR_NAME + +* First Heading +look, you can even use LaTeX Math: + +$$ +\beta r\cup\mathbb{H} +$$ diff --git a/talk_org_revealjs/slides.org b/talk_org_revealjs/slides.org new file mode 100644 index 0000000..21d0628 --- /dev/null +++ b/talk_org_revealjs/slides.org @@ -0,0 +1,9 @@ +#+TITLE: TEMPLATE_NAME +#+AUTHOR: YOUR_NAME + +* First Heading +look, you can even use LaTeX Math: + +$$ +\beta r\cup\mathbb{H} +$$