Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-21092

Body of the 'Expand' user macro is not included in a PDF export

      In Confluence 3.4, we added support for the {expand} user macro and made the code available for administrators to add to their wikis.

      In Confluence 3.5, we plan to ship the {expand} user macro with Confluence.

      The problem: When you export pages to PDF, the text between the macro tags is not visible. This is a problem for the Atlassian documentation, and also for any customers who use the {expand} user macro and export their pages to PDF.

      Update

      This issue relates to the PDF export only. Please refer to CONF-21315 for the HTML export.

            [CONFSERVER-21092] Body of the 'Expand' user macro is not included in a PDF export

            The updated

            {expand}

            macro code is available on CAC.

            HTML export is tracked in CONF-21315.

            Stefan Saasen (Inactive) added a comment - The updated {expand} macro code is available on CAC. HTML export is tracked in CONF-21315 .

            The PDF export is fixed by the update macro code. See http://confluence.atlassian.com/display/DOC/Writing+the+Expand+User+Macro for the updated version.

            Stefan Saasen (Inactive) added a comment - The PDF export is fixed by the update macro code. See http://confluence.atlassian.com/display/DOC/Writing+the+Expand+User+Macro for the updated version.

            This problem appears to exist for the cloak macro as well. Is that one going to be fixed too?

            Wendy Fergusson added a comment - This problem appears to exist for the cloak macro as well. Is that one going to be fixed too?

            Sounds like you need a new checklist!

            Mark Hrynczak (Inactive) added a comment - Sounds like you need a new checklist !

            Thanks Sarah!

            Stefan Saasen (Inactive) added a comment - Thanks Sarah!

            SarahA added a comment -

            I don't think it's fixed yet for HTML. See attached HTML export DOC-220031-1500.html.zip.

            SarahA added a comment - I don't think it's fixed yet for HTML. See attached HTML export DOC-220031-1500.html.zip .

            Tested in Safari 4.0.5, FF 3.0.18, IE 7, Google Chrome 7

            Stefan Saasen (Inactive) added a comment - Tested in Safari 4.0.5, FF 3.0.18, IE 7, Google Chrome 7

            BenA added a comment -

            New version of macro, post tech review ready for QA.

            ## @param title:title=Expand Title|type=string|required=false|desc=Title for the text to expand|default=Click here to expand...
            ##
            ## Check for a blank first parameter
            ##
            #if ($paramtitle && $paramtitle.length() > 0)
               #set ($expandtitle = $paramtitle)
            #elseif ($param0 && $param0.length() > 0)
               #set ($expandtitle = $param0)
            #else
               #set ($expandtitle = "Click here to expand...")
            #end
            #set ($toggleId = $action.random)
            #set ($imagePath = "${bootstrap.webAppContextPath}/images/icons")
            #set ($imageRight = "$imagePath/arrow_right.png")
            #set ($imageDown = "$imagePath/arrow_down.png")
            ##
            ## Toggle body div and icon when expander clicked or the user hits enter.
            ##
            <script type="text/javascript">
            //<![CDATA[
                // preload open image (variable not used elsewhere)
                new Image().src = "$imageDown";
                function expandmacroExpand(eventee,clickee) {
                    var expander = jQuery(clickee),            
                        expanderImage = jQuery(".expand-control-image", expander),
                        expanderContent = expander.next(),
                        e = eventee;
                    if (e.type == "mouseup" || (e.type == "keyup" && e.keyCode == 13)) {
                        if (!expander.hasClass("on")) {
                            // open
                            expanderImage.attr("src", "$imageDown").attr("alt", "Open");
                            expanderContent.fadeIn("fast").removeClass("expand-hidden");
                            expander.addClass("on");
                        } else {
                            // close
                            expander.removeClass("on");
                            expanderContent.fadeOut("fast").addClass("expand-hidden");
                            expanderImage.attr("src", "$imageRight").attr("alt", "Closed");
                        }
                    };
                }; 
            //]]>
            </script>
            <style type="text/css">
            @media all {
                .expand-content { margin-left: 20px; }
                .expand-control-icon { display: inline-block; width: 20px; }
            }
            @media screen { 
                .expand-hidden { display: none; }
                .expand-control { cursor: pointer; text-decoration: none; }
                .expander-image, .expand-control-text { vertical-align: middle; text-decoration:none; }
            }
            @media print { 
                /* always show expander text in print */
                .expand-content { display: block !important; }
            }
            </style>
            ##
            ## Display
            ##
            <div id="expander-$toggleId" class="expand-control" onmouseup="expandmacroExpand(event,this)" onkeyup="expandmacroExpand(event,this)" tabindex="0"><span class="expand-control-icon"><img class="expand-control-image" src="$imageRight"></span><span class="expand-control-text">$generalUtil.htmlEncode($expandtitle)</span></div>
            <div class="expand-content expand-hidden">$!body</div>
            

            BenA added a comment - New version of macro, post tech review ready for QA. ## @param title:title=Expand Title|type=string|required= false |desc=Title for the text to expand| default =Click here to expand... ## ## Check for a blank first parameter ## # if ($paramtitle && $paramtitle.length() > 0) #set ($expandtitle = $paramtitle) #elseif ($param0 && $param0.length() > 0) #set ($expandtitle = $param0) # else #set ($expandtitle = "Click here to expand..." ) #end #set ($toggleId = $action.random) #set ($imagePath = "${bootstrap.webAppContextPath}/images/icons" ) #set ($imageRight = "$imagePath/arrow_right.png" ) #set ($imageDown = "$imagePath/arrow_down.png" ) ## ## Toggle body div and icon when expander clicked or the user hits enter. ## <script type= "text/javascript" > //<![CDATA[ // preload open image (variable not used elsewhere) new Image().src = "$imageDown" ; function expandmacroExpand(eventee,clickee) { var expander = jQuery(clickee), expanderImage = jQuery( ".expand-control-image" , expander), expanderContent = expander.next(), e = eventee; if (e.type == "mouseup" || (e.type == "keyup" && e.keyCode == 13)) { if (!expander.hasClass( "on" )) { // open expanderImage.attr( "src" , "$imageDown" ).attr( "alt" , "Open" ); expanderContent.fadeIn( "fast" ).removeClass( "expand-hidden" ); expander.addClass( "on" ); } else { // close expander.removeClass( "on" ); expanderContent.fadeOut( "fast" ).addClass( "expand-hidden" ); expanderImage.attr( "src" , "$imageRight" ).attr( "alt" , "Closed" ); } }; }; //]]> </script> <style type= "text/css" > @media all { .expand-content { margin-left: 20px; } .expand-control-icon { display: inline-block; width: 20px; } } @media screen { .expand-hidden { display: none; } .expand-control { cursor: pointer; text-decoration: none; } .expander-image, .expand-control-text { vertical-align: middle; text-decoration:none; } } @media print { /* always show expander text in print */ .expand-content { display: block !important; } } </style> ## ## Display ## <div id= "expander-$toggleId" class= "expand-control" onmouseup= "expandmacroExpand(event, this )" onkeyup= "expandmacroExpand(event, this )" tabindex= "0" ><span class= "expand-control-icon" ><img class= "expand-control-image" src= "$imageRight" ></span><span class= "expand-control-text" >$generalUtil.htmlEncode($expandtitle)</span></div> <div class= "expand-content expand-hidden" >$!body</div>

            BenA added a comment -

            Updated existing code:

            • expand text now prints
            • expand text now shows in PDF export
            • expansion show/hide now has simple fade in/out
            • now keyboard accessible - user can tab to controls and hit enter to open/close
            • image now has alt text to indicate open/closed state (users can localise text as a user macro)

            Code ready for review.

            Note the tech writers already have a task to update the documentation.

            BenA added a comment - Updated existing code: expand text now prints expand text now shows in PDF export expansion show/hide now has simple fade in/out now keyboard accessible - user can tab to controls and hit enter to open/close image now has alt text to indicate open/closed state (users can localise text as a user macro) Code ready for review. Note the tech writers already have a task to update the documentation.

            Would it also be possible to please make the text between the tags visible when printing?

            Rosie Jameson [Atlassian] (Inactive) added a comment - - edited Would it also be possible to please make the text between the tags visible when printing?

              bbuchanan BenA
              smaddox SarahA
              Affected customers:
              10 This affects my team
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 4h Original Estimate - 4h
                  4h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10h
                  10h