Skip to Content
Documents & TemplatesEditing Tags in Word

Safely Editing Tags in Word

Tag Templates are ordinary Word documents, so it is tempting to edit the tags the way you would edit any other text. A few habits from normal Word editing will quietly corrupt a tag. This article covers what to watch for so an edit doesn’t break the whole document.

If you are new to tags, read What Are Tag Templates? first. This article assumes you already know what a tag looks like.

A tag has to live on one line — never press Enter inside it

A tag is a single unit that starts with { and ends with }. Word does not know that. If your cursor is inside a tag and you press Enter, Word splits the tag across two paragraphs, and the merge engine can no longer read it as one tag. The result is a tag that appears in the finished document unreplaced.

The same thing happens invisibly when a tag falls at the end of a line and Word wraps it, or when you paste a tag from another document that carried a hidden paragraph mark. Keep every tag on a single line, and if a tag seems to have stopped working after an edit, turn on Word’s paragraph marks (the ¶ button on the Home tab) and check that no paragraph break landed inside it.

To change a tag, select the whole thing including the braces and retype it in one pass

The reliable way to edit a tag is to select from the opening { through the closing } — braces included — and type the replacement in a single go. Do not click into the middle of a tag and edit a word or two.

Word records text as a series of runs, and clicking into the middle of a tag to edit it often leaves the tag split across several runs even though it looks continuous on screen. A tag split across runs may render fine, or it may fail — you can’t tell by looking. Selecting the entire tag and retyping it collapses it back into a single clean run. When in doubt, delete the tag completely and type it fresh rather than surgically editing it.

Symptoms of a malformed tag

A malformed tag can leave raw tags in the finished document or cause generation to fail. If you see either symptom after editing a template, check for stray braces, unpaired loop tags, and unsupported expressions. If you need help finding the problem, send ScopeStack support the template and the project you used to generate it.

Keep loop tags paired — deleting one half breaks generation

Loops and conditional sections come in pairs: an opening {#collection} and a matching closing {/collection}, with the repeating content between them.

{#services} {name} — {extended_hours} hours {/services}

The opening and closing paths must match exactly. An unbalanced pair can cause generation to fail. When you remove a looped section, remove both the {#...} and its {/...}, and when you rename the path, rename it in both places.

Give stacked loop and condition tags their own paragraphs

When a loop or condition tag is alone in its paragraph, ScopeStack removes that paragraph from the finished document. When two of these tags share a paragraph with nothing else on it, for example {#language_fields}{#slug=="customer"}, the paragraph stays and prints as a blank line, even though both tags work. The matching closing pair leaves a second blank line below the block.

To fix it, press Enter between the tags so each one starts its own paragraph, with nothing else on the line. Shift+Enter does not help, because it adds a line break inside the same paragraph. This applies only to tags on lines of their own. A loop written on the same line as the text it prints stays as the template shows it.

{#language_fields} {#slug=="customer"} {~~formatted_sentences} {/slug=="customer"} {/language_fields}

Smart quotes and Word’s run-splitting inside prose are harmless

Two things people worry about that are not a problem in tag templates:

  • Smart (curly) quotes in body text. Word’s autocorrect turning " into " " in your ordinary document prose does not affect tags. (The one exception is a curly quote inside a tag’s equality check, e.g. {#state=="Massachusetts"} — there the quote must stay straight. But that is about the character inside the tag, not the prose around it.)
  • Word splitting your paragraph text into runs. Word constantly re-chunks text into runs as you type and format; for ordinary template text this is invisible and harmless. It only matters inside a tag, which is why the fix above is to select and retype the whole tag rather than to worry about runs everywhere.

Quick checklist before you re-upload an edited template

  • Every tag sits on one line, with no paragraph break inside it.
  • Every tag you changed was selected brace-to-brace and retyped, not edited in place.
  • Every {#...} has a matching {/...} with the identical path.
  • If the last generated document showed raw tags, contact support to check the template against live merge data and locate the broken tag before assuming the data is at fault.

New to ScopeStack?

ScopeStack automates scoping, pricing, and SOW generation for IT services teams. See how it fits your process.

Book a demoBrowse the docs
Last updated on