What's the wiki markup used for the conditionalcontent code?

Comments

4 comments

  • Avatar
    Nils Bier

    Hi Tom,

    since Confluence 4.0 Wiki Markup is removed from Confluence. Using the Confluence Source Editor (see https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor), you can further analyze the storage format and can see, that conditionalcontent is stored on the page like:

    <ac:structured-macro ac:name="conditionalcontent">
    <ac:parameter ac:name="sv-attr:C0A811C40146C779680D7466074B0B05">C0A811C40146C779680D7ED2654817E7</ac:parameter>
    <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter><ac:parameter ac:name="">OS: (Win98) </ac:parameter>
    <ac:rich-text-body>text</ac:rich-text-body>
    </ac:structured-macro>

    Whereas the first attribute ("C0A811C40146C779680D7466074B0B05") is static and the second one depends on the variant.

    I hope that information helps. Let me know if you have further questions.

     

    Cheers,
    Nils

     

    0
    Comment actions Permalink
  • Avatar
    Tom Johnson

    Thanks for your response. I see how the code might be manipulated using the raw xml syntax, but it's totally unworkable from a practical level, esp. since it's not easy to tell what C0A811C40146C779680D7ED2654817E7 might refer to. Are you sure there's no equivalent wiki syntax for the macro that is more familiar? Many of the other macros I've seen have a syntax that more or less corresponds to the model I indicated earlier -- e.g., {conditionalcontent: attribute=java}.

    If this isn't available, can I request it as a feature? 

    0
    Comment actions Permalink
  • Avatar
    Tom Johnson

    Or maybe would it be possible to create a custom user macro that contains the more cryptic variant code?

    0
    Comment actions Permalink
  • Avatar
    Nils Bier

    Hi Tom,

    you could work around this with a usermacro with the following code:

     

    ## @noparams
    <ac:structured-macro ac:name="conditionalcontent">
    <ac:parameter ac:name="sv-attr:C0A811C40146C779680D7466074B0B05">C0A811C40146C779680D73404FC07900</ac:parameter>
    <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
    <ac:rich-text-body>$body</ac:rich-text-body>
    </ac:structured-macro>

     

    Whereas the first string ("sv-attr:C0A811C40146C779680D7466074B0B05") is the attribute and the second one is the corresponding value (C0A811C40146C779680D73404FC07900). So you have to create an own user macro for each of your variants. The macro will then create a conditionalcontent macro with something like the following storage format:

    <ac:structured-macro ac:name="macroname"><ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter><ac:rich-text-body>
    <p>conditionaltext</p></ac:rich-text-body></ac:structured-macro>

    Does that help? Please let me know if you have further questions.

     

    Cheers,Nils

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk