summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/compile_rest/slides.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2013-02-13 18:35:39 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2013-02-13 18:35:39 -0300
commita40930043121a4b60de8526d58417761a54ab718 (patch)
tree383c5cf8e320761ee942619282fe51be625179a7 /nikola/plugins/compile_rest/slides.py
parent9c5708cc92af894e414bc76ee35ec2230de5d288 (diff)
Imported Upstream version 5.2upstream/5.2
Diffstat (limited to 'nikola/plugins/compile_rest/slides.py')
-rw-r--r--nikola/plugins/compile_rest/slides.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/nikola/plugins/compile_rest/slides.py b/nikola/plugins/compile_rest/slides.py
index 942a7d4..c9d55f3 100644
--- a/nikola/plugins/compile_rest/slides.py
+++ b/nikola/plugins/compile_rest/slides.py
@@ -8,11 +8,11 @@
# distribute, sublicense, and/or sell copies of the
# Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
-#
+#
# The above copyright notice and this permission notice
# shall be included in all copies or substantial portions of
# the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
@@ -27,10 +27,9 @@ import json
from docutils import nodes
from docutils.parsers.rst import Directive, directives
-class slides(Directive):
+class slides(Directive):
""" Restructured text extension for inserting slideshows."""
-
has_content = True
option_spec = {
"preload": directives.flag,
@@ -60,12 +59,13 @@ class slides(Directive):
"animationStart": directives.unchanged,
"animationComplete": directives.unchanged,
}
-
+
def run(self):
if len(self.content) == 0:
return
- for opt in ("preload", "generateNextPrev", "pagination", "generatePagination",
- "crossfade", "randomize", "hoverPause", "autoHeight", "bigTarget"):
+ for opt in ("preload", "generateNextPrev", "pagination",
+ "generatePagination", "crossfade", "randomize",
+ "hoverPause", "autoHeight", "bigTarget"):
if opt in self.options:
self.options[opt] = True
options = {
@@ -73,17 +73,19 @@ class slides(Directive):
"bigTarget": True,
"paginationClass": "pager",
"currentClass": "slide-current"
- }
+ }
options.update(self.options)
options = json.dumps(options)
output = []
- output.append("""<script> $(function(){ $("#slides").slides(%s); }); </script>""" % options)
- output.append("""<div id="slides" class="slides"><div class="slides_container">""")
+ output.append('<script> $(function(){ $("#slides").slides(%s); });'
+ '</script>' % options)
+ output.append('<div id="slides" class="slides"><div '
+ 'class="slides_container">')
for image in self.content:
output.append("""<div><img src="%s"></div>""" % image)
output.append("""</div></div>""")
-
+
return [nodes.raw('', '\n'.join(output), format='html')]
-
+
directives.register_directive('slides', slides)