Merge from trunk

This commit is contained in:
Charles Haley 2011-02-18 10:57:58 +00:00
commit 30685cf627
76 changed files with 61390 additions and 36097 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,63 @@
__license__ = 'GPL v3'
__copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
'''
bighollywood.breitbart.com
'''
from calibre.web.feeds.news import BasicNewsRecipe
class BigHollywood(BasicNewsRecipe):
title = 'Big Hollywood'
__author__ = 'Darko Miletic'
description = 'News and articles from the media world'
publisher = 'Big Hollywood'
category = 'news, media, art, literature, movies, politics, USA, Hollywood'
oldest_article = 7
max_articles_per_feed = 200
no_stylesheets = True
encoding = 'utf8'
use_embedded_content = False
language = 'en'
remove_empty_feeds = True
publication_type = 'blog'
extra_css = """
body{font-family: Arial,sans-serif }
"""
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
keep_only_tags=[dict(attrs={'class':'postcontent'})]
remove_tags = [
dict(name=['meta','link','link','iframe','embed','object'])
,dict(name='p', attrs={'class':['post_meta_links','postfooter']})
]
remove_attributes=['original','onclick']
feeds = [(u'Articles', u'http://bighollywood.breitbart.com/feed/')]
def preprocess_html(self, soup):
for item in soup.findAll(style=True):
del item['style']
for item in soup.findAll('a'):
limg = item.find('img')
if item.string is not None:
str = item.string
item.replaceWith(str)
else:
if limg:
if limg['src'].endswith('BlogPrintButton.png'):
limg.extract()
item.name = 'div'
item.attrs = []
else:
str = self.tag_to_string(item)
item.replaceWith(str)
for item in soup.findAll('img'):
if not item.has_key('alt'):
item['alt'] = 'image'
return soup

View File

@ -254,6 +254,13 @@
<xsl:template match="fb:empty-line"> <xsl:template match="fb:empty-line">
<br/> <br/>
</xsl:template> </xsl:template>
<!-- super/sub-scripts -->
<xsl:template match="fb:sup">
<sup><xsl:apply-templates/></sup>
</xsl:template>
<xsl:template match="fb:sub">
<sub><xsl:apply-templates/></sub>
</xsl:template>
<!-- link --> <!-- link -->
<xsl:template match="fb:a"> <xsl:template match="fb:a">
<xsl:element name="a"> <xsl:element name="a">

View File

@ -6,7 +6,7 @@ __license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import os, cPickle, re, anydbm, shutil import os, cPickle, re, anydbm, shutil, marshal
from zlib import compress from zlib import compress
from setup import Command, basenames, __appname__ from setup import Command, basenames, __appname__
@ -194,7 +194,7 @@ class Resources(Command):
def kanwaout(self, out): def kanwaout(self, out):
dic = anydbm.open(out, 'c') dic = anydbm.open(out, 'c')
for (k, v) in self.records.iteritems(): for (k, v) in self.records.iteritems():
dic[k] = compress(cPickle.dumps(v, -1)) dic[k] = compress(marshal.dumps(v))
dic.close() dic.close()

View File

@ -264,10 +264,17 @@ class Dehyphenator(object):
class CSSPreProcessor(object): class CSSPreProcessor(object):
PAGE_PAT = re.compile(r'@page[^{]*?{[^}]*?}') PAGE_PAT = re.compile(r'@page[^{]*?{[^}]*?}')
# Remove some of the broken CSS Microsoft products
# create, slightly dangerous as it removes to end of line
# rather than semi-colon
MS_PAT = re.compile(r'^\s*(mso-|panose-).+?$',
re.MULTILINE|re.IGNORECASE)
def __call__(self, data, add_namespace=False): def __call__(self, data, add_namespace=False):
from calibre.ebooks.oeb.base import XHTML_CSS_NAMESPACE from calibre.ebooks.oeb.base import XHTML_CSS_NAMESPACE
data = self.PAGE_PAT.sub('', data) data = self.PAGE_PAT.sub('', data)
if '\n' in data:
data = self.MS_PAT.sub('', data)
if not add_namespace: if not add_namespace:
return data return data
ans, namespaced = [], False ans, namespaced = [], False

