Adventure Game Studio

AGS Development => Site & Forum Reports => Topic started by: Snarky on Sat 08/10/2022 08:49:08

Title: Linebreaks disappear in code blocks in old posts
Post by: Snarky on Sat 08/10/2022 08:49:08
I happened to come across an old post (https://www.adventuregamestudio.co.uk/forums/index.php?msg=636575147) of mine, and noticed that the code samples are mangled, with everything appearing on a single line. By trying to edit the post I see that there are linebreaks in the text, but for some reason they are ignored when the post is parsed and displayed.
Title: Re: Linebreaks disappear in code blocks in old posts
Post by: Snarky on Sat 08/10/2022 08:53:04
Here's (https://www.adventuregamestudio.co.uk/forums/index.php?msg=636630123) another example, where one of the code blocks shows up fine and the other has the disappearing line breaks. (It also features some mangled Unicode characters.)
Title: Re: Linebreaks disappear in code blocks in old posts
Post by: AGA on Sun 09/10/2022 10:17:16
In your first example both code blocks show fine for me.  In the second one, it seems to work fine if it isn't wrapped in a hide tag.  I'd assume the code formatting plugin's parser doesn't recognise code blocks when they're nested inside another tag.
Title: Re: Linebreaks disappear in code blocks in old posts
Post by: Snarky on Sun 09/10/2022 17:38:05
Quote from: AGA on Sun 09/10/2022 10:17:16In your first example both code blocks show fine for me.

To be clear, they all show up as code-formatted, but for me the formatting inside the code block fails to recognize any of the line-breaks, rendering each one as one long line (most of which it thinks is commented out).

I see now that as you say, it applies specifically to code blocks wrapped inside spoiler tags. (But perhaps other tags as well?)
Title: Re: Linebreaks disappear in code blocks in old posts
Post by: AGA on Mon 10/10/2022 17:19:59
Yeah, when I said "show fine", I meant it rendered as you'd probably expect, linebreaks and all.  Only the hide example didn't.  All tags are handled programmatically, so I'd expect any nested tag will break:

Quote
Code (java) Select
System.out.print("Hello");
System.out.println("World");

EDIT: or not...  Perhaps it's just the code tag library JS specifically then!