Ticket #244 (accepted enhancement)

Opened 1 year ago

Last modified 1 year ago

PATCH: parameterizable wrapping of fuses in CFOUTPUT

Reported by: barneyb Owned by: scorfield
Type: enhancement Priority: normal
Milestone: Fusebox 5.6 Component: Extensions: Lexicons/Plugins
Version: Severity: normal
Keywords: Cc:

Description

For whitespace reasons, I don't want my fuses to be automatically wrapped in CFOUTPUT by the include verb. I've enclosed a patch below (against that source:/trunk@492) that uses a fusebox parameter named 'wrapIncludeInCfoutput' to control this behaviour.

Index: C:/JRun4/servers/cfusion/cfusion-ear/cfusion-war/gpsracr/fusebox/verbs/include.cfm
===================================================================
--- C:/JRun4/servers/cfusion/cfusion-ear/cfusion-war/gpsracr/fusebox/verbs/include.cfm	(revision 492)
+++ C:/JRun4/servers/cfusion/cfusion-ear/cfusion-war/gpsracr/fusebox/verbs/include.cfm	(working copy)
@@ -133,17 +133,24 @@
 		if (fb_.verbInfo.attributes.contentvariable is not "" and not fb_.verbInfo.attributes.overwrite) {
 			fb_appendLine('<cfif not isDefined("#fb_.verbInfo.attributes.contentvariable#")>');
 		}
+		if (NOT structKeyExists(fb_.app, "wrapIncludeInCfoutput") OR NOT isBoolean(fb_.app.wrapIncludeInCfoutput) OR fb_.app.wrapIncludeInCfoutput) {
+			fb_.openCfoutput = "<cfoutput>";
+			fb_.closeCfoutput = "</cfoutput>";
+		} else {
+			fb_.openCfoutput = "";
+			fb_.closeCfoutput = "";
+		}
 		fb_appendLine("<cftry>");
 		if (fb_.verbInfo.attributes.contentvariable is not "") {
 			if (fb_.verbInfo.attributes.append) {
-				fb_appendLine('<cfparam name="#fb_.verbInfo.attributes.contentvariable#" default=""><cfsavecontent variable="#fb_.verbInfo.attributes.contentvariable#"><cfoutput>###fb_.verbInfo.attributes.contentvariable###<cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#"></cfoutput></cfsavecontent>');
+				fb_appendLine('<cfparam name="#fb_.verbInfo.attributes.contentvariable#" default=""><cfsavecontent variable="#fb_.verbInfo.attributes.contentvariable#"><cfoutput>###fb_.verbInfo.attributes.contentvariable###</cfoutput>#fb_.openCfoutput#<cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#">#fb_.closeCfoutput#</cfsavecontent>');
 			} else if (fb_.verbInfo.attributes.prepend) {
-				fb_appendLine('<cfparam name="#fb_.verbInfo.attributes.contentvariable#" default=""><cfsavecontent variable="#fb_.verbInfo.attributes.contentvariable#"><cfoutput><cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#">###fb_.verbInfo.attributes.contentvariable###</cfoutput></cfsavecontent>');
+				fb_appendLine('<cfparam name="#fb_.verbInfo.attributes.contentvariable#" default=""><cfsavecontent variable="#fb_.verbInfo.attributes.contentvariable#">#fb_.openCfoutput#<cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#">#fb_.closeCfoutput#<cfoutput>###fb_.verbInfo.attributes.contentvariable###</cfoutput></cfsavecontent>');
 			} else {
-				fb_appendLine('<cfsavecontent variable="#fb_.verbInfo.attributes.contentvariable#"><cfoutput><cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#"></cfoutput></cfsavecontent>');
+				fb_appendLine('<cfsavecontent variable="#fb_.verbInfo.attributes.contentvariable#">#fb_.openCfoutput#<cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#">#fb_.closeCfoutput#</cfsavecontent>');
 			}
 		} else {
-			fb_appendLine('<cfoutput><cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#"></cfoutput>');
+			fb_appendLine('#fb_.openCfoutput#<cfinclude template="#fb_.verbInfo.action.getCircuit().getApplication().parseRootPath##fb_.targetCircuit.getRelativePath()##fb_.template#">#fb_.closeCfoutput#');
 		}
 		fb_appendLine('<cfcatch type="missingInclude"><cfif len(cfcatch.MissingFileName) gte #fb_.templateLen# and right(cfcatch.MissingFileName,#fb_.templateLen#) is "#fb_.template#">');
 		if (fb_.verbInfo.attributes.required) {

Attachments

Change History

Changed 1 year ago by barneyb

That source reference should be source:/framework/trunk@492, of course. I can't edit the ticket, so posting here. Apologies for that.

Changed 1 year ago by scorfield

  • milestone set to Fusebox 5.6

This seems very similar to some other tickets about output suppression that have been deferred to 5.6.

Changed 1 year ago by scorfield

  • owner changed from sean@corfield.org to scorfield
  • status changed from new to accepted

See also #244 for a similar request.

Note: See TracTickets for help on using tickets.