### The TaskJuggler User Manual

Project Management beyond Gantt Chart Drawing

<< logicalflagexpression << | Table Of Contents | >> managers >>

Keyword | macro

Purpose

Defines a text fragment that can later be inserted by using the specified ID. To insert the text fragment anywhere in the text you need to write ${ID}.The body is not optional. It must be enclosed in square brackets. Macros can be declared like this:

    macro FOO [ This text ]

If later `${FOO}` is found in the project file, it is expanded to `This text`.

Macros may have arguments. Arguments are accessed with special macros with numbers as names. The number specifies the index of the argument.

    macro FOO [ This ${1} text ]

will expand to `This stupid text` if called as `${FOO "stupid"}`. Macros may call other macros. All macro arguments must be enclosed by double quotes. In case the argument contains a double quote, it must be escaped by a slash (`/`).

User defined macro IDs must have at least one uppercase letter as all lowercase letter IDs are reserved for built-in macros.

To terminate the macro definition, the `]` must be the last character in the line. If there are any other characters trailing it (even spaces or comments) the `]` will not be considered the end of the macro definition.

In macro calls the macro names can be prefixed by a question mark. In this case the macro will expand to nothing if the macro is not defined. Otherwise the undefined macro would be flagged with an error message.

The macro call

    ${?foo}

will expand to nothing if foo is undefined.

Syntax | `macro <ID> <MACRO>`
Arguments | none
Context | properties

    project "Example Project" 2008-01-18 +2m {
      timezone "America/Denver"
    }

    macro allocateGroup [
      allocate tux1, tux2
    ]

    resource tux1 "Tux1"
    resource tux2 "Tux2"

    task t1 "Task1" {
      start ${projectstart}  # built-in macro
    }

    task t2 "Task2" {
      depends !t1
      effort 20d
      ${allocateGroup}
    }

<< logicalflagexpression << | Table Of Contents | >> managers >>

Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012 by Chris Schlaeger <chris@linux.com>.TaskJuggler is a trademark of Chris Schlaeger.