Page 1 of 1

Formatting bug/improvement

Posted: Mon Sep 22, 2025 12:13 pm
by thedoctar
Many old posts are almost unreadable due to formatting issues.

E.g. I recently noted that when writing a[n], the [n] is not displayed correctly.

I guess the formatting for posts got changed, as when I first started I don't remember this issue, although it was a long time ago, so may I misremember.
I don't think [ i] and [n] should be used for formatting because it's used to denote arrays. Sometimes using plain text is nice rather than TeX.

Re: Formatting bug/improvement

Posted: Mon Sep 22, 2025 3:14 pm
by euler
Not sure why [n] is failing to display as it's not used for BBCode. Did you have an example post I could look at?

Regarding the italics issue. There is no easy solution. I wanted to ensure that parsing is done correctly. Before I made the mistake of accommodating poorly formatted posts and unclosed tags now fall foul of the changes. Obviously index notation was never meant to be part of an unclosed italics, but now things are being done properly it affects those posts.

I continue to trawl the threads and I rarely find any affected. Where I do find them most often it is part of code not placed on code tags, so I fix them by putting code tags in. Where it is pseudocode/algorithm descriptions (even more rare), I manually add the new [text] tag that neutralises and BBCode.

Re: Formatting bug/improvement

Posted: Tue Sep 23, 2025 12:54 pm
by thedoctar
This post fails to display T[n] correctly on both Firefox and Chrome on my Lubuntu 22.04 OS: https://projecteuler.net/post_id=27390

This post fails to display an up arrow correctly, but when I quote it it looks fine for some reason (that's how I know the weird HTML code for symbols is an up arrow): https://projecteuler.net/post_id=37235

This post uses the tag [equiv] which is not displayed as text or the ≡ symbol: https://projecteuler.net/post_id=42306

This post uses Z[j] where j = i to denote complex integers but is rendered as italics XD: https://projecteuler.net/post_id=171377

This one also has a funny HTML code that is supposed to be ≡: https://projecteuler.net/post_id=30818 and this one https://projecteuler.net/post_id=30765

This one uses the [ge] I presume it means greater than or equal to: https://projecteuler.net/post_id=33312

Re: Formatting bug/improvement

Posted: Tue Sep 23, 2025 6:27 pm
by euler
Thanks for taking the time to provide clear links. I'm currently working on a massive back end update, so it might be some time before I can properly process them. The bug in the first link you gave is an actual rendering issue which I will prioritise.

Re: Formatting bug/improvement

Posted: Wed Sep 24, 2025 6:13 pm
by euler
There were a number of old posts using legacy BBCode like [equiv], [le], [radic], and so on. I've done a global replace in the DB with the MathJax equivalents. However, these won't necessarily display until that thread is re-cached. But you can be assured that those posts are now fixed.

I've just uploaded a new version of the script that parses the posts. It took a radical change to some of the core elements to handle things like [n]. Due to this processing posts in a different way there may be unforeseen consequences, so please report anything that no longer works (that was working before the change today).

Regarding the issue with Z[ i ]. That is unfixable in a general sense as it is impossible to distinguish between when someone wants to use italics and someone wants to use i as an index without making the regex unnecessarily complex, and even then there would be too many edge cases. So the parser will now correctly interprets elements like that as an opening italic tag. Like HTML it doesn't need a closing tag, but if one is not found it adds it to the end of the post so that it doesn't flow into other posts.

However, these can be fixed on a post-by-post basis by wrapping text in a [text] tag. This will neutralise any BBCode found between it. I have fixed the post you referenced, but there are going to be others and I certainly don't want to be manually repairing all those old posts.

Re: Formatting bug/improvement

Posted: Thu Sep 25, 2025 3:01 pm
by thedoctar
Thanks for all the fixes! So quick too!
I personally think it's better to ignore open italics code without closing one, because italics are normally used sparingly, but what do I know!