Action @COPY
Copies the content that follows this action to reuse it elsewhere in the document with @PASTE.
Should be followed by some content, then a @ENDCOPY action to mark the end of the copied content.
Think of the common copy/paste pattern. DocuMold is essentially doing that when generating a document.
Usage
Parameters
| name |
(Required) The name to use to refer to this copied content with |
Examples
More information
The @COPY and @ENDCOPY actions will be removed from the document, but the content in between
will remain where it initially was.
@COPY 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 @COPY (or @CUT) that has the same name. @PASTE can be used before or after the @COPY (or @CUT).
Multiple @PASTE actions can be used with the same name of @COPY (or @CUT).
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 content normally in the first desired location, wrap it with the @COPY
and @ENDCOPY actions, then every other places, use @PASTE to reuse the content.
The content of a @COPY action is always copied for use elsewhere in the document (with @PASTE), even when the @COPY is removed by a @IF action.
The name of the @COPY must be unique within the document, including with the names of @CUT 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.