From fb3ddf62e93b36a982189a6d26e8d43b052b6add Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Fri, 7 Feb 2020 10:24:12 +0100 Subject: [PATCH 1/5] build: Add deploy upload rules Useful to deploy to gh-pages, for example: make upload will replace gh-pages branch with generated HTML: https://crossstream.github.io/org-reveal/Readme.html Forwarded: https://github.com/yjwen/org-reveal/pull/406 Change-Id: I6e041c6930c3ea9f5f7ac08255fc48d94a97bb84 Signed-off-by: Philippe Coval --- Makefile | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 251c770..63681de 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,12 @@ default: help all srcs?=$(wildcard *.org | sort) objs?=${srcs:.org=.html} -target?=$(shell echo ${srcs:.org=} | head -n1) +target?=$(shell echo ${srcs:.org=} | tr ' ' '\n' | head -n1) reveal_url?=https://github.com/hakimel/reveal.js/ reveal_zip_url?=https://github.com/hakimel/reveal.js/archive/master.zip reveal_dir?=./reveal.js sudo?=sudo +deploy_branch?=gh-pages help: @@ -26,6 +27,7 @@ help: @echo "# make all # Build html" @echo "# make start # View HTML in Web browser" @echo "# make download # Download deps" + @echo "# make upload # to build and publish" @echo "# make setup/debian setup download start # ..." @echo "# Config:" @echo "# srcs=${srcs}" @@ -36,6 +38,7 @@ all: ${objs} ls $^ download: ${reveal_dir} + ls $^ start: ${target}.html x-www-browser $< @@ -94,8 +97,8 @@ html: ${target}.html all/%: ${srcs} for src in $^ ; do \ - dir=$$(dirname -- "$${src}") ; \ - make target="$${dir}/index" ${@F} \ + target=$$(echo "$${src}" | sed -e 's|\.org$$||g') ; \ + make target="$${target}" "${@F}" \ || exit $$? ; \ done @@ -104,4 +107,27 @@ ${reveal_dir}: wget -O- ${reveal_zip_url} > reveal.js.zip unzip reveal.js.zip mv reveal.js-master ${@} - @rm -f tmp.zip + @rm -f reveal.js.zip + +deploy: + -git commit -sam "WIP: About to deploy ${target}" + git checkout ${deploy_branch} \ + || git checkout -b ${deploy_branch} master + make html + git add -f ${target}.html + -git commit -am "WIP: Generated html ${target}" + git checkout master + +upload: + git checkout master + -git branch -D ${deploy_branch} + git checkout -b ${deploy_branch} + -git commit -sam "WIP: About to download" + make download + git add -f "${reveal_dir}" + -git commit -sam "WIP: Add ${reveal_dir}" + ${MAKE} all/deploy + git checkout ${deploy_branch} + echo "# About to push to origin in 5 secs ?" + sleep 5 ; git push -f origin HEAD:gh-pages + git checkout master From 418cfec3dd18043f1ad52026fb9744bb531854ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Giquel?= Date: Sat, 15 Feb 2020 14:02:25 +0100 Subject: [PATCH 2/5] Add options to set the toc slide background --- Readme.org | 10 ++++++++++ ox-reveal.el | 29 +++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Readme.org b/Readme.org index d1ff161..3ad9915 100644 --- a/Readme.org +++ b/Readme.org @@ -42,6 +42,7 @@ - [[Single Image Background][Single Image Background]]([[https://github.com/yjwen/org-reveal#single-image-background][gh]]) - [[Repeating Image Background][Repeating Image Background]]([[https://github.com/yjwen/org-reveal#repeating-image-background][gh]]) - [[Title Slide Background Image][Title Slide Background Image]]([[https://github.com/yjwen/org-reveal#title-slide-background-image][gh]]) + - [[Table of Contents Slide Background Image][Table of Contents Slide Background Image]]([[https://github.com/yjwen/org-reveal#table-of-contents-slide-background-image][gh]]) - [[Background for all slides][Background for all slides]]([[https://github.com/yjwen/org-reveal#background-for-all-slides][gh]]) #+REVEAL: split:t - [[Slide Size][Slide Size]]([[https://github.com/yjwen/org-reveal#slide-size][gh]]) @@ -387,6 +388,15 @@ Available transitions are: default|cube|page|concave|zoom|linear|fade|none. * =REVEAL_TITLE_SLIDE_BACKGROUND_SIZE=: HTML size specification, e.g. ~200px~. * =REVEAL_TITLE_SLIDE_BACKGROUND_REPEAT=: Set to ~repeat~ to repeat the image. * =REVEAL_TITLE_SLIDE_BACKGROUND_OPACITY=: Set the background opacity. +*** Table of Contents Slide Background Image + + To set the (automatically generated) table of contents slide's background + image, please specify the following options: + + * =REVEAL_TOC_SLIDE_BACKGROUND=: A URL to the background image. + * =REVEAL_TOC_SLIDE_BACKGROUND_SIZE=: HTML size specification, e.g. ~200px~. + * =REVEAL_TOC_SLIDE_BACKGROUND_REPEAT=: Set to ~repeat~ to repeat the image. + * =REVEAL_TOC_SLIDE_BACKGROUND_OPACITY=: Set the background opacity. *** Background for all slides You can also configure the background for all slides in the presentation with: diff --git a/ox-reveal.el b/ox-reveal.el index 3572aaa..b9bade6 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -73,6 +73,12 @@ (:reveal-title-slide-background-repeat "REVEAL_TITLE_SLIDE_BACKGROUND_REPEAT" nil nil t) (:reveal-title-slide-background-transition "REVEAL_TITLE_SLIDE_BACKGROUND_TRANSITION" nil nil t) (:reveal-title-slide-background-opacity "REVEAL_TITLE_SLIDE_BACKGROUND_OPACITY" nil nil t) + (:reveal-toc-slide-background "REVEAL_TOC_SLIDE_BACKGROUND" nil nil t) + (:reveal-toc-slide-background-size "REVEAL_TOC_SLIDE_BACKGROUND_SIZE" nil nil t) + (:reveal-toc-slide-background-position "REVEAL_TOC_SLIDE_BACKGROUND_POSITION" nil nil t) + (:reveal-toc-slide-background-repeat "REVEAL_TOC_SLIDE_BACKGROUND_REPEAT" nil nil t) + (:reveal-toc-slide-background-transition "REVEAL_TOC_SLIDE_BACKGROUND_TRANSITION" nil nil t) + (:reveal-toc-slide-background-opacity "REVEAL_TOC_SLIDE_BACKGROUND_OPACITY" nil nil t) (:reveal-default-slide-background "REVEAL_DEFAULT_SLIDE_BACKGROUND" nil nil t) (:reveal-default-slide-background-size "REVEAL_DEFAULT_SLIDE_BACKGROUND_SIZE" nil nil t) (:reveal-default-slide-background-position "REVEAL_DEFAULT_SLIDE_BACKGROUND_POSITION" nil nil t) @@ -677,9 +683,28 @@ dependencies: [ "Build a slide of table of contents." (let ((toc (org-html-toc depth info))) (when toc - (let ((toc-slide-with-header (plist-get info :reveal-slide-global-header)) + (let ((toc-slide-background (plist-get info :reveal-toc-slide-background)) + (toc-slide-background-size (plist-get info :reveal-toc-slide-background-size)) + (toc-slide-background-position (plist-get info :reveal-toc-slide-background-position)) + (toc-slide-background-repeat (plist-get info :reveal-toc-slide-background-repeat)) + (toc-slide-background-transition (plist-get info :reveal-toc-slide-background-transition)) + (toc-slide-background-opacity (plist-get info :reveal-toc-slide-background-opacity)) + (toc-slide-with-header (plist-get info :reveal-slide-global-header)) (toc-slide-with-footer (plist-get info :reveal-slide-global-footer))) - (concat "
\n" + (concat "
" (when toc-slide-with-header (let ((header (plist-get info :reveal-slide-header))) (when header (format "
%s
\n" header)))) From b8e5809b1f93ff3dfa7b5b2532dcf24bcc90b738 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 2 Mar 2020 11:24:18 +0100 Subject: [PATCH 3/5] doc: Fix badge URL for image This change will help for caching script Change-Id: I648da01270e4e986248d70df6b78c5f47f7168b4 Signed-off-by: Philippe Coval --- Readme.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.org b/Readme.org index 3ad9915..c75fddf 100644 --- a/Readme.org +++ b/Readme.org @@ -12,7 +12,7 @@ #+REVEAL_EXTRA_CSS: ./local.css [[http://melpa.org/#/ox-reveal][file:http://melpa.org/packages/ox-reveal-badge.svg]] -[[http://www.gnu.org/licenses/gpl-3.0.html][http://img.shields.io/:license-gpl3-blue.svg]] +[[http://www.gnu.org/licenses/gpl-3.0.html][file:https://img.shields.io/:license-gpl3-blue.svg]] * Table of Contents Title links are for viewing within org-mode buffer only. *Github From 60f6c3a3d2c59b3475787a951da27a1c0238b40d Mon Sep 17 00:00:00 2001 From: Yujie Wen Date: Tue, 3 Mar 2020 17:01:36 +0800 Subject: [PATCH 4/5] Fixed #409. docs for enabling line numbers for highlight.js --- Readme.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Readme.org b/Readme.org index c75fddf..e047b05 100644 --- a/Readme.org +++ b/Readme.org @@ -619,6 +619,19 @@ can have one optional ~%s~ to be replaced by ~reveal-root~. The "%r" in the given CSS file name will be replaced by Reveal.js' URL. + Reveal.js supports to enable line numbers and highlighting on + given line numbers. Please use ~:code_attribs~ to pass [[https://github.com/hakimel/reveal.js#line-numbers--highlights][the proper + attributes]] to the source code block . Below is an example. +#+BEGIN_SRC org +,#+ATTR_REVEAL: :code_attribs data-line-numbers='1|3' +,#+BEGIN_SRC c++ +int main() +{ + cout << "Hello" << endl; +} +,#+END_SRC +#+END_SRC + ** Editable Source Code It is now possible to embed code blocks in a codemirror instance in order to edit code during a presentation. At present, this capacity is turned on or off at time export using these defcustoms: - ~org-reveal-klipsify-src~ From f058da6fe9cfb4bf8f89ef8416a528906f404650 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 2 Mar 2020 10:30:09 +0100 Subject: [PATCH 5/5] build: Add caching feature for offline use Note that fonts will remain online, so caching at browser level or proxy might help. Origin: https://github.com/rzr/rzr-presentations Change-Id: I59ba3e177511fd63b59baccfd97604587766bdb6 Signed-off-by: Philippe Coval --- Makefile | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/Makefile b/Makefile index 63681de..d2465df 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,8 @@ reveal_zip_url?=https://github.com/hakimel/reveal.js/archive/master.zip reveal_dir?=./reveal.js sudo?=sudo deploy_branch?=gh-pages +cache_dir?=./cache/url +make?=make -f ${CURDIR}/Makefile help: @@ -27,6 +29,7 @@ help: @echo "# make all # Build html" @echo "# make start # View HTML in Web browser" @echo "# make download # Download deps" + @echo "# make offline # Cache inlined resources and generate cached pages" @echo "# make upload # to build and publish" @echo "# make setup/debian setup download start # ..." @echo "# Config:" @@ -131,3 +134,70 @@ upload: echo "# About to push to origin in 5 secs ?" sleep 5 ; git push -f origin HEAD:gh-pages git checkout master + +%.lst: %.org Makefile + echo "" > "$@" + -grep -o -e 'https\?://[^]"]*' -- "$<" \ + | grep -E ".**\.(gif|png|svg|jpg|jpeg|webm|mp4)"\ + | sort -u >> "$@.tmp" + mv "$@.tmp" "$@" + + +%/curl: + @mkdir -p http https + @ln -fs http http: + @ln -fs https https: + ls "${@D}" > /dev/null 2>&1 \ + || curl --create-dirs -o "./${@D}" -- "${@D}" + find . -iname "*#*" | while read file; do \ + basename=$$(basename -- "$${file}"); \ + dirname=$$(dirname -- "$${file}"); \ + dstname=$$(echo "$${basename}" | sed -e 's|#.|%23.|g'); \ + ln -fs "$${basename}" "$${dirname}/$${dstname}"; \ + dstname=$$(echo "$${basename}" | sed -e 's|#.||g'); \ + ln -fs "$${basename}" "$${dirname}/$${dstname}"; \ + done + + +.PHONY: cache +cache: ${target}.lst Makefile + @mkdir -p "${ $@.tmp + sort -u $< | while read url; do \ + sed -e "s|$${url}|${cache_dir}/$${url}|g" \ + -e "s|${cache_dir}/http://|${cache_dir}/http/|g" \ + -e "s|${cache_dir}/https://|${cache_dir}/https/|g" \ + -i "${@}.tmp" ; \ + done + mv "${@}.tmp" "$@" + +html-cache: ${target}.org ${target}._cache.org + make html target="${target}._cache" + sed -e "s|#./|/./|g" -i "${target}._cache.html" + +offline: all/cache all/html-cache + sync + +offline/start: offline + ${MAKE} ${@F} target="${target}._cache" + +commit/offline: + -git branch -D ${@F}/master + git checkout -b ${@F}/master + ${MAKE} download + -git add -f . + -git commit -am 'deploy: Cache downloaded files' + ${MAKE} cache + -git add -f . + -git commit -am 'deploy: Cache downloaded files, see lst file for sources' + ${MAKE} ${@F} + -git add -f . + -git commit -am 'deploy: Render cached files'