How to display the content of a text attachment in the page?
Last modified by Vincent Massol on 2013/02/09
Try this:
{{velocity}}
$doc.getAttachment("myattachment.txt").getContentAsString())
{{/velocity}}
$doc.getAttachment("myattachment.txt").getContentAsString())
{{/velocity}}
If you don't want to evaluate the content of the attachment as wiki syntax you'll need to use the verbatim syntax. For example in XWiki Syntax 2.0:
{{velocity}}
{{{$doc.getAttachment("myattachment.txt").getContentAsString())}}}
{{/velocity}}
{{{$doc.getAttachment("myattachment.txt").getContentAsString())}}}
{{/velocity}}
Alternatively you can use the Code Macro:
{{velocity}}
{{code}}
$doc.getAttachment("todo-uitests.txt").getContentAsString())
{{/code}}
{{/velocity}}
{{code}}
$doc.getAttachment("todo-uitests.txt").getContentAsString())
{{/code}}
{{/velocity}}