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

View HTML: adds Prettify button to CSS viewer, other fixes #4282

merged 4 commits into from Oct 23, 2018


None yet
3 participants

poire-z commented Oct 22, 2018

  • Cleanup onSetStatusLine()
  • ReaderDictionary:dismissLookupInfo(): avoid forceRePaint()
  • View HTML: adds Prettify button to CSS viewer

Details in the commit messages.

The CSS Prettify turns this:



poire-z added some commits Oct 22, 2018

Cleanup onSetStatusLine()
Follow up to fa0117b (#4268), to make things a bit clearer:
Only ReaderRolling get the 'SetStatusLine' event, and tells
crengine about the change, and then send the 'UpdatePos' event.
ReaderFooter now just gets a :setVisible() method.

Now, all the code that calls a self.ui.document:set* method, that
most probably triggers a full re-rendering by crengine, do signal
'UpdatePos' immediately after. This event signals that all page
number, pages count, positions... are no more valid and must be
queried or computed again.
This could also be used if we ever want to cache Page Links or
Screen Boxes: this event will have us dropped these caches.
ReaderDictionary:dismissLookupInfo(): avoid forceRePaint()
Avoid forceRePaint() (and showing the full page without any
widget) between closing the "Looking up..." info message and
displaying the Dictionary result window, as it's not really
needed (I must have added it for symmetry with
ReaderDictionary:showLookupInfo() where it is needed.)
This avoids some occasional refresh competition glitches.

Also trim spaces at start or end of selection (can't hurt),
and replaced ugly string.gsub(text) with text:gsub().
View HTML: adds Prettify button to CSS viewer
Quick and non-full-proof prettification, but quite good
and enough to make unreadable/minified CSS files readable
for Style tweaks cooking.

@poire-z poire-z force-pushed the poire-z:various_fixes branch from 809cee6 to e28e5c8 Oct 22, 2018

@poire-z poire-z merged commit dc4f188 into koreader:master Oct 23, 2018

1 check passed

ci/circleci Your tests passed on CircleCI!

@poire-z poire-z deleted the poire-z:various_fixes branch Oct 23, 2018


This comment has been minimized.

KenMaltby commented Oct 23, 2018

Is there a reason for the style sheet to be displayed "UnPretty"/ without the formatting? The addition of "Tweaks" may provide users with an introduction/interest in CSS, and the formatting should help make gaining a proper understanding easier.


This comment has been minimized.


Frenzie commented Oct 23, 2018

It looks like it might mess things up in some cases.


This comment has been minimized.


poire-z commented Oct 23, 2018

Is there a reason for the style sheet to be displayed "UnPretty"/ without the formatting?

Mostly because I like to see the original state of things (and what's fed to crengine): the original CSS content of the book may be minified and unreadable in some books, but it may as well already be pretty in other books, with some other defaults for spacing, indentation, some comments, multiple line feeds to separate sections...

And because the prettification is a bit quick and rough (a few regexps, no real css grammar rules), and it may mess with the original CSS code (I hope not, but for example, any comma in a comment will make a new line, so /* Deal with paragraphs, lists, tables */ will make 3 lines once prettified.

And there are some "choices" I made in the prettification that help reading some CSS, but that does not look super nice in others.
Eg, our original Wikipedia EPUB CSS looks like:
But once prettified:

So, it's more like an alternative view :)

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