Report on new color markup ideas for moinmoin wiki, by Achin Sharma for google code in task.
NOTE: in the markups below the end of the 'tag' is being given by simple '[/]'. and not something like '[/color]' because every occurance would kill the closest tag following that the html is nested properly. The difference would be that [/color] could help in dealing with unclosed tags which in first case would cause havoc, by closing one step early, in a domino effect. But the codes are suppose to be dealt properly, if that error handling part can be overlooked then the first method should be used because that is simpler and shorter to type.
Recommendation 1
Comes From
Syntax
[color=red] red text [/] would give <span style="color:red"> red text </span>
similarly
[color=#f00] red text [/] would give <span style="color:#f00">red text </span>
For future reference, it could also be combined with other attributes like
[color=#f00; float=left;] red text [/]
I dont know python but this could be easily done with php infact something very similar is running on my own site.
PROS
- Easy to write without much coding.
- Does not conflict with any moin wiki marco that i know of.
- Human readable, no special knowledge required
CONS
- I could not find any, had i been able to, it would not have been my first recomendation
Comments
While this doesn't usually conflict with other moin markup, [...] might be present in normal text.
But there might be even the rare case where this conflict with [[target]] markup - how we do know what's meant, what has priority then?
Also, other wikis use [] for (external) links.
Reply
Although all of your points are correct but it all depends on how you detect the syntax. Again, i would say that i dont know python but in php regex is a very simple solution which would pick up instances which have '[color=(.+)]' where (.+) part would be variable and the syntax would be applicable only and only if the non variable part exists in exact same way (case can obviously be overlooked). And a little search tells me that python also has regex support.
Although there is chance of [...] being there in normal text but then that is what the end tag [/] is for. They both being in same line in specific pattern will be more than just a coincidence. I would still stick to this recommendation.
Recommendation 2
Comes From
A slight variation in tiki.org. Original ~~red:This text is Red~~
Syntax
[red] red text [/] would give <span style="color:red"> red text </span>
similarly
[#f00] red text [/] would give <span style="color:#f00"> red text </span>
PROS
- Super easy to write
- Minimum level of coding knowledge required
CONS
- Would be hard to implement server side. Hard but not imposible, generic names could be listed to be recognizedly and if the tag starts from a '#' sign then it can safely be supposed to be text color.
- Minimum flexibility, no space for extra atributes
Comments
Agreed. Also this has even more likeliness to be found in normal text.
Recommendation 3
Comes From
Syntax
It is used by media wiki, one of the most used wiki cms on the web. it is use of html straight but with restricted attributes.
<span style="color:#f00"> red text </span>
PROS
- Easy to implement on server side
- Some custom or opensource in-page html editor can be used which gives the editor complete freedom for writing any code
CONS
- In absence of any online editor, it can be difficult for an editor with less or no html knowledge
Comments
A general problem with directly allowing html spans and trying to filter the bad stuff out of it is to recognize bad stuff (there are lots of ways to encode it).
Reply
Agreed but a simple approach would be instead of filtering the bad stuff, we can only allow the good stuff. That way we just have to approve 5 (for example) attributes which are safe (e.g title, class, id, and select attributes of style). It again comes to how we code all this.
Recommendation 4
Comes From
Moin table markup.
Syntax
This is similar to recommendation one, but it is here because same syntax has bee used in moin table markup. The user would not need to understand this if he is already familiar with the table markup.
<color=red> red text </> would give <span style="color:red"> red text </span>
PROS
- Same as recommendation one except the second one
CONS
- It could conflict with the table markup itself, if used inside a cell to color a portion of text. The opening tag can be confused with the cell color tag which is same.
A work around to the solution of point one could be to change the markup to something like <color="red"></> but that would defeat the purpose of being same to table syntax for familiarization and choosing recommendation four upon recommendation one.
Task Questions
Would it use css?
No
If so, how would css look like?
-
If not, why not?
It would use inline style.