From 8b20da98e4b99a8c417e983ea7840d5439b43cd2 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 16:14:41 +0200 Subject: [PATCH 01/33] Put markdeck revealjs adjustments in a markdeck theme --- src/Makefile | 3 + src/markdeck/assets/markdeck/css/_common.scss | 73 +---------- .../assets/markdeck/css/_commoncommon.scss | 72 +++++++++++ .../markdeck/css/markdeck.revealjs.scss | 62 ++------- .../markdeck/css/theme/source/markdeck.scss | 119 ++++++++++++++++++ src/markdeck/defaults.yaml | 2 +- src/markdeck/loop | 3 + 7 files changed, 208 insertions(+), 126 deletions(-) create mode 100644 src/markdeck/assets/markdeck/css/_commoncommon.scss create mode 100644 src/markdeck/assets/markdeck/css/theme/source/markdeck.scss diff --git a/src/Makefile b/src/Makefile index 6cfc7d1..dc016d5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -27,6 +27,7 @@ prepare: downloaded/bin/pandoc \ markdeck/assets/3rdparty/asciinema-player.js \ markdeck/assets/3rdparty/asciinema-player.css \ markdeck/assets/3rdparty/reveal.js \ + markdeck/assets/3rdparty/reveal.js/css/theme/source/markdeck.scss \ markdeck/assets/3rdparty/impress.js \ jqueryemoji \ markdeck/helper/downloaded/trianglify-background-generator-master \ @@ -90,6 +91,8 @@ markdeck/assets/3rdparty/reveal.js: mkdir -p $@ curl -L "https://github.com/hakimel/reveal.js/archive/$(REVEALJS_VERSION).tar.gz" | tar -C $@ --strip-components=1 --exclude test --exclude font -zxvf - +markdeck/assets/3rdparty/reveal.js/css/theme/source/markdeck.scss: markdeck/assets/markdeck/css/theme/source/markdeck.scss + cp $^ $@ markdeck/assets/3rdparty/impress.js: mkdir -p $@ diff --git a/src/markdeck/assets/markdeck/css/_common.scss b/src/markdeck/assets/markdeck/css/_common.scss index a851f7f..8f56212 100644 --- a/src/markdeck/assets/markdeck/css/_common.scss +++ b/src/markdeck/assets/markdeck/css/_common.scss @@ -1,43 +1,6 @@ -img.emoji { - width: 1.1em; - height: 1.1em; - padding: 0; - margin: 0; - vertical-align: baseline; -} - -.rerendering-message { - display: none; - position: absolute; - text-align: center; - top: 20%; - left: 0; - width: 100%; - height: 100vh; - z-index: 1000; - color: white; - font-size: 200%; - text-shadow: 2px 2px #000000; -} - -.markdeck-logo { - position: absolute; - left: 0; - right: 0; - text-align: center; - bottom: 8px; - height: 8px; - font-size: 10px; - color: #5550; - z-index: 1; - - a { - color: #333a; - text-shadow: 1px 1px #bbba; - background: none; - text-decoration: none; - } -} +// FIXME this is just the remainder of what has been moved into markdeck.scss +// for revealjs but not yet for impressjs. +@import "commoncommon"; .light-on-dark, section.light-on-dark h1 { color: #fff; @@ -51,36 +14,6 @@ img.emoji { } } -/*! - * Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com - * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) - */ -@font-face { - font-family: "Font Awesome 5 Brands"; - font-style: normal; - font-weight: normal; - src: url(fonts/fa-brands-400.ttf) format("truetype"); -} -.fab { - font-family:"Font Awesome 5 Brands"; -} - -/*! - * Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com - * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) - */ -@font-face { - font-family: "Font Awesome 5 Free"; - font-style: normal; - font-weight: 900; - src: url(fonts/fa-solid-900.ttf) format("truetype"); -} -.fa, .fas { - font-family:"Font Awesome 5 Free"; - font-weight:900; -} - -@import "fontawesome.css"; @font-face { font-family: 'Inconsolata'; diff --git a/src/markdeck/assets/markdeck/css/_commoncommon.scss b/src/markdeck/assets/markdeck/css/_commoncommon.scss new file mode 100644 index 0000000..6ddaa18 --- /dev/null +++ b/src/markdeck/assets/markdeck/css/_commoncommon.scss @@ -0,0 +1,72 @@ +img.emoji { + width: 1.1em; + height: 1.1em; + padding: 0; + margin: 0; + vertical-align: baseline; +} + +.rerendering-message { + display: none; + position: absolute; + text-align: center; + top: 20%; + left: 0; + width: 100%; + height: 100vh; + z-index: 1000; + color: white; + font-size: 200%; + text-shadow: 2px 2px #000000; +} + +.markdeck-logo { + position: absolute; + left: 0; + right: 0; + text-align: center; + bottom: 8px; + height: 8px; + font-size: 10px; + color: #5550; + z-index: 1; + + a { + color: #333a; + text-shadow: 1px 1px #bbba; + background: none; + text-decoration: none; + } +} + +/*! + * Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +@font-face { + font-family: "Font Awesome 5 Brands"; + font-style: normal; + font-weight: normal; + src: url(fonts/fa-brands-400.ttf) format("truetype"); +} + +.fab { + font-family:"Font Awesome 5 Brands"; +} + +/*! + * Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ +@font-face { + font-family: "Font Awesome 5 Free"; + font-style: normal; + font-weight: 900; + src: url(fonts/fa-solid-900.ttf) format("truetype"); +} +.fa, .fas { + font-family:"Font Awesome 5 Free"; + font-weight:900; +} + +@import "fontawesome.css"; diff --git a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss index 6e22449..6880c64 100644 --- a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss +++ b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss @@ -1,26 +1,9 @@ -@import "common"; - -.reveal { - h1, h2, h3, h4, h5, h6, div { - font-family: sans-serif; - } -} - -.reveal h1 { - font-size: 1.4em; } - -.reveal h2 { - font-size: 0.8em; } +@import "commoncommon"; .reveal .license { font-size: 12pt; } -.reveal section img { - border: 0; - background: transparent; -} - .reveal .footer { position: absolute; bottom: 1em; @@ -28,35 +11,6 @@ font-size: 0.5em; } -.reveal .controls .navigate-up.enabled { - border-bottom-color: #444; -} - -.reveal .controls .navigate-down.enabled { - border-top-color: #444; -} - -.reveal .controls .navigate-right.enabled { - border-left-color: #444; -} - -.reveal .controls .navigate-left.enabled { - border-right-color: #444; -} - -.reveal .progress span { - background: #444; -} - -.reveal section img { - box-shadow: none; -} - -.slide-background { - background-size: cover !important; - background-repeat: no-repeat; -} - .reveal img.emoji { width: 1.1em; height: 1.1em; @@ -65,14 +19,6 @@ vertical-align: baseline; } -section.has-dark-background.colorfull * { - // text-shadow: 1px 1px #000; -} - -section.has-dark-background.colorfull a { - color: AliceBlue; -} - .flush-text-left { text-align: left; } @@ -80,3 +26,9 @@ section.has-dark-background.colorfull a { .rerendering-message { display: none; } + +.reveal section img { + border: 0; + background: transparent; +} + diff --git a/src/markdeck/assets/markdeck/css/theme/source/markdeck.scss b/src/markdeck/assets/markdeck/css/theme/source/markdeck.scss new file mode 100644 index 0000000..5c241d6 --- /dev/null +++ b/src/markdeck/assets/markdeck/css/theme/source/markdeck.scss @@ -0,0 +1,119 @@ +/** + * Markdeck theme for reveal.js presentations, similar + * to the simple theme. The accent color is darkblue. + * + * reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se + */ + + +// Default mixins and settings ----------------- +@import "../template/mixins"; +@import "../template/settings"; +// --------------------------------------------- + +// Include theme-specific fonts +@font-face { + font-family: 'Inconsolata'; + font-style: normal; + font-weight: 400; + src: url("fonts/Inconsolata-Regular.ttf") format('truetype'); +} + +@font-face { + font-family: "EB Garamond Bold"; + font-style: normal; + font-weight: 400; + src: url("fonts/EBGaramond-Bold.ttf") format('truetype'); +} + +@font-face { + font-family: "xkcd Script"; + font-style: normal; + font-weight: 400; + src: url("fonts/xkcd-script.ttf") format('truetype'); +} + +@font-face { + font-family: 'Raleway'; + font-style: normal; + font-weight: 400; + src: url("fonts/Raleway-Regular.ttf") format('truetype'); +} + +// Override theme settings (see ../template/settings.scss) +$mainFont: 'Lato', sans-serif; +$mainColor: #000; +$headingFont: sans-serif; +$headingColor: #000; +$headingTextShadow: none; +$headingTextTransform: none; +$backgroundColor: #fff; +$linkColor: #00008B; +$linkColorHover: lighten( $linkColor, 20% ); +$selectionBackgroundColor: rgba(0, 0, 0, 0.99); + +$heading1Size: 1.4em; +$heading2Size: 0.8em; +$heading3Size: 0.8em; +$heading4Size: 0.8em; + +section.has-dark-background { + &, h1, h2, h3, h4, h5, h6 { + color: #fff; + } +} + +.slide-background { + background-size: cover !important; + background-repeat: no-repeat; +} + +.light-on-dark, section.light-on-dark h1 { + color: #fff; + text-shadow: 0px 1px #000; +} + +section.has-dark-background.colorfull * { + // text-shadow: 1px 1px #000; +} + +section.has-dark-background.colorfull a { + color: AliceBlue; +} + +.ltr, .inline { + p, pre { + display: inline-block; + vertical-align: middle; + } +} + +// Theme template ------------------------------ +@import "../template/theme"; +// --------------------------------------------- + +// Override some settings from theme +.reveal section img { + box-shadow: none; +} + +.reveal .progress span { + background: #444; +} + +.reveal .controls .navigate-up.enabled { + border-bottom-color: #444; +} + +.reveal .controls .navigate-down.enabled { + border-top-color: #444; +} + +.reveal .controls .navigate-right.enabled { + border-left-color: #444; +} + +.reveal .controls .navigate-left.enabled { + border-right-color: #444; +} + diff --git a/src/markdeck/defaults.yaml b/src/markdeck/defaults.yaml index dddd2ef..fe47d94 100644 --- a/src/markdeck/defaults.yaml +++ b/src/markdeck/defaults.yaml @@ -22,7 +22,7 @@ standalone: asciinema: false -theme: black +theme: markdeck themePath: assets/3rdparty/reveal.js/css/theme transition: slide controls: false diff --git a/src/markdeck/loop b/src/markdeck/loop index 322b465..d2b42be 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -81,6 +81,9 @@ while true; do sassc \ /markdeck/assets/markdeck/css/markdeck.revealjs.scss \ /target/assets/markdeck/css/markdeck.revealjs.css || : + sassc \ + /markdeck/assets/3rdparty/reveal.js/css/theme/source/markdeck.scss \ + /target/assets/3rdparty/reveal.js/css/theme/markdeck.css || : sassc \ /markdeck/assets/markdeck/css/markdeck.impressjs.scss \ /target/assets/markdeck/css/markdeck.impressjs.css || : From ccc8aeeb451b702ed1d0968e0bafd3fe3df064a7 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 16:15:06 +0200 Subject: [PATCH 02/33] Hide box-shadow around emojis --- src/markdeck/assets/markdeck/css/_commoncommon.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdeck/assets/markdeck/css/_commoncommon.scss b/src/markdeck/assets/markdeck/css/_commoncommon.scss index 6ddaa18..002ccce 100644 --- a/src/markdeck/assets/markdeck/css/_commoncommon.scss +++ b/src/markdeck/assets/markdeck/css/_commoncommon.scss @@ -4,6 +4,7 @@ img.emoji { padding: 0; margin: 0; vertical-align: baseline; + box-shadow: none; } .rerendering-message { @@ -49,7 +50,6 @@ img.emoji { font-weight: normal; src: url(fonts/fa-brands-400.ttf) format("truetype"); } - .fab { font-family:"Font Awesome 5 Brands"; } From 87bb47a35adcded1894cb609b6a7164cf652f88d Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 16:57:25 +0200 Subject: [PATCH 03/33] Remove duplicate plantuml.jar integration --- src/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index dc016d5..44ee637 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,7 +21,6 @@ push: all prepare: downloaded/bin/pandoc \ - markdeck/lib/plantuml.jar \ markdeck/lib/plantuml.jar \ markdeck/lib/ditaa.jar \ markdeck/assets/3rdparty/asciinema-player.js \ From 87db390a5df61aafd56382f3906d8b4f637eff5f Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 17:44:20 +0200 Subject: [PATCH 04/33] Remove duplicate img.emoji theming --- src/markdeck/assets/markdeck/css/_commoncommon.scss | 9 --------- src/markdeck/assets/markdeck/css/markdeck.revealjs.scss | 1 + 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/markdeck/assets/markdeck/css/_commoncommon.scss b/src/markdeck/assets/markdeck/css/_commoncommon.scss index 002ccce..1280424 100644 --- a/src/markdeck/assets/markdeck/css/_commoncommon.scss +++ b/src/markdeck/assets/markdeck/css/_commoncommon.scss @@ -1,12 +1,3 @@ -img.emoji { - width: 1.1em; - height: 1.1em; - padding: 0; - margin: 0; - vertical-align: baseline; - box-shadow: none; -} - .rerendering-message { display: none; position: absolute; diff --git a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss index 6880c64..f65c7be 100644 --- a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss +++ b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss @@ -17,6 +17,7 @@ padding: 0; margin: 0; vertical-align: baseline; + box-shadow: none; } .flush-text-left { From 058d80417c77c9146ef247504e5a2103bb6f7a3a Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 17:45:44 +0200 Subject: [PATCH 05/33] Support creation of custom revealjs themes through files in assets/css/theme/source --- src/markdeck/loop | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/markdeck/loop b/src/markdeck/loop index d2b42be..e043562 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -73,6 +73,14 @@ while true; do /source/assets/css/slides.scss \ /target/assets/css/slides.css || : fi + if [[ -e /source/assets/css/theme/source/ ]]; then + find /source/assets/css/theme/source/ -name \*.scss | while read filename; do + cp "$filename" /target/assets/3rdparty/reveal.js/css/theme/source/ + sassc \ + /target/assets/3rdparty/reveal.js/css/theme/source/$(basename "$filename") \ + /target/assets/3rdparty/reveal.js/css/theme/$(basename "$filename" | sed -e 's/\.scss$/.css/') || : + done + fi if [[ -e /source/assets/css/slides.impress.scss ]]; then sassc \ /source/assets/css/slides.impress.scss \ From 1e4fffd4d9b723b6fa028b733507475223df5bc1 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 18:46:55 +0200 Subject: [PATCH 06/33] Add header and footer elements that can be styled by themes --- src/markdeck/template-reveal.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/markdeck/template-reveal.html b/src/markdeck/template-reveal.html index 6c65160..5c6b1cc 100644 --- a/src/markdeck/template-reveal.html +++ b/src/markdeck/template-reveal.html @@ -49,6 +49,9 @@ $endif$ +
+ +
From b7f04d34034e63d90ac59f217f1435e81ae59768 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 21:37:52 +0200 Subject: [PATCH 07/33] Show display controls in speaker notes always --- src/markdeck/assets/markdeck/css/markdeck.revealjs.scss | 3 +++ src/markdeck/template-reveal.html | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss index f65c7be..7262050 100644 --- a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss +++ b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss @@ -33,3 +33,6 @@ background: transparent; } +.notes .reveal .controls { + display: contents !important; +} diff --git a/src/markdeck/template-reveal.html b/src/markdeck/template-reveal.html index 5c6b1cc..097e1a2 100644 --- a/src/markdeck/template-reveal.html +++ b/src/markdeck/template-reveal.html @@ -130,6 +130,12 @@ $for(include-after)$ From b0aa50d6dee14122da6a162346926669965354a7 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Fri, 27 Sep 2019 21:51:32 +0200 Subject: [PATCH 08/33] Include favicon from user's theme folder --- src/markdeck/template-reveal.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/markdeck/template-reveal.html b/src/markdeck/template-reveal.html index 097e1a2..9c15f4d 100644 --- a/src/markdeck/template-reveal.html +++ b/src/markdeck/template-reveal.html @@ -15,6 +15,7 @@ + From 5d9614666d75743a207d429f3d8912695f1f010c Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sat, 28 Sep 2019 22:00:56 +0200 Subject: [PATCH 09/33] Convert bash script to Makefile --- src/markdeck/Makefile | 152 ++++++++++++++++++++++++++++++++++++++++++ src/markdeck/loop | 113 ++----------------------------- 2 files changed, 157 insertions(+), 108 deletions(-) create mode 100644 src/markdeck/Makefile diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile new file mode 100644 index 0000000..850ab45 --- /dev/null +++ b/src/markdeck/Makefile @@ -0,0 +1,152 @@ +SHELL := /bin/bash + +all: .info-all render sync config pandoc + @echo "-------- /rerendering ---------" + @echo + +.info-all: + @echo "-------- rerendering ---------" + + +.info-render: + @echo "-------- rerendering prep ---------" + +render: .info-render /target/assets/css/rerendering.css /target/rendered + @echo "-------- /rerendering prep ---------" + @echo + +/target/assets/css/rerendering.css: /markdeck/assets/markdeck/css/when-rerendering.css /target/assets/css + cp $< $@ + +/target/assets/css: + mkdir -p $@ + +# FIXME not suer what this is good for? +/target/rendered: + mkdir -p $@ + + +.info-sync: + @echo "-------- rsync output --------" + +sync: .info-sync .rsync .fc-list + @echo "-------- /rsync ---------" + @echo + +.rsync: /markdeck/assets /markdeck/explain.html /target /target/assets/css/slides.scss /target/assets/css/render-pdf.css + -rsync -au /markdeck/assets /target/ + -if [ -d /source/assets ]; then rsync -auv /source/assets /target/; fi + -rsync -au /markdeck/explain.html /target/ + +.fc-list: + @echo + @echo "Know fonts:" + @fc-list + +/target/assets/css/slides.scss /target/assets/css/slides.impress.css /target/assets/css/render-pdf.css: + touch $@ + + +.info-sass: + @echo "-------- sass output --------" + +sass: .info-sass \ + /target/assets/css/slides.css \ + /target/assets/css/slides.impress.css \ + /target/assets/markdeck/css/markdeck.impressjs.css \ + /target/assets/markdeck/css/markdeck.revealjs.css \ + .sync-custom-themes \ + $(addprefix /target/assets/3rdparty/reveal.js/css/theme/,$(addsuffix .css,$(basename $(notdir $(wildcard /target/assets/3rdparty/reveal.js/css/theme/source/*.scss))))) + + @echo "-------- /sass ---------" + @echo + +.sync-custom-themes: $(wildcard /source/assets/css/theme/source/*.scss) + rsync -au $^ /target/assets/3rdparty/reveal.js/css/theme/source/ + + +.info-config: + @echo "-------- config --------" + +config: .info-config .metadata + jq '. | .' < /target/.meta/config.json + @echo "ASCIIART_CONFIG=${ASCIIART_CONFIG}" + @echo "-------- /config --------" + @echo + +.metadata: /target/.meta /target/.meta/config.json + +/target/.meta/config.json: $(wildcard /source/slide*.md) /markdeck/note.md /markdeck/defaults.yaml + pandoc --template=/markdeck/metadata.template $^ > $@ + +/target/.meta: + mkdir -p $@ + + +.info-pandoc: + @echo "-------- pandoc output --------" + +pandoc: .info-pandoc /target/index.html + @echo "-------- /pandoc output --------" + @echo + +/target/slides.combined.md.txt: $(wildcard /source/slide*.md) + -rm -f $@ + touch $@ + if [ -n "$^" ]; then \ + for F in $^; do \ + markdown-pp --exclude latexrender $$F >> $@ ; \ + echo >> $@; \ + done; \ + else \ + cp /markdeck/note.md $@; \ + fi + +PANDOC_ARGS= +ifeq ($(shell test -e /source/include-before-body && echo 1),1) +PANDOC_ARGS="$(PANDOC_ARGS) --include-before-body /source/include-before-body" +endif +ifeq ($(shell test -e /source/include-after-body && echo 1),1) +PANDOC_ARGS="$(PANDOC_ARGS) --include-after-body /source/include-after-body" +endif +variant=$(shell jq -r '.variant' < /target/.meta/config.json) + +/target/index.html.tmp: /target/slides.combined.md.txt /target/.meta/config.json /markdeck/defaults.yaml + pandoc \ + -f markdown+yaml_metadata_block \ + -t revealjs \ + --no-highlight \ + --wrap=preserve \ + --standalone \ + --template=/markdeck/template-$(variant).html \ + --slide-level=2 \ + --section-divs \ + --lua-filter /markdeck/lib/skip-slide-filter.lua \ + --filter mathjax-pandoc-filter \ + --lua-filter /markdeck/lib/render-asciiart-filter.lua \ + --lua-filter /markdeck/lib/render-emojis-filter.lua \ + --lua-filter /markdeck/lib/bg-shortcut-filter.lua \ + --lua-filter /markdeck/lib/$(variant)-shortcut-filter.lua \ + --lua-filter /markdeck/lib/inline-svg.lua \ + --lua-filter /markdeck/lib/font-awesome.lua \ + $(PANDOC_ARGS) \ + -o $@ \ + /target/slides.combined.md.txt /markdeck/defaults.yaml 2>&1 | tee /tmp/pandoc.output + + +/target/index.html: /target/index.html.tmp + # clear rerendering styling + echo "" > /target/assets/css/rerendering.css + cp $< $@ + +.SECONDEXPANSION: +/target/assets/3rdparty/reveal.js/css/theme/%.css: $$(addsuffix /%.scss,/target/assets/3rdparty/reveal.js/css/theme/source) + sassc $< $@ + +/target/assets/markdeck/css/%.css /target/assets/css/%.css: $$(subst .css,.scss,$$@) + sassc $< $@ + +clean: + rm -rf /target/.??* /target/* + +.PHONY: all .info-all render .info-render sync .info-sync .rsync .fc-list sass .info-sass .sync-custom-themes clean config .info-config pandoc .info-pandoc diff --git a/src/markdeck/loop b/src/markdeck/loop index e043562..d17b352 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -27,7 +27,6 @@ function print_usage() { } function show_errors() { - rm -f /target/index.html echo '
' > /target/index.html
     cat /tmp/pandoc.output >> /target/index.html
     echo '
