Issue Details (XML | Word | Printable)

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

Strikethrough XWiki syntax

Created: 10/May/07 00:01   Updated: 11/Feb/08 11:49
Component/s: Wiki features
Affects Version/s: None
Fix Version/s: 1.3 M2

File Attachments: 1. Java Source File StrikethroughSyntaxTest.java (6 kB)

Issue Links:
Related
 

Date of First Response: 24/May/07 21:47
Resolution Date: 11/Feb/08 11:49
Tests: Unit


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

It generates markup specifying that the delimited text is deleted; in XHTML the <del> tag is used.

Expected behavior:

This is not -- stroked --  => This is not -- stroked --
This is not --stroked --  => This is not --stroked --
This is not -- stroked--  => This is not -- stroked--
This is --stroked-- => This is <del>stroked</del>
This is --a-- stroke => This is <del>a</del> stroke
This is --a-- short stroke-- => This is <del>a</del> short stroke--
This is --all -- stroked-- => This is <del>all -- stroked</del>
This is --all --stroked-- => This is <del>all --stroked</del>
This is --one--stroked-- => This is <del>one</del>stroked--
--a-- => <del>a</del>
More --strokes-- on a --line-- => More <del>strokes</del> on a <del>line</del>
The extra dashes are ----inside--- => The extra dashes are <del>--inside-</del>
This--is--stroked => This<del>is</del>stroked
--Eeny--meeny--miny--moe-- => <del>Eeny</del>meeny<del>miny</del>moe--
-- Eeny--meeny--miny--moe-- => ...<li>Eeny<del>meeny</del>miny<del>moe</del></li>...
this is a ------ line => this is a <hr/> line
-- this is a list item-- => ...<li>this is a list item--</li>...
HTML <!-- comments are ignored --> => HTML <!-- comments are ignored -->
Multiple HTML <!-- comments --> are <!-- ignored --> => Multiple HTML <!-- comments --> are <!-- ignored -->
Ignore --things-- inside <script> n = --i; m = i--; </script> => Ignore <del>things</del> inside <script> n = --i; m = i--; </script>
Ignore <a href="/some--page--with--dashes">attributes</a> => Ignore <a href="/some--page--with--dashes">attributes</a>

Multiline examples:
This is not --not
stroked--
 => 
This is not --not
stroked--

<script>
m = --i; n = i--;
</script>
m = --i; n = i--;
 =>
<script>
m = --i; n = i--;
</script>
m = <del>i; n = i</del>;


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

This --is
also
stroked--
 =>
This <del>is
also
stroked</del>

But this is --not

stroked--
 =>
But this is --not<p class="paragraph"/>
stroked--

Catalin Hritcu added a comment - 24/May/07 21:47
Functional test for two of these test cases. All the test cases should be tested using unit tests.

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>