foundeo / toscript

Converts Tag based CFML to CFML Script
GNU General Public License v3.0
20 stars 9 forks source link

Fix nested cfoutput #19

Closed adamcameron closed 7 years ago

adamcameron commented 7 years ago

Input (from the Adobe docs):

<!--- Upload video --->
<cfhttp url="#youTubeUploadURL#" result="result" method="POST" timeout="450" multipartType="related"> 
<cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#authdata.auth#"> 
<cfhttpparam type="header" name="X-GData-Client" value="#variables.clientkey#"> 
<cfhttpparam type="header" name="X-GData-Key" value="key=#variables.devkey#"> 
<cfhttpparam type="header" name="Slug" value="#videoFileName#"> 
<!---<CFHTTPPARAM type="HEADER" name="Connection" value="Keep-Alive"> --->
<!--- Send 2 files --->
<cfhttpparam type="file" name="API_XML_Request" file="#tmpfile#"
mimetype="application/atom+xml"> 
<cfhttpparam type="file" name="file" file="#videoName#" mimetype="video/*"> 
</cfhttp>

Output:

//  Upload video 
cfhttp( url=youTubeUploadURL, multipartType="related", timeout=450, result="result", method="POST" );
cfhttpparam( name="Authorization", type="header", value="#authdata.auth#"" );
cfhttpparam( name="X-GData-Client", type="header", value=variables.clientkey );
cfhttpparam( name="X-GData-Key", type="header", value="#variables.devkey#"" );
cfhttpparam( name="Slug", type="header", value=videoFileName );
// <CFHTTPPARAM type="HEADER" name="Connection" value="Keep-Alive"> 
//  Send 2 files 
cfhttpparam( file=tmpfile, name="API_XML_Request", type="file", mimetype="application/atom+xml" );
cfhttpparam( file=videoName, name="file", type="file", mimetype="video/*" );

Obvs. should use a block construct when there are nested tags here.

adamcameron commented 7 years ago

Grouped cfoutput has same issue, just FYI. It might be a good edge-case to test your solution with:

<cfset q = queryNew("c1,c2", "varchar,varchar", [
    ["A", "1"],
    ["B", "2"],
    ["B", "22"],
    ["C", "3"],
    ["C", "33"],
    ["C", "333"]
])>

<cfoutput query="q" group="c1">
    <h2>#c1#</h2>
    <ul>
    <cfoutput>
        <li>#c2#</li>
    </cfoutput>
    </ul>
</cfoutput>
pfreitag commented 7 years ago

reopening because still need to fix nested cfoutput

adamcameron commented 7 years ago

Sorry dude. I just presumed it was another example of the same glitch. Woulda raised another ticket had I realised they were different issues.

pfreitag commented 7 years ago

no prob