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 12-29-2019, 05:54 AM   #1
Argel
Opinionated [but right]
Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.Argel is no ebook tyro.
 
Argel's Avatar
 
Posts: 276
Karma: 1412
Join Date: Apr 2008
Location: UK
Device: Cybook Gen3, PRS 505, Kindle International, HTC Desire
remove-tags syntax

So I'm clearly getting something wrong. Every article in the London Review of Books ends with this:

*******

<div class="article-send-letter"><div class="inner"><h3><svg version="1.1" class="letters-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18 18" xml:space="preserve"><g class="pencil" transform="translate(7.301175, 0.000000)"><polygon fill="#494746" points="7.8,5 5.7,2.9 -0.8,9.4 1.3,11.5"></polygon><path fill="#494746" d="M7.6,1.1L6.5,2.1l2.1,2.1l1.1-1.1c0.6-0.6,0.6-1.6,0-2.1C9.1,0.4,8.2,0.4,7.6,1.1z"></path><polygon fill="#494746" points="-3,13.7 0.6,12.2 -1.5,10.1"></polygon></g><polygon fill="#494746" points="15.3,6.8 13.3,8.8 13.3,15.5 2.5,15.5 2.5,4.7 9.2,4.7 11.1,2.7 0.5,2.7 0.5,17.6 15.3,17.6 "></polygon></svg>
send letters to</h3><p>
The Editor<br>
London Review of Books<br>
28 Little Russell Street<br>
London, WC1A 2HN
<br><br><a href="mailto:letters@lrb.co.uk?subject=Letter%20to %20the%20editor&amp;body=Please%20include%20your%2 0name%2C%20address%2C%20and%20phone%20number%20so% 20that%20we%20contact%20you.">letters@lrb.co.uk</a><br><br>
Please include name, address and a telephone number
</p></div></div>

*****

I'm including the following in the script:

remove_tags = [
dict(name='div', attrs={'class' : 'article-send-letter'}),
classes('social-button article-mask lrb-readmorelink')
]

Social buttons etc are correctly removed by the 'classes' line.

However the 'dict' line, whose form was copied from the API documentation, does nothing - the 'article-send-letter' text sails straight through.

I have tried putting 'article-send-letter' into the plain list of classes but that didn't work either.

What am I doing wrong?

Argel
Argel is offline   Reply With Quote
Old 12-29-2019, 07:10 AM   #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: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
dont use 'div' its possible the tag in the original source is not a div but something like <aside> or whatever. The recipe system auto-converts these to <div> so if you are looking at th esource, looks at the original source by opening it in your browser.
kovidgoyal is online now   Reply With Quote
Advert
Old 12-29-2019, 07:14 AM   #3
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: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That should take care of it
https://github.com/kovidgoyal/calibr...c9987efa100200
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove all Tags silverraven Library Management 7 02-09-2016 09:00 AM
syntax tags MMAC Library Management 1 02-29-2012 03:51 PM
How to remove all tags at once? al35 Calibre 11 04-09-2010 11:51 AM
RFE: Remove remove tags in bulk edit magphil Calibre 0 08-11-2009 10:37 AM
Remove <p> tags? sideburnt Calibre 3 06-11-2009 12:22 PM


All times are GMT -4. The time now is 12:31 PM.


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