[xwiki-devs] can't escape the link syntax in xhtml parser
Hi, I add a test case for escaped symbol, but it does not pass. The test case is like below. The xhtmlparser only realize the "[" "]" as the SpecialSymbol. .#------------------------------------------------------------------------------ .input|xwiki/2.0 .#------------------------------------------------------------------------------ \[notlink\] .#----------------------------------------------------- .expect|event .#----------------------------------------------------- beginDocument beginParagraph: [] onEscape: [[] onWord: [notlink] onEscape: []] endParagraph: [] endDocument .#----------------------------------------------------- .expect|xhtml .#----------------------------------------------------- <p>[notlink]</p> .#----------------------------------------------------- .expect|xwiki .#----------------------------------------------------- \[notlink\] .#----------------------------------------------------- .input|xhtml/1.0 .#----------------------------------------------------- <html><p>[notlink]</p></html> I see the class WikiModelXHTMLParser can handle the escaped symbols, by add them like return new XhtmlParser(Arrays.asList("**", "~~", "##", "--", "__", "^^", ",,"));\ How about add [ ] in it, like return new XhtmlParser(Arrays.asList("**", "~~", "##", "--", "__", "^^", ",,", "[", "]")); Thanks Wang Ning
Hi Wang, The [ symbol is a special symbol but not a wiki syntax token so it's normal that it's not escaped automatically by the XHTML parser (and it shouldn't be). Thus if you enter for ex "[nolink]" in the WYSIWYG editor it should generate "[nolink]" in xwiki syntax (and *not* \[nolink\]). Right now we don't have any XHTML notation to tell the XHTML parser that some characters are escaped. I don't know if we should have such a syntax or not. I think it would be good to have even though it's not necessary Since [ doesn't require to be escaped if you enter \[notlink\] in wiki syntax, go to the WYSIWYG renderer and come back to wiki syntax you'll get "[nolink]" which is valid. However I've just noticed that [[, ]], {{ and }} should also be escaped so I've fixed this. Thanks -Vincent On Sep 15, 2008, at 7:04 AM, Wang Ning wrote:
Hi,
I add a test case for escaped symbol, but it does not pass. The test case is like below. The xhtmlparser only realize the "[" "]" as the SpecialSymbol.
.#------------------------------------------------------------------------------ .input|xwiki/2.0 .#------------------------------------------------------------------------------ \[notlink\] .#----------------------------------------------------- .expect|event .#----------------------------------------------------- beginDocument beginParagraph: [] onEscape: [[] onWord: [notlink] onEscape: []] endParagraph: [] endDocument .#----------------------------------------------------- .expect|xhtml .#----------------------------------------------------- <p>[notlink]</p> .#----------------------------------------------------- .expect|xwiki .#----------------------------------------------------- \[notlink\] .#----------------------------------------------------- .input|xhtml/1.0 .#----------------------------------------------------- <html><p>[notlink]</p></html>
I see the class WikiModelXHTMLParser can handle the escaped symbols, by add them like return new XhtmlParser(Arrays.asList("**", "~~", "##", "--", "__", "^^", ",,"));\ How about add [ ] in it, like return new XhtmlParser(Arrays.asList("**", "~~", "##", "--", "__", "^^", ",,", "[", "]"));
Thanks Wang Ning _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Vincent Massol -
Wang Ning