Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
ugrade flaskreveal to support reveal 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
humrochagf committed Nov 9, 2015
1 parent 1c31187 commit 67e1da1
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 100 deletions.
25 changes: 19 additions & 6 deletions example_slides/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
'description': 'A flask-reveal example presentation',
}

# Themes
# beige, black, blood, league, moon, night, serif, simple, sky,
# solarized, white
REVEAL_THEME = 'black'

REVEAL_CONFIG = {
# Display controls in the bottom right corner
'controls': True,
Expand Down Expand Up @@ -49,6 +54,13 @@
# i.e. contained within a limited portion of the screen
'embedded': False,

# Flags if we should show a help overlay when the questionmark
# key is pressed
'help': True,

# Flags if speaker notes should be visible to all viewers
'showNotes': False,

# Number of milliseconds between automatically proceeding to the
# next slide, disabled when set to 0, this value can be overwritten
# by using a data-autoslide attribute on your slides
Expand All @@ -66,17 +78,12 @@
# Opens links in an iframe preview overlay
'previewLinks': False,

# Slide theme
# default/beige/blood/moon/night/serif/simple/sky/solarized
'theme': 'default',

# Transition style
# default/cube/page/concave/zoom/linear/fade/none
'transition': 'default',

# Transition speed
# default/fast/slow
'transitionSpeed': 'default',
'transitionSpeed': 'default', # default/fast/slow

# Transition style for full page slide backgrounds
# default/none/slide/concave/convex/zoom
Expand All @@ -92,4 +99,10 @@

# Parallax background size
'parallaxBackgroundSize': '', # CSS syntax, e.g. "2100px 900px"

# Amount to move parallax background (horizontal and vertical)
# on slide change
# Number, e.g. 100
'parallaxBackgroundHorizontal': '',
'parallaxBackgroundVertical': '',
}
7 changes: 6 additions & 1 deletion flask_reveal/blueprints/reveal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import glob
import os

from flask import Blueprint, current_app, render_template, send_from_directory
from flask import (Blueprint, current_app, render_template,
send_from_directory, url_for)


reveal_blueprint = Blueprint('reveal', __name__)
Expand Down Expand Up @@ -49,11 +50,15 @@ def presentation():
meta = current_app.config.get('REVEAL_META')
slides = load_markdown_slides(current_app.config.get('PRESENTATION_ROOT'))
config = current_app.config.get('REVEAL_CONFIG')
theme = (url_for('static', filename='css/theme/') +
current_app.config.get('REVEAL_THEME') +
'.css')

context = {
'meta': meta,
'slides': slides,
'config': config,
'theme': theme,
}

return render_template('presentation.html', **context)
22 changes: 18 additions & 4 deletions flask_reveal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
'description': 'Some description'
}

# Themes
# beige, black, blood, league, moon, night, serif, simple, sky,
# solarized, white
REVEAL_THEME = 'black'

REVEAL_CONFIG = {
# Display controls in the bottom right corner
'controls': True,
Expand Down Expand Up @@ -49,6 +54,13 @@
# i.e. contained within a limited portion of the screen
'embedded': False,

# Flags if we should show a help overlay when the questionmark
# key is pressed
'help': True,

# Flags if speaker notes should be visible to all viewers
'showNotes': False,

# Number of milliseconds between automatically proceeding to the
# next slide, disabled when set to 0, this value can be overwritten
# by using a data-autoslide attribute on your slides
Expand All @@ -66,10 +78,6 @@
# Opens links in an iframe preview overlay
'previewLinks': False,

# Slide theme
# default/beige/blood/moon/night/serif/simple/sky/solarized
'theme': 'default',

# Transition style
# default/cube/page/concave/zoom/linear/fade/none
'transition': 'default',
Expand All @@ -91,4 +99,10 @@

# Parallax background size
'parallaxBackgroundSize': '', # CSS syntax, e.g. "2100px 900px"

# Amount to move parallax background (horizontal and vertical)
# on slide change
# Number, e.g. 100
'parallaxBackgroundHorizontal': '',
'parallaxBackgroundVertical': '',
}
176 changes: 88 additions & 88 deletions flask_reveal/templates/presentation.html
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
<!doctype html>
<html lang="en">

<head>
<!-- Metadata about the presentation -->
<meta charset="utf-8">

<title>{{ meta.title }}</title>

<meta name="description" content="{{ meta.description }}">
<meta name="author" content="{{ meta.author }}">

<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">

<!-- Presentation Styles -->
<link rel="stylesheet" href="{{ url_for('static', filename='css/reveal.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/theme/default.css') }}" id="theme">

