Public Access
Add Still Alive photo; keep spaces between split lyric pieces
The source page splits some lines into several spans; a browser renders the
whitespace between them as a space, which the importer dropped ("becausewe").
It now adds that space. Regenerated imported.h.
Add a photo of the demo on the panel to the README.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7e738b951b
commit
410885de24
3 files changed
+7
-1
No files matched your search
@@ -91,6 +91,8 @@ pio device monitor
|
|||||||
|
|
||||||
## Still Alive demo
|
## Still Alive demo
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
A recreation of Portal's ending: timed song text typed into a console on the
|
A recreation of Portal's ending: timed song text typed into a console on the
|
||||||
left, credits scrolling top right, ASCII art bottom right. The text, timing, art
|
left, credits scrolling top right, ASCII art bottom right. The text, timing, art
|
||||||
and credits in `src/still_alive/imported.h` come from
|
and credits in `src/still_alive/imported.h` come from
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
@@ -96,7 +96,9 @@ def parse_steps(page, art_ids):
|
|||||||
end = screens[i + 1].start() if i + 1 < len(screens) else len(page)
|
end = screens[i + 1].start() if i + 1 < len(screens) else len(page)
|
||||||
body = page[screen.end():end]
|
body = page[screen.end():end]
|
||||||
steps.append((base, len(steps), 0, "STEP_CLEAR", "ART_KEEP", ""))
|
steps.append((base, len(steps), 0, "STEP_CLEAR", "ART_KEEP", ""))
|
||||||
for tag in re.finditer(r"<(span|br)\b[^>]*>", body):
|
# Group 2 is the whitespace after the element: a browser renders it as one
|
||||||
|
# space between spans on the same line ("because" + "we can").
|
||||||
|
for tag in re.finditer(r"<(span|br)\b[^>]*>(?:</span>)?(\s*)", body):
|
||||||
t = tag.group(0)
|
t = tag.group(0)
|
||||||
if tag.group(1) == "br":
|
if tag.group(1) == "br":
|
||||||
offset = attr(t, "data-show-offset")
|
offset = attr(t, "data-show-offset")
|
||||||
@@ -107,6 +109,8 @@ def parse_steps(page, art_ids):
|
|||||||
if text is None or attr(t, "data-start") is None:
|
if text is None or attr(t, "data-start") is None:
|
||||||
continue
|
continue
|
||||||
flags = "STEP_NEWLINE" if attr(t, "data-append-br") == "true" else "0"
|
flags = "STEP_NEWLINE" if attr(t, "data-append-br") == "true" else "0"
|
||||||
|
if flags == "0" and tag.group(2) and not text.endswith(" "):
|
||||||
|
text += " "
|
||||||
art = attr(t, "data-asciiart")
|
art = attr(t, "data-asciiart")
|
||||||
art_id = "ART_KEEP" if art is None else ("ART_NONE" if art == "clear" else str(art_ids.get(art, 0)))
|
art_id = "ART_KEEP" if art is None else ("ART_NONE" if art == "clear" else str(art_ids.get(art, 0)))
|
||||||
steps.append((base + int(attr(t, "data-start")), len(steps),
|
steps.append((base + int(attr(t, "data-start")), len(steps),
|
||||||
|
|||||||
Reference in new issue
Block a user