custom-content-shortcode icon indicating copy to clipboard operation
custom-content-shortcode copied to clipboard

shortcode outputs extra whitespace - breaks html minifiers

Open codemonkeynorth opened this issue 5 years ago • 0 comments

shortcode outputs extra whitespace for every line.

It would be useful if extra line breaks/double space etc between shortcode tags was removed from output

if i have a CCS like this:

[if check={COURSE_TYPE} value="new"][set type]new[/set][else][set type][/set][/if]
£[format decimals=0 point=. thousands=,]
[if check={TYPE} value="new"]
[global][data key="course-information-new" field="total_fees"][/global]
[else]
[global][data key="course-information" field="total_fees"][/global]
[/if]
[/format]
[/pass]

all of those lines create whitespace around the output

normally it's not a problem but when run through an HTML compressor on a line like this it'll end up stripping white space between words because of the extra whitespace from the shortcode

New Courses: [my_shortcode] Fees

will come out something like this after compression

New Courses:£1,000Fees

since the uncompressed HTML is actually something like

New Courses


£1,000


Fees

essentially I'd have to write it like this... [if check={COURSE_TYPE} value="new"][set type]new[/set][else][set type][/set][/if]£[format decimals=0 point=. thousands=,][if check={TYPE} value="new"][global][data key="course-information-new" field="total_fees"][/global][else][global][data key="course-information" field="total_fees"][/global][/if][/format][/pass] ...which is hard to read

thanks J

codemonkeynorth avatar Jul 01 '20 20:07 codemonkeynorth