Ever need a quick recap what happened during the previous meeting? Now you can read your meeting minutes in a chronological order with the CQL Navigation Macro introduced in Canned Search for Confluence 1.5.0

How to pass in the date from other macros

Background


Sometimes, there is a requirement to generate the countdown based on the output from other macros 


This is a workaround by using Confluence user macro to redirect the output of the encapsulated macros as the date paramater for the Countdown macro

The date format generated by the other macros must follow the format of dd-mm-yy.

Otherwise, additional preprocessing steps can be added in the user macro code

Instructions


Setting up the user macro

  1. Log in as Confluence Admin
  2. Go to Confluence Administration > General Configuration 
  3. Click on User Macros on the left side menu
  4. Click on Create a User Macro
  5. Fill in the details as the table below

    Macro Namecountdownbody
    VisibilityVisible to all users in the Macro Browser
    Macro TitleCountdown Date in Body
    DescriptionUses the output of other macros as the date input to the Countdown Timer plugin
    CategoriesVisuals & Images
    Icon URL 
    Documentation URL 
    Macro Body ProcessingRendered
    Template
    ## Macro title: Countdown Date in Body
    ## Macro has a body: Y
    ## Body processing: Rendered
    ##
    ## @noparams
    #set ($index = $body.indexOf('</span>'))
    #set ($index = $index - 8)
    #if ($index > 0)
       #set ($startIndex = $index - 8)
       #set ($date = $body.substring($startIndex, $index))
    #else
      #set ($date = $body)
    #end
     
    <ac:structured-macro ac ac:name="countdown" ac:schema-version="1">
       <ac:parameter ac:name="countdowndate">$date</ac:parameter>
       <ac:parameter ac:name="centered">true</ac:parameter>
       <ac:parameter ac:name="style">Black</ac:parameter>
    </ac:structured-macro>
  6. Click on Save button


Using the user macro

  1. Go to the page or template
  2. Add the Countdown Date in Body user macro instead of Countdown macro
  3. Add the other macros which will provide the date 

    Plain DateOther Macro