Commit 6f938d50 authored by Corey Jepperson's avatar Corey Jepperson

childMap in q

parent ee9e0eb4
......@@ -296,7 +296,6 @@ module.exports = function restubFromBlQuery(params, cb){
allNewNodes.push({name:_path.join(curTargetPath, "bl:autoStubbed"), value: sourcePath})
}
var templateContentResult = !slingTemplateContent ? templateContent({resourceType, targetPath: sourceMapping ? sourcePath : _path.join(targetPath, curTargetPath), prefix: curTargetPath + jcrContentNode, forceChildMap: querySpecification.childMap}) : '';
if(_.isArray(templateContentResult)){
allNewNodes = allNewNodes.concat(templateContentResult);
......
......@@ -16,9 +16,9 @@ module.exports = function templateContent(options){
var result={"sling:resourceType":resourceType};
var template = null;
if(options.forceChildMap){
result["bl:map"] = options.forceChildMap;
template = { "bl:map": options.forceChildMap };
}else{
var blMap = component.getComponentInheritSettings();
......@@ -42,22 +42,26 @@ module.exports = function templateContent(options){
var pathRegex = [];
_.each(blMap.exclude, (path)=>{
var parts=path.split("/");
parts.pop();
while(parts.length){
pathRegex.push( `^${prefixWithSlash}${parts.join("/")}/sling:resourceType` )
if (blMap) {
_.each(blMap.exclude, (path)=>{
var parts=path.split("/");
parts.pop();
}
pathRegex.push(`^${prefixWithSlash}${path}($|/)`);
});
while(parts.length){
pathRegex.push( `^${prefixWithSlash}${parts.join("/")}/sling:resourceType` )
parts.pop();
}
pathRegex.push(`^${prefixWithSlash}${path}($|/)`);
});
}
pathRegex = pathRegex.join("|") + (pathRegex.length?"|":"") + "(^|/)bl:map/";
pathRegex = new RegExp(pathRegex);
var flattenedTemplate = flatten(component.template, {prefix});
if (template) {
Object.assign(flattenedTemplate, flatten(template, {prefix}));
}
// TODO: How to get the parsys bl:dont-merge setting written to the REPO?
// answer: the correct moment to write the parsys meta-setting to the repo is at "child component add" time.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment