Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-26-2011, 04:45 PM   #1
joeindallas
Enthusiast
joeindallas began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Jan 2011
Device: Kindle 3
Help with text justification

OK, I've tried to go through all the tutorials and examples, but i can't seem to get the text in a simple recipe I've cobbled together (Dallas Morning News sports feeds) to be left justified. I've tried to use the USA Today recipe as an example, but no matter what i try - all the text in the articles is center justified. If I examine the output of the command line interface, i see:

'change_justification': 'original',
...
'extra_css': None,

even though I've specified extra CSS. Any ideas? The recipe (with the unworking extra CSS stripped out):

import re
from calibre.web.feeds.recipes import BasicNewsRecipe


class AdvancedUserRecipe1295487944(BasicNewsRecipe):
title = u'DMN Team RSS Sports Feeds'
oldest_article = 7
max_articles_per_feed = 100

remove_tags = [dict(name='div', attrs={'class':'categoryGroup'})]
remove_tags.append(dict(name = 'div', attrs = {'class': 'archivesGroup'}))

feeds = [(u'Rangers RSS', u'http://rangersblog.dallasnews.com/index.xml'), (u'Mavericks RSS', u'http://mavsblog.dallasnews.com/index.xml'), (u'Cowboys RSS', u'http://cowboysblog.dallasnews.com/index.xml')]



Thanks for any help!
joeindallas is offline   Reply With Quote
Old 01-26-2011, 04:53 PM   #2
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 joeindallas View Post
OK, I've tried to go through all the tutorials and examples, but i can't seem to get the text in a simple recipe I've cobbled together (Dallas Morning News sports feeds) to be left justified. I've tried to use the USA Today recipe as an example, but no matter what i try - all the text in the articles is center justified. If I examine the output of the command line interface, i see:

'change_justification': 'original',
...
'extra_css': None,

even though I've specified extra CSS. Any ideas? The recipe (with the unworking extra CSS stripped out):

import re
from calibre.web.feeds.recipes import BasicNewsRecipe


class AdvancedUserRecipe1295487944(BasicNewsRecipe):
title = u'DMN Team RSS Sports Feeds'
oldest_article = 7
max_articles_per_feed = 100

remove_tags = [dict(name='div', attrs={'class':'categoryGroup'})]
remove_tags.append(dict(name = 'div', attrs = {'class': 'archivesGroup'}))

feeds = [(u'Rangers RSS', u'http://rangersblog.dallasnews.com/index.xml'), (u'Mavericks RSS', u'http://mavsblog.dallasnews.com/index.xml'), (u'Cowboys RSS', u'http://cowboysblog.dallasnews.com/index.xml')]



Thanks for any help!
If that's your recipe, you haven't specified extra_css.
1) tell it to not use stylesheets:
Code:
no_stylesheets = True
2) You may need to strip inline styles

3) Add your extra_css, here's a common one:
Code:
    extra_css = '''
                    h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                    h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
                    p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
		'''
Starson17 is offline   Reply With Quote
 
Enthusiast
Old 01-26-2011, 06:08 PM   #3
joeindallas
Enthusiast
joeindallas began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Jan 2011
Device: Kindle 3
I deleted my lines for "no_stylesheets" and "extra_css" since they weren't working (and I was a little afraid that I was really just being stupid!)

Your code worked! At least it changed the fonts and sizes, so I was able to add the left justification and it works. The weird thing: I think my attempts all had extra_css = ' blah, blah' in single quotes. It looked to me like your example had two double-quotes on each side, but when I cut-and-pasted into textpad and saved as *.recipe - it saved it as 3 single-qotes on each side. I'm really confused, but it works - thank you very much!

Joe

Last edited by joeindallas; 01-26-2011 at 06:28 PM. Reason: spelling
joeindallas is offline   Reply With Quote
Old 01-28-2011, 09:24 AM   #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 joeindallas View Post
it works - thank you very much!
Joe
I'm happy your problem was solved.
Starson17 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text Justification ramjet1953 Sigil 1 11-07-2010 09:53 PM
Text Justification GSteer Kobo Reader 4 05-03-2010 12:55 AM
LIT to EPUB Text Justification Solicitous Calibre 5 11-17-2009 06:31 AM
Help with text justification jament Calibre 4 11-10-2009 05:27 PM
Kindle 2 Text Justification leonardfrye Amazon Kindle 3 02-16-2009 02:57 PM


All times are GMT -4. The time now is 03:18 AM.


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