Replace and Render Plugin

Name Replace and Render
Vendor Adaptavist.com Ltd (Website)
Authors Alain Moran
Homepage http://confluence.atlassian.com/display/CONFEXT/Replace+and+Render+Plugin
Issue Management http://jira.adaptavist.com/browse/RNR
Continuous Integration n/a
Categories Formatting Macros
Most Recent Version 1.0.0
Availability Confluence v2.1 to v3.0.0_01
State Stable
Support By: Adaptavist Community Support
Website: http://www.adaptavist.com/display/free/Support
License Freeware / Open Source (BSD)
Price Free
Release Docs http://confluence.atlassian.com/display/CONFEXT/Replace+and+Render+Plugin
Java API Docs n/a
Download Source http://svn.atlassian.com/svn/public/contrib/confluence/replaceandrender-plugin/tags/1.0.0
Download JAR adaptavist-plugin-replaceandrender-1.0.0.jar

Description/Features

Allows replacements to be made within a block of wiki markup

Usage

        {replace-and-render}
          {replace-body}{div:align=%alignment%}this is some text{div}{replace-body}
          {replace-item:%alignment%}center{replace-item}
        {replace-and-render}

Examples

{replace-and-render}
 {replace-body}{%mymacro%}this is the replace body with a %replaceme%{%mymacro%}{replace-body}
 {replace-item:%replaceme%}replacement{replace-item}
 {replace-item:%mymacro%}center{replace-item}
{replace-and-render}
{velocity-render:parameter=value}
#set($varible="value")
variable = $variable
parameter = $parameter
#foreach($a in ['a','b','c'])
  $velocityCount : $a </br>
#end
...etc...
{velocity-render}

Version History

Open Issues

Screenshots

Labels