' >> /target/index.html @@ -52,117 +51,15 @@ export ASCIIART_LIBDIR=/markdeck/lib while true; do cd /target - echo "-------- rerendering ---------" - mkdir -p /target/assets/css/ - cp -v /markdeck/assets/markdeck/css/when-rerendering.css /target/assets/css/rerendering.css + make -f /markdeck/Makefile render - [[ -d /target/rendered ]] || mkdir -p /target/rendered + make -f /markdeck/Makefile sync - echo "-------- rsync output --------" - rsync -a /markdeck/assets /target/ || : - touch /target/assets/css/slides.css /target/assets/css/render-pdf.css - [[ -d /source/assets ]] && rsync -av /source/assets /target/ || : - rsync -a /markdeck/explain.html /target/ || : - fc-list - echo "-------- /rsync output --------" - echo + make -f /markdeck/Makefile sass - echo "-------- sass output --------" - if [[ -e /source/assets/css/slides.scss ]]; then - sassc \ - /source/assets/css/slides.scss \ - /target/assets/css/slides.css || : - fi - if [[ -e /source/assets/css/theme/source/ ]]; then - find /source/assets/css/theme/source/ -name \*.scss | while read filename; do - cp "$filename" /target/assets/3rdparty/reveal.js/css/theme/source/ - sassc \ - /target/assets/3rdparty/reveal.js/css/theme/source/$(basename "$filename") \ - /target/assets/3rdparty/reveal.js/css/theme/$(basename "$filename" | sed -e 's/\.scss$/.css/') || : - done - fi - if [[ -e /source/assets/css/slides.impress.scss ]]; then - sassc \ - /source/assets/css/slides.impress.scss \ - /target/assets/css/slides.impress.css || : - fi - sassc \ - /markdeck/assets/markdeck/css/markdeck.revealjs.scss \ - /target/assets/markdeck/css/markdeck.revealjs.css || : - sassc \ - /markdeck/assets/3rdparty/reveal.js/css/theme/source/markdeck.scss \ - /target/assets/3rdparty/reveal.js/css/theme/markdeck.css || : - sassc \ - /markdeck/assets/markdeck/css/markdeck.impressjs.scss \ - /target/assets/markdeck/css/markdeck.impressjs.css || : - echo "-------- /sass output --------" - echo - - echo "-------- config --------" - shopt -s nullglob - SOURCE_MD=$(echo /source/slide*.md) - shopt -u nullglob - METADATA="$(pandoc --template=/markdeck/metadata.template ${SOURCE_MD:-/markdeck/note.md} /markdeck/defaults.yaml)" - mkdir -p /target/.meta/ - rm -f /target/.meta/config.json - echo "$METADATA" > /target/.meta/config.json - jq '. | .' <<<$METADATA - variant=$(jq -r '.variant' <<< "$METADATA") - echo "ASCIIART_CONFIG=$ASCIIART_CONFIG" - echo "-------- /config --------" - echo + make -f /markdeck/Makefile config - echo "-------- pandoc output --------" - PANDOC_ARGS= - [[ -e /source/include-before-body ]] && PANDOC_ARGS="$PANDOC_ARGS --include-before-body /source/include-before-body" - [[ -e /source/include-after-body ]] && PANDOC_ARGS="$PANDOC_ARGS --include-after-body /source/include-after-body" - rm -f /target/slides.combined.md.txt - # cat ${SOURCE_MD:-/markdeck/note.md} > /target/slides.combined.md.txt - if [[ -n ${SOURCE_MD:-} ]]; then - for F in $SOURCE_MD; do - markdown-pp --exclude latexrender $F >> /target/slides.combined.md.txt - echo >> /target/slides.combined.md.txt - done - else - cp /markdeck/note.md /target/slides.combined.md.txt - fi - - - template=/markdeck/template-${variant}.html - if pandoc \ - -f markdown+yaml_metadata_block \ - -t revealjs \ - --no-highlight \ - --wrap=preserve \ - --standalone \ - --template=$template \ - --slide-level=2 \ - --section-divs \ - --lua-filter /markdeck/lib/skip-slide-filter.lua \ - --filter mathjax-pandoc-filter \ - --lua-filter /markdeck/lib/render-asciiart-filter.lua \ - --lua-filter /markdeck/lib/render-emojis-filter.lua \ - --lua-filter /markdeck/lib/bg-shortcut-filter.lua \ - --lua-filter /markdeck/lib/${variant}-shortcut-filter.lua \ - --lua-filter /markdeck/lib/inline-svg.lua \ - --lua-filter /markdeck/lib/font-awesome.lua \ - $PANDOC_ARGS \ - -o /target/index.html.tmp \ - /target/slides.combined.md.txt /markdeck/defaults.yaml 2>&1 | tee /tmp/pandoc.output; - then - if [[ -e /target/index.html.tmp ]]; then - echo "" > /target/assets/css/rerendering.css - mv /target/index.html.tmp /target/index.html - else - show_errors - fi - else - show_errors - fi - echo "-------- /pandoc output --------" - echo - echo "-------- /rerendering ----------" - echo + make -f /markdeck/Makefile pandoc || show_errors $ONCE && break From 5f8c0c8410f4ab3f0d3df5254fb0d60a464f4c8c Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 07:53:10 +0200 Subject: [PATCH 10/33] Replace make variables with shell variables --- src/markdeck/Makefile | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 850ab45..a4f86c7 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -102,23 +102,18 @@ pandoc: .info-pandoc /target/index.html cp /markdeck/note.md $@; \ fi -PANDOC_ARGS= -ifeq ($(shell test -e /source/include-before-body && echo 1),1) -PANDOC_ARGS="$(PANDOC_ARGS) --include-before-body /source/include-before-body" -endif -ifeq ($(shell test -e /source/include-after-body && echo 1),1) -PANDOC_ARGS="$(PANDOC_ARGS) --include-after-body /source/include-after-body" -endif -variant=$(shell jq -r '.variant' < /target/.meta/config.json) - /target/index.html.tmp: /target/slides.combined.md.txt /target/.meta/config.json /markdeck/defaults.yaml + PANDOC_ARGS=; \ + [ -e /source/include-before-body ] && PANDOC_ARGS="$${PANDOC_ARGS} --include-before-body /source/include-before-body"; \ + [ -e /source/include-after-body ] && PANDOC_ARGS="$${PANDOC_ARGS} --include-after-body /source/include-after-body"; \ + variant="$$(jq -r '.variant' < /target/.meta/config.json)"; \ pandoc \ -f markdown+yaml_metadata_block \ -t revealjs \ --no-highlight \ --wrap=preserve \ --standalone \ - --template=/markdeck/template-$(variant).html \ + --template=/markdeck/template-$${variant}.html \ --slide-level=2 \ --section-divs \ --lua-filter /markdeck/lib/skip-slide-filter.lua \ @@ -126,14 +121,13 @@ variant=$(shell jq -r '.variant' < /target/.meta/config.json) --lua-filter /markdeck/lib/render-asciiart-filter.lua \ --lua-filter /markdeck/lib/render-emojis-filter.lua \ --lua-filter /markdeck/lib/bg-shortcut-filter.lua \ - --lua-filter /markdeck/lib/$(variant)-shortcut-filter.lua \ + --lua-filter /markdeck/lib/$${variant}-shortcut-filter.lua \ --lua-filter /markdeck/lib/inline-svg.lua \ --lua-filter /markdeck/lib/font-awesome.lua \ - $(PANDOC_ARGS) \ + $${PANDOC_ARGS} \ -o $@ \ /target/slides.combined.md.txt /markdeck/defaults.yaml 2>&1 | tee /tmp/pandoc.output - /target/index.html: /target/index.html.tmp # clear rerendering styling echo "" > /target/assets/css/rerendering.css From ab23ab1c0b165e7256cde622bab9eb0539ed06f2 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 08:11:05 +0200 Subject: [PATCH 11/33] Combine multiple rsync calls into one --- src/markdeck/Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index a4f86c7..95882a4 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -33,10 +33,14 @@ sync: .info-sync .rsync .fc-list @echo "-------- /rsync ---------" @echo -.rsync: /markdeck/assets /markdeck/explain.html /target /target/assets/css/slides.scss /target/assets/css/render-pdf.css - -rsync -au /markdeck/assets /target/ - -if [ -d /source/assets ]; then rsync -auv /source/assets /target/; fi - -rsync -au /markdeck/explain.html /target/ +.rsync: /target .rsync-sync /target/assets/css/slides.scss /target/assets/css/render-pdf.css + +.rsync-sync: /markdeck/assets $(wildcard /source/assets) /markdeck/explain.html + # FIXME the dynamically generated scss and css files are deleted by rsync. + # If there was a way to separate the files coming from rsync and the + # dynamically generated files this would be ideal + # -rsync -auv --delete $^ /target/ + -rsync -auv $^ /target/ .fc-list: @echo @@ -143,4 +147,4 @@ pandoc: .info-pandoc /target/index.html clean: rm -rf /target/.??* /target/* -.PHONY: all .info-all render .info-render sync .info-sync .rsync .fc-list sass .info-sass .sync-custom-themes clean config .info-config pandoc .info-pandoc +.PHONY: all .info-all render .info-render sync .info-sync .rsync .rsync-sync .fc-list sass .info-sass .sync-custom-themes clean config .info-config pandoc .info-pandoc From 17c6cf4518ef2ea7f0cf5838aa6d9e8c85acca1f Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 08:27:27 +0200 Subject: [PATCH 12/33] Reduce wait time of liveserver to 50 milliseconds --- src/Dockerfile.liveserver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dockerfile.liveserver b/src/Dockerfile.liveserver index 71c9d68..9a9bb74 100644 --- a/src/Dockerfile.liveserver +++ b/src/Dockerfile.liveserver @@ -9,4 +9,4 @@ EXPOSE 8080 VOLUME /target WORKDIR /target -ENTRYPOINT node /usr/local/bin/live-server --no-browser --wait=100 --watch=/target/index.html,assets/css/ . +ENTRYPOINT node /usr/local/bin/live-server --no-browser --wait=50 --watch=/target/index.html,assets/css/ . From 863abb0a87792cbec0ec0ec1ccb01946d0e7dd5d Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 08:31:09 +0200 Subject: [PATCH 13/33] Move temporary files into .meta/ --- src/markdeck/Makefile | 11 +++++------ src/markdeck/loop | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 95882a4..718a0fc 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -21,7 +21,6 @@ render: .info-render /target/assets/css/rerendering.css /target/rendered /target/assets/css: mkdir -p $@ -# FIXME not suer what this is good for? /target/rendered: mkdir -p $@ @@ -94,7 +93,7 @@ pandoc: .info-pandoc /target/index.html @echo "-------- /pandoc output --------" @echo -/target/slides.combined.md.txt: $(wildcard /source/slide*.md) +/target/.meta/slides.combined.md.txt: $(wildcard /source/slide*.md) -rm -f $@ touch $@ if [ -n "$^" ]; then \ @@ -106,7 +105,7 @@ pandoc: .info-pandoc /target/index.html cp /markdeck/note.md $@; \ fi -/target/index.html.tmp: /target/slides.combined.md.txt /target/.meta/config.json /markdeck/defaults.yaml +/target/.meta/index.html: /target/.meta/slides.combined.md.txt /target/.meta/config.json /markdeck/defaults.yaml PANDOC_ARGS=; \ [ -e /source/include-before-body ] && PANDOC_ARGS="$${PANDOC_ARGS} --include-before-body /source/include-before-body"; \ [ -e /source/include-after-body ] && PANDOC_ARGS="$${PANDOC_ARGS} --include-after-body /source/include-after-body"; \ @@ -130,12 +129,12 @@ pandoc: .info-pandoc /target/index.html --lua-filter /markdeck/lib/font-awesome.lua \ $${PANDOC_ARGS} \ -o $@ \ - /target/slides.combined.md.txt /markdeck/defaults.yaml 2>&1 | tee /tmp/pandoc.output + $< /markdeck/defaults.yaml 2>&1 | tee /target/.meta/pandoc.output -/target/index.html: /target/index.html.tmp +/target/index.html: /target/.meta /target/.meta/index.html # clear rerendering styling echo "" > /target/assets/css/rerendering.css - cp $< $@ + cp /target/.meta/index.html $@ .SECONDEXPANSION: /target/assets/3rdparty/reveal.js/css/theme/%.css: $$(addsuffix /%.scss,/target/assets/3rdparty/reveal.js/css/theme/source) diff --git a/src/markdeck/loop b/src/markdeck/loop index d17b352..c34433e 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -28,11 +28,11 @@ function print_usage() { function show_errors() { echo '
' > /target/index.html
-    cat /tmp/pandoc.output >> /target/index.html
+    cat /target/.meta/pandoc.output >> /target/index.html
     echo '
