使用 Confluence 4.0 时,如何在用户宏中使用 wiki 标记(或其他产生动态输出的东西,在用户宏编辑器中完成)。在 Confluence 3.5.3 中,我有一个包含以下内容的宏,我想迁移它:
{info:title=Table of content}
{toc}
{info}
使用 Confluence 4.0 时,如何在用户宏中使用 wiki 标记(或其他产生动态输出的东西,在用户宏编辑器中完成)。在 Confluence 3.5.3 中,我有一个包含以下内容的宏,我想迁移它:
{info:title=Table of content}
{toc}
{info}
要获取需要为宏编写的 XHTML,请执行以下步骤:
如果您无权访问“查看存储格式”选项,则解决方法是:
pageId=
URL 中的 。http://{your-confluence-root}/plugins/viewstorage/viewpagestorage.action?pageId={your-page-id}
好的,我发现了如何解决这个问题。您必须编写 XHTML,下面显示了上面的示例在 XHTML 中的样子:
## @noparams
<ac:macro ac:name="info">
<ac:parameter ac:name="title">Table of content</ac:parameter>
<ac:rich-text-body>
<ac:macro ac:name="toc" />
</ac:rich-text-body>
</ac:macro>
我发现的另一种肮脏方法是使用过渡标记(将来可能会过时):
## @noparams
<ac:macro ac:name="unmigrated-inline-wiki-markup">
<ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
<ac:plain-text-body><![CDATA[
{info}Here you can write wiki markup the old way, until Atlassian removes this transition markup (unmigrated-inline-wiki-markup){info}
]]></ac:plain-text-body>
</ac:macro>
您应该只在您的用户宏中将 wiki 标记动态呈现为 xhtml!这是一些代码:
## @noparams
#set($globalHelper = $action.getHelper())
#set($renderedhtml = $globalHelper.renderConfluenceMacro("{info}test{info}"))
$renderedhtml