plugin plugin Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 23, 2007

    James Mortimer says:

    there is no pid for jira, so I've added my comments here: 1) link from annotati...

    there is no pid for jira, so I've added my comments here:

    1) link from annotation guide documentation is incorrect:
    gives: http://www.adaptavist.com/display/USERGUIDE/replace-and-render+macro
    should be: http://confluence.atlassian.com/display/CONFEXT/Replace+and+Render+Plugin

    2) http://jira.adaptavist.com/browse/RNR is invalid

    3) replace and render no longer exists on adaptavist site that I could find, by search or by index into their custom macros

    4) feature request:

    • content from 'replace-body' could be taken from an attachment or an 'included' page - allows a rudimentary template system

    5) feature request:

    • allow a shorthand notation where you have a simple replacement:
      Unknown macro: {replace-and-render}

      content

      will replace any occurance of key with value in content and render the content as wiki.

    1. Jan 24, 2007

      Alain Moran says:

      1: Yes, for now the context help will have to suffice I'm a little busy with oth...

      1: Yes, for now the context help will have to suffice I'm a little busy with other projects to write the docs up ... sorry

      2: JIRA project created.

      3: As I say .. I havent had time to write the docs up yet, since this was a throwaway 'lunchtime' creation that was intended as a way of working out one way that this kind of thing could be done.

      4: the output from the

      Unable to render {include} No page title provided

      or

      Unknown macro: {import}

      macros could be used to import or include the content from another page ... not sure about attachments though.

      5: As bob rightly says, this is the syntax of the run macro which should be used instead.

      1. Mar 21, 2007

        James Mortimer says:

        I couldn't get this to work with {include} as it seems to render the content int...

        I couldn't get this to work with {include} as it seems to render the content into html first in my attempt.
        I can't find any references for an {import} macro, but that might work if indeed it imports wiki rather than html.

        1. Mar 21, 2007

          James Mortimer says:

          {replace-and-render} {replace-item:%test%}James{replace-item} {replace-body...
          {replace-and-render}
          {replace-item:%test%}James{replace-item}
          {replace-body}
          |Include |{include:replace-and-render-included-page}|
          |Import |{import:replace-and-render-included-page}|
          |metadata-from|{metadata-from:replace-and-render-included-page|test}|
          |zone-template-instance|{zone-template-instance:replace-and-render-included-page}{zone-template-instance}|
          {replace-body}
          {replace-and-render}
          

          replace-and-render-included-page contains

          "%test%"
          {metadata:test}"%test%"{metadata}
          
        2. Mar 21, 2007

          Alain Moran says:

          Ah, yeah, you are correct ... they would need to include the wiki text and not t...

          Ah, yeah, you are correct ... they would need to include the wiki text and not the html .. my mistake.

  2. Jan 23, 2007

    James Mortimer says:

    example was: {replace-and-render:key=value}content{replace-and-render}

    example was:

    {replace-and-render:key=value}content{replace-and-render}
    
    1. Jan 24, 2007

      Alain Moran says:

      aha ... it would appear that bob intended to insert his comment here, since this...

      aha ... it would appear that bob intended to insert his comment here, since this is exactly what the run macro does

  3. Jan 23, 2007

    Bob Swift says:

    This has some overlap with the Run macro.

    This has some overlap with the Run macro.

    1. Jan 24, 2007

      James Mortimer says:

      major differences substitutions are done in the macro body in sub-tags, so tha...

      major differences

      • substitutions are done in the macro body in sub-tags, so that special characters like | = , can be used
      • syntax is simple and the name of the macro is intuitive for the simple 'replace' functions

      recommend:

      • harmonize or combine the two plugins, but continue to provide the current features of replace-and-render listed above. They can essentially call the same code base, but be separate interfaces.

      -will cross post this to the run page.-

    2. Jan 24, 2007

      Alain Moran says:

      The intention of replace-and-render was to allow the output of one macro to be f...

      The intention of replace-and-render was to allow the output of one macro to be fed into the arguments of another, which doesnt appear to be possible with the run macro.

      1. Jan 24, 2007

        Bob Swift says:

        Well, Run macro certainly does that. It's main purpose was to allow for the use...

        Well, Run macro certainly does that. It's main purpose was to allow for the user to provide input (parameters) that could then be used to drive other macros like sql for instance. As far as substitutions, | is the only restrictions due to the parsing Confluence does (as an aside, I think that could be improved ). All that said, I think James' suggestion to harmonize is appropriate and something we can sort out in the future. Run macro is still in beta partly because of the need to make changes (that may be incompatible) as a result of feedback.

        1. Jan 24, 2007

          Alain Moran says:

          Heh .. I mean as in take the output of a macro and inject it as a parameter, eg:...

          Heh .. I mean as in take the output of a macro and inject it as a parameter, eg:

          {replace-and-render}
            {replace-body} 
              {show-to:users=%participants%}
                This text is only visible to those people who have contributed to the page.
              {show-to}
            {replace-body}
            {replace-item:%participants%}{page-info:participants|type=flat}{replace-item}
          {replace-and-render}
          

          I'm not sure how that could be achieved with the run macro.

          1. Jan 24, 2007

            Bob Swift says:

            I see what you mean, yes, that is quite different and useful. Even so, there mi...

            I see what you mean, yes, that is quite different and useful. Even so, there might be some things we could harmonize. James created an issue RUN-5 where we can discuss further. One obvious area is how to identify replacement variables.

          2. Jan 25, 2007

            James Mortimer says:

            interesting and important use case above that I neglected in my first list of di...

            interesting and important use case above that I neglected in my first list of disctinct differences between run and replace-and-render

            Chould almost be called 'render-then-replace-and-render-again'.

            The hack macro I had written to do the same was just called {replace}, but {replace-and-render} encompases it's entire functionality so I will discontinue development for now. I didn't even get a chance to post it yet.

  4. Feb 08, 2007

    James Mortimer says:

    Run macro is now Run Plugin
  5. Feb 08, 2007

    James Mortimer says:

    A great extension to the [replace-and-render plugin] which would differe...

    A great extension to the [replace-and-render plugin] which would differentiate it from the Run Plugin would be a 'foreach' capability: For example:

    {foreach}
    {foreach-head}
    || Item || Link || Page Titles || Labelled Pages ||
    {foreach-head}
    {foreach-tail}{foreach-tail}
    {foreach-body}
    || %item% | [%item%] | {search:query=title:%item%} | {contentbylabel:%item%} |
    {foreach-body}
    {foreach-list:%item%}
    alpha
    beta
    gamma
    {foreach-list}
    {foreach}
    

    that would render a table with 4 rows and the obvious replacements

    But this could be a fairly simple patch to replace-and-render that includes a new tag,

    Unknown macro: {replace-list}

    (instead of

    Unknown macro: {foreach-list}

    )

    • Each line of the list is rendered.
    • the head / body and tail are assembled as wiki and rendered as one step
    • Not that I know a use case yet, but if you had multiple lists, it would do all permutations of replacements.
    • leading and trailing whitespace and newlines for the head and tail are ignored
    1. Feb 08, 2007

      Alain Moran says:

      You would use the {velocity-render} macro for this kind of thing

      You would use the {velocity-render} macro for this kind of thing

  6. Mar 21, 2007

    James Mortimer says:

    There are two very useful macros, Zones Plugin and Replace and Render Plugin, wh...

    There are two very useful macros, Zones Plugin and Replace and Render Plugin, which were once-offs and Alain and Jason don't have time to support / extend them. Perhaps you or the community would combine them, as they are essentially the same thing, except:

    • replace and render allows you to specify more useful replace strings, such as %var%, which can be used as macro parameters, unlike {zone:var}
    • replace and render can take the template body from the current page (for one-time replacements), while zones, it seems, cannot
    • zones very elegantly allow you to get the source from another page, while replace-and-render only uses it's own body.

    Both are very simple, and very useful, and provide fundamental functionality missing from Confluence.

    Currently, I almost always use both together because of each's deficiencies and strengths (a replace-and-render, wrapped in a zone-template)

    replace-and-render would be redundant if:
    a) zones supported the {zone-data:%var%}value{zone-data} or {zone-data:$var}value{zone-data} syntax for replacing %var% and $var, respectively, for use in macro parameters
    b) supported a {zone-body}body{zone-body} tag which, if present, would override the parameter to zone-template-instance that looked for the body on another page.

    zone-templates would be redundant if:
    a) replace and render could optionally get it's body from the replace-body tag (as it does currently), or from a remote page using {replace-and-render:space:page} or {replace-and-render:body=space:page}

    (They also have some overlap with the Run macro. See discussion above.)

    http://developer.atlassian.com/jira/browse/ZONE-15

    Thanks guys, for two essential plugins!

    1. Mar 21, 2007

      James Mortimer says:

      http://jira.adaptavist.com/browse/RNR-5
  7. Apr 07, 2007

    Olivier Oswald says:

    By using the replace-and-render plugin in combination with the html plugin, you'...

    By using the replace-and-render plugin in combination with the html plugin, you're able to create new pages based on form values. The following example shows two dropdown lists on the current page allowing the user to select a month and year. By clicking on the Create Status Report button, a JavaScript is called which redirects the browser to Confluence's "add page" dialog with a predefined title.

    {replace-and-render}
    	{replace-body} 
    		{html}
    			<br><select id="cboStatusReportMonth">
    				<option></option>
    				<option>January</option><option>February</option><option>March</option><option>April</option>
    				<option>May</option><option>June</option><option>July</option><option>August</option>
    				<option>September</option><option>October</option><option>November</option><option>December</option>
    			</select>
    			<select id="cboStatusReportYear">
    				<option>2006</option><option selected>2007</option><option>2008</option><option>2009</option>
    			</select>
    			<input type="button" value="Create Status Report" onclick="createStatusReport();">
    
    			<script language="JavaScript">
    				function createStatusReport() {
    					var spaceKey = "%spaceKey%";
    					var fromPageId = "%pageId%";
    					var projectName = "%pageTitle%";
    					var boilerplate = "%boilerPlate%";
    					var monthText = document.getElementById('cboStatusReportMonth').value;
    					var yearText = document.getElementById('cboStatusReportYear').value;
    					
    					if (monthText.length>0 && yearText.length>0) {
    						var title = "Status Report for '" + projectName + "' - " + monthText + " " + yearText;
    						document.location = "/pages/createfromboilerplate.action?spaceKey=" + escape(spaceKey) + "&linkCreation=true&title=" + escape(title) + "&fromPageId=" + fromPageId + "&parentPageString=" + escape(projectName) + "&boilerplate=" + escape(boilerplate);;
    					} else {
    						alert("Please select a month and year.");
    					}
    				}
    			</script>
    		{html}
      {replace-body}
      {replace-item:%pageId%}{page-info:pageId}{replace-item}
      {replace-item:%pageTitle%}{page-info:title}{replace-item}
      {replace-item:%spaceKey%}PRJ{replace-item}
      {replace-item:%boilerPlate%}StatusReport{replace-item}
    {replace-and-render}
    

    There's a known issue with this method: although the title of the new page is specified, Confluence still displays the "add page" dialog with the title text box disabled, leaving the user the only option to either click "Save" to finally create the page - or to cancel the process. This is not very user friendly, but seems to be the only option for the moment.

    1. Apr 10, 2007

      Alain Moran says:

      If you take apart the create-page macro, then you should find another action whi...

      If you take apart the create-page macro, then you should find another action which will be more friendly to the kind of things you are doing here.

    2. Jul 11, 2007

      David Peterson [CustomWare] says:

      By the way, if you remove the '&linkCreation=true' parameter from the URL, y...

      By the way, if you remove the '&linkCreation=true' parameter from the URL, you will be able to edit the page title.

    3. Feb 28, 2008

      Sean V says:

      This is exactly what I was looking for, but alas, it doesn't work in IE (it does...

      This is exactly what I was looking for, but alas, it doesn't work in IE (it does in Firefox, though).
      The problem lines seem to be those below. These vars just aren't getting set (they're empty).

      var monthText = document.getElementById('cboStatusReportMonth').value;
      var yearText = document.getElementById('cboStatusReportYear').value;

      Anyone with more than my cursory understanding of Javascript know what's going on?

      1. Mar 03, 2008

        Sean V says:

        Looks like I finally figured out the IE glitch. The trick is to break each of th...

        Looks like I finally figured out the IE glitch. The trick is to break each of the problem lines above into two. See the code below (note that this version if for weekly status reports, so it's a bit different from above):

        {replace-and-render}
             {replace-body} 
             {html}Week Ending:
             <select id="cboStatusReportWeek">
                  <option></option>
                  <option>02-29-2008</option>
                  <option>03-07-2008</option>
                  <option>03-14-2008</option>
                  <option>03-21-2008</option>
                  <option>03-28-2008</option>
                  <option>04-04-2008</option>
                  <option>04-11-2008</option>
                  <option>04-18-2008</option>
                  <option>04-25-2008</option>
             </select>
             <input type="button" value="Add a Weekly Status Report" onclick="createStatusReport();">
             <script language="JavaScript">
                  function createStatusReport() {
                       var spaceKey = "%spaceKey%";
                       var fromPageId = "%pageId%";
                       var projectName = "%pageTitle%";
                       var boilerplate = "%boilerPlate%";
                       var weekMenu = document.getElementById("cboStatusReportWeek");
                       var weekText = weekMenu.options[weekMenu.selectedIndex].text;
                       if (weekText.length>0) {
                            var title = projectName + ", " + weekText;
                            document.location = "/pages/createfromboilerplate.action?spaceKey=" + escape(spaceKey) + "&linkCreation=true&title=" + escape(title) + "&fromPageId=" + fromPageId + "&parentPageString=" + escape(projectName) + "&boilerplate=" + escape(boilerplate);
                           } else {
                             alert("Please select a week.");
        			  }
        		}
             </script>
             {html}
             {replace-body}
             {replace-item:%pageId%}{page-info:pageId}{replace-item}
             {replace-item:%pageTitle%}{page-info:title}{replace-item}
             {replace-item:%spaceKey%}YPCBizIpedia{replace-item}
             {replace-item:%boilerPlate%}Weekly Status Template{replace-item}
        {replace-and-render}
        
        1. Mar 04, 2008

          Olivier Oswald says:

          thanx sean. been travelling for the last four months and didn't find the time to...

          thanx sean. been travelling for the last four months and didn't find the time to respond.

  8. May 30, 2007

    Olivier Oswald says:

    How do I properly replace a value in report-table generated content? I would lik...

    How do I properly replace a value in report-table generated content? I would like to replace the table's <thead> element with a <tr> element in order to work around a bug of the table-plus macro. The following code does not work. Does replace-and-render first replace, then render the content?

    {replace-and-render}
    	{replace-item:thead}tr{replace-item}
    	{replace-body}
    		{report-table}
    			{content-reporter:scope=@self > children|types=page|labels=todo}
    				{date-sort:data:DueDate}
    			{content-reporter}
    			{report-column:title=Task}{report-info:data:Task}{report-column}
    			{report-column:title=Due Date}{report-info:data:DueDate}{report-column}
    		{report-table}
    	{replace-body}
    {replace-and-render}
    
    1. May 30, 2007

      David Peterson [CustomWare] says:

      Unfortunately, {replace-and-render} won't help you with this. As implied by the ...

      Unfortunately, {replace-and-render} won't help you with this. As implied by the name of the macro, it first replaces, then renders, which means you can't do any replacements on the HTML code generated by the rendering engine.

      I wasn't aware that there was a specific bug with the table-plus macro, but my suggestion would be to fix the bug, rather than try to hack around it. Incidentally, if you replaced <thead> with <tr> you would probably still have problems, since the <thead> already contains a <tr>.

      1. May 31, 2007

        Olivier Oswald says:

        correct, should have spent more time on this. here's the bug report on table-plu...

        correct, should have spent more time on this. here's the bug report on table-plus.

  9. Dec 10, 2007

    Timothy Grotheer says:

    Just a couple of quick questions,  I'm trying to pull information from fro...

    Just a couple of quick questions,

     I'm trying to pull information from from a table on one page and bring it to a drop, list, or check box list on another page.

    I have tried using the get-data macro in combination with the list option macro and this will pull the data, however, when the option

    is displayed in the drop or list box, the get-data macro code is displayed but once selected and saved, the actual information from the

    table is displayed.  This turned me to the replace-and-render macro.  It seems like it will do the trick, however, I was wondering which directory

    to install the .jar files into and I was also wondering if you had a solution to my information retrieval problem.  Any information will

    be greatly appreciated

    Thanks

    Tim Grotheer

  10. Feb 20, 2008

    Sean V says:

    I'm trying to auto-generate labels based on a user's selection of check boxes (v...

    I'm trying to auto-generate labels based on a user's selection of check boxes (via Scaffolding plug-in) by using Replace and Render. Trouble is, when more than one check box is selected, only one label is generated. I'd like a label for each of the selected check boxes. Is this possible? Sample code:

    {list-data:MyThings\|type=check\|multiple=true\|required=true}
    {list-option:Thing_1}Thing_1{list-option}
    {list-option:Thing_2}Thing_2{list-option}
    {list-option:Thing_3}Thing_3{list-option}
    {list-data}
    
    {replace-and-render}
    {replace-item:%label%}{get-data:MyThings}{replace-item}
    {replace-body}{add-label:%label%}{replace-body}
    {replace-and-render} 
    

    Clicking on both Thing_1 and Thing_2 will produce a saved page with only the label "Thing_1"

    1. Feb 21, 2008

      David Peterson [CustomWare] says:

      A new {label-options} macro is coming in the next iteration of Scaffolding which...

      A new {label-options} macro is coming in the next iteration of Scaffolding which should make life easier. It will correctly add multiple labels to your page based on what is selected. One issue which is harder to get around is that it won't remove labels when they are unchecked. This is due to the order in which the page is saved, and the 'edit labels' section of the edit screen. But it will at least get us part way.

      As for your next question (when will this version be out), that I can't say conclusively at present. I'll see if I can arrange an interim release sometime in the next week, but no promises. If you're disparate, email me and I'll see about getting you a snapshot release.

      1. Mar 12, 2008

        Jose Biton says:

        I've been desperately trying to find a way to automatically assign pages and blo...

        I've been desperately trying to find a way to automatically assign pages and blogs created from a parent page. My first issue is that I don't know what label to look for. For example, my space may consist of companies and each company has pages that relate to products. I would like to have a link from the company page that creates a child product page. I want the child page to inherent the main company label.

        For example:
        Parent has 2 labels: company AND apple (there might be an adjacent page with two labels company AND IBM)

        Parent has a create page and create news links as follows:

        1. Create Child Page:

         {create-page:template=NewFund\|prompt=Add a new fund to this Shop}New Fund{create-page}

        2. Create News:

        {link-to:add news\|labels=visitnote}(+) Add Visit Notes{link-to}

        I would like the following to occur:

        • If the user hits the first link. A new page is created inheriting the parent labels: company AND apple
        • If the user hits the second link: A new blog entry is created that also inherits two lables company AND apple

        To make matters a bit more cumberson... in reality the new pages would only inherit the term apple (ie- the name of the company) I would then use the addlabel macro to give these a fund label for the first link or a visitnote label for the second.

        I think that if I can figure out a list of the labels on the page then I could figure out which label to use. This goes for other parts of the page as well. For example, on the parent page I display a list of blogs that have been created from that parent page. Staying with the example above, I'd like to display the "visit notes" created on the parent page using the following macro:

          {blog-posts:5 | content=title |  labels=apple,visitnote | match-labels=all}
        

        It seems simple enough, but I am using a template for the page and need the label "apple" to be dynamic (ie- there will be pages where the term is IBM, MSFT, CISCO, etc.).

        Thanks for any help you could provide.

        1. Mar 17, 2008

          Jose Biton says:

          I may have found a work-around but can't quite get it to work. I'm trying to aut...

          I may have found a work-around but can't quite get it to work. I'm trying to automatically set a unique label for each page based on the title. So for I have the following:

          
          {set-data:Title}
            {report-info:content:title}
          {set-data}
          
          {replace-and-render}
           {replace-item:%label%}{get-data:Title}{replace-item}
           {replace-body}{add-label:%label%}{replace-body}
          {replace-and-render}
          
          

          But the label that gets assigned to the page is '%label%.

          What am I missing?

          Also, does anyone know of a way to get multiple words to convert into one? For example of the name of the title page is 'My title page' I'd like the label to read Mytitlepage or My_title_page. I do not want the page to have three labels My, Title and Page.

          Thoughts and comments are very welcomed.

          Thanks.

          1. Mar 17, 2008

            David Peterson [CustomWare] says:

            Ah...I kind of see what you're doing now, although I'm not exactly sure why... ...

            Ah...I kind of see what you're doing now, although I'm not exactly sure why...

            In any case, why not just use the {report-info} macro directly. Eg:

            {replace-and-render}
             {replace-item:%label%}{report-info:content:title}{replace-item}
             {replace-body}{add-label:%label%}{replace-body}
            {replace-and-render}
            

            Alternately, if you have the latest version of reporting (2.0.0) you can do this:

            {report-on|injected=true}{add-label:%content:title%}{report-on}
            

            However, I'm not sure this will work correctly anyway - page titles will not always make valid label names. For example, labels can't contain spaces but page titles can.

            1. Mar 18, 2008

              Jose Biton says:

              Thanks for the response. As to the why? I created a template with scaffolds fro...

              Thanks for the response. As to the why?

              I created a template with scaffolds from which users create pages. The space tracks companies and their products. I'd like each company page to look similar as a user fills in the information. After a company page is created a user can create a product page. I'd like the product page to inherit a label from the parent page. That's why I'm trying to generate labels automatically.

              On a more complicated note, I would also like to tie news items (blogs) to specific pages with labels. For example, when I visit a company I'd create a news page with two tags: visitnote and companyname. So, I created a link to an 'add news' page, but have not been able to automatically add the labels.

              I was not able to get the title working, but I was able to do the following:

               {replace-and-render}
                {replace-item:%label%}{report-info:content:labels|source=@parent|separator=","}{replace-item}
                {replace-body}{add-label:%label%}{replace-body}
               {replace-and-render}
              
              1. Mar 18, 2008

                David Peterson [CustomWare] says:

                Yeah, using the parent labels will be more likely to work, since they are by def...

                Yeah, using the parent labels will be more likely to work, since they are by definition valid labels.

                That said, I believe the Label Management Plugin has some magic to allow labels to be inherited by child pages. Perhaps that will serve your purpose more effectively.

            2. Mar 18, 2008

              Jose Biton says:

              Thanks for the response. As to the why? I created a template with scaffolds fro...

              Thanks for the response. As to the why?

              I created a template with scaffolds from which users create pages. The space tracks companies and their products. I'd like each company page to look similar as a user fills in the information. After a company page is created a user can create a product page. I'd like the product page to inherit a label from the parent page. That's why I'm trying to generate labels automatically.

              On a more complicated note, I would also like to tie news items (blogs) to specific pages with labels. For example, when I visit a company I'd create a news page with two tags: visitnote and companyname. So, I created a link to an 'add news' page, but have not been able to automatically add the labels.

              I was not able to get the title working, but I was able to do the following:

               {replace-and-render}
                {replace-item:%label%}{report-info:content:labels|source=@parent|separator=","}{replace-item}
                {replace-body}{add-label:%label%}{replace-body}
               {replace-and-render}
              

              Now I just need a remove-label option.

              1. Oct 22, 2008

                David Andrew Wareham says:

                Has a remove-label option be added or being worked on?

                Has a remove-label option be added or being worked on?

            3. Mar 18, 2008

              Jose Biton says:

              I don't think that the title can be converted into a lable, or at least I was no...

              I don't think that the title can be converted into a lable, or at least I was not able to get either method suggested to work. I was however able to get the following to work:

              {replace-and-render}
               {replace-item:%label%}{report-info:content:labels|source=@parent|separator=","}{replace-item}
               {replace-body}{add-label:%label%}{replace-body}
              {replace-and-render}
              

              As to the why?... I have a space to track companies. Each company page should have the same look/feel, so I'm using live-templates. Also, each company has product which we allow users to create from the company page using an add-page. We'd like to be able to automatically assign the labels to these products. Lastly and very important, we conduct visits to these companies and are using blog postings to record the visits. Like new products we'd like to be able to launch the 'add news' page with predetermined labels so that these could appear on the main company page.

              Hopefully that makes sense.

  11. Aug 01, 2008

    Christian Nesemann says:

    Hi, is it somehow possible to set a width in percentage when using RnR-Macro ? ...

    Hi,

    is it somehow possible to set a width in percentage when using RnR-Macro ? Maybe with an escape-char ?

    Somethign like this

    &#37;

    doesn't work

    e.g.

    
    {replace-and-render}
    {replace-item:%TableWidth%} 25% {replace-item}
    {replace-body}
    
    {table:width=%TableWidth%}
    {tr}{td}Cell{td}{tr}
    {table}
    
    {replace-body}
    {replace-and-render}
    
    

    regards Christian

  12. Sep 10, 2008

    Bob Harner says:

    I wonder, since (I belive) velocity templates allow the direct invocation of jav...

    I wonder, since (I belive) velocity templates allow the direct invocation of java classes, doesn't the {velocity-render} macro constitute a security vulnerability?

    1. Sep 10, 2008

      David Peterson [CustomWare] says:

      Yeah, I would believe agree. You can disable the macro individually from the Adm...

      Yeah, I would believe agree. You can disable the macro individually from the Admin panel, but it would be good if this was disabled by default. I didn't even realise it had been added...

  13. Sep 11, 2008

    Hamish Willee says:

    Hi I'm creating a number of search pages using the Advanced Search Macro. Each ...

    Hi

    I'm creating a number of search pages using the Advanced Search Macro. Each of the pages has a hidden text field specifying a pattern of ORed labels, and a select list which has the same labels (and'd)

    This results in a large page, potentially error prone. What I would like to do is specify the items as a comma separated list at the top of the page, and automatically have each value input to my advance search macros. I can see how the replace and render might help me if I had a fixed length list, but unfortunately it will vary by page.

    Can replace and render help me?

    Regards
    H

    PS Actually, what would be even better would be if the advanced search macro ORed the values of checkboxes, and/or a container allowed values to be specified as a comma separated list. Not going to happen

  14. Apr 08

    Ghalib Ghuneim says:

    I have the next macro (listofprojectusers): I call it passing parameter: listofp...

    I have the next macro (listofprojectusers):
    I call it passing parameter:
    listofprojectusers:3004

    {replace-and-render}
    	{replace-body}{userlister:groups=p%value%PL,p%value%TL,p%value%PQ,p%value%PA}{replace-body}
    {replace-item:%value%}$param0{replace-item}
    {replace-and-render}
    

    and at the end i need the result to look like:

    {userlister:group=p3004PL,p3004TL,p3004PQ,p3004PA}
    

    but it does not works, when I send the parameter it give me:

    No results were found for groups : pPA, pPL, pPQ, pTL
    it does not replace the value of $param0 when it is alone

    {replace-item:%value%}$param0{replace-item}
    

    and it works when i write anything with $param0 for ex.

    {replace-item:%value%}($param0){replace-item}
    

    which in result give me broken string

    No results were found for groups : p(0003)PA, p(0003)PL, p(0003)PQ, p(0003)TL

    any advise

  15. May 29

    Matthias Schuldner says:

    How can I replace a space? Is there something like this: {replace-and-render}...

    How can I replace a space?
    Is there something like this:

    {replace-and-render}
      {replace-body}
        my text
        {replace-body}
        {replace-item:' '}-{replace-item}
     {replace-and-render}
    

    --> my-text

    Any hints?
    Thanks!