Contents
Color2
Description
Extends Color macro to support text color, background color, and font. Also uses code from MiniPage to support markup within text. e.g. Color2(red,blue,courier,red courier on blue)
Download & Release Notes
Download |
Release Version |
Moin Version |
Release Notes |
1.6 |
1.7 |
Note: install as Color2.py; It worked on my 1.7.1 Desktop MoinMoin |
|
1.6 |
1.6 |
Note: install as Color2.py |
|
|
1.5 |
|
Usage
Example
"Tested" in MoinMoin 1.7.1
"Tested" in MoinMoin 1.8.2 (2009.03.12)
Syntax for colorizing text in MoinMoin 1.7.1:
In normal text
<<Color2(color,bgcolor,font,text)>> <<Color2(color,bgcolor,text)>> <<Color2(color,text)>>
Example, in normal text:
<<Color2(red,blue,courier,red courier on blue)>> <<Color2(green,yellow,Green Font on Yellow Background)>> <<Color2(orange,Orange Text)>>
Result (somehow, courier does not work? example from "Description" above):
Also works within tables:
||<<Color2(red,blue,courier,red courier on blue)>><<BR>><<Color2(green,yellow,Green Font on Yellow Background)>><<BR>><<Color2(orange,Orange Text)>>||
||<style="background-color: #CCFFFF;"> <!> '''Notice!'''<<BR>>The allocation of IP addresses for the abc interfaces on the host start with 10.10.<<Color2(red,1)>>.<<Color2(red,1)>> --> (abc server .<<Color2(red,rack 1, rack position 1)>>). ||
Copyright
License
Bugs
This macro should be refactored
- use of arg parser for macros
- use of wikiutil.renderText()
user input needs to be escaped XSS problems
Discussion
- If there is no syntax given by the autors, you might find some information in the .py file itself.
When using super or subscript modifiers Color2 does not work -- PeterGurk
- This macro does not give an easy way to color text that has commas in it. -- JohnJHarrison
It seems that this macro also supports colon (:) as a delimiter, which could be a workaround for the comma (,) issue. Nonetheless, since both (,) and (:) are frequently used in normal texts, how about allowing it use a bar (|) rather than comma (,)? Example: Color2_bar.py. -- TakeoKatsuki 2009-08-08 01:58:56
<<Color2(black|yellow|For example, color2 will work fine with commas and colons like this: black, yellow, and green.)>>
- It should also work if the text is entered quoted. comma is the delimiter for arguments if the argumentparser is involved.
<<Color2(black,yellow,"For example, color2 will work fine with commas and colons like this: black, yellow, and green.")>> so it makes sense for one using this macro to refactor it to use the argument parser and while doing this also to fix the XSS problem.
- Currently it doesn't work with quote, right?
Yes, because it is not using the argument parser. Besides looking into the moin macros e.g. EmbedObject.py a simple example is given at HelloWorld-1.7 (macro examples).
- Currently it doesn't work with quote, right?
- It should also work if the text is entered quoted. comma is the delimiter for arguments if the argumentparser is involved.
When using with MoinMoin 1.8.2 the macro seems to add a line break after the coloured text in the preview pane. The page is displayed correctly though. -- SamRoy
- I've tested this "break line" with 1.6 and 1.7, and the reason is somewhere in formattext procedure. -- KrisR
