JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Other
739 stars 157 forks source link

add ability to download AO3 workskin if scraping styles is enabled #967

Closed niacdoial closed 1 year ago

niacdoial commented 1 year ago

If the "keep_html_attrs" config parameter includes "style", add the workskin (for AO3 works that have one) to the ebook's stylesheet.

JimmXinu commented 1 year ago

I'd like a few changes before accepting this:

  1. This should be a new configuration switch such as use_workskin. Inclusion of style in keep_html_attrs shouldn't be the controlling element. If anything, an author using inline styles probably indicates they don't use workskin CSS.

    Search for use_view_full_work in fanficfare/configurable.py (in two places), fanficfare/defaults.ini, and calibre-plugin/plugin-defaults.ini for examples of what to add where.

  2. I'd appreciate comments in story.py and base_writer.py about extra_css that refer to the new setting.

  3. FFF is still back compatible to old versions of Calibre in python2. Please use from ..six import text_type as unicode and unicode instead of str for consistency.

niacdoial commented 1 year ago
  1. OK, I will do that. Should that new option be false by default ?
  2. OK.
  3. ... I feel like I should have thought of it myself, oh well.
JimmXinu commented 1 year ago
  1. Yes. Commented out and false is what we usually do. Thanks.
niacdoial commented 1 year ago

done! I also spotted while searching that AO3 was not the only site to use use_view_full_work

niacdoial commented 1 year ago

thanks!

JimmXinu commented 1 year ago

That pointed out to me that squidgeworld also shares all settings with AO3, so I made some more lists.

However, while testing this, it occurs that the CSS order should be workskin, then output_css setting so user can override workskin in personal.ini.

niacdoial commented 1 year ago

oh. well, I got a new commit out that fixes that, if you didn't do so on your side yet

chocolatechipcats commented 1 year ago

@niacdoial just wanted to thank you personally for letting me download a story that had tricky CSS that I couldn't get working manually!