Check out Symmetric Chess, our featured variant for March, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

How to Design and Post Your Own Game. A reference for those who want to post their own games here.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Wed, Nov 30, 2022 08:29 AM UTC in reply to Greg Strong from 01:46 AM:

I also use WYSIWYG mode for submitting comments. My only reason for using HTML is when I want to embed active elements (like Interactive Diagrams) in the submission. Links, images, pre-formatted text and such are all supported in WYSIWIG mode.

In general I find the indentation enforced by the CkEditor in HTML mode helpful. Apart from HTML it also appears to understand embedded JavaScript, and the nice layout prevents errors. I thought that ending 'solo tages" like IMG or BR with /> was actually the HTML 5 standard, so you can hardly blame the editor that it enforces that.

Only very rarely the mangling of whitespace by the Ck Editor backfires. One case was for posting Interactive Diagrams: the definition of those must be given as text within a HTML tag pair (like DIV or TD) which normally ignore leading whitespace in their content. So the Editor indented the definition line, while the original Diagram script expected the definition lines to be left-adjusted. So I had delete all leading whitespace from the Diagram definition before saving each time I edited a submission containing a Diagram. I quickly got tired of that, so I just had the routine in the Diagram script that parses the game definition strip the leading whitespce. (As well as trailing BR tags, which tend to appear there when you copy-paste from HTML Page Source.)

I think the only reason we are discussing this issue is that we now have identified a second (quite rare) case where the adding of leading whitespace backfires: text within TEXTAREA tags. Apparently this is a blind spot of the CkEditor: it does recognize PRE tags, and knows it should not mess with the layout there. But it appears to not do the same thing for TEXTAREA, while it should: this is another context where the text between tags should not be messed with.

While I see plenty of reasons why one could want to use pre-formatted text in submissions through PRE tags, I only see very few for TEXTAREA. The Play-Test Applet uses a TEXTAREA for pasting an existing Interactive Diagram into it (so you can convert it to GAME code, or get a table with verbal descriptions of the moves. But it starts out empty. But it appears that invoking Game Courier as a game viewer would be another application, and the first and only article I so far encountered that did this was Asylum Chess.

Logical solution would be: (1) Make Game Courier strip the leading whitespace the CkEditor added, so that it no longer matters (like I did for the Diagram). (2) Fix the Ck Editor so it treats TEXTAREA the same as PRE (not adding any whitespace). (3) Let the submission script delete leading whitespace only between TEXTAREA tags. This cannot be too hard. (4) Let the submission form test whether the page being edited contains TEXTAREA tags by itself, and only in that case suppress the use of the CkEditor. The text input fields of the form have the standard editing capabilities (which you have to rely on when JavaScript is switched off, as the CkEditor is a JavaScript program).