Issue Details (XML | Word | Printable)

Key: XWIKI-1248
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

Strong XWiki syntax

Created: 21/May/07 01:40   Updated: 11/Feb/08 12:03
Component/s: Wiki features
Affects Version/s: None
Fix Version/s: 1.3 M2

Issue Links:
Related
 

Resolution Date: 11/Feb/08 12:03
Tests: Unit


 Description  « Hide
The strong wiki markup is triggered by placing a piece of text inside stars, like: *text*. This filter only works in single line mode.

It generates markup specifying that the delimited text is strongly empahised; in XHTML the <strong> tag is used.

Expected behavior:

This is not * bold * => This is not * bold *
This is not *bold * => This is not *bold *
This is not * bold* => This is not * bold*
This is *bold* => This is <strong>bold</strong>
This is *a* letter bold => This is <strong>a</strong> letter bold
This is *a* short bold* => This is <strong>a</strong> short bold*
This is *all * bold* => This is <strong>all * bold</strong>
This is *all *bold* => This is <strong>all *bold</strong>
This is *one*bold* => This is <strong>one</strong>bold*
*a* => <strong>a</strong>
More *bolds* on a *line* => More <strong>bolds</strong> on a <strong>line</strong>
The extra stars are **inside** => The extra stars are <strong>*inside*</strong>
This*is*bold => This<strong>is</strong>bold
*Eeny*meeny*miny*moe* => <strong>Eeny</strong>meeny<strong>miny</strong>moe*
* Eeny*meeny*miny*moe* => ...<li>Eeny<strong>meeny</strong>miny<strong>moe</strong></li>...
* list* item => ...<li>list* item</li>...
* *list* item => ...<li><strong>list</strong> item</li>...
This is a bold *** text => This is an bold <strong>*</strong> text
This is a bold ****** text => This is an bold <strong>****</strong> text
Ignore *things* inside <script> var x = m*n+n*n; </script> => Ignore <strong>things</strong> inside <script> var x = m*n+n*n; </script>
Ignore <a href="/some*page*with*stars">attributes</a> => Ignore <a href="/some*page*with*stars">attributes</a>

Multiline examples:
This is not *not
bold*
 =>
This is not *not
bold*

<script>
var s = "non *bold* text";
</script>
var s = "non *bold* text"; 
 =>
<script>
var s = "non *bold* text";
</script>
var s = "non <strong>bold</strong> text";


 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Sergiu Dumitriu added a comment - 21/May/07 02:08
An alternative is to let it work on multiple lines, if the lines are part of the same paragraph.
This *is
bold*
 =>
This <strong>is
bold</strong>

This *is
also
bold*
 =>
This <strong>is
also
bold</strong>

But this is *not

bold*
 =>
But this is *not<p class="paragraph"/>
bold*

Sergiu Dumitriu added a comment - 11/Feb/08 12:03
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>