Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignores not working on this method #93

Open
lmajano opened this issue Nov 20, 2020 · 3 comments
Open

Ignores not working on this method #93

lmajano opened this issue Nov 20, 2020 · 3 comments

Comments

@lmajano
Copy link

lmajano commented Nov 20, 2020

Ignores not working on this method for some reason:

function processStackTrace( required str ){
		// cfformat-ignore-start

		// Not using encodeForHTML() as it is too destructive and ruins whitespace chars and other stuff
		arguments.str = HTMLEditFormat( arguments.str );
		// process functions e.g. $funcINDEX.runFunction(
		arguments.str = reReplaceNoCase( arguments.str, "\$([^(\(|\:)]+)(\:|\()", "<span class='method'>$\1</span>(", "ALL" );
		// process characters within parentheses e.g. (ServletAuthenticationCallHandler.java:57)
		arguments.str = reReplaceNoCase( arguments.str, "\(([^\)]+)\)", "<span class='highlight'>(\1)</span>", "ALL" );
		// process characters in brackets e.g. [hello world]
		arguments.str = reReplaceNoCase( arguments.str, "\[([^\]]+)\]", "<span class='highlight'>[\1]</span>", "ALL" );
		arguments.str = replace( arguments.str, chr( 13 ) & chr( 10 ), chr( 13 ) , 'all' );
		arguments.str = replace( arguments.str, chr( 10 ), chr( 13 ) , 'all' );
		arguments.str = replace( arguments.str, chr( 13 ), '<br>' , 'all' );
		arguments.str = replaceNoCase( arguments.str, chr(9), repeatString( "&nbsp;", 4 ), "all" );

		// cfformat-ignore-end

		return arguments.str;
	}

It still manages to manipulate to this:

function processStackTrace( required str ){
		// cfformat-ignore-start

		// Not using encodeForHTML() as it is too destructive and ruins whitespace chars and other stuff
		arguments.str = HTMLEditFormat( arguments.str );
		// process functions e.g. $funcINDEX.runFunction(
		arguments.str = reReplaceNoCase( arguments.str, "\$([^(\(|\:)]+)(\:|\()", "<span class='method'>$\1</span>
(", "ALL" );
		// process characters within parentheses e.g. (ServletAuthenticationCallHandler.java:57)
		arguments.str = reReplaceNoCase( arguments.str, "\(([^\)]+)\)", "<span class='highlight'>(\1)</span>
", "ALL" );
		// process characters in brackets e.g. [hello world]
		arguments.str = reReplaceNoCase( arguments.str, "\[([^\]]+)\]", "<span class='highlight'>[\1]</span>
", "ALL" );
		arguments.str = replace( arguments.str, chr( 13 ) & chr( 10 ), chr( 13 ) , 'all' );
		arguments.str = replace( arguments.str, chr( 10 ), chr( 13 ) , 'all' );
		arguments.str = replace( arguments.str, chr( 13 ), '<br>' , 'all' );
		arguments.str = replaceNoCase( arguments.str, chr(9), repeatString( "&nbsp;", 4 ), "all" );

		// cfformat-ignore-end

		return arguments.str;
	}
@jcberquist
Copy link
Owner

That is odd, in my testing I can't reproduce this. I went and found the original file in the ColdBox repo and used the .cfformat.json file there and tried formatting it, and it didn't produce any extra line breaks.

@lmajano
Copy link
Author

lmajano commented Nov 20, 2020 via email

@jcberquist
Copy link
Owner

@lmajano I think I finally might know what is going on here. I was just talking with @bdw429s about how cfformat handles UTF-8 files with a BOM, and I realized that cfformat, while preserving the BOM correctly, was not parsing such files correctly. I cloned the ColdBox repo and checked, and the source file in question has a BOM. This is hopefully fixed now in the latest version of cfformat (v0.15.14).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants