Is it possible to insert M2DOC queries from an outside source?

Hello,
Let’s say you would like to put inside a logical component the following description:

image

Acquiring the description using {m: LogicalComponent.description} would “print” the text as it is.

{m:comment please insert description below}
Insered Text1
Insered Text2
{m:comment end of description}

My need is to print only what’s outside of comments, not the M2DOC query.

In order to do so, i need to make M2DOC “run” twice, once to acquire the description, and second time to use the M2DOC queries acquired from the description in order to run them again, thus NOT printing the comments.

So :

  • It it possible to insert M2DOC queries from a source outside of the template such as described or any ohter way?
  • Is there a better way to it somehow? if any.

Thanks.

The notation {m:…} is not a string that can be interpreted by M2Doc. it’s a notation that represent the MS Word fields. You can use the replace() or replaceAll() services that take a regular expression as argument:

description.replaceAll('START_TAG.*?END_TAG', '')
1 Like

Thank you very much.