This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.

No-Export macro

Name No Export
Version 1.0
Product Versions Any
Author(s) APT
Homepage n/a
Price Free
License n/a
JavaDocs n/a
IssueTracking n/a
Download JAR n/a
Download Source See below

Description/Features

A simple user macro to prevent the enclosed text from being exported to PDF, Word of HTML. Particular useful exported manuals or documentation.

Installation

Create a new user macro with the name "no-export", with "Macro has body" checked, with this code below.

##render the body of the macro
#set($wiki=$body)
#set($globalHelper=$action.getGlobalHelper())
#if($content) ## i. e. we render a normal page
#set($renderer=$globalHelper.getWikiStyleRenderer())
#set($context=$content.toPageContext())
#set($xhtml=$renderer.convertWikiToXHtml($context, $wiki))
#else ## we are e. g. in Global Template Preview
#set($xhtml=$globalHelper.renderConfluenceMacro($wiki))
#end

##check the request URI (if available) for doexport or exportword
#if(!($req.getRequestURI().length() > 0) || ($req.getRequestURI().indexOf("doexport") == -1 && $req.getRequestURI().indexOf("exportword")== -1))
  <div style="border:1px solid #dd4;background-color:#fff;margin-bottom:1em;width:100%;margin-left:auto;margin-right:auto;">
    <div style="background-color:#ffc;font-size:1.2em;  border-bottom:1px solid #dd4;padding:2px; color:#444;">
      <strong>Internal Notes</strong> <small>This section won't appear in exports</small>
    </div>
    <div style="padding: 0.2em;">
      ${xhtml}
    </div>
  </div>
#end

Usage

You can not add a {no-export} macro with enclosed comments into a page of text that you do want exported.

Examples

h1. My application documentation

All my visible text that will be exported to pdf for distribution to clients.

{no-export}
Developers note - this is a secret note that won't go into the exported pdf, word or html when you export the page or space.
{no-export}

would be rendered as follows:

Version History

Open Issues

Screenshots

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 12, 2007

    Jon Hertzig says:

    Two things: I assume you can remove the panel and text notifying that it won't...

    Two things:

    1. I assume you can remove the panel and text notifying that it won't export? (Would you take out everything from }} on, just leave in {{{xhtml} and #end ?
    2. I'm trying to incorporate this into a macro that puts a pagetree in a lefthand column on every page, without much luck. The macro is like this:
      {section}
      {column:width=25%}
      {panel:title=[$param0]}
      {pagetreesearch:rootPage=$param0}
      {pagetree:root=$param0}
      {panel}
      {column}
      {column:width=75%}
      {scrollbar}
      $body
      {scrollbar}
      {display-footnotes}
      {column}
      {section}
      

    Ideally, I'd like to put {no-export} bracketing everything before and after $body (so the pagetree column doesn't print) - but what happens is that the columns get messed up in the display. I can bracket just the panel, and it still displays ok, but then the PDF shows a blank left column on every page...
    Any suggestions?

    Cheers,
    jh