Seesaw plugin for moin
http://seesaw.ncl.ac.uk/1.9/SeeSaw
Configuration
Images go in /home/moin/moin-1.9.3/MoinMoin/web/static/htdocs/seesaw/img
seesaw.js and jquery*.js go in /home/moin/moin-1.9.3/MoinMoin/web/static/htdocs/seesaw/js
Then edit moin-1.9.3/wiki/wikiconfig.py to include the necessary JS
1 # near the top 2 from MoinMoin.config import multiconfig, url_prefix_static 3 ... 4 5 # at the bottom: 6 html_head = ''' 7 <script type="text/javascript" src="%(url_prefix_static)s/seesaw/js/jquery-1.4.4.min.js"></script> 8 <script type="text/javascript" src="%(url_prefix_static)s/seesaw/js/seesaw.js"></script> 9 ''' % {'url_prefix_static':url_prefix_static}
Configure Seesaw itself for the paths, moin-1.9.3/wiki/data/plugin/macro/SeeSaw.py
#--- Configuration ---------------------------------------- from MoinMoin.config import url_prefix_static img_prefix = url_prefix_static.rstrip("/") + "/seesaw/img"
- Restart the app process if not running in CGI mode (to reload the changed python files)
Add borders to seesaw blocks
When you have large chunks of seesaw'd markup, adding a faint outline to the block can make it a little easier to identify. This could be done by editing the common.css of all your themes, but it's tedious and error prone, and also doesn't get kept as you add more themes.
Instead, let's add it to the seesaw code itself.
Create the container directory for your CSS file, it probably doesn't exist yet. Adjust the path to suit your system
mkdir /home/moin/moin-1.9.3/MoinMoin/web/static/htdocs/seesaw/css
Add seesaw.css to the directory you just created:
div.seesaw { border: 1px silver dotted; }
Edit moin-1.9.3/wiki/wikiconfig.py to include the new CSS, it goes in the edit you made for JS in the original setup
1 --- OLDwikiconfig.py 2012-02-13 13:09:32.243905389 +1100 2 +++ wikiconfig.py 2012-02-13 13:12:08.991916014 +1100 3 @@ -178,5 +178,6 @@ 4 html_head = ''' 5 <script type="text/javascript" src="%(url_prefix_static)s/seesaw/js/jquery-1.4.4.min.js"></script> 6 <script type="text/javascript" src="%(url_prefix_static)s/seesaw/js/seesaw.js"></script> 7 +<link rel="stylesheet" type="text/css" href="%(url_prefix_static)s/seesaw/css/seesaw.css"> 8 ''' % {'url_prefix_static':url_prefix_static}
Restart the app process if not running in CGI mode (to reload the updated wikiconfig.py)
Customisation
This makes the common desired use-case more concise to use when writing moin syntax, and tweaks the visual styling a little so that inline linkage (ie. hyperlinks as you're used to them on the internets) is neat and identifiable.
1 --- SeeSaw.py 2011-01-23 23:11:59.000000000 +1100
2 +++ /home/moin/moin-1.9.3/wiki/data/plugin/macro/SeeSaw.py 2011-11-14 14:35:39.659539842 +1100
3 @@ -224,7 +224,9 @@
4 # Change this to the relative location of the images
5 #
6 # img_prefix="/moin_static18x/common"
7 -img_prefix="/img"
8 +#img_prefix="/img"
9 +from MoinMoin.config import url_prefix_static
10 +img_prefix = url_prefix_static.rstrip("/") + "/seesaw/img"
11 #
12 # Optionally change this (to extend the list of image sets)
13 #
14 @@ -247,15 +249,15 @@
15 else:
16 return wikiutil.escape(x)
17
18 - parser = wikiutil.ParameterParser('%(section)s%(toshow)s%(tohide)s%(show)b%(bg)s%(inline)s%(image)s%(speed)s%(seesaw)b%(addclass)s%(type)s%(effect)s')
19 + parser = wikiutil.ParameterParser('%(section)s%(linktext)s%(toshow)s%(tohide)s%(show)b%(bg)s%(inline)s%(image)s%(speed)s%(seesaw)b%(addclass)s%(type)s%(effect)s')
20 (count,dict) = parser.parse_parameters(args)
21 - (section,toshow,tohide,show,bg,inline,image,speed,seesaw,addclass,type,effect) = (dict[x] for x in ('section','toshow','tohide','show','bg','inline','image','speed', 'seesaw','addclass','type','effect'))
22 + (section,linktext,toshow,tohide,show,bg,inline,image,speed,seesaw,addclass,type,effect) = (dict[x] for x in ('section','linktext','toshow','tohide','show','bg','inline','image','speed', 'seesaw','addclass','type','effect'))
23
24 if section is None:
25 section = 'section'
26
27 if speed is None:
28 - speed = 0
29 + speed = 100
30 try:
31 speed = int(speed)
32 except:
33 @@ -269,13 +271,17 @@
34 if show is None:
35 show = False
36
37 - if tohide is None and toshow is None:
38 - if inline is None:
39 - toshow = 'Show'; tohide = 'Hide'
40 - else:
41 - toshow = u'»»'; tohide = u'««'
42 - elif tohide is None and toshow is not None:
43 - tohide = toshow
44 + if linktext is not None:
45 + toshow = u'»%s' % linktext;
46 + tohide = u'»%s' % linktext;
47 + else:
48 + if tohide is None and toshow is None:
49 + if inline is None:
50 + toshow = 'Show'; tohide = 'Hide'
51 + else:
52 + toshow = u'»»'; tohide = u'««'
53 + elif tohide is None and toshow is not None:
54 + tohide = toshow
55 showpart = 'showpart'; showstyle = '''style="display:inline"'''
56 hidepart = 'hidepart'; hidestyle = '''style="display:none"'''
57 if show:
58 @@ -290,7 +296,7 @@
59 openaction = closeaction = 'button'
60
61 if effect is None or (effect != 'slide' and effect != 'fade'):
62 - effect = 'show'
63 + effect = 'slide'
64 effect = "'%s'" % effect
65
66 regex = re.compile(r'(.*)<<(.*)>>(.*)')