Hi,
If you want to make sure to output verbatim text (ie not interpreted) you can use the
{{{…}}} syntax when using XWiki Syntax 2.0+
See
http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax#HVerbatim
However this may not be enough for your needs. We’re currently lacking an escape tool for
wiki syntax AFAIK and I remember seeing a JIRA issue about this (can’t find it right now).
I agree that we should push for this since it’s becoming something more and more asked
for.
Thanks
-Vincent
On 19 Jan 2015 at 08:15:16, Thanh Hong Dai (hdthanh@tma.com.vn(mailto:hdthanh@tma.com.vn))
wrote:
Currently, I'm using something like this to
generate a list of pages whose
prefix is "Prefix:" and link to them:
{velocity}} (((
#foreach ($row in $services.query.hql("select doc.name, doc.fullName from
XWikiDocument doc where doc.space.hidden = false and doc.space not in
('XWiki', 'Sandbox', 'Main', 'Macros') and doc.name like
'Prefix:%'").execute())
* **[[$row[0].replaceFirst("Prefix: *",
"").replaceAll("~",
"~~~~").replaceAll("[\x20-\x7f&&[^a-zA-Z0-9 ~]]",
"~~$0")>>doc:$row[1].replaceAll("~",
"~~").replaceAll("[\x5b\x5d|]", "\\$0
")]]**
#end
))) {{/velocity}}
I have tested with some heavy test cases like
Prefix:
~~~!!!```@@@$$$%%%^^^&&&***((()))___----+++==={{{}}}[[[]]]\\\|||:::;;;'''"""
???///...>>>,,,<<<
And what I have above works correctly (both showing the title and linking to
the document). I only work on a few hard test cases, though, so I'm not sure
if I missed anything.
Is there a method that does all this automatically? Or is there a better
approach to this?