I am creating a DIV macro that will allow users to place custom <div> tags and place content within the div.
I tested with an iframe and i noticed that there are extraneous tags being displayed as plain text after the iframe.
I'm just basing this test on the "collapse" macro from this page: https://confluence.atlassian.com/conf73/writing-user-macros-991928530.html
I'm putting the HTML macro with my iframe within my DIV macro.
This is what the rendered page looks like. The iframe is correctly inside my div container, but there is an extra "</div>" printed after the iframe
Looking at the page source, the </div> is both in the html as expected but also in some text after the iframe.
This becomes even more of a problem if you have nested div macros or tables, it seems to print out any closing tags after the iframe.
I've tested with a few other websites in the iframe with similar results.
Why are you nesting a HTML macro inside the body of the macro? I would just structure the macro so that all the HTML is inside the user macro, and then you can either have body hold the src link, or even make it a parameter with no macro body. Then use the parameters in your code.
I would also make the width and height parameters to make it more configurable.
If you need the HTML macro, then move that instance to inside the user macro. Take a look at this article I wrote awhile back on wrapping a macro: Getting Started with User Macros - Writing a Wrapper Macro
Thanks for the info Bill, I'll take a look at your article.
The original intent was to have a generic div macro that could include any content like text or other macros. This would help tie in with custom stylesheets and being able to style elements with a surrounding div id/class.
Are there known issues with nested macros?
I see. Yeah I've been trying to generalize macros as best i can and then nest any existing macros inside, but like you said I've also ran into some strange cases of the output not behaving as expected.
I'll try making a simple iframe specific macro and see if that has any similar issues.
For the most part, I haven't had issues with the nested div macros in my post. But seems to be something with how the iframe is processed in conjunction with the macro.
Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond. A long time favorite, Team Cale...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events