๐Ÿ“ LTV_manual.mdv4.6.5 · 2026-11-06

LTV BBCode โ€” Manual

Module: LTVBBC.php ยท Class: LTVBBCode ยท Version: 1.9.0 ยท Date: 01-11-2026 Package id: Egerszegi.ae_and_Claude.ai:LTV-bbcode Authors: Andrew.human (Architect / Project Manager), Claude.ai (Lead Programmer / Debugging), Gemini.ai (Consultant / Theming)

Written for humans and for machines/AIs: section 1 is a plain summary, section 8 is a compact fact sheet.


1. What it is

[ltv] is an SMF BBCode tag with two jobs:

Form Job
[ltv=inline]text[/ltv] Show the text between the tags, in full, in monospace in a themed card. BBCode between the tags ([b], [i], [color], [url], โ€ฆ) is rendered; smileys are off.
[ltv=autodisplay]x[/ltv] / [ltv=noautodisplay]x[/ltv] Per-post switch that auto-embeds the post's .txt / .text attachments in the same kind of card, via ISE_text_viewer.html, with BBCode rendered (v1.9.0; needs the Collaborative v6.5+ viewer).

The tag name [ltv] was used by an older, retired "Lightweight Text Viewer" mod (v1.0โ€“v2.7.1, archived as "LemonLib"). This is a different mechanism that reuses the name.

2. Requirements

3. Using [ltv=inline]

[ltv=inline]
anything you type here
keeps its indentation and line breaks
[/ltv]

Behaviour:

4. Using the autodisplay toggles

[ltv=autodisplay]x[/ltv]      turn on auto-embed of this post's .txt/.text attachments (default is off)
[ltv=noautodisplay]x[/ltv] turn it off (same as the default)

5. Install and uninstall

Install through the SMF Package Manager with ltv_bbcode_v<version>.zip.

Branch What the install does
2.0.x ltv_check_collabcore.php; copy LTVBBC.php to $sourcedir; ltv_register.php (registers LTVBBCode::integrate on integrate_bbc_codes and adds LTVBBC.php to integrate_pre_include); ltv_display_install_template.php (inserts the autodisplay call into Display.template.php).
2.1.x Same check and file copy; <hook> entries for integrate_bbc_codes and integrate_pre_parsebbc; same Display.template.php step.

Uninstall reverses each step (ltv_unregister.php / hook reverse, ltv_display_uninstall_template.php, remove LTVBBC.php). The Display.template.php step uses targeted matching so it removes only LTV's own block even if other mods inserted theirs at the same anchor.

ltv_display_patch.xml is a legacy reference and is not used by the install steps.

LTV_manual.md and CHANGELOG.md are reference files in the zip; the installer does not copy them to the forum.

6. Files in the package

File Purpose
LTVBBC.php The module: tag definition, inline renderer, autodisplay logic, card and theme code.
package-info.xml Package definition for 2.0.x and 2.1.x.
readme.txt Shown by the installer.
ltv_check_collabcore.php Install-time dependency check (CollabCore, RedBox).
ltv_register.php / ltv_unregister.php 2.0.x hook registration / removal.
ltv_display_install_template.php / ltv_display_uninstall_template.php Add / remove LTV's block in Display.template.php.
ltv_display_patch.xml Legacy, not referenced.
LTV_manual.md, CHANGELOG.md Documentation.

7. How inline works, and why (read before changing it)

The tag is registered as type unparsed_equals_content. SMF hands the validate callback $data[0] (the text between the tags) and $data[1] (the value after =); whatever is left in $data[0] is the output.

What arrives in $data[0]: the stored post body โ€” already entity-escaped (&lt;, &amp;, โ€ฆ), with newlines as <br> (<br /> on 2.0.x) and possibly &nbsp; for space runs.

What happens to the output afterwards (checked against SMF 2.1's parse_bbc(); 2.0.x source could not be fetched, so 2.0.x is assumed to match): the output is wrapped in newline markers, smileys are applied to the chunks between those markers, and a final "Cleanup whitespace" pass turns every "\n" into <br>, every double space into " &nbsp;", and every &#13; back into a real "\n". Consequences for anything this tag returns:

  1. No raw "\n" โ€” it would become <br> inside the card's CSS and JavaScript (breaking both) and would shift the smiley chunking so smileys fire inside the text. Line breaks are therefore written as &#13;.
  2. No two spaces in a row โ€” they would become &nbsp; inside the JavaScript (a syntax error). Card markup is collapsed to single spaces (flatten()); runs of spaces in the user's text are written as &#32;, which the browser shows as an ordinary space.
  3. The user's text goes in after the card is flattened (a placeholder token, INLINE_TOKEN, is swapped for it), because flatten() collapses whitespace.
  4. Raw < and > are escaped as a safety net, although SMF already escapes the body before it is stored.
  5. Each block carries its own CSS and JavaScript. parse_bbc() caches slow messages, so a cached post can appear in a different position on a different page; a block relying on another block's assets could end up with none. Cost: roughly the card's CSS/JS size per block (a few KB).

wrapCard() is shared with autodisplay and is deliberately untouched. Autodisplay is echoed by Display.template.php, not by parse_bbc(), so rules 1โ€“5 apply only to inline.

8. Fact sheet (for machines)

tag:              ltv
parser type: unparsed_equals_content (not 'parameters' โ€” fails to populate value on this fork)
values: inline | autodisplay | noautodisplay (case-insensitive, trimmed)
inline output: div.ltv-card > header + pre.ltv-inline ; BBC rendered via parse_bbc($text,false), smileys off ; no message id needed
inline limits: none on length ; lines wrap ; one leading + one trailing newline dropped
autodisplay: per message ; default off ; needs CollabMsgTracker::current() > 0
theme storage: localStorage "ise_ltv_theme" ; default theme "indigo"
version const: LTVBBCode::VERSION
version shown: banner "v<version>" in every card header
requires: CollabCore >= 2.0 (MsgTracker >= 1.0), RedBox >= 1.3
hooks 2.0.x: integrate_bbc_codes (+ integrate_pre_include for LTVBBC.php)
hooks 2.1.x: integrate_bbc_codes, integrate_pre_parsebbc
template patch: Display.template.php, anchor "if ($attachment['is_image']"

9. Known limits and unverified points

10. Test checklist for a new install

In a test post, using [ltv=inline]:

  1. Several lines with indentation and a blank line in the middle โ€” all preserved.
  2. A line containing [b]bold[/b] โ€” shows bold; [nobbc][b][/nobbc] shows literally.
  3. A URL becomes a link; :) and 8) stay text (no smiley image).
  4. <b>, & and quotes โ€” shown as typed.
  5. A very long line โ€” wraps.
  6. Two inline blocks in one post โ€” both render and the theme switcher works on both.
  7. Autodisplay on a post with a .txt attachment containing [b]bold[/b]: opens rendered (bold), the "Render BBCode" box is ticked, unticking shows the raw text, search still finds text in both modes.

11. Version history

See CHANGELOG.md. Current: 1.9.0 (01-11-2026) โ€” [ltv=autodisplay] renders BBCode via the viewer.