<!-- For syntax highlighting -->
<link rel="stylesheet" href="{{ url_for('static', filename='lib/css/zenburn.css') }}">

<!-- Scripts loaded before the body -->
<!-- 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 = '{{ url_for("static", filename="css/print/pdf.css") }}';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>

<!--[if lt IE 9]>
<script src="{{ url_for('static', filename='lib/js/html5shiv.js') }}"></script>
<![endif]-->
</head>

<body>
<!-- Presentation body -->
<div class="reveal">

<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
{% for slide in slides %}
<section data-markdown>
<script type="text/template">
{{ slide|safe }}
</script>
</section>
{% endfor %}
</div>

</div>

<!-- Scripts loaded after the content -->
<script src="{{ url_for('static', filename='lib/js/head.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/reveal.min.js') }}"></script>

<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
{% for config_name, value in config.items() %}
{% if value == true %}
{{ config_name }}: true,
{% elif value == false %}
{{ config_name }}: false,
{% elif value is number %}
{{ config_name }}: {{ value }},
{% else %}
{{ config_name }}: '{{ value }}',
{% endif %}
{% endfor %}

// Optional libraries used to extend on reveal.js
dependencies: [
{ src: '{{ url_for("static", filename="lib/js/classList.js") }}', condition: function() { return !document.body.classList; } },
{ src: '{{ url_for("static", filename="plugin/markdown/marked.js") }}', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '{{ url_for("static", filename="plugin/markdown/markdown.js") }}', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '{{ url_for("static", filename="plugin/highlight/highlight.js") }}', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '{{ url_for("static", filename="plugin/zoom-js/zoom.js") }}', async: true, condition: function() { return !!document.body.classList; } },
{ src: '{{ url_for("static", filename="plugin/notes/notes.js") }}', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>

</body>
<head>
<!-- Metadata about the presentation -->
<meta charset="utf-8">

<title>{{ meta.title }}</title>

<meta name="description" content="{{ meta.description }}">
<meta name="author" content="{{ meta.author }}">

<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">

<!-- Presentation Styles -->
<link rel="stylesheet" href="{{ url_for('static', filename='css/reveal.css') }}">
<link rel="stylesheet" href="{{ theme }}" id="theme">

<!-- For syntax highlighting -->
<link rel="stylesheet" href="{{ url_for('static', filename='lib/css/zenburn.css') }}">

<!-- Scripts loaded before the body -->
<!-- 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 = '{{ url_for("static", filename="css/print/pdf.css") }}';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>

<!--[if lt IE 9]>
<script src="{{ url_for('static', filename='lib/js/html5shiv.js') }}"></script>
<![endif]-->
</head>

<body>
<!-- Presentation body -->
<div class="reveal">

<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
{% for slide in slides %}
<section data-markdown>
<script type="text/template">
{{ slide|safe }}
</script>
</section>
{% endfor %}
</div>

</div>

<!-- Scripts loaded after the content -->
<script src="{{ url_for('static', filename='lib/js/head.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/reveal.js') }}"></script>

<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
{% for config_name, value in config.items() %}
{% if value == true %}
{{ config_name }}: true,
{% elif value == false %}
{{ config_name }}: false,
{% elif value is number %}
{{ config_name }}: {{ value }},
{% else %}
{{ config_name }}: '{{ value }}',
{% endif %}
{% endfor %}

// Optional libraries used to extend on reveal.js
dependencies: [
{ src: '{{ url_for("static", filename="lib/js/classList.js") }}', condition: function() { return !document.body.classList; } },
{ src: '{{ url_for("static", filename="plugin/markdown/marked.js") }}', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '{{ url_for("static", filename="plugin/markdown/markdown.js") }}', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '{{ url_for("static", filename="plugin/highlight/highlight.js") }}', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '{{ url_for("static", filename="plugin/zoom-js/zoom.js") }}', async: true, condition: function() { return !!document.body.classList; } },
{ src: '{{ url_for("static", filename="plugin/notes/notes.js") }}', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>

</body>
</html>
2 changes: 1 addition & 1 deletion flask_reveal/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_install_reveal_parse_args(self):
self.assertEqual(self.install_reveal.path, None)
self.assertEqual(self.install_reveal.url,
'https://github.com/hakimel/reveal.js/' +
'archive/2.6.2.tar.gz')
'archive/3.1.0.tar.gz')

def test_mk_presentation_parse_args(self):
self.mk_presentation.parse_args([])
Expand Down

0 comments on commit 67e1da1

Please sign in to comment.