Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 03-07-2022, 07:11 PM   #1
jma1
Connoisseur
jma1 began at the beginning.
 
Posts: 85
Karma: 10
Join Date: Dec 2015
Device: Kindle
The Federalist Recipie repair

The current built-in recipe no longer works as the html class names have been changed. I find that there are now two different html codings being used, some articles use one and some use the other. In the attached revision to the built-in recipe file, I added classes to the keep_only_tags command that correspond to both of these two configurations (without removing the original classes) hence the command is lengthy. It seems to work well getting all of the article content with three exceptions that I do not know how to fix.

First, for some of the articles the main photo appears incorrectly at the end of the article in the mobi file. The source order of elements is title, byline, photo, photo caption, article body. Some articles appear this way in the output but some have the photo at the end. There are also some in-line photos and graphics and those appear properly in the output.

Second, the 'Share' list in the left-side box of the source article is back in the output file as a bullet list just before the article body and should be removed.

Third, the 'More Articles' buttons that appear below the source article appear as a second list in the output file after the article body and also should be removed.

Thanks in advance.
Attached Files
File Type: recipe The Federalist v4_1059.recipe (2.3 KB, 104 views)
jma1 is offline   Reply With Quote
Old 03-07-2022, 09:13 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,343
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...8caaa865195dc7
kovidgoyal is online now   Reply With Quote
Advert
Old 03-09-2022, 07:36 PM   #3
jma1
Connoisseur
jma1 began at the beginning.
 
Posts: 85
Karma: 10
Join Date: Dec 2015
Device: Kindle
Some articles missing lead photo and inline graphics, for example titled 'Propoganda Press.." and "We Knew Before...".
jma1 is offline   Reply With Quote
Old 03-10-2022, 01:57 PM   #4
jma1
Connoisseur
jma1 began at the beginning.
 
Posts: 85
Karma: 10
Join Date: Dec 2015
Device: Kindle
Added links to the example articles.

Some articles missing lead photo and inline graphics, for example titled Propoganda Press… and We Knew Before....
jma1 is offline   Reply With Quote
Old 03-11-2022, 10:14 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,343
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...a55adec8386e18
kovidgoyal is online now   Reply With Quote
Advert
Old 03-12-2022, 09:43 AM   #6
jma1
Connoisseur
jma1 began at the beginning.
 
Posts: 85
Karma: 10
Join Date: Dec 2015
Device: Kindle
Perfect - thanks.

As an aside, I often use the following to remove hyperlinks. Is there an easy way to format the affected text from which hyperlink was removed (perhaps with underlining) to leave a visible trace indicating that there is a link in the source document?

def postprocess_html(self, soup, first_fetch):
for a in soup.findAll('a', href=True):
del a['href']
return soup
jma1 is offline   Reply With Quote
Old 03-12-2022, 08:18 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,343
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
a['style'] = 'text-decoration: underline'
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Federalist recipie no longer works jma1 Recipes 2 10-22-2020 01:21 PM
Request for new recipie The Federalist jma1 Recipes 9 05-11-2018 12:37 PM
History U.S. Founders: The Federalist Papers (PDF) Last_of_the_PEs Other Books 0 05-25-2011 02:30 AM
Government Publius: The Federalist Papers. eReader. 30 Jan 2008 6charlong Other Books 1 01-30-2008 04:52 PM


All times are GMT -4. The time now is 01:28 AM.


MobileRead.com is a privately owned, operated and funded community.