Fix guide images, and the service class the timetable hides in an icon - #9
Merged
Conversation
The route card and the station board both have a badge for the service class, and it never appeared. w3.srbvoz.rs renders that column as `<img title="REGIO VOZ">` rather than text, so reading the cell's text gave an empty string and `if (connection.rank.isNotEmpty)` was never true. Cells now fall back to the titles of the images they contain, which also recovers the "Ponuda" column the parser had been dropping: travel classes, bicycle carriage, and whether a reservation is required. That reads under the badges on a route card, where it answers the question people actually open the timetable with. The live test asserts both columns arrive, since neither has a visible failure mode — they simply go quiet if the markup changes back.
The guide shipped 283 blurred smudges instead of photographs. srb.guide runs Hugo behind lazysizes: every image carries a blurred placeholder of a few hundred bytes in `src`, with the real file in `data-srcset` / `data-src`. The scraper read `src` first, so 257 of the 283 images were placeholders — the worst of them 20 pixels wide. The scraper now prefers the srcset, taking the widest variant a phone can use. That cap is 1280px: the site publishes up to 2268px, which is twelve times the bytes of the 480w for pixels no phone here has. On screen: - Tap an image to open it full screen. Pinch and double-tap were always there but invisible, so the viewer also has zoom buttons — four steps of 1.6x, with the last step out returning to the fitted size. A double-tap back to fitted resets the buttons with it. - Inline images are capped at half a screen. A portrait screenshot at full width pushed the rest of the article off the page. - Both the inline image and the viewer report a failed load rather than leaving a gap, and the viewer shows download progress. `assets/data/guide.json` is re-scraped with the fixed tool. Note that the app prefers the copy it downloads from GitHub over the bundled one, so the images only correct themselves for existing installs once this is on master.
Both were reported as "it does not work" and both turned out to be columns of someone else's markup being read the wrong way, which is worth writing down where the next person will look.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things reported as "it doesn't work", both of which turned out to be a
column of someone else's markup being read the wrong way.
Guide images were placeholders
srb.guide runs Hugo behind lazysizes. Every image looks like this:
The scraper read
src, so 257 of the guide's 283 images were blurred stubsof a few hundred bytes — the worst 20 pixels wide. It now prefers
data-srcsetand takes the widest variant a phone can use, capped at 1280px: the 2268px
original is twelve times the bytes of the 480w for pixels no phone here has.
assets/data/guide.jsonis re-scraped with the fixed tool; a sample of tenimages went from ~460 bytes to 10–95 KB.
On screen:
there but invisible, so the viewer has zoom buttons too — four steps of 1.6x,
the last step out returning to the fitted size, and a double-tap back to
fitted resets the buttons with it.
width used to push the rest of the article off the page.
a gap, and the viewer shows download progress.
Note for after the merge: the app prefers the guide it downloads from GitHub
over the bundled copy, so existing installs correct themselves within a day of
this landing on
master(or immediately via Settings → check now).The class of train never showed
The route card and the station board each have a badge for the service class,
and it was always absent. The timetable renders that column as
<img title="REGIO VOZ">, not text, so the cell's text was empty and the badgewas never built. Cells now fall back to the titles of the images they contain,
which also recovers the
Ponudacolumn the parser had been dropping — travelclasses, bicycle carriage, and whether a reservation is required. That reads
under the badges on a route card:
Verification
flutter analyzeclean; 89 tests pass, including 8 new ones for the srcsetpicker
neither has a visible failure mode — they just go quiet if the markup changes
tap opens the viewer, the zoom buttons step in and back to fitted, and
Beograd Centar → Niš shows four runs with their class and offer