diff --git a/src/python/jw/pkg/cmds/projects/lib/templates.py b/src/python/jw/pkg/cmds/projects/lib/templates.py index bc9bf23c..ad55af2f 100644 --- a/src/python/jw/pkg/cmds/projects/lib/templates.py +++ b/src/python/jw/pkg/cmds/projects/lib/templates.py @@ -1,3 +1,4 @@ +import re import textwrap from typing import Any, Iterable, TypeAlias, TypeGuard @@ -95,12 +96,17 @@ def format_list_dict( parts = template.splitlines(keepends = True) for line in parts: - for key, value in fmt_dict.items(): - marker = '{' + key + '}' - if marker in line: - indent = line[:line.index(marker)] - value = str(value).replace('\n', '\n' + indent) - line = line.replace(marker, value) + for key, val in fmt_dict.items(): + # -- A marker preceded by '$' or '{' is literal text rather + # than a placeholder, so that e.g. ${prefix} survives as a + # pkg-config variable reference + rx = re.compile(r'(?