Action @CUT

Copies and remove the content that follows this action to use it elsewhere in the document with @PASTE.

Should be followed by some content, then a @ENDCUT action to mark the end of the cut content. This content will be removed from the document and will only appear where a corresponding @PASTE is used.

Think of the common cut/paste pattern. DocuMold is essentially doing that when generating a document.

Usage

<# @CUT("name") #>

Parameters

name

(Required) The name to use to refer to this copied content with @PASTE. Must be a text (with quotes \"). Cannot be a variable.

Examples

Example With these variables Result

<# @CUT(“example”) #>
Some text here
One more line
<# @ENDCUT #>
But then!
<# @PASTE(“example”) #>

(None)

But then!
Some text here
One more line

<# @CUT(“example”) #>
Some text here
<# @ENDCUT #>
Text after cut

(None)

Text after cut

<# @CUT(“example”) #>
Some text here
A command: <# UPPER(client_name) #>
<# @ENDCUT #>
But then!
<# @PASTE(“example”) #>

client_name is "Anna Logwatch"

But then!
Some text here
A command: ANNA LOGWATCH

<# @IF(country = “Canada”) #>
For Canadians:
<# @CUT(“first_part”) #>
Some text here
One more line
<# @ENDCUT #>
<# @ELSE #>
For non-Canadians:
<# @PASTE(“first_part”) #>
<# @ENDIF #>

country is "Belgium"

For non-Canadians:
Some text here
One more line

Before: <# @PASTE(“ex”) #>
<# @CUT(“ex”) #>Some text<# @ENDCUT #>
Once: <# @PASTE(“ex”) #>
Again: <# @PASTE(“ex”) #>

(None)

Before: Some text
Once: Some text
Again: Some text

More information

The @CUT and @ENDCUT actions and the content between them will be removed from the document.

@CUT is meant to be used with the @PASTE action, which also receives a “name”. The @PASTE action will be replaced by the content of the @CUT (or @COPY) that has the same name. @PASTE can be used before or after the @CUT (or @COPY).

Multiple @PASTE actions can be used with the same name of a @CUT (or @COPY).

The main use for this action is if you have a section of content that you use in multiple places in the document, possibly within multiple @IF. Place the shared content at the end of the document, wrap it with the @CUT and @ENDCUT actions, then every other places that need it, use @PASTE to use the content.

The content of a @CUT action is always copied for use elsewhere in the document (with @PASTE), even when the @CUT is removed by a @IF action.

The name of the @CUT must be unique within the document, including with the names @COPY actions.

Which to use between @COPY or @CUT is mostly a preference. If you want the content to be at one of the places where it is needed, use @COPY, if you prefer to make it easier to find by placing it at the end of the document, use @CUT.

See also