Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add Wikipedia HTML ToC, View HTML & CSS tweaks #10769

Merged
merged 4 commits into from Aug 1, 2023

Conversation

poire-z
Copy link
Contributor

@poire-z poire-z commented Aug 1, 2023

Wikipedia EPUBs: re-add ToC in content

The ToC is no longer in the HTML we get from the Wikipedia API. So, add it ourselves.
Also, as we can't get anywhere the Wikipedia localized string for "Contents" (ie. "Sommaire" in French), use thick <HR> to mark the start and end of this ToC.
See #10746 (comment) and followups.

ViewHTML: fix content messed up when consecutive nbsp

Fix bug in replace_in_html() when consecutive matches, that could get parts of the content eaten and now shown.
Also ensure content after leading indentation is not wrapped on the next line.

util.prettifyCSS(): do better with more complex CSS

ie with unprettified:
image
image

Before | After:

image
image
image

(But as it is all regex stuff, and not proper CSS tokenization, it may still do bad things in some cases...)

[chore] replace utf8 bytes with Unicode escape sequence

Because it is better if we inprint in our brain while reading code that a right single quotation mark is U+2019, rather than its utf8 byte sequence is \xE2\x80\x99 !


This change is Reviewable

The ToC is no longer in the HTML we get from the
Wikipedia API. So, add it ourselves.
Also, as we can't get anywhere the Wikipedia localized
string for "Contents" (ie. "Sommaire" in French), use
thick <HR> to mark the start and end of this ToC.
Fix bug in replace_in_html() when consecutive
matches.
Also ensure content after leading indentation is not
wrapped on the next line.
@Frenzie Frenzie added this to the 2023.08 milestone Aug 1, 2023
@poire-z poire-z merged commit 626864f into koreader:master Aug 1, 2023
3 checks passed
@poire-z poire-z deleted the wiki_css_nutf8 branch August 1, 2023 23:29
Frenzie added a commit to Frenzie/koreader that referenced this pull request Aug 26, 2023
Frenzie added a commit that referenced this pull request Aug 26, 2023
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.

None yet

2 participants