From 6555042bbcb9da65c3f4aba935e1b35fe84ad523 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Sat, 31 Jan 2015 14:53:22 -0700 Subject: [PATCH] Add new plugin rightimg 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 | 19 +++++++++++++++++++ in/webber.conf | 1 + plugins/rightimg.py | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 plugins/rightimg.py diff --git a/in/style/default.css b/in/style/default.css index 204210a..8711651 100644 --- a/in/style/default.css +++ b/in/style/default.css @@ -691,3 +691,22 @@ hr { font-size: 1.5em; font-weight: bold; } + +/* ============================================= + Floating right image with caption +================================================ */ + +div.rightimg { + float: right; + display: table; + margin: 0 0 0.5em 0.5em; + padding: 0.5em; +} +div.rightimg p { + display: table-caption; + caption-side: bottom; + text-align: center; + font-style: italic; + font-size: smaller; + text-indent: 0; +} diff --git a/in/webber.conf b/in/webber.conf index d02eaf2..7711729 100644 --- a/in/webber.conf +++ b/in/webber.conf @@ -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 index 0000000..45b600e --- /dev/null +++ b/plugins/rightimg.py @@ -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 = "