Commit 04aae432 authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Fix top level image link bug and some cleanup

parent 72e5c006
<!DOCTYPE html>
<html$if(lang)$ lang="$lang$"$endif$>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
$for(author-meta)$
<meta name="author" content="$author-meta$" />
$endfor$
$if(date-meta)$
<meta name="dcterms.date" content="$date-meta$" />
$endif$
<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="$revealjs-url$/css/reveal.css"/>
<style type="text/css">code{white-space: pre;}</style>
$if(highlighting-css)$
<style type="text/css">
$highlighting-css$
</style>
$endif$
$if(theme)$
<link rel="stylesheet" href="$revealjs-url$/css/theme/$theme$.css" id="theme">
$else$
<link rel="stylesheet" href="$revealjs-url$/css/theme/black.css" id="theme">
$endif$
$for(css)$
<link rel="stylesheet" href="$css$"/>
$endfor$
<link rel="stylesheet" href="$decker-support-dir$/font-awesome-4.6.3/css/font-awesome.min.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '$revealjs-url$/css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--[if lt IE 9]>
<script src="$revealjs-url$/lib/js/html5shiv.js"></script>
<![endif]-->
$if(math)$
$math$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
</head>
<body>
$for(include-before)$
$include-before$
$endfor$
<div class="reveal">
<div class="slides">
$if(title)$
<section>
<h1 class="title">$title$</h1>
$if(subtitle)$
<h1 class="subtitle">$subtitle$</h1>
$endif$
$for(author)$
<h2 class="author">$author$</h2>
$endfor$
<h3 class="date">$date$</h3>
</section>
$endif$
$if(toc)$
<section id="$idprefix$TOC">
$toc$
</section>
$endif$
$body$
</div>
</div>
<script src="$revealjs-url$/lib/js/head.min.js"></script>
<script src="$revealjs-url$/js/reveal.js"></script>
<script>
var sn = false;
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
keyboard: {
84: function() {
sn = !sn;
Reveal.configure({ showNotes: sn });
}
},
showNotes: sn,
controls: false, // Display controls in the bottom right corner
progress: true, // Display a presentation progress bar
history: $if(history)$$history$$else$false$endif$, // Push each slide change to the browser history
center: $if(center)$$center$$else$true$endif$, // Vertical centering of slides
maxScale: $if(maxScale)$$maxScale$$else$1.5$endif$, // Bounds for smallest/largest possible content scale
slideNumber: $if(slideNumber)$true$else$false$endif$, // Display the page number of the current slide
theme: $if(theme)$'$theme$'$else$Reveal.getQueryHash().theme$endif$, // available themes are in /css/theme
transition: $if(transition)$'$transition$'$else$Reveal.getQueryHash().transition || 'default'$endif$, // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: '$revealjs-url$/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '$revealjs-url$/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: '$revealjs-url$/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
// { src: '$revealjs-url$/plugin/search/search.js', async: true, condition: function() { return !!document.body.classList; }, }
// { src: '$revealjs-url$/plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
]});
</script>
$for(include-after)$
$include-after$
$endfor$
</body>
</html>
---
author: Henrik Tramberend
date: '15.5.2016'
history: True
subtitle: Tutorial and Examples
theme: 'htr-slides'
title: Decker Slide Tool
......@@ -54,7 +55,7 @@ transition: linear
The following text ist included from file `/resource/realtive.md`:
[\#include](/resource/relative.md)
[\#include](include/relative.md)
# Multicolumn slides
......@@ -208,7 +209,9 @@ $e=mc^2$
# These are just notes {.notes}
Slides with headers that are have the `.notes` class attribute are not included in the presentation. They are only visible in the handout and probably are available as presenter notes during slide presentation.
Slides with headers that are have the `.notes` class attribute are not included
in the presentation. They are only visible in the handout and probably are
available as presenter notes during slide presentation.
# Cached Images
......@@ -216,7 +219,8 @@ Slides with headers that are have the `.notes` class attribute are not included
Remote images can be cached locally
Cache directory is named `img/cached` and is located in the directory of the referencing document
Cache directory is named `img/cached` and is located in the directory of the
referencing document
`decker cache` scans for and downloads all images
......@@ -224,7 +228,8 @@ Cache directory is named `img/cached` and is located in the directory of the ref
## Cached remote image
![Some piece of scene graph](https://tramberend.beuth-hochschule.de/img/cg1-banner.png)
![Some piece of scene
graph](https://tramberend.beuth-hochschule.de/img/cg1-banner.png)
# Meta Data
......@@ -293,7 +298,8 @@ Your total score is 42.
- `*-deck.html` a *reveal.js* based HTML slide deck
- `*-deck.pdf` a PDF version of that deck
- `*-handout.html` a HTML document containing only the speaker notes from the deck
- `*-handout.html` a HTML document containing only the speaker notes from the
deck
- `*-handout.pdf` a PDF version of that handout
## Generated from `*-page.md`
......
---
author: Henrik Tramberend
title: Decker Page
subtitle: {{course}} ({{semester}})
date: 15.5.2016
---
# Introduction
[#include](/resource/relative.md)
[\#include](include/relative.md)
This is just a simple run-of-the-mill document. Use it for exercises and
everything else. This document also has access to the meta data in surrounding
......@@ -17,9 +10,7 @@ The date is {{date}}.
All structured data entries are:
{{#structured}}
- {{.}}
{{/structured}}
{{\#structured}} - {{.}} {{/structured}}
{{sometext}}
......
Points: 5
LectureId: LECTURE_ID
Answer:
CorrectAnswer: THE ANSWER.
tag: FreeForm
HeightInMm: 20
TopicId: free-form-example
Title: FREE
Difficulty: Medium
Comment: COMMENT
Question: THE QUESTION?
Points: 5
LectureId: LECTURE_ID
Answer:
tag: FillText
CorrectWords:
- HOLES
- TEXT
FillText: FILL THE ___ IN THE ___.
TopicId: fill-text-example
Title: FILL TEXT
Difficulty: Medium
Comment: COMMENT
Question: THE QUESTION?
# This is a Second Level Include
## Transitive include images with relative URLs
![Transitively included image](../img/06-metal.png){width="80%"}
# Level 1
## Included from
- `../example-deck.md`
## Meta Data defined in `../example-meta.yaml`
- Semester: {{semester}}
## Including
- `level-2.md`
[\#include](level-2.md)
Points: 5
LectureId: LECTURE_ID
Answer:
tag: MultipleChoice
Choices:
- Correct: true
TheAnswer: ANSWER_1
- Correct: true
TheAnswer: ANSWER_2
- Correct: false
TheAnswer: DISTRACTOR_1
- Correct: false
TheAnswer: DISTRACTOR_2
TopicId: multiple-choice-example
Title: MULTIPLE CHOICE
Difficulty: Medium
Comment: COMMENT
Question: |
Die Frage ist wie immer, klappt das mit den Bildern und den Pfaden?
Hier sollte jetzt ein Bild kommen.
![](07-moveable-camera-480x270@1000-elevated.png){width=50%}
---
author: Henrik Tramberend
date: '15.5.2016'
subtitle: Tutorial and Examples
theme: 'htr-slides'
title: Decker Slide Tool
transition: linear
---
# Overview
- Features
- Installation
- Usage
- Development
# Features {.section}
# Markdown Syntax
## Pandoc-Markdown
- Slides are basically [Pandoc-Markdown](http://pandoc.org) formatted
text
- Pandoc provides a Markdown variant with many extensions
## Some Pandoc extensions
- Bibliographies
- Footnotes
- Tables
- Figures with captions
- Code blocks with syntax highlighting
- LaTeX math typesetting
# Slides
## Markdown header
- Level 1 header (`#`) starts new slide
- Level 2 header (`##`) starts a block on a slide
- Level 3 header (`###`) starts new column on a slide
``` {.markdown}
# Episode IV: A new Slide
## A long time ago ...
... in a galaxy far, far away.
```
# Includes
## Include markdown files
The following text ist included from file `/resource/realtive.md`:
[#include](/resource/relative.md)
# Multicolumn slides
## The author
![](img/htr-beuth.jpg)
###
## Slide source
``` {.markdown}
# Multicolumn slides
## The author
![](img/htr-beuth.jpg)
###
## Slide source
~~~ {.markdown}
~~~
```
# Local Images
## Relative path
![](img/06-metal.png){width=75%}
# LaTeX Math
## Syntax
- Standard LaTeX syntax
- Single \$ encloses inline math
- Double \$\$ encloses a display math block
## Example
- To $\infty$ and beyond!
$$
e = mc^2
$$
# Compile Time Macros
## Macros
- Appropriated link `[Link text](Url)` and image `![Alt text](Url)` syntax
- Example: embed a YouTube video
``` {.markdown}
## Video
[:youtube](Wji-BZ0oCwg)
```
###
## Video
[:youtube](Wji-BZ0oCwg)
# Compile Time Templating
## Mustache templates
- Markdown source code is processed with Mustache
``` {.markdown}
{{=<% %>=}}
The current semester is {{semester}}
<%={{ }}=%>
```
- Data is provided in YAML files
``` {.yaml}
---
semester: Summer 2016
---
```
- Results in
``` {.markdown}
The current semester is Summer 2016
```
# Blocks
## Block markup
- Level 2 headers start new block
- Blocks can be marked with attributes
## Alert block {.alert}
- This block is marked `alert`
``` {.markdown}
## Alert block {.alert}
- This block is marked `.alert`
```
###
......@@ -4,20 +4,26 @@ A markdown based tool for slide deck creation.
## Usage
*decker* behaves very much like a build tool. It works recursively on the current directory and all subdirectories. Markdown files ending on `.md` in those directories are processed and converted to either a reveal.js slide show, a HTML document, or a PDF document, depending on the file name.
*decker* behaves very much like a build tool. It works recursively on the current
directory and all subdirectories. Markdown files ending on `.md` in those
directories are processed and converted to either a reveal.js slide show, a HTML
document, or a PDF document, depending on the file name.
`*-deck.md`
: Files with this ending are processed as silde decks. From one source file potentially four different targets can be generated:
: Files with this ending are processed as silde decks. From one source file
potentially four different targets can be generated:
- `*-deck.html` A reveal.js based slide show
- `*-handout.hmtl` A HTML document containing the speaker notes to the slide show.
- `*-handout.hmtl` A HTML document containing the speaker notes to the
slide show.
- `*-deck.pdf` A PDF version of the slide show
- `*-handout.pdf` A PDF version of the handout
`*-page.md`
: Markdown files ending on `*-page.md` are translated into corresponding HTML or PDF documents.
: Markdown files ending on `*-page.md` are translated into corresponding HTML
or PDF documents.
## *decker* targets
......@@ -28,34 +34,42 @@ decker html
: Builds HTML versions of all available documents.
decker pdf
: Builds PDF versions of all documents that are generated from `*-deck.md` files.
: Builds PDF versions of all documents that are generated from
`*-deck.md` files.
decker pdf-decks
: Builds PDF versions of all slide decks.
decker watch
: Builds HTML versions of all documents and then watches for document changes. Each change to a watched document triggers a rebuild. Watching can be terminated with `^C`.
: Builds HTML versions of all documents and then watches for document changes.
Each change to a watched document triggers a rebuild. Watching can be
terminated with `^C`.
decker server
: Like `decker watch`. Additionally a local web server is started that serves the generated HTML files. The `index.html` document is automatically openend in the browser. Changed files are automatically reloaded in the browser.
: Like `decker watch`. Additionally a local web server is started that serves
the generated HTML files. The `index.html` document is automatically openend
in the browser. Changed files are automatically reloaded in the browser.
decker example
: Write a few example files to the current directory. To start exploring decker type
: Write a few example files to the current directory. To start exploring decker
type
``` {.bash}
$ decker example
$ decker server
```
and make some changes to the Markdown files. `example-deck.md` contains the source code for a slide deck that explains most of the features supported.
and make some changes to the Markdown files. `example-deck.md` contains the
source code for a slide deck that explains most of the features supported.
decker clean
: Recursively removes all generated files from the current directory.
decker check
: Check for all required external depencies. If one of the programs is missing, an error is generated. Required programs include:
: Check for all required external depencies. If one of the programs is missing,
an error is generated. Required programs include:
- `pdflatex` as part of a complete LaTeX installation
- `decktape.sh` for the generation of PDF versions of slide decks
......@@ -66,13 +80,18 @@ decker plan
: Prints a list of all source files found below the current directory.
decker meta
: Pretty prints all meta data that can be found in `*.yaml` files in the current directory and below. Meta data is mainly used to perform substitutions in Markdown documents using the Mustache templating system.
: Pretty prints all meta data that can be found in `*.yaml` files in the
current directory and below. Meta data is mainly used to perform
substitutions in Markdown documents using the Mustache templating system.
decker publish
: Publish the generated files to a remote location using `rsync` if the location is specified in the meta data. The keys `rsync-destination.host` and `rsync-destination.path` specify the publishing destination.
: Publish the generated files to a remote location using `rsync` if the
location is specified in the meta data. The keys `rsync-destination.host` and
`rsync-destination.path` specify the publishing destination.
decker clean-cache
: Remove all cached image files. Subsequent document builds will use the original remote images.
: Remove all cached image files. Subsequent document builds will use the
original remote images.
## Installation
......
# This is a Level 2 Include
Transitive is so very traditional.
Course is {{course}}
Module is {{module}}
![Transitively included image](example/img/06-metal.png)
# Level 1 Header
*Here be DRAGONS.*
[#include](level-2.md)
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
data Assignment = Assignment {
}
\ No newline at end of file
This diff is collapsed.
......@@ -15,8 +15,8 @@ import qualified Data.Yaml as Y
import qualified Data.HashMap.Strict as Map
import NeatInterpolation
main =
do projectDir <- calcProjectDirectory
main = do
projectDir <- calcProjectDirectory
--
let publicDir = projectDir </> "public"
let cacheDir = publicDir </> "cache"
......@@ -34,7 +34,8 @@ main =
isCacheableURI "ftp://heise.de" `shouldBe` False
--
describe "adjustLocalUrl" $
do it "adjusts URL to be relative to the project root or the provided base directory" $
do it
"adjusts URL to be relative to the project root or the provided base directory" $
do adjustLocalUrl projectDir "base" "http://heise.de" `shouldBe`
"http://heise.de"
--
......@@ -54,13 +55,22 @@ main =
"../four/img.png"
makeRelativeTo "/some/where/else" "/one/two/four/img.png" `shouldBe`
"../../../one/two/four/img.png"
makeRelativeTo
"/Users/henrik/tmp/decker-demo/public"
"/Users/henrik/tmp/decker-demo/public/cache/b48cadafb942dc1426316772321dd0c7.png" `shouldBe`
"cache/b48cadafb942dc1426316772321dd0c7.png"
--
describe "cacheRemoteFile" $
it "Stores the data behind a URL locally, if possible. Return the local path to the cached file." $
do cacheRemoteFile cacheDir "https://tramberend.beuth-hochschule.de/img/htr-beuth.jpg" `shouldReturn`
it
"Stores the data behind a URL locally, if possible. Return the local path to the cached file." $
do cacheRemoteFile
cacheDir
"https://tramberend.beuth-hochschule.de/img/htr-beuth.jpg" `shouldReturn`
cacheDir </>
"bc137c359488beadbb61589f7fe9e208.jpg"
cacheRemoteFile cacheDir "ftp://tramberend.beuth-hochschule.de/img/htr-beuth.jpg" `shouldReturn`
cacheRemoteFile
cacheDir
"ftp://tramberend.beuth-hochschule.de/img/htr-beuth.jpg" `shouldReturn`
"ftp://tramberend.beuth-hochschule.de/img/htr-beuth.jpg"
cacheRemoteFile cacheDir "/img/htr-beuth.jpg" `shouldReturn`
"/img/htr-beuth.jpg"
......@@ -68,36 +78,103 @@ main =
"img/htr-beuth.jpg"
--
describe "cacheRemoteImages" $
it "Replaces all remote images in the pandoc document with locally caches copies." $
it
"Replaces all remote images in the pandoc document with locally caches copies." $
do cacheRemoteImages
cacheDir
(Pandoc nullMeta
[(Para [Image nullAttr
(Pandoc
nullMeta
[ (Para
[ Image
nullAttr