resolveReferenceContent function
String
resolveReferenceContent({
- required String content,
- required String targetRelativePath,
- required String targetAbsolutePath,
- required ClayConfig config,
Applies the annotation and config transforms to content as if it lived
at targetRelativePath under targetAbsolutePath.
Transforms run in this order: line deletions → content replacements → remotions → replace blocks → insert blocks → Mustache tag unwrapping → spacing groups → partials.
Annotation markers use comment delimiters (/* */, # #, or <!-- -->)
with fixed keywords such as remove-start, with, and partial v.
See the annotation reference.
Binary extensions (.png, .webp) are returned unchanged.
Implementation
String resolveReferenceContent({
required String content,
required String targetRelativePath,
required String targetAbsolutePath,
required ClayConfig config,
}) {
if (shouldSkipContentTransforms(targetRelativePath)) {
return content;
}
return applyPartials(
content: applySpacingGroups(
content: applyMustacheTags(
content: applyInsertBlocks(
content: applyReplaceBlocks(
content: applyRemotions(
content: applyReplacements(
input: applyLineDeletions(
content: content,
filePath: targetRelativePath,
lineDeletions: config.lineDeletions,
),
replacements: config.replacements,
),
),
),
),
),
),
targetAbsolutePath: targetAbsolutePath,
);
}