Skip to content

Add Wikipedia app - #67

Open
HarshBhatia wants to merge 3 commits into
BandarLabs:mainfrom
HarshBhatia:add-wikipedia-app
Open

Add Wikipedia app#67
HarshBhatia wants to merge 3 commits into
BandarLabs:mainfrom
HarshBhatia:add-wikipedia-app

Conversation

@HarshBhatia

@HarshBhatia HarshBhatia commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New Store app kobo-wiki: search Wikipedia from an on-panel keyboard, or open a random main-namespace article, with no browser needed.
  • Uses Wikipedia's own anonymous action=query API — 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 the rss and hn examples.
  • Registered in apps/catalog.json, added to the workspace members and STORE_PACKAGES in kobo-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, including checked_in_registry_contains_every_store_application)
  • cargo fmt --all --check
  • cargo clippy -p kobo-wiki --all-targets --all-features -- -D warnings
  • cargo check --workspace --all-features
  • Manually exercised in the browser simulator (kobo 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


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@abhishek-anand

Copy link
Copy Markdown
Contributor

@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.

@HarshBhatia

HarshBhatia commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

@abhishek-anand Yes I have a Kobo Libra Color, here is the app running on it:
wiki-kb-3
wiki-device-2
wiki-device

@abhishek-anand

Copy link
Copy Markdown
Contributor

@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.
@HarshBhatia

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Rebased onto main and pushed both fixes:

  • minimum_cobalt_version bumped to 0.3.1
  • Registered with the site generator following Add Zotero Reader to the App Store #74's pattern: tools/generate-app-pages.mjs screenshot mapping, docs/apps/wiki/index.html, a homepage card in docs/index.html, and a docs/sitemap.xml entry. The screenshot is a clean capture from the Clara BW simulator profile (kobo drive --ideal), showing an article with its section headings (the feature added in the other commit on this branch, in response to testing on a real Kobo).

Verified: node tools/generate-app-pages.mjs runs clean against a fresh git diff, cargo run -p kobo-cli -- app-check --registry apps/catalog.json verifies wiki, cargo test -p kobo-wiki (13) and cargo test -p kobo-cli (205) pass, cargo fmt --all --check and cargo clippy -p kobo-wiki --all-targets --all-features -- -D warnings are clean.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants