This Concordion extension adds an embed
command that embeds HTML in the Concordion output. It is similar to the echo command, except that it does not escape HTML text.
Installation
The extension is available from Maven Central.
Usage
To add the extension with no namespace declarations, either annotate the fixture class with:
@Extensions(EmbedExtension.class)
or set the system property concordion.extensions
to org.concordion.ext.EmbedExtension
HTML
For HTML format specifications, to use the embed
command, add an attribute named embed
using the namespace "urn:concordion-extensions:2010"
to an element. For example:
<html xmlns:concordion="http://www.concordion.org/2007/concordion"
xmlns:ext="urn:concordion-extensions:2010">
....
<span ext:embed="methodThatReturnsHtml()"/>
...
Markdown
For Markdown format specifications, you need to declare the ext
namespace in the Concordion fixture:
@ConcordionOptions(declareNamespaces={"ext", "urn:concordion-extensions:2010"})
The embed
command can then be used within the Markdown spec, eg:
[-](- "ext:embed=getDetails()")
Declaring additional namespaces
If the HTML fragment includes elements or attributes with a namespace prefix, the additional namespaces must be declared, both in the HTML specification, and to the extension. The easiest way is to use the @Extension
annotation on an EmbedExtension
instance field within the fixture class.
For example, to map the myns
prefix to the http://com.myco/myns
namespace:
@Extension
public ConcordionExtension extension =
new EmbedExtension().withNamespace("myns", "http://com.myco/myns");