Question, how do I force page breaks in news recipes? I tried adding:
extra_css = .chapter { page-break-before: always } but I think Calibre is overriding it by adding:
style="page-break-before:avoid;page-break-after:avoid" to every
<div class="chapter"> entry.
I also tried adding:
<span style="page-break-before: always"></span> before
<div class="chapter"> to the print version but it looks like those lines are just being stripped away. Pretty sure this is a news specific behavior since using the command line html2epub on the individual print version gives me a really nice epub with page breaks.
Code:
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2009, tifa1984'
'''
www.fanfiction.net
'''
import string, re
from calibre.web.feeds.news import BasicNewsRecipe
class FFNetFeed(BasicNewsRecipe):
title = u'FFNetFeed'
__author__ = 'FanFiction.Net'
description = 'unleash your imagination'
oldest_article = 7
extra_css = .chapter { page-break-before: always }
feeds = [
('Rurouni Kenshin - Kaoru/Kenshin', 'http://www.fanfiction.net/atom/l/355/10/0/1/1/0/410/411/0/0/')
]
def print_version(self, url):
main, sep, rest = url.rpartition('/1/')
rmain, rsep, storyid = main.rpartition('/s/')
return 'http://localhost/flag/print.php?source=ffnet&format=news&storyid=' + storyid
I'm attaching the PHP scripts I used for generating the print version along with some sample HTML output. I'm trying to convert the algorithm to a Calibre recipe but alas, it's taking me a long time to do so.
Dependencies:
php5-cli
php5-curl
php5-tidy