Add Wikipedia app - #67
Conversation
|
@HarshBhatia Thanks for contributing, happy to merge this. Do you have a Kobo which you have run this on? It would be great to see how it looks. |
|
@abhishek-anand Yes I have a Kobo Libra Color, here is the app running on it: |
|
@HarshBhatia thanks! Looks cool, please rebase and two fixes: minimum_cobalt_version is now 0.3.1 (the app protocol is updated to 11), and we have a web app store pages for each app, generate-app-pages.mjs crashes with missing screenshot metadata for this, so it needs screenshot and the mapping. For an example please check this PR for an app #74 and we can merge. |
Search Wikipedia's own action=query API from an on-panel keyboard, or skip straight to a random main-namespace article. Results paginate like the rss/hn examples, and the article body is fetched as plain text (explaintext=1) and paginated for the reading screen. Registers the app in the Store catalog and workspace.
Fetches the extract as HTML instead of explaintext=1, since plain text throws away the one thing that told a section title apart from the paragraph under it. A small scanner splits the extract into headings and paragraphs on <h2>/<h3>/<p>, using kobo_html::to_text to clean up inline markup and entities within each block. Rendering real headings needed a place for them to draw larger than body text inside paginated prose, so this adds QuoteRole::Heading to the shared UI engine (kobo-ui), its wire encoding (kobo-protocol), and Context::paginate_tagged_reading (kobo-sdk) to measure them correctly against the reading face. Also fixes search-result snippets and paragraph text showing literal &BandarLabs#39; and other entities: both now go through kobo_html::to_text instead of a hand-rolled, incomplete entity list. Confirmed on real hardware (Kobo Libra Colour): headings now stand out from body text, and apostrophes render correctly.
Bumps minimum_cobalt_version to 0.3.1, the current release, and registers the app with the site generator (screenshot mapping, docs/apps/wiki/index.html, a homepage card, and a sitemap entry), matching how every other Store app is published. The screenshot is a clean capture from the Clara BW simulator profile (kobo drive --ideal) showing an article with two section headings, the feature this app's other commit added.
9ff3921 to
67f899e
Compare
|
Thanks for the review! Rebased onto main and pushed both fixes:
Verified: Also happy to run this on a Kobo again if useful — this branch has been tested end-to-end on a real Libra Colour (search, random article, pagination, headings). |



Summary
kobo-wiki: search Wikipedia from an on-panel keyboard, or open a random main-namespace article, with no browser needed.action=queryAPI — no key, no rate-limit tier. Search results and the article's plain-text extract (explaintext=1) are paginated for the panel, following the same shape as therssandhnexamples.apps/catalog.json, added to the workspace members andSTORE_PACKAGESinkobo-cli.Test plan
cargo test -p kobo-wiki(10 unit tests covering URL building, JSON parsing, and malformed-answer handling)cargo test -p kobo-cli(204 tests, includingchecked_in_registry_contains_every_store_application)cargo fmt --all --checkcargo clippy -p kobo-wiki --all-targets --all-features -- -D warningscargo check --workspace --all-featureskobo dev) against the live Wikipedia API: typed a search, opened a result, confirmed the real article text loaded and paginated correctly (34 pages for a long article), and Random correctly skips straight to an article.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ps4WcGHVxjRU4uz8urehe1
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.