]> oss.titaniummirror.com Git - oss-web.git/commitdiff
Add new plugin rightimg
authorR. Steve McKown <rsmckown@gmail.com>
Sat, 31 Jan 2015 21:53:22 +0000 (14:53 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Sat, 31 Jan 2015 21:56:46 +0000 (14:56 -0700)
righimg floats an image to the right, with caption if the caption key is
provided in the parameters.  All other parameters are rendered into the
image tag, which means at least 'src' must be provided.

in/style/default.css
in/webber.conf
plugins/rightimg.py [new file with mode: 0644]

index 204210ad1cce1c73e82f569da19832cc4e983895..8711651cbbcc708e32b2d106d860f62e8ebc2c3b 100644 (file)
@@ -691,3 +691,22 @@ hr {
        font-size: 1.5em;\r
        font-weight: bold;\r
 }\r
+\r
+/* =============================================\r
+  Floating right image with caption\r
+================================================ */\r
+\r
+div.rightimg {\r
+  float: right;\r
+  display: table;\r
+  margin: 0 0 0.5em 0.5em;\r
+  padding: 0.5em;\r
+}\r
+div.rightimg p {\r
+  display: table-caption;\r
+  caption-side: bottom;\r
+  text-align: center;\r
+  font-style: italic;\r
+  font-size: smaller;\r
+  text-indent: 0;\r
+}\r
index d02eaf20b25ec94a1135c7044343b823db6530fb..77117292f532f63b72148bea19768dc16125d72f 100644 (file)
@@ -13,6 +13,7 @@ plugins: [
        "read_html",
        "read_copyonly",
        "read_markdown",
+       "rightimg",
        "template_mako",
        "google_sitemap",
        ]
diff --git a/plugins/rightimg.py b/plugins/rightimg.py
new file mode 100644 (file)
index 0000000..45b600e
--- /dev/null
@@ -0,0 +1,16 @@
+# -*- coding: iso-8859-1 -*-
+from webber import *
+
+@set_macro("rightimg")
+def rightimg_macro(params):
+       if cfg.test_verbose:
+               print "in macro skeleton.pull_rightimg_macro, params:", params
+        html = "<div class=\"rightimg\"><img src=\"%s\"" % params['src']
+        for key in params.keys():
+            if key != 'caption' and key != 'src':
+                html += " %s=\"%s\"" % (key, params[key])
+        if 'caption' in params:
+            html += "><p>%s</div>" % params['caption']
+        else:
+            html += "></div>"
+        return html