From 76d9c46ef11c73150820dd19822a5815ed5a90f7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 May 2012 10:03:11 +0530 Subject: [PATCH] Economico by Krittika Goyal --- recipes/economico.recipe | 30 ++++++++++++++++++++++++ src/calibre/customize/conversion.py | 4 +++- src/calibre/manual/faq.rst | 16 +++++++++++++ src/calibre/manual/template_lang.rst | 4 ++-- src/calibre/utils/formatter_functions.py | 6 ++--- 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 recipes/economico.recipe diff --git a/recipes/economico.recipe b/recipes/economico.recipe new file mode 100644 index 0000000000..86a1e15975 --- /dev/null +++ b/recipes/economico.recipe @@ -0,0 +1,30 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class Economico(BasicNewsRecipe): + title = u'Economico' + language = 'pt' + __author__ = 'Krittika Goyal' + oldest_article = 1 #days + max_articles_per_feed = 25 + encoding = 'utf-8' + use_embedded_content = False + + no_stylesheets = True + auto_cleanup = True + + + feeds = [ +('Ultima Hora', + 'http://economico.sapo.pt/rss/ultimas'), + ('Em Foco', + 'http://economico.sapo.pt/rss/emfoco'), + ('Mercados', + 'http://economico.sapo.pt/rss/mercados'), + ('Empresas', + 'http://economico.sapo.pt/rss/empresas'), + ('Economia', + 'http://economico.sapo.pt/rss/economia'), + ('Politica', + 'http://economico.sapo.pt/rss/politica'), +] + diff --git a/src/calibre/customize/conversion.py b/src/calibre/customize/conversion.py index 344a4e18dc..ee8656f0ca 100644 --- a/src/calibre/customize/conversion.py +++ b/src/calibre/customize/conversion.py @@ -302,7 +302,9 @@ class OutputFormatPlugin(Plugin): :param item: The item (HTML file) being processed :param stylizer: A Stylizer object containing the flattened styles for - item. You can get the style for any element by stylizer.style(element). + item. You can get the style for any element by + stylizer.style(element). + ''' pass diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index 34e54592e4..0c891767df 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -69,6 +69,22 @@ If you have a hand edited TOC in the input document, you can use the TOC detecti Finally, I encourage you to ditch the content TOC and only have a metadata TOC in your ebooks. Metadata TOCs will give the people reading your ebooks a much superior navigation experience (except on the Kindle, where they are essentially the same as a content TOC). +The covers for my MOBI files have stopped showing up in Kindle for PC/Kindle for Android/etc. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is caused by a bug in the Amazon software. You can work around it by going +to Preferences->Output Options->MOBI output and setting the "Enable sharing +of book content" option. If you are reconverting a previously converted book, +you will also have to enable the option in the conversion dialog for that +individual book (as per book conversion settings are saved and take +precedence). + +Note that doing this will mean that the generated MOBI will show up under +personal documents instead of Books on the Kindle Fire and Amazon whispersync +will not work, but the covers will. It's your choice which functionality is +more important to you. I encourage you to contact Amazon and ask them to fix +this bug. + How do I convert a collection of HTML files in a specific order? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In order to convert a collection of HTML files in a specific oder, you have to create a table of contents file. That is, another HTML file that contains links to all the other files in the desired order. Such a file looks like:: diff --git a/src/calibre/manual/template_lang.rst b/src/calibre/manual/template_lang.rst index fb035a8cb3..3730ab7054 100644 --- a/src/calibre/manual/template_lang.rst +++ b/src/calibre/manual/template_lang.rst @@ -245,7 +245,7 @@ The following functions are available in addition to those described in single-f * ``current_library_name() -- `` return the last name on the path to the current calibre library. This function can be called in template program mode using the template ``{:'current_library_name()'}``. * ``days_between(date1, date2)`` -- return the number of days between ``date1`` and ``date2``. The number is positive if ``date1`` is greater than ``date2``, otherwise negative. If either ``date1`` or ``date2`` are not dates, the function returns the empty string. * ``divide(x, y)`` -- returns x / y. Throws an exception if either x or y are not numbers. - * ``eval(string)`` -- evaluates the string as a program, passing the local variables (those ``assign`` ed to). This permits using the template processor to construct complex results from local variables. Because the `{` and `}` characters are special, you must use `[[` for the `{` character and `]]` for the '}' character; they are converted automatically. Note also that prefixes and suffixes (the "|prefix|suffix" syntax) cannot be used in the argument to this function when using template program mode. + * ``eval(string)`` -- evaluates the string as a program, passing the local variables (those ``assign`` ed to). This permits using the template processor to construct complex results from local variables. Because the `{` and `}` characters are special, you must use `[[` for the `{` character and `]]` for the '}' character; they are converted automatically. Note also that prefixes and suffixes (the `|prefix|suffix` syntax) cannot be used in the argument to this function when using template program mode. * ``field(name)`` -- returns the metadata field named by ``name``. * ``first_non_empty(value, value, ...)`` -- returns the first value that is not empty. If all values are empty, then the empty value is returned. You can have as many values as you want. * ``format_date(x, date_format)`` -- format_date(val, format_string) -- format the value, which must be a date field, using the format_string, returning a string. The formatting codes are:: @@ -306,7 +306,7 @@ The following functions are available in addition to those described in single-f * ``substr(str, start, end)`` -- returns the ``start``'th through the ``end``'th characters of ``str``. The first character in ``str`` is the zero'th character. If end is negative, then it indicates that many characters counting from the right. If end is zero, then it indicates the last character. For example, ``substr('12345', 1, 0)`` returns ``'2345'``, and ``substr('12345', 1, -1)`` returns ``'234'``. * ``subtract(x, y)`` -- returns x - y. Throws an exception if either x or y are not numbers. * ``today()`` -- return a date string for today. This value is designed for use in format_date or days_between, but can be manipulated like any other string. The date is in ISO format. - * ``template(x)`` -- evaluates x as a template. The evaluation is done in its own context, meaning that variables are not shared between the caller and the template evaluation. Because the `{` and `}` characters are special, you must use `[[` for the `{` character and `]]` for the '}' character; they are converted automatically. For example, ``template('[[title_sort]]') will evaluate the template ``{title_sort}`` and return its value. Note also that prefixes and suffixes (the "|prefix|suffix" syntax) cannot be used in the argument to this function when using template program mode. + * ``template(x)`` -- evaluates x as a template. The evaluation is done in its own context, meaning that variables are not shared between the caller and the template evaluation. Because the `{` and `}` characters are special, you must use `[[` for the `{` character and `]]` for the '}' character; they are converted automatically. For example, ``template('[[title_sort]]') will evaluate the template ``{title_sort}`` and return its value. Note also that prefixes and suffixes (the `|prefix|suffix` syntax) cannot be used in the argument to this function when using template program mode. .. _template_functions_reference: diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index 5b620e54e3..23c7c51a84 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -218,7 +218,7 @@ class BuiltinTemplate(BuiltinFormatterFunction): ']] for the } character; they are converted automatically. ' 'For example, template(\'[[title_sort]]\') will evaluate the ' 'template {title_sort} and return its value. Note also that ' - 'prefixes and suffixes (the "|prefix|suffix" syntax) cannot be ' + 'prefixes and suffixes (the `|prefix|suffix` syntax) cannot be ' 'used in the argument to this function when using template program mode.') def evaluate(self, formatter, kwargs, mi, locals, template): @@ -235,7 +235,7 @@ class BuiltinEval(BuiltinFormatterFunction): 'results from local variables. Because the { and } ' 'characters are special, you must use [[ for the { character and ' ']] for the } character; they are converted automatically. ' - 'Note also that prefixes and suffixes (the "|prefix|suffix" syntax) ' + 'Note also that prefixes and suffixes (the `|prefix|suffix` syntax) ' 'cannot be used in the argument to this function when using ' 'template program mode.') @@ -1144,7 +1144,7 @@ class BuiltinFinishFormatting(BuiltinFormatterFunction): category = 'Formatting values' __doc__ = doc = _('finish_formatting(val, fmt, prefix, suffix) -- apply the ' 'format, prefix, and suffix to a value in the same way as ' - 'done in a template like {series_index:05.2f| - |- }. For ' + 'done in a template like `{series_index:05.2f| - |- }`. For ' 'example, the following program produces the same output ' 'as the above template: ' 'program: finish_formatting(field("series_index"), "05.2f", " - ", " - ")')