daledotshan/liferay-portal — pull request #24 by yuhai (2013-10-31 08:12:57+00:00)
Title: LPS-41561  Wiki table formatting is broken when cells contain multiple items with hyperlinks 

When creole markup td cells(td label grammar '|||' in creole) parser to html by js method, from my understanding, we just match 0 or 1 link in td cell by checking the following regex. When wrote two links and the two links didn't match correctly:
// match 0 or 1 Links in td cell
\\[\\[' + rx.link + '(\\|' + rx.linkText + ')?\\]\\]

So the fix logic is the following:
1. We should match multiple Links(0 or multiple times) in cell, so use '()*' based on original regex and change for
change
\\[\\[' + rx.link + '(\\|' + rx.linkText + ')?\\]\\]
to
( \\[\\[' + rx.link + '(\\|' + rx.linkText + ')?\\]\\])*

2. By above change, we only match the followings grammar:
|[[url|test]][[url|test]][[url|test]]|
In this td cell, we can successfully match three links because there aren't any characters existed between three links. So we need to append the regex expression [^|~\\[{]* at the end of the link expression. That is to say, it may exist any characters except the characters(|~\\[{ these character means other creole markup and they will conflict in td ) behind one link. After the changes, it will match successfully.
For example:
|[[url|test]] [[url|test]] dffd [[url|test]]| -> it will match three link in one td cell

Creole markup grammar refers to http://www.wikicreole.org/wiki/Creole1.0

Please help check it.
thx