Issue Details (XML | Word | Printable)

Key: XWIKI-1243
Type: Task Task
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Sergiu Dumitriu
Reporter: Sergiu Dumitriu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
XWiki Core

Underline XWiki syntax

Created: 20/May/07 23:36   Updated: 11/Feb/08 11:49
Component/s: Wiki features
Affects Version/s: None
Fix Version/s: 1.3 M2

Issue Links:
Related
 

Resolution Date: 11/Feb/08 11:49
Tests: Unit


 Description  « Hide
The underline wiki markup is triggered by placing a piece of text inside double-underscore, like: __text__. This filter only works in single line mode.

It generates markup specifying that the delimited text is underlined; in XHTML the <em class="underline"> tag is used.

Expected behavior:

This is not __ underlined __  => This is not __ underlined __
This is not __underlined __  => This is not __underlined __
This is not __ underlined__  => This is not __ underlined__
This is __underlined__ => This is <em class="underline">underlined</em>
This is __a__ letter underlined => This is <em class="underline">a</em> letter underlined
This is __a__ short underline__ => This is <em class="underline">a</em> short underline__
This is __all __ underlined__ => This is <em class="underline">all __ underlined</em>
This is __all __underlined__ => This is <em class="underline">all __underlined</em>
This is __one__underlined__ => This is <em class="underline">one</em>underlined__
__a__ => <em class="underline">a</em>
More __underlines__ on a __line__ => More <em class="underline">underlines</em> on a <em class="underline">line</em>
The extra lines are ____inside___ => The extra lines are <em class="underline">__inside_</em>
This__is__underlined => This<em class="underline">is</em>underlined
__Eeny__meeny__miny__moe__ => <em class="underline">Eeny</em>meeny<em class="underline">miny</em>moe__
__ Eeny__meeny__miny__moe__ => __ Eeny<em class="underline">meeny</em>miny<em class="underline">moe</em>
this is an underlined ______ text => this is an underlined <em class="underline">__</em> text
Ignore __things__ inside <script> a__i = 0; m = a__i; </script> => Ignore <em class="underline">things</em> inside <script> a__i = 0; m = a__i; </script>
Ignore <a href="/some__page__with__underlines">attributes</a> => Ignore <a href="/some__page__with__underlines">attributes</a>

Multiline examples:
This is __not
underlined__
 => 
This is __not
underlined__

<script>
m = a__i; n = a__i;
</script>
m = a__i; n = a__i;
 =>
<script>
m = a__i; n = a__i;
</script>
m = a<em class="underline">i; n = a</em>i;


 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Sergiu Dumitriu added a comment - 21/May/07 00:38
An alternative is to let it work on multiple lines, if the lines are part of the same paragraph.
This __is
underlined__
 =>
This <em class="underline">is
underlined</em>

This __is
also
underlined__
 =>
This <em class="underline">is
also
underlined</em>

But this is __not

underlined__
 =>
This is __not<p class="paragraph"/>
underlined__

Sergiu Dumitriu added a comment - 11/Feb/08 11:49
The syntax works as proposed, with the following remarks:
  • Filtering out links and scripts is not implemented, as it increases the rendering time a lot in some usage scenarios. This should be fixed when switching to the new rendering engine.
  • Works on a single line only.
  • Regex should run in O(n*m) whatever the text, where n=<text length> and m=<number of __ occurrences>