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
4 files changed
+33
-27
No files matched your search
@@ -96,7 +96,9 @@ def parse_steps(page, art_ids):
|
||||
end = screens[i + 1].start() if i + 1 < len(screens) else len(page)
|
||||
body = page[screen.end():end]
|
||||
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)
|
||||
if tag.group(1) == "br":
|
||||
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:
|
||||
continue
|
||||
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_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),
|
||||
|
||||
Reference in new issue
Block a user