mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
9ebb335346
@ -208,6 +208,10 @@ class HTMLProcessor(Processor, Rationalizer):
|
||||
for tag in self.root.xpath('//table | //tr | //th | //td'):
|
||||
tag.tag = 'div'
|
||||
|
||||
# ADE can't handle & in an img url
|
||||
for tag in self.root.xpath('//img[@src]'):
|
||||
tag.set('src', tag.get('src', '').replace('&', ''))
|
||||
|
||||
|
||||
def save(self):
|
||||
for meta in list(self.root.xpath('//meta')):
|
||||
|
@ -162,9 +162,13 @@ class LRFStream(LRFObject):
|
||||
self.stream = stream.read(self.stream_size)
|
||||
if self.stream_flags & 0x200 !=0:
|
||||
l = len(self.stream);
|
||||
key = l % self._scramble_key + 0xF;
|
||||
key = self._scramble_key&0xFF
|
||||
if key != 0 and key <= 0xF0:
|
||||
key = l % key + 0xF
|
||||
else:
|
||||
key = 0
|
||||
if l > 0x400 and (isinstance(self, ImageStream) or isinstance(self, Font) or isinstance(self, SoundStream)):
|
||||
l = 0x400;
|
||||
l = 0x400
|
||||
self.stream = self.descramble_buffer(self.stream, l, key)
|
||||
if self.stream_flags & 0x100 !=0:
|
||||
decomp_size = struct.unpack("<I", self.stream[:4])[0]
|
||||
|
@ -13,7 +13,6 @@ class Exiled(BasicNewsRecipe):
|
||||
__author__ = 'Darko Miletic'
|
||||
description = "Mankind's only alternative since 1997 - Formerly known as The eXile"
|
||||
publisher = 'Exiled Online'
|
||||
language = _('English')
|
||||
category = 'news, politics, international'
|
||||
oldest_article = 15
|
||||
max_articles_per_feed = 100
|
||||
@ -21,10 +20,12 @@ class Exiled(BasicNewsRecipe):
|
||||
use_embedded_content = False
|
||||
encoding = 'utf8'
|
||||
remove_javascript = True
|
||||
language = _('English')
|
||||
cover_url = 'http://exiledonline.com/wp-content/themes/exiledonline_theme/images/header-sm.gif'
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment' , description
|
||||
, '--base-font-size', '10'
|
||||
, '--category' , category
|
||||
, '--publisher' , publisher
|
||||
]
|
||||
@ -40,7 +41,7 @@ class Exiled(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
|
||||
feeds = [(u'Articles', u'http://exiledonline.com/feed/' )]
|
||||
feeds = [(u'Articles', u'http://exiledonline.com/feed/')]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for item in soup.findAll(style=True):
|
||||
@ -49,3 +50,8 @@ class Exiled(BasicNewsRecipe):
|
||||
soup.head.insert(0,mtag)
|
||||
return soup
|
||||
|
||||
def get_article_url(self, article):
|
||||
raw = article.get('link', None)
|
||||
final = raw + 'all/1/'
|
||||
return final
|
||||
|
||||
|
@ -6,7 +6,7 @@ __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
laprensa.com.ni
|
||||
'''
|
||||
|
||||
import locale
|
||||
import datetime
|
||||
import time
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
@ -23,23 +23,9 @@ class LaPrensa_ni(BasicNewsRecipe):
|
||||
encoding = 'cp1252'
|
||||
remove_javascript = True
|
||||
language = _('Spanish')
|
||||
|
||||
#Locale setting to get appropriate date/month values in Spanish
|
||||
try:
|
||||
#Windows seting for locale
|
||||
locale.setlocale(locale.LC_TIME,'Spanish_Nicaragua')
|
||||
except locale.Error:
|
||||
#Linux setting for locale -- choose one appropriate for your distribution
|
||||
try:
|
||||
locale.setlocale(locale.LC_TIME,'es_NI')
|
||||
except locale.Error:
|
||||
try:
|
||||
locale.setlocale(locale.LC_TIME,'es_ES')
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
current_index = time.strftime("http://www.laprensa.com.ni/archivo/%Y/%B/%d/noticias/")
|
||||
months_es = ['enero','febrero','marzo','abril','mayo','junio','julio','agosto','septiembre','octubre','noviembre','diciembre']
|
||||
current_month = months_es[datetime.date.today().month - 1]
|
||||
current_index = time.strftime("http://www.laprensa.com.ni/archivo/%Y/" + current_month + "/%d/noticias/")
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
@ -91,6 +77,3 @@ class LaPrensa_ni(BasicNewsRecipe):
|
||||
totalfeeds.append((feedtitle, articles))
|
||||
return totalfeeds
|
||||
|
||||
def cleanup(self):
|
||||
#Going back to the default locale
|
||||
locale.setlocale(locale.LC_TIME,'')
|
||||
|
@ -2,10 +2,10 @@ from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.db.models import permalink
|
||||
from django.contrib.auth.models import User
|
||||
from calibre.www.apps.tagging.fields import TagField
|
||||
from tagging.fields import TagField
|
||||
from calibre.www.apps.blog.managers import PublicManager
|
||||
|
||||
import calibre.www.apps.tagging as tagging
|
||||
import tagging
|
||||
|
||||
class Category(models.Model):
|
||||
"""Category model."""
|
||||
|
@ -40,10 +40,10 @@ INSTALLED_APPS = (
|
||||
'django.contrib.sites',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.comments',
|
||||
'django.contrib.markup',
|
||||
'calibre.www.apps.inlines',
|
||||
'calibre.www.apps.tagging',
|
||||
'tagging',
|
||||
'calibre.www.apps.blog',
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
@ -2,14 +2,16 @@ from django.conf.urls.defaults import patterns, include, handler404, handler500
|
||||
from django.conf import settings
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
#from django.contrib import admin
|
||||
#admin.autodiscover()
|
||||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
||||
# (r'^admin/(.*)', admin.site.root),
|
||||
(r'^admin/(.*)', admin.site.root),
|
||||
|
||||
(r'^comments/', include('django.contrib.comments.urls')),
|
||||
(r'', include('calibre.www.apps.blog.urls')),
|
||||
|
||||
|
||||
|
||||
)
|
||||
|
@ -1,6 +1,6 @@
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from calibre.www.apps.tagging.managers import ModelTaggedItemManager, TagDescriptor
|
||||
from tagging.managers import ModelTaggedItemManager, TagDescriptor
|
||||
|
||||
VERSION = (0, 3, 'pre')
|
||||
|
@ -1,5 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from calibre.www.apps.tagging.models import Tag, TaggedItem
|
||||
from tagging.models import Tag, TaggedItem
|
||||
|
||||
admin.site.register(TaggedItem)
|
||||
admin.site.register(Tag)
|
@ -5,9 +5,9 @@ from django.db.models import signals
|
||||
from django.db.models.fields import CharField
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from calibre.www.apps.tagging import settings
|
||||
from calibre.www.apps.tagging.models import Tag
|
||||
from calibre.www.apps.tagging.utils import edit_string_for_tags
|
||||
from tagging import settings
|
||||
from tagging.models import Tag
|
||||
from tagging.utils import edit_string_for_tags
|
||||
|
||||
class TagField(CharField):
|
||||
"""
|
||||
@ -101,7 +101,7 @@ class TagField(CharField):
|
||||
return 'CharField'
|
||||
|
||||
def formfield(self, **kwargs):
|
||||
from calibre.www.apps.tagging import forms
|
||||
from tagging import forms
|
||||
defaults = {'form_class': forms.TagField}
|
||||
defaults.update(kwargs)
|
||||
return super(TagField, self).formfield(**defaults)
|
@ -4,9 +4,9 @@ Tagging components for Django's form library.
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from calibre.www.apps.tagging import settings
|
||||
from calibre.www.apps.tagging.models import Tag
|
||||
from calibre.www.apps.tagging.utils import parse_tag_input
|
||||
from tagging import settings
|
||||
from tagging.models import Tag
|
||||
from tagging.utils import parse_tag_input
|
||||
|
||||
class AdminTagForm(forms.ModelForm):
|
||||
class Meta:
|
@ -5,7 +5,7 @@ application.
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
|
||||
from calibre.www.apps.tagging.models import Tag, TaggedItem
|
||||
from tagging.models import Tag, TaggedItem
|
||||
|
||||
class ModelTagManager(models.Manager):
|
||||
"""
|
@ -13,9 +13,9 @@ from django.db import connection, models
|
||||
from django.db.models.query import QuerySet
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from calibre.www.apps.tagging import settings
|
||||
from calibre.www.apps.tagging.utils import calculate_cloud, get_tag_list, get_queryset_and_model, parse_tag_input
|
||||
from calibre.www.apps.tagging.utils import LOGARITHMIC
|
||||
from tagging import settings
|
||||
from tagging.utils import calculate_cloud, get_tag_list, get_queryset_and_model, parse_tag_input
|
||||
from tagging.utils import LOGARITHMIC
|
||||
|
||||
qn = connection.ops.quote_name
|
||||
|
@ -159,7 +159,7 @@ def get_tag_list(tags):
|
||||
* A ``Tag`` ``QuerySet``.
|
||||
|
||||
"""
|
||||
from calibre.www.apps.tagging.models import Tag
|
||||
from tagging.models import Tag
|
||||
if isinstance(tags, Tag):
|
||||
return [tags]
|
||||
elif isinstance(tags, QuerySet) and tags.model is Tag:
|
||||
@ -201,7 +201,7 @@ def get_tag(tag):
|
||||
|
||||
If no matching tag can be found, ``None`` will be returned.
|
||||
"""
|
||||
from calibre.www.apps.tagging.models import Tag
|
||||
from tagging.models import Tag
|
||||
if isinstance(tag, Tag):
|
||||
return tag
|
||||
|
@ -5,8 +5,8 @@ from django.http import Http404
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.generic.list_detail import object_list
|
||||
|
||||
from calibre.www.apps.tagging.models import Tag, TaggedItem
|
||||
from calibre.www.apps.tagging.utils import get_tag, get_queryset_and_model
|
||||
from tagging.models import Tag, TaggedItem
|
||||
from tagging.utils import get_tag, get_queryset_and_model
|
||||
|
||||
def tagged_object_list(request, queryset_or_model=None, tag=None,
|
||||
related_tags=False, related_tag_counts=True, **kwargs):
|
Loading…
x
Reference in New Issue
Block a user