Preformatted inline text: [tt] fails (solved)

Started by Simon, October 07, 2024, 04:32:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Simon

Preformatted inline text with the "tt" tag worked in SMF 2.0, but fails in 2.1:

example

With preformatted text, I mean text in a fixed font that clearly disambiguates lowercase-L from uppercase-i or the digit one, uppercase-o from the digit zero, etc. That's common for code snippets and for command lines that I want others to run.

There is the "pre" tag, which typesets the text preformatted indeed, but it sets the preformatted text into its own
line,


and I don't want
that.



There is "font=Courier New", which works inline, but it has two disadvantages: It's unwieldy to type by hand, and it doesn't produce preformatted text independent of systems, because Courier New isn't necessarily installed everywhere. E.g., in Firefox on Linux, I get a serifed font from "font=Courier New". I want logical formatting, not a specific font.

(In the admin panel, I found a grab-bag of BBCode tags that one can activate or deactivate, and "tt" looks activated there already. I didn't see anything related there other than "tt" and "pre".)

How do I typeset preformatted inline text?

-- Simon

Mindless

You can provide a generic font name like [font=monospace]1Il0O[/font].  That doesn't help with other people using Courier New though.

namida

Huh, surprised I didn't notice that, I regularly use that tag for changelogs etc. Will look into it.

Interestingly, this only seems to affect new posts. Existing posts (pre-upgrade; example) that already contained the tag are fine.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

namida

I noticed tt is listed under "Legacy tags" in the admin panel. Clicking on the ? icon next to this brings up the following:

QuoteLegacy BBCodes are obsolete and cannot be used in new posts. However, they will be parsed in existing posts if enabled here.

Enabling legacy BBCodes is only useful if your forum was upgraded from a previous version of SMF.

Also, even when they are enabled, some legacy BBCodes will not be rendered in the same way that they once were. For example, the [flash] BBCode will simply show a link to the Flash content instead of embedding it.

The other code that is similar in purpose is [code], but that goes even further than [pre] and displays similarly to a quote.

On one hand, the easiest way to deal with this is probably just to figure out how SMF filters this out (I suspect it's likely little more than the tag not being whitelisted for new posts) and modify it to consider tt to be not legacy. On the other, this may mean that they intend to fully remove it in a later update, so perhaps a workaround like that isn't the best idea.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

#4
Thanks for digging!

Wow, that makes me wonder how the SMF authors want their users to format filenames, commands, ... Preformatting markup is the #1 feature for technical boards, where it's more important even than bold/italics (lovely to have but ultimately no showstopper), or than formatting hyperlinks (which could theoretically remain unclickable, but preformatted, thus copy-paste-able).

Yeah, if there is no canonical way, it warrants hacking it in.

In the meantime, I'll resort to the "pre" tag and accept the unwieldy typesetting. Thanks for fixing the "code" tag's CSS.

-- Simon

namida

There's an addon that restores full support, WYSIWYG editor included. I'll try that out and install it at some point.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Silken Healer

You can still acsess the raw BBCode, and preview it, like it is now, with that extention if you want, right? I don't like WYSIWYG editors.

namida

Quote from: Silken Healer on October 17, 2024, 04:20:06 PMYou can still acsess the raw BBCode, and preview it, like it is now, with that extention if you want, right? I don't like WYSIWYG editors.

An update that restores a tag is not likely to have a side effect of forcing everyone to use the currently-optional WYSIWYG editor.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Silken Healer


Simon

In the SMF support forum, Kindred (SMF 2.1 support guy) wants people to use "font=Courier New". It baffles me how that shall be the way forward in the eyes of the SMF designers. Users don't have that font necessarily. But I haven't studied the SMF support forum more to know about the designers' reasoning.

namida, feel free to install/hack whatever you'd like in October. E.g., RestoreTT, or that full post editor support that you found.

In November, if you haven't gotten around to do something yet, I'll hack the "tt" tag out of a single line in Load.php on the live server:

   $context['legacy_bbc'] = array(
      'acronym', 'bdo', 'black', 'blue', 'flash', 'ftp', 'glow',
      'green', 'move', 'red', 'shadow', 'tt', 'white',
   );

-- Simon

namida

I couldn't be bothered with it when I made the CSS fixes the other day, and since then, every other time I've been reminded about it has been while I'm at work or otherwise not able to do it. Your post broke that pattern and was seen just as I got home and was still awake and clear-headed enough to actually work on this, so the TeleTypeBBC addon has now been installed. An out-of-cycle backup of the site (to the usual place) is running as I post this, as (like all addons) some of its configuration is in the database, and would be lost if we had to rely on an older backup when restoring the site.

EDIT: Forgot to demonstrate it working. :P
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

#11
Wonderful, thanks!

-- Simon