You can sign up to get a daily email of our articles, see the Mailing List page!
Support us on Patreon to keep GamingOnLinux alive. This ensures we have no timed articles and no paywalls. Just good, fresh content! Alternatively, you can donate through Paypal, Flattr and Liberapay.!
Code tag ignoring whitespace
stretch611 commented on 20 November 2018 at 3:24 am UTC

I noticed this while posting this comment:

https://www.gamingonlinux.com/articles/surviving-mars-space-race-expansion-and-gagarin-free-update-have-released-working-well-on-linux.12977/comment_id=140815

I used the code tag for formatting... In preview, this allowed me to not ignore whitespace and all the numbers lines up. But when posted it started to ignore white space. So you probably have a difference in your stylesheets or a missing PRE tag in HTML.

liamdawe commented on 20 November 2018 at 10:45 am UTC

Your right, the we use the HTML code tag which isn't really all that great. Can probably achieve a better result with the pre tag since it automatically preserves whitespace with the same styling we use now. Will look into it.

stretch611 commented on 20 November 2018 at 2:38 pm UTC

Ok, so I figured why was I complaining and having you look at the code... After all it is HTML and I have all the display code here in my browser.

It appears as if the html/css formatting is not the problem here. The tags in both places appear to have the same markup and css structure.

The problem actually appears to be when you generate the HTML. When you "view source" on the article/comment page, the extra whitespace is stripped out completely. It does not show the whitespace because the page generating the HTML removes it.

However, the whitespace still exists in the database (or whatever method you use to store comments.) This is evident because if I go back and attempt to edit my comment, the whitespace still appears inside the textarea.

So in order to fix the problem, you need to determine where the whitespace is being stripped out. Most likely it is being done as a page directive when generating the whole page, or, it is probably being done when sanitizing the comment for output. (i.e. most likely where you strip harmful html tags from the posted comment.)

Of course to figure this out would require access to the actual server side source code used for the website which I don't have access too... (and you don't want to see my bill for this either )

Due to spam you need to Register and Login to comment.


Or login with...

Livestreams & Videos
Community Livestreams
See more!
Popular this week
View by Category
Contact
Latest Comments
Latest Forum Posts