diff options
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index f3fc51671..ab6d0390b 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -67,7 +67,10 @@ export namespace Field { // as a kind of macro to include the content of those documents Doc.MyPublishedDocs.forEach(doc => { const regex = new RegExp(`^\\^${doc.title}\\s`, 'm'); - script = script.replace(regex, Cast(doc.text, RichTextField, null)?.Text ?? ''); + const sections = (Cast(doc.text, RichTextField, null)?.Text ?? '').split('--DOCDATA--'); + if (script.match(regex)) { + script = script.replace(regex, sections[0]) + (sections.length > 1 ? sections[1] : ''); + } }); return script; } |