MCPcopy
hub / github.com/pugjs/pug / applyIncludes

Function applyIncludes

packages/pug-linker/index.js:132–150  ·  view source on GitHub ↗
(ast, child)

Source from the content-addressed store, hash-verified

130}
131
132function applyIncludes(ast, child) {
133 return walk(
134 ast,
135 function before(node, replace) {
136 if (node.type === 'RawInclude') {
137 replace({type: 'Text', val: node.file.str.replace(/\r/g, '')});
138 }
139 },
140 function after(node, replace) {
141 if (node.type === 'Include') {
142 var childAST = link(node.file.ast);
143 if (childAST.hasExtends) {
144 childAST = removeBlocks(childAST);
145 }
146 replace(applyYield(childAST, node.block));
147 }
148 }
149 );
150}
151function removeBlocks(ast) {
152 return walk(ast, function(node, replace) {
153 if (node.type === 'NamedBlock') {

Callers 1

linkFunction · 0.85

Calls 4

replaceFunction · 0.85
linkFunction · 0.85
removeBlocksFunction · 0.85
applyYieldFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…