View File

@ -1,4 +1,3 @@
import os.path
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__license__ = 'GPL v3' __license__ = 'GPL v3'

View File

@ -50,7 +50,10 @@ class PMLOutput(OutputFormatPlugin):
with open(os.path.join(tdir, 'index.pml'), 'wb') as out: with open(os.path.join(tdir, 'index.pml'), 'wb') as out:
out.write(pml.encode(opts.pml_output_encoding, 'replace')) out.write(pml.encode(opts.pml_output_encoding, 'replace'))
self.write_images(oeb_book.manifest, pmlmlizer.image_hrefs, tdir, opts) img_path = os.path.join(tdir, 'index_img')
if not os.path.exists(img_path):
os.makedirs(img_path)
self.write_images(oeb_book.manifest, pmlmlizer.image_hrefs, img_path, opts)
log.debug('Compressing output...') log.debug('Compressing output...')
pmlz = ZipFile(output_path, 'w') pmlz = ZipFile(output_path, 'w')

View File

@ -181,6 +181,9 @@ class PMLMLizer(object):
for unused in anchors.difference(links): for unused in anchors.difference(links):
text = text.replace('\\Q="%s"' % unused, '') text = text.replace('\\Q="%s"' % unused, '')
# Remove \Cn tags that are within \x and \Xn tags
text = re.sub(ur'(?msu)(?P<t>\\(x|X[0-4]))(?P<a>.*?)(?P<c>\\C[0-4]\s*=\s*"[^"]*")(?P<b>.*?)(?P=t)', '\g<t>\g<a>\g<b>\g<t>', text)
# Replace bad characters. # Replace bad characters.
text = text.replace(u'\xc2', '') text = text.replace(u'\xc2', '')
text = text.replace(u'\xa0', ' ') text = text.replace(u'\xa0', ' ')
@ -255,7 +258,12 @@ class PMLMLizer(object):
# TOC markers. # TOC markers.
toc_name = elem.attrib.get('name', None) toc_name = elem.attrib.get('name', None)
toc_id = elem.attrib.get('id', None) toc_id = elem.attrib.get('id', None)
if (toc_id or toc_name) and tag not in ('h1', 'h2','h3','h4','h5','h6',): # Only write the TOC marker if the tag isn't a heading and we aren't in one.
if (toc_id or toc_name) and tag not in ('h1', 'h2','h3','h4','h5','h6') and \
'x' not in tag_stack+tags and 'X0' not in tag_stack+tags and \
'X1' not in tag_stack+tags and 'X2' not in tag_stack+tags and \
'X3' not in tag_stack+tags and 'X4' not in tag_stack+tags:
toc_page = page.href toc_page = page.href
if self.toc.get(toc_page, None): if self.toc.get(toc_page, None):
for toc_x in (toc_name, toc_id): for toc_x in (toc_name, toc_id):
@ -264,8 +272,8 @@ class PMLMLizer(object):
toc_depth = max(min(toc_depth, 4), 0) toc_depth = max(min(toc_depth, 4), 0)
text.append('\\C%s="%s"' % (toc_depth, toc_title)) text.append('\\C%s="%s"' % (toc_depth, toc_title))
# Process style information that needs holds a single tag # Process style information that needs holds a single tag.
# Commented out because every page in an OEB book starts with this style # Commented out because every page in an OEB book starts with this style.
if style['page-break-before'] == 'always': if style['page-break-before'] == 'always':
text.append('\\p') text.append('\\p')

View File

@ -160,6 +160,7 @@ class MultiCompleteComboBox(EnComboBox):
c.setCaseSensitivity(Qt.CaseSensitive) c.setCaseSensitivity(Qt.CaseSensitive)
self.dummy_model = CompleteModel(self) self.dummy_model = CompleteModel(self)
c.setModel(self.dummy_model) c.setModel(self.dummy_model)
self.lineEdit()._completer.setWidget(self)
def update_items_cache(self, complete_items): def update_items_cache(self, complete_items):
self.lineEdit().update_items_cache(complete_items) self.lineEdit().update_items_cache(complete_items)

