I defiened a very basic xhtml macro for setting a date value which I want to be converted to date picker storage format (resp. date lozenge).
xhtml macro definition:
<xhtml-macro name="helloworld" class="com.atlassian.tutorial.anotherNewPlugin.macro.helloworld" key='helloworld-macro' hide-body="true">
<description key="helloworld.macro.desc"/>
<category name="formatting"/>
<parameters>
<parameter name="Date" type="string"/>
</parameters>
</xhtml-macro>
helloworld.java
public class helloworld implements Macro {
public String execute(Map<String, String> map, String s, ConversionContext conversionContext) throws MacroExecutionException {
String date;
String result = "";
if (map.get("Date") != null) {
date = map.get("Date");
result = "<time datetime=\"" + date + "\"></time>";
}
return result;
}
public BodyType getBodyType() { return BodyType.NONE; }
public OutputType getOutputType() { return OutputType.BLOCK; }
}
I would expect this:
But I get this:
Inspecting html source shows this:
<p>
<time datetime="2019-04-04" class="conf-macro output-block" data-hasbody="false" data-macro-name="helloworld"> </time>
</p>
Can anybody please give me a hint what I am doing wrong?
Hello there!
Marcel, I took your HTML source for the picker and applied it to one of my local pages using the source editor:
After hitting apply, Confluence automatically changes the input to this:
<p>
<time datetime="2019-04-04"/>
</p>
And then the date picker is correctly shown.
You might need to check what and when this is being passed to Connie:
class="conf-macro output-block" data-hasbody="false" data-macro-name="helloworld"
Since this is excluded form the final result with the Source editor, I would imagine that this is what is breaking the date picker when you display it.
This could be hidden in what is returned by
map.get("Date");
Which is the value given to your date variable which is then concatenated with result and returned by your method.
Hopes this helps Marcel! Looking forward to your reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.