- Add navbar with login/logout, search form, and Find Link branding
- Clean up index page: search-only, examples behind ?debug=1
- Improve article page: remove debug clutter, named Wikipedia links, collapsible candidates
- Add SVG favicon (🔗 emoji)
- Fix diff CSS: compact layout, auto table layout to eliminate wide marker column gap
- Catch TokenRequestDenied in OAuth start and show error page
- Store username in session at login; clear bad session on API failure
- Raise NoMatch when diff is empty (edit already applied)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Skip no-parameter templates (navboxes) and add annotated link,
excerpt, main, see to the list of skipped parameterised templates
- Preserve sentence-initial capitalisation when replacement is lowercase
- Skip matches that sit entirely inside an existing [[link]] destination
- Treat link destinations that start with q as more specific links to
preserve, in both find_link_in_chunk and find_link_and_section
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
parse_cite: extend to skip {{cite}}/{{citation}}, {{short description}},
{{gli}}, {{defn}}, external links [https://...], italic text ''...'',
and bullet-point lines containing bare URLs (unformatted bibliography
entries). Uses brace-counting to handle nested templates correctly.
parse_links: yield [[Category:...]] links as 'category' tokens so they
are never modified.
add_link: handle three new boundary cases where the match spans an
existing [[link]]:
- match ends exactly at the link boundary: replace the whole thing with
a single clean link (e.g. surface [[runoff (hydrology)|runoff]] →
[[surface runoff]])
- match starts right after [[: absorb the stray [[ (e.g.
[[anti-globalization]] movement → [[anti-globalization movement]])
- match starts partway inside a link: skip (would produce broken wikitext)
- match spans into but not through a link: use a piped prefix link
(e.g. cross-platform [[interchange station]] →
[[cross-platform interchange|cross-platform]] [[interchange station]])
Fallback search: mask [[Category:...]] spans with spaces so the pattern
cannot match inside them. Guard against matches that are part of a
longer named entity (title-case phrase followed by extra words then an
abbreviation in parentheses, e.g. "Anti-Globalization Movement of
Russia (AGMR)").
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mediawiki_oauth: set User-Agent on all OAuth1Session instances so
Wikimedia doesn't reject token and API requests with 403; add timeout
parameter to api_post_request (default 4s).
mediawiki_api: add APIError exception; wrap .json() in call() to raise
APIError with status code and response body on decode failure; raise
timeout to 30s for edit POSTs.
api: wrap call_get_diff .json() with the same JSONDecodeError guard,
raising MediawikiError with HTTP status and body on failure.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Set User-Agent on OAuth1Session during token fetch and access token
exchange so Wikimedia doesn't reject the requests with 403
- Extract handle_post() from article_page() for clarity
- Catch api.MediawikiError in get_best_hit() to skip bad API responses
rather than crashing the page
- Catch mediawiki_api.APIError on save and return a 502 with the error
text instead of a 500 traceback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>