Skip to content

Commit

Permalink
attempt fix parsing errors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grantcopley committed Sep 29, 2024
1 parent fc64565 commit 6f65d44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
15 changes: 7 additions & 8 deletions models/CBWIREController.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,13 @@ component singleton {
if( structKeyExists( variables, "preprocessors" ) ){
return variables.preprocessors;
}
// Scan the folder 'preprocessor' for all CFCs and return an array
local.files = directoryList(
path=getDirectoryFromPath(getCurrentTemplatePath()) & "preprocessor",
recurse=false,
listInfo="name",
filter="*.cfc",
type="file"
);
// List of preprocesssors here. Had to hard code instead of using
// directoryList because of filesystem differences in various OSes
local.files = [
"TemplatePreprocessor.cfc",
"CBWIREPreprocessor.cfc",
"TeleportPreprocessor.cfc"
]
// Map the files to their getInstance path
variables.preprocessors = local.files.map( ( _file ) => {
local.getInstancePath = replace( _file, ".cfc", "" ) & "@cbwire";
Expand Down
12 changes: 5 additions & 7 deletions models/preprocessor/TemplatePreprocessor.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ component {
* @return string
*/
function parseAssets( content, counter = 1 ) {
if ( counter == 1 ) {
content = replaceNoCase( content, "</cbwire:assets>", "</" & "cf" & "savecontent>", "all" );
arguments.content = replaceNoCase( arguments.content, "</cbwire:assets>", "</" & "cf" & "savecontent>", "one" );
arguments.content = replaceNoCase( arguments.content, "<cbwire:assets>", "<" & "cf" & "savecontent variable=""attributes.returnValues.assets#counter#"">", "one");
if ( findNoCase( "<cbwire:assets>", arguments.content ) ) {
arguments.content = parseAssets( arguments.content, arguments.counter + 1 );
}
content = replaceNoCase( content, "<cbwire:assets>", "<" & "cf" & "savecontent variable=""attributes.returnValues.assets#counter#"">", "one");
if ( findNoCase( "<cbwire:assets>", content ) ) {
content = parseAssets( content, counter + 1 );
}
return content;
return arguments.content;
}
}

0 comments on commit 6f65d44

Please sign in to comment.