View Single Post
Old 03-30-2017, 05:54 PM   #1923
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,038
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
New alpha test version.

2017-03-30
- Add *_filelist INI feature.
- (internal change) Remove self.decode to defaults.ini.
- (internal change) Refactor to move fetches to Configuration class plus test version bump.
- Can't skip numChapters - adapter_trekfanfictionnet
- Remove defunct sites portkey.org and psychfic.com from defaults.ini
- Update translations.
- Bump test version.

This version does some significant refactoring, touched 100+ files and changed the way site encoding is handled. It's worked in my testing, but it is a bit more 'test' than usual. Which is why I'm attaching it here for bleeding-edge testers first rather than in the usual test post.

The big change is adding *_filelist to INI. This was requested by davidfor for output_css, but I've generalized.
  1. Instead of using output_css in personal.ini, you can put your CSS in a file and use output_css_filelist to pull it in automatically. But it will work for other settings as well.
  2. setting_name_filelist is a comma separated list of URLs. This includes http, https and file URLs. The contents of all URLs will be concatenated and used as one blob of text.
  3. If you use setting_name_filelist, setting_name values will be ignored; even if they appear in a more specific [section]. If you choose to use _filelist settings, you'll have to be a bit more careful than usual.
  4. add_to_setting_name_filelist works--you can add additional, more specific files to the filelist.
  5. While setting_name is ignored in favor of setting_name_filelist, add_to_setting_name is still applied, letting you still add text directly in personal.ini.
  6. When moving output_css from personal.in to a file or URL, be aware that percent(%) substitutions done by the INI parser are not done to content loaded via _filelist.
    Code:
    background_color: ffffff
    
    output_css:
     body { background-color: #%(background_color)s; }
    Needs to instead be:
    Code:
    body { background-color: #ffffff; }
  7. Similarly, where percentages in INI need to be escaped with %%, they should not be in _filelist files:
    Code:
     .full     {width: 100%%; }
    -- vs --
     .full     {width: 100%; }
  8. The plugin performs some syntax and safety checks on replace_metadata, custom_columns_settings and generate_cover_settings. These checks are not performed on _filelist loaded settings.
  9. The INI parser used on defaults.ini and personal.ini tends to remove leading and trailing whitespaces. Settings loaded using _filelist are not subject to that. I don't believe it will cause problems, but it's possible regexps may be effected.
Here's a short example using output_css:
Code:
[epub]
output_css_filelist:https://www.somesite.com/epub.css
# - or - 
output_css_filelist:file:///C:/Users/user/Desktop/FanFicFare/epub.css

add_to_output_css:
 .ADDED_epub { border: 1px solid black; padding: 2px; }

[defaults]
add_to_output_css:
 .ADDED_default { border: 1px solid black; padding: 2px; }

[test1.com]
add_to_output_css_filelist:,https://www.somesite.com/epub2.css

add_to_output_css:
 .ADDED_test1 { border: 1px solid black; padding: 2px; }
The final resulting CSS is:
Code:
#WEB1 { display: none; }
...
#WEB2 { display: none; }
...
.ADDED_default { border: 1px solid black; padding: 2px; }
.ADDED_test1 { border: 1px solid black; padding: 2px; }
.ADDED_epub { border: 1px solid black; padding: 2px; }

Last edited by JimmXinu; 04-05-2017 at 02:10 PM. Reason: Remove obsolete test versions - replaced by newer test or released version.
JimmXinu is offline   Reply With Quote