Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

shortcode outputs extra whitespace – breaks html minifiers

$
0
0

Replies: 0

Hi,
anyone have a good solution for this please? it might be only fixable at plugin level
https://github.com/eliot-akira/custom-content-shortcode/issues/12

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 (double spaces etc)

so…

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


Viewing all articles
Browse latest Browse all 59525

Trending Articles