' >> /target/index.html echo -e "${esc}[37m${esc}[43m" echo -e "\npandoc crashed\n" - cat /tmp/pandoc.output + cat /target/.meta/pandoc.output echo -e "${esc}[0m" sleep 4 } From af3bf1d7b919229122fc07828359fe46a431340b Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 08:39:19 +0200 Subject: [PATCH 14/33] Move rendered folder to assets/rendered --- src/markdeck/Makefile | 4 ++-- src/markdeck/lib/render-asciiart-filter.lua | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 718a0fc..1aea643 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -11,7 +11,7 @@ all: .info-all render sync config pandoc .info-render: @echo "-------- rerendering prep ---------" -render: .info-render /target/assets/css/rerendering.css /target/rendered +render: .info-render /target/assets/css/rerendering.css /target/assets/rendered @echo "-------- /rerendering prep ---------" @echo @@ -21,7 +21,7 @@ render: .info-render /target/assets/css/rerendering.css /target/rendered /target/assets/css: mkdir -p $@ -/target/rendered: +/target/assets/rendered: mkdir -p $@ diff --git a/src/markdeck/lib/render-asciiart-filter.lua b/src/markdeck/lib/render-asciiart-filter.lua index aefd3f4..338e9b8 100644 --- a/src/markdeck/lib/render-asciiart-filter.lua +++ b/src/markdeck/lib/render-asciiart-filter.lua @@ -41,11 +41,11 @@ else io.stderr:write(err) end -local outputdir=io.open("rendered","r") +local outputdir=io.open("assets/rendered","r") if outputdir~=nil then io.close(outputdir) else - os.execute("mkdir rendered") + os.execute("mkdir assets/rendered") end LIBDIR=os.getenv("ASCIIART_LIBDIR") or "lib" @@ -128,7 +128,7 @@ images = {} function Cleanup(doc) - local pfile = io.popen('ls -a rendered/*.png rendered/*.svg 2> /dev/null') + local pfile = io.popen('ls -a assets/rendered/*.png assets/rendered/*.svg 2> /dev/null') for fname in pfile:lines() do if not images[fname] then io.stderr:write("removing obsolete '" .. fname .. "'\n") @@ -146,7 +146,7 @@ function Render(elem, attr) if elem.classes[1] == format then local cmd, filetype = render_cmd(elem.text, elem.attributes or {}) local mimetype = "image/" .. filetype - local fname = "rendered/" .. format .. "-" .. pandoc.sha1(cmd[1] .. table.concat(cmd[2], " ") .. cmd[3]) .. "." .. filetype + local fname = "assets/rendered/" .. format .. "-" .. pandoc.sha1(cmd[1] .. table.concat(cmd[2], " ") .. cmd[3]) .. "." .. filetype local data = nil local f=io.open(fname,"rb") From c8115f31722db5f6209acb1b60437a5b34d1f774 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 18:55:23 +0200 Subject: [PATCH 15/33] Don't sync explain.html --- src/markdeck/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 1aea643..7f93529 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -34,7 +34,7 @@ sync: .info-sync .rsync .fc-list .rsync: /target .rsync-sync /target/assets/css/slides.scss /target/assets/css/render-pdf.css -.rsync-sync: /markdeck/assets $(wildcard /source/assets) /markdeck/explain.html +.rsync-sync: /markdeck/assets $(wildcard /source/assets) # FIXME the dynamically generated scss and css files are deleted by rsync. # If there was a way to separate the files coming from rsync and the # dynamically generated files this would be ideal From e30d122057b916ac441b53e8e9792f6b7989e1e0 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 19:51:25 +0200 Subject: [PATCH 16/33] Fix reference point for wait-for-changes and add inotify target --- src/Dockerfile.pandoc | 1 + src/markdeck/Makefile | 5 +++++ src/markdeck/loop | 1 + src/markdeck/wait-for-changes | 5 +++-- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Dockerfile.pandoc b/src/Dockerfile.pandoc index c396714..7ef8e5d 100644 --- a/src/Dockerfile.pandoc +++ b/src/Dockerfile.pandoc @@ -6,6 +6,7 @@ ARG pandoc_version ARG version ARG motto +# TODO try watchman to get inotify working. Currently watchman in alpine edge .. RUN apk add \ make bash curl \ graphviz inotify-tools rsync \ diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 7f93529..65c9f48 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -143,6 +143,11 @@ pandoc: .info-pandoc /target/index.html /target/assets/markdeck/css/%.css /target/assets/css/%.css: $$(subst .css,.scss,$$@) sassc $< $@ +waitforchanges: $(wildcard /source/slide*.md) /source/assets $(wildcard /source/include-before-body) $(wildcard /source/include-after-body) + # TODO currently inotify doesn't work on mounted volumes :-/ + inotifywait -e modify,create,delete,move,attrib -r $^ + + clean: rm -rf /target/.??* /target/* diff --git a/src/markdeck/loop b/src/markdeck/loop index c34433e..dc38b4b 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -71,6 +71,7 @@ while true; do sleep .5 print_usage + # make -f /markdeck/Makefile waitforchanges /markdeck/wait-for-changes echo -e "\n\n\n\n\n\n\n\n\n\n" diff --git a/src/markdeck/wait-for-changes b/src/markdeck/wait-for-changes index d6791a0..9da5ed9 100755 --- a/src/markdeck/wait-for-changes +++ b/src/markdeck/wait-for-changes @@ -2,7 +2,7 @@ set -e -E -u SOURCES="/source/slide*.md $(find /source/assets -type d) /source/include-before-body /source/include-after-body" -TARGET=/target/index.html +TARGET="$(mktemp)" last_sources=$(echo $SOURCES) no_change=true @@ -19,6 +19,7 @@ while $no_change; do no_change=false fi done - $no_change && sleep 2 + $no_change && sleep 1 done +rm -f "${TARGET}" exit 0 From cd5bc433d693ad0c0c965946994a51dad7572c4c Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Sun, 29 Sep 2019 23:31:11 +0200 Subject: [PATCH 17/33] Simplify loop --- src/markdeck/Makefile | 3 ++- src/markdeck/loop | 13 ++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 65c9f48..6eae723 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -145,7 +145,8 @@ pandoc: .info-pandoc /target/index.html waitforchanges: $(wildcard /source/slide*.md) /source/assets $(wildcard /source/include-before-body) $(wildcard /source/include-after-body) # TODO currently inotify doesn't work on mounted volumes :-/ - inotifywait -e modify,create,delete,move,attrib -r $^ + # inotifywait -e modify,create,delete,move,attrib -r $^ + /markdeck/wait-for-changes clean: diff --git a/src/markdeck/loop b/src/markdeck/loop index dc38b4b..3aeac0f 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -51,15 +51,7 @@ export ASCIIART_LIBDIR=/markdeck/lib while true; do cd /target - make -f /markdeck/Makefile render - - make -f /markdeck/Makefile sync - - make -f /markdeck/Makefile sass - - make -f /markdeck/Makefile config - - make -f /markdeck/Makefile pandoc || show_errors + make -f /markdeck/Makefile all || show_errors $ONCE && break @@ -71,8 +63,7 @@ while true; do sleep .5 print_usage - # make -f /markdeck/Makefile waitforchanges - /markdeck/wait-for-changes + make -f /markdeck/Makefile waitforchanges echo -e "\n\n\n\n\n\n\n\n\n\n" done From 00933aec1c21d5360e60c857336b0ea8c62a4ae4 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Mon, 30 Sep 2019 07:04:02 +0200 Subject: [PATCH 18/33] Rename wait-for-changes target and make it PHONY --- src/markdeck/Makefile | 4 ++-- src/markdeck/loop | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 6eae723..e23954f 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -143,7 +143,7 @@ pandoc: .info-pandoc /target/index.html /target/assets/markdeck/css/%.css /target/assets/css/%.css: $$(subst .css,.scss,$$@) sassc $< $@ -waitforchanges: $(wildcard /source/slide*.md) /source/assets $(wildcard /source/include-before-body) $(wildcard /source/include-after-body) +wait-for-changes: $(wildcard /source/slide*.md) /source/assets $(wildcard /source/include-before-body) $(wildcard /source/include-after-body) # TODO currently inotify doesn't work on mounted volumes :-/ # inotifywait -e modify,create,delete,move,attrib -r $^ /markdeck/wait-for-changes @@ -152,4 +152,4 @@ waitforchanges: $(wildcard /source/slide*.md) /source/assets $(wildcard /source/ clean: rm -rf /target/.??* /target/* -.PHONY: all .info-all render .info-render sync .info-sync .rsync .rsync-sync .fc-list sass .info-sass .sync-custom-themes clean config .info-config pandoc .info-pandoc +.PHONY: all .info-all render .info-render sync .info-sync .rsync .rsync-sync .fc-list sass .info-sass .sync-custom-themes clean config .info-config pandoc .info-pandoc wait-for-changes diff --git a/src/markdeck/loop b/src/markdeck/loop index 3aeac0f..93b722b 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -63,7 +63,7 @@ while true; do sleep .5 print_usage - make -f /markdeck/Makefile waitforchanges + make -f /markdeck/Makefile wait-for-changes echo -e "\n\n\n\n\n\n\n\n\n\n" done From eaa633fc820f661118827cc8c2caad73495449ab Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Mon, 30 Sep 2019 07:33:48 +0200 Subject: [PATCH 19/33] Rename default target from all to build --- src/markdeck/Makefile | 6 +++--- src/markdeck/loop | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index e23954f..e2e2f64 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -1,10 +1,10 @@ SHELL := /bin/bash -all: .info-all render sync config pandoc +build: .info-build render sync config pandoc @echo "-------- /rerendering ---------" @echo -.info-all: +.info-build: @echo "-------- rerendering ---------" @@ -152,4 +152,4 @@ wait-for-changes: $(wildcard /source/slide*.md) /source/assets $(wildcard /sourc clean: rm -rf /target/.??* /target/* -.PHONY: all .info-all render .info-render sync .info-sync .rsync .rsync-sync .fc-list sass .info-sass .sync-custom-themes clean config .info-config pandoc .info-pandoc wait-for-changes +.PHONY: build .info-build render .info-render sync .info-sync .rsync .rsync-sync .fc-list sass .info-sass .sync-custom-themes clean config .info-config pandoc .info-pandoc wait-for-changes diff --git a/src/markdeck/loop b/src/markdeck/loop index 93b722b..e1c9714 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -51,7 +51,7 @@ export ASCIIART_LIBDIR=/markdeck/lib while true; do cd /target - make -f /markdeck/Makefile all || show_errors + make -f /markdeck/Makefile build || show_errors $ONCE && break From 6944eead6271699227e1641077ca79d4d48ca3b6 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Mon, 30 Sep 2019 12:06:11 +0200 Subject: [PATCH 20/33] Add missing sass dependency --- src/markdeck/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index e2e2f64..a122fdd 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash -build: .info-build render sync config pandoc +build: .info-build render sync sass config pandoc @echo "-------- /rerendering ---------" @echo From 099da2faeb6b5dd27c0e1104a48459842b06c20b Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Thu, 3 Oct 2019 14:10:31 +0200 Subject: [PATCH 21/33] Fix typo --- src/markdeck/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index a122fdd..3acf9d7 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -43,7 +43,7 @@ sync: .info-sync .rsync .fc-list .fc-list: @echo - @echo "Know fonts:" + @echo "Known fonts:" @fc-list /target/assets/css/slides.scss /target/assets/css/slides.impress.css /target/assets/css/render-pdf.css: From c2cb6c133a1962219f4211742664f32a7068fe24 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Thu, 3 Oct 2019 14:11:36 +0200 Subject: [PATCH 22/33] Create reference point for wait changes before the build run --- src/markdeck/Makefile | 4 +++- src/markdeck/loop | 6 ++++++ src/markdeck/wait-for-changes | 8 ++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/markdeck/Makefile b/src/markdeck/Makefile index 3acf9d7..ff01463 100644 --- a/src/markdeck/Makefile +++ b/src/markdeck/Makefile @@ -1,3 +1,5 @@ +#!/usr/bin/env make -f + SHELL := /bin/bash build: .info-build render sync sass config pandoc @@ -146,7 +148,7 @@ pandoc: .info-pandoc /target/index.html wait-for-changes: $(wildcard /source/slide*.md) /source/assets $(wildcard /source/include-before-body) $(wildcard /source/include-after-body) # TODO currently inotify doesn't work on mounted volumes :-/ # inotifywait -e modify,create,delete,move,attrib -r $^ - /markdeck/wait-for-changes + /markdeck/wait-for-changes "$(WAIT_REFERENCE)" clean: diff --git a/src/markdeck/loop b/src/markdeck/loop index e1c9714..85d00ef 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -48,9 +48,13 @@ fi export ASCIIART_CONFIG export ASCIIART_LIBDIR=/markdeck/lib +export WAIT_REFERENCE="$(mktemp)" + while true; do cd /target + touch "${WAIT_REFERENCE}" + make -f /markdeck/Makefile build || show_errors $ONCE && break @@ -68,4 +72,6 @@ while true; do echo -e "\n\n\n\n\n\n\n\n\n\n" done +rm -f "${WAIT_REFERENCE}" + echo "done." diff --git a/src/markdeck/wait-for-changes b/src/markdeck/wait-for-changes index 9da5ed9..f7bf413 100755 --- a/src/markdeck/wait-for-changes +++ b/src/markdeck/wait-for-changes @@ -2,7 +2,11 @@ set -e -E -u SOURCES="/source/slide*.md $(find /source/assets -type d) /source/include-before-body /source/include-after-body" -TARGET="$(mktemp)" +TARGET="${1}" + +if [ ! -e "${TARGET}" ]; then + exit 1 +fi last_sources=$(echo $SOURCES) no_change=true @@ -21,5 +25,5 @@ while $no_change; do done $no_change && sleep 1 done -rm -f "${TARGET}" + exit 0 From 2bdc92e2cb9ff71f8cb23d9dc68eec1bef806ac9 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Thu, 7 Nov 2019 09:00:36 +0100 Subject: [PATCH 23/33] Add option fragmentsInURL --- src/markdeck/defaults.yaml | 1 + src/markdeck/template-reveal.html | 1 + 2 files changed, 2 insertions(+) diff --git a/src/markdeck/defaults.yaml b/src/markdeck/defaults.yaml index fe47d94..0aa4d0f 100644 --- a/src/markdeck/defaults.yaml +++ b/src/markdeck/defaults.yaml @@ -41,6 +41,7 @@ loop: false rtl: false shuffle: false fragments: true +fragmentsInURL: true embedded: false help: true showNotes: false diff --git a/src/markdeck/template-reveal.html b/src/markdeck/template-reveal.html index 9c15f4d..e33874e 100644 --- a/src/markdeck/template-reveal.html +++ b/src/markdeck/template-reveal.html @@ -90,6 +90,7 @@ rtl: '$rtl$', shuffle: '$shuffle$', fragments: '$fragments$', + fragmentsInURL: '$fragmentsInURL$', embedded: '$embedded$', help: '$help$', showNotes: '$showNotes$', From aa52136b3c3d35b22ffb406285bf9744a1fc96f3 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Thu, 7 Nov 2019 09:01:25 +0100 Subject: [PATCH 24/33] Support columns configuration from pandoc documentation --- src/markdeck/assets/markdeck/css/markdeck.revealjs.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss index 7262050..43080ad 100644 --- a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss +++ b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss @@ -1,5 +1,9 @@ @import "commoncommon"; +.columns { + display: flex; +} + .reveal .license { font-size: 12pt; } From fa63940b4ba961e93b6e1789a93bd47f305d6971 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Thu, 7 Nov 2019 09:01:49 +0100 Subject: [PATCH 25/33] Delete duplicate empty line --- src/markdeck/assets/markdeck/css/_common.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/markdeck/assets/markdeck/css/_common.scss b/src/markdeck/assets/markdeck/css/_common.scss index 8f56212..447e5ee 100644 --- a/src/markdeck/assets/markdeck/css/_common.scss +++ b/src/markdeck/assets/markdeck/css/_common.scss @@ -14,7 +14,6 @@ } } - @font-face { font-family: 'Inconsolata'; font-style: normal; From b04f456a663b796de32e76bd70799b5f4e0f6945 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 19:26:38 +0100 Subject: [PATCH 26/33] Set MARKDECK_USER for pdf and standalone to ensure write access --- markdeck | 2 ++ 1 file changed, 2 insertions(+) diff --git a/markdeck b/markdeck index 77b1076..a0ec8e5 100755 --- a/markdeck +++ b/markdeck @@ -65,6 +65,7 @@ services: pdf: image: "arne/markdeck-decktape:0.5" + user: "\$MARKDECK_USER" volumes: - type: bind source: ${PWD}/${BUILD} @@ -74,6 +75,7 @@ services: standalone: image: "arne/markdeck-standalone:0.2" + user: "\$MARKDECK_USER" volumes: - type: bind source: ${PWD}/${BUILD} From b976b80a2f497a36f2c49565e7dc068fcdbfddb0 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 19:28:32 +0100 Subject: [PATCH 27/33] Improve error detection if pdf rendering fails --- src/markdeck/loop.decktape | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/markdeck/loop.decktape b/src/markdeck/loop.decktape index d293383..7264883 100755 --- a/src/markdeck/loop.decktape +++ b/src/markdeck/loop.decktape @@ -43,6 +43,7 @@ while true; do echo "pdf rendering finished" fi sleep 1 - [ /slides/index.html -nt /slides/.meta/pdf_rendered ] && continue + + [ -e /slides/index.html ] && [ -e /slides/.meta/pdf_rendered ] && [ /slides/index.html -nt /slides/.meta/pdf_rendered ] && continue inotifywait -qq /slides/index.html done From 6665eba881b7424061a4805d92752177168d8630 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 19:29:21 +0100 Subject: [PATCH 28/33] Unify error messages to start with an uppercase letter and end with a period --- src/markdeck/loop | 8 ++++---- src/markdeck/loop.decktape | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/markdeck/loop b/src/markdeck/loop index 85d00ef..aae672c 100755 --- a/src/markdeck/loop +++ b/src/markdeck/loop @@ -10,7 +10,7 @@ case $PARAM in shell) bash -i; exit;; --once) ONCE=true;; loop) ;; - *) echo "unknown parameter '$PARAM' given, aborting here..." && exit 1;; + *) echo "Unknown parameter '$PARAM' given, aborting here." && exit 1;; esac shopt -s nullglob @@ -20,7 +20,7 @@ function print_usage() { echo -e "\n\n\n${esc}[1mmarkdeck $VERSION - $MOTTO${esc}[0m\n" echo -e " ${esc}[1mfor the slides: open http://localhost:$PORT${esc}[0m" echo - echo -e "for side-by-side view: open http://localhost:$PORT/explain.html" + echo -e "For side-by-side view: open http://localhost:$PORT/explain.html" echo -e " to stop markdeck: hit Ctrl-C" echo echo @@ -60,7 +60,7 @@ while true; do $ONCE && break if [[ /source -nt /target/index.html ]]; then - echo -e "\n\n\nchange detected: sources newer than rendered deck, rerendering started...\n\n\n" + echo -e "\n\n\nChange detected, restart rerendering.\n\n\n" continue fi @@ -74,4 +74,4 @@ done rm -f "${WAIT_REFERENCE}" -echo "done." +echo "Markdeck done." diff --git a/src/markdeck/loop.decktape b/src/markdeck/loop.decktape index 7264883..3f62abc 100755 --- a/src/markdeck/loop.decktape +++ b/src/markdeck/loop.decktape @@ -8,9 +8,11 @@ while true; do CONFIG=$(cat $CONFIG_FILE) pdf=$(echo "$CONFIG" | jq -r '.pdf') + echo "whoami $USER" + if [ -n "$pdf" ]; then + echo "Start PDF rendering." touch /slides/.meta/pdf_rendered - echo "starting pdf rendering" # stat -c "%y %n" /target/index.html # stat -c "%y %n" /target/.meta/pdf_rendered pdf_size=$(echo "$CONFIG" | jq -r '.pdf_size') @@ -40,10 +42,14 @@ while true; do convert -density 300x300 $(ls -1r -tc /tmp/slides/*.png) /slides/$pdf.screenshots.pdf fi - echo "pdf rendering finished" + echo "PDF rendering finished." + else + echo "No PDF specified, skip rendering." fi sleep 1 [ -e /slides/index.html ] && [ -e /slides/.meta/pdf_rendered ] && [ /slides/index.html -nt /slides/.meta/pdf_rendered ] && continue inotifywait -qq /slides/index.html done + +# vi: ft=sh:tw=80:sw=4:ts=4:sts=4:et From ac8051263dadccb3cd060b38276191d18ec5ddaa Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 19:35:01 +0100 Subject: [PATCH 29/33] Delete debug information --- src/markdeck/loop.decktape | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/markdeck/loop.decktape b/src/markdeck/loop.decktape index 3f62abc..1f04d51 100755 --- a/src/markdeck/loop.decktape +++ b/src/markdeck/loop.decktape @@ -8,8 +8,6 @@ while true; do CONFIG=$(cat $CONFIG_FILE) pdf=$(echo "$CONFIG" | jq -r '.pdf') - echo "whoami $USER" - if [ -n "$pdf" ]; then echo "Start PDF rendering." touch /slides/.meta/pdf_rendered From 8191989e47452fe065a540d07b7ba1564a005103 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 19:37:39 +0100 Subject: [PATCH 30/33] Add more information about the reason for skipping PDF rendering --- src/markdeck/loop.decktape | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdeck/loop.decktape b/src/markdeck/loop.decktape index 1f04d51..0d49d81 100755 --- a/src/markdeck/loop.decktape +++ b/src/markdeck/loop.decktape @@ -42,7 +42,7 @@ while true; do echo "PDF rendering finished." else - echo "No PDF specified, skip rendering." + echo "No PDF output file specified, skip rendering." fi sleep 1 From 88526c5da108a1e6942fb0d3caaec51dee9fc095 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 19:38:52 +0100 Subject: [PATCH 31/33] Deactivate markdeckFooter by default --- src/markdeck/defaults.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdeck/defaults.yaml b/src/markdeck/defaults.yaml index 0aa4d0f..4a5021e 100644 --- a/src/markdeck/defaults.yaml +++ b/src/markdeck/defaults.yaml @@ -16,7 +16,7 @@ margin: 0.1 minScale: 0.2 maxScale: 1.5 -markdeckFooter: true +markdeckFooter: false standalone: From 7335b382f7e4e979c70da42935c1c9cc9a8385f2 Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 20:02:41 +0100 Subject: [PATCH 32/33] Increase heading font sizes in default theme to make it them readable --- .../assets/markdeck/css/theme/source/markdeck.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/markdeck/assets/markdeck/css/theme/source/markdeck.scss b/src/markdeck/assets/markdeck/css/theme/source/markdeck.scss index 5c241d6..2aa2199 100644 --- a/src/markdeck/assets/markdeck/css/theme/source/markdeck.scss +++ b/src/markdeck/assets/markdeck/css/theme/source/markdeck.scss @@ -52,10 +52,10 @@ $linkColor: #00008B; $linkColorHover: lighten( $linkColor, 20% ); $selectionBackgroundColor: rgba(0, 0, 0, 0.99); -$heading1Size: 1.4em; -$heading2Size: 0.8em; -$heading3Size: 0.8em; -$heading4Size: 0.8em; +$heading1Size: 2.5em; +$heading2Size: 1.5em; +$heading3Size: 1.3em; +$heading4Size: 1.1em; section.has-dark-background { &, h1, h2, h3, h4, h5, h6 { From b61b44cc9a0380ca78bf430b3727e375abd6de9d Mon Sep 17 00:00:00 2001 From: Jan Christoph Ebersbach Date: Tue, 26 Nov 2019 22:44:06 +0100 Subject: [PATCH 33/33] Hide list style if requested --- src/markdeck/assets/markdeck/css/markdeck.revealjs.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss index 43080ad..fe4abea 100644 --- a/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss +++ b/src/markdeck/assets/markdeck/css/markdeck.revealjs.scss @@ -4,6 +4,11 @@ display: flex; } +.no-list-style ul { + list-style-type: none; + padding-left: 0; +} + .reveal .license { font-size: 12pt; }