View File

@ -1,7 +1,7 @@
//Define the SIP wrapper to the pictureflow widget //Define the SIP wrapper to the pictureflow widget
//Author - Kovid Goyal <kovid@kovidgoyal.net> //Author - Kovid Goyal <kovid@kovidgoyal.net>
%Module pictureflow 1 %Module(name=pictureflow, version=1)
%Import QtCore/QtCoremod.sip %Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip %Import QtGui/QtGuimod.sip

View File

@ -260,6 +260,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
self.restore_default_button.clicked.connect(self.restore_to_default) self.restore_default_button.clicked.connect(self.restore_to_default)
self.apply_button.clicked.connect(self.apply_tweak) self.apply_button.clicked.connect(self.apply_tweak)
self.plugin_tweaks_button.clicked.connect(self.plugin_tweaks) self.plugin_tweaks_button.clicked.connect(self.plugin_tweaks)
self.splitter.setStretchFactor(0, 1)
self.splitter.setStretchFactor(1, 100)
def plugin_tweaks(self): def plugin_tweaks(self):
raw = self.tweaks.plugin_tweaks_string raw = self.tweaks.plugin_tweaks_string

View File

@ -13,8 +13,16 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item row="0" column="0" rowspan="2"> <item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
@ -62,8 +70,10 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </widget>
<item row="0" column="1"> <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>Help</string> <string>Help</string>
@ -82,7 +92,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>Edit tweak</string> <string>Edit tweak</string>
@ -120,6 +130,10 @@
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item>
</layout>
</widget>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -1,7 +1,7 @@
//Define the SIP wrapper to the QProgressIndicator widget //Define the SIP wrapper to the QProgressIndicator widget
//Author - Kovid Goyal <kovid@kovidgoyal.net> //Author - Kovid Goyal <kovid@kovidgoyal.net>
%Module progress_indicator 1 %Module(name=progress_indicator, version=1)
%Import QtCore/QtCoremod.sip %Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip %Import QtGui/QtGuimod.sip

View File

@ -186,6 +186,7 @@ class PostInstall:
from calibre.ebooks.metadata.fetch import option_parser as fem_op from calibre.ebooks.metadata.fetch import option_parser as fem_op
from calibre.gui2.main import option_parser as guiop from calibre.gui2.main import option_parser as guiop
from calibre.utils.smtp import option_parser as smtp_op from calibre.utils.smtp import option_parser as smtp_op
from calibre.library.server.main import option_parser as serv_op
from calibre.ebooks.epub.fix.main import option_parser as fix_op from calibre.ebooks.epub.fix.main import option_parser as fix_op
any_formats = ['epub', 'htm', 'html', 'xhtml', 'xhtm', 'rar', 'zip', any_formats = ['epub', 'htm', 'html', 'xhtml', 'xhtm', 'rar', 'zip',
'txt', 'lit', 'rtf', 'pdf', 'prc', 'mobi', 'fb2', 'odt', 'lrf', 'snb'] 'txt', 'lit', 'rtf', 'pdf', 'prc', 'mobi', 'fb2', 'odt', 'lrf', 'snb']
@ -208,6 +209,7 @@ class PostInstall:
f.write(opts_and_exts('ebook-viewer', viewer_op, any_formats)) f.write(opts_and_exts('ebook-viewer', viewer_op, any_formats))
f.write(opts_and_words('fetch-ebook-metadata', fem_op, [])) f.write(opts_and_words('fetch-ebook-metadata', fem_op, []))
f.write(opts_and_words('calibre-smtp', smtp_op, [])) f.write(opts_and_words('calibre-smtp', smtp_op, []))
f.write(opts_and_words('calibre-server', serv_op, []))
f.write(opts_and_exts('epub-fix', fix_op, ['epub'])) f.write(opts_and_exts('epub-fix', fix_op, ['epub']))
f.write(textwrap.dedent(''' f.write(textwrap.dedent('''
_ebook_device_ls() _ebook_device_ls()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

14703
src/calibre/translations/pa.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff