[closed] Whitespace from Skin:BuildLink

I’ve made a change on GitHub but before I submit a pull request, I just thought I’d make sure I’m using the tag correctly.

My setup is FarCry 7.0.6 on Lucee with smart white space management enabled. Each sample below is inside a <cfsetting enablecfoutputonly="yes">.

If I use My <skin:buildLink alias="home">Home Page</skin:buildLink>., I get <a href="/"></a> output in code and nothing visually.

If I use <cfoutput>My <skin:buildLink alias="home">Home Page</skin:buildLink>.</cfoutput>, I get the following in code:

<a href="/">Home Page</a>

And visually this comes out as My Home Page .

The only difference when using the linktext attribute is that Home Page gets output in the first example.

With my change from the commit below, the new lines are removed and the space between the link and the full stop goes away.


Before I submit a pull request, am I doing anything wrong?

Typically I would do:

<skin:buildlink alias="home"><cfoutput>Home Page</cfoutput></skin:buildlink>

which should work around your issue. By wrapping the entire tag in cfoutput you’re telling CF to ignore your cfsetting directive and output everything.

But that would turn my example into:

<cfoutput>My </cfoutput><skin:buildLink alias="home"><cfoutput>Home Page</cfoutput></skin:buildLink><cfoutput>.</cfoutput>

Is it just me or is that a little ridiculous?

The whole point of my change is that the extra cfoutput would not be needed. And I didn’t add the cfsilent - that was already in buildLink. I just removed some whitespace.

I didn’t review your pull request. Having now done so it seems like a fine change to me. ridiculous? yes, but if you have issues with whitespace then sometimes its the only option.

Another thing you can do is dump the custom tag and just use the underlying UDF:

<cfoutput>my <a href="#application.fapi.getLink(alias = 'home')#">Home Page</a>.</cfoutput>
1 Like

Happy to accept this as a pull request :slight_smile:

Sorry - got a bit distracted :innocent: