Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-18-2010, 08:02 PM   #1
ultimatebuster
Junior Member
ultimatebuster began at the beginning.
 
ultimatebuster's Avatar
 
Posts: 7
Karma: 10
Join Date: Jul 2009
Device: Kindle 2
keep_only_tags

So apparently you can keep the tag with a the id of "content"
Code:
keep_only_tags = [dict(id=['content'])]
However, is it possible to keep the tag with a class? As the class is a built-in word for python, like:

Code:
<div class="content" id="124"></div>

Last edited by ultimatebuster; 03-18-2010 at 08:11 PM.
ultimatebuster is offline   Reply With Quote
Old 03-18-2010, 08:27 PM   #2
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
Quote:
Originally Posted by ultimatebuster View Post
So apparently you can keep the tag with a the id of "content"
Code:
keep_only_tags = [dict(id=['content'])]
However, is it possible to keep the tag with a class? As the class is a built-in word for python, like:

Code:
<div class="content" id="124"></div>
I believe you can but recipe questions get a more thorough response if asked in the custom recipe sticky thread.
DoctorOhh is offline   Reply With Quote
Advert
Old 03-18-2010, 08:30 PM   #3
ultimatebuster
Junior Member
ultimatebuster began at the beginning.
 
ultimatebuster's Avatar
 
Posts: 7
Karma: 10
Join Date: Jul 2009
Device: Kindle 2
ok thanks
ultimatebuster is offline   Reply With Quote
Old 03-19-2010, 07:29 PM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by ultimatebuster View Post
So apparently you can keep the tag with a the id of "content"
Code:
keep_only_tags = [dict(id=['content'])]
However, is it possible to keep the tag with a class? As the class is a built-in word for python, like:

Code:
<div class="content" id="124"></div>
The tags are all processed by BeautifulSoup, and here is a link explaining the interaction between the Python keyword and BeautifulSoup.

In short, the answer is that you can keep or remove tags with the "class" keyword without conflict with the Python keyword. Almost all recipes do, and looking at a few will show you how it's done.
Starson17 is offline   Reply With Quote
Old 03-19-2010, 07:49 PM   #5
kiklop74
Guru
kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.kiklop74 can program the VCR without an owner's manual.
 
kiklop74's Avatar
 
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
This is how it's done:

id example
Code:
keep_only_tags = [dict(attrs={'id':'content'})]
class example
Code:
keep_only_tags = [dict(attrs={'class':'content'})]
kiklop74 is offline   Reply With Quote
Advert
Reply


Forum Jump


All times are GMT -4. The time now is 11:38 PM.


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