TitleStyle Double Percent Problem
Date23-Nov-2005 18:54:21 EET
Version2.2.28 and 2.2.32.cvs
Bug criticalityMediumBug
Browser version
Bug statusClosedBug
PageProvider used
Servlet Container
Operating System
Java version

Trying to use the double-% CSS style method to emulate the super and sub-script missing in the JSPWiki markup syntax (compare Idea Support Superscriptsubscript Formatting), I find a whitespace problem. The trailing double-% is recognized only if followed by whitespace, which makes it impossible to use it for many purposes.

H%%sub 2%%O - %%sup super-%% and %%sub sub-%%script

renders as:

H2- super- and sub-

Please test problem with 2.3.

This is not the bug. In

H2%%sub 2%%O
what happens is that the latter double-% is recognized as a marker to start a style called "O"; not to stop the style called "sub". You see, styles can nest...

The bug is that we don't have a blank, non-rendering character to stop the rendering with.

-- JanneJalkanen

Why not use the tilde (~) character after the double-% as the non-rendering stop character. Actually any 'special character' (different from open-bracket ( or valid css-class-name charater ) should be recognised as NOT being the start of a new double-%. (which actually works). Examples:

hyphen H%%(vertical-align: sub;) 2%%-O, 
period H%%(vertical-align: sub;) 2%%.O, or 
tilde: H%%(vertical-align: sub;) 2%%~O

Render as: hyphen H 2-O, period H 2.O, or tilde: H 2~O


I don't like using ~, because it is supposed to modify the behaviour of the thing right after it; not the one before it. However, we could just simply eat away the first whitespace after the double-%. Or maybe use triple-percent as an absolute stop-sign?

-- JanneJalkanen

I see the nesting problem. Eating away first whitespace would mean that in some places wiki text would distinguish between single and double whitespace, which I believe would become a major headache in the future.

The tilde method works, it modifies the behavior of the element right of it, escaping it. Ok, here there is nothing to escape. What would not work with the tilde method as it stands, is to have a sequence of subscript followed immediately by some other formatting. For example Word-subscript-Word-in-italics would be impossible, because the tilde would destroy the start of the italics.

Following Dirk's proposal: It seems rather logical to me to define tilde-blank as a non-rendering blank:

H2%%sub 2%%~ O

Alternative: define double-percent slash as /% as an alternative form to end of div/span style. Seems easy to remember because similar to html.

--- Gregor Hagedorn

I've implemented both of Gregor's suggestions in 2.4.35. Thanks heaps!

-- JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-14) was last changed on 13-Aug-2006 21:32 by Janne Jalkanen