This commit is contained in:
Yujie Wen 2020-03-04 17:37:35 +08:00
commit 9f26bcca27
3 changed files with 151 additions and 7 deletions

104
Makefile
View File

@ -12,11 +12,14 @@ 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
cache_dir?=./cache/url
make?=make -f ${CURDIR}/Makefile
help:
@ -26,6 +29,8 @@ 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:"
@echo "# srcs=${srcs}"
@ -36,6 +41,7 @@ all: ${objs}
ls $^
download: ${reveal_dir}
ls $^
start: ${target}.html
x-www-browser $<
@ -94,8 +100,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 +110,94 @@ ${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
%.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 "${<D}/${cache_dir}"
cd "${<D}/${cache_dir}" && \
cat "${CURDIR}/$<" | while read url ; do \
${make} $${url}/curl || exit $$? ; \
done
${target}._cache.org: ${target}.lst ${target}.org cache reveal.js
sed -e 's|^#+REVEAL_ROOT:.*|#+REVEAL_ROOT: ${CURDIR}/reveal.js|g' \
< ${target}.org > $@.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'

View File

@ -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
@ -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:
@ -609,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~

View File

@ -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)
@ -683,9 +689,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 "<section id=\"table-of-contents\">\n"
(concat "<section id=\"table-of-contents\""
(when toc-slide-background
(concat " data-background=\"" toc-slide-background "\""))
(when toc-slide-background-size
(concat " data-background-size=\"" toc-slide-background-size "\""))
(when toc-slide-background-position
(concat " data-background-position=\"" toc-slide-background-position "\""))
(when toc-slide-background-repeat
(concat " data-background-repeat=\"" toc-slide-background-repeat "\""))
(when toc-slide-background-transition
(concat " data-background-transition=\"" toc-slide-background-transition "\""))
(when toc-slide-background-opacity
(concat " data-background-opacity=\"" toc-slide-background-opacity "\""))
">"
(when toc-slide-with-header
(let ((header (plist-get info :reveal-slide-header)))
(when header (format "<div class=\"slide-header\">%s</div>\n" header))))