1
0
Fork 0
forked from github/pelican
Commit graph

18 commits

Author SHA1 Message Date
Oliver Urs Lenz
a78950bce7 tweak paginator to accomodate {slug}.html patterns 2018-11-01 00:14:22 +01:00
Oliver Urs Lenz
62128fb948 control pagination per template 2018-07-12 17:39:51 +02:00
Vladimír Vondruš
182fb11c80 Allow to use page URL in pagination pattern.
Currently it was only possible to use page "save as" name or part of it
for generating pagination links. That's not sufficient when page URLs
differ a lot from actual filenames. With this patch it's possible to use
the `{url}` placeholder in PAGINATION_PATTERNS setting. For example, the
paginated archives would be saved to:

    blog/index.html
    blog/2/index.html
    blog/3/index.html

while the actual URLs would be like this (with the help of Apache's
mod_rewrite):

    http://blog.my.site/
    http://blog.my.site/2/
    http://blog.my.site/3/

The configuration that corresponds to this is roughly the following:

    ARCHIVES_SAVE_AS = 'blog/index.html'
    ARCHIVES_URL = 'http://blog.my.site/'
    PAGINATION_PATTERNS = [
        (1, '/{url}', '{base_name}/index.html'),
        (2, '/{url}{number}/', '{base_name}/{number}/index.html')
    ]

Also added YEAR_ARCHIVE_URL, MONTH_ARCHIVE_URL and DAY_ARCHIVE_URL
settings, as they were missing and now they make sense.
2018-02-10 18:26:55 +01:00
derwinlu
8993c55e6e fulfil pep8 standard 2015-08-17 13:34:32 +02:00
George V. Reilly
4c25610cd8 Fix Pelican rendering and unit tests on Windows.
* Fix {filename} links on Windows.
  Otherwise '{filename}/foo/bar.jpg' doesn't work
* Clean up relative Posix path handling in contents.
* Use Posix paths in readers
* Environment for Popen must be strs, not unicodes.
* Ignore Git CRLF warnings.
* Replace CRLFs with LFs in inputs on Windows.
* Fix importer tests
* Fix test_contents
* Fix one last backslash in paginated output
* Skip the remaining failing locale tests on Windows.
* Document the use of forward slashes on Windows.
* Add some Fabric and ghp-import notes
2015-01-25 17:42:53 -08:00
Deniz Turgut
ed3209888a Refactor logging handling
Old system was using manual string formatting for log messages.
This caused issues with common operations like exception logging
because often they need to be handled differently for Py2/Py3
compatibility. In order to unify the effort:

 - All logging is changed to `logging.level(msg, arg1, arg2)` style.
 - A `SafeLogger` is implemented to auto-decode exceptions properly
in the args (ref #1403).
 - Custom formatters were overriding useful logging functionality
like traceback outputing (ref #1402). They are refactored to be
more transparent. Traceback information is provided in `--debug`
mode for `read_file` errors in generators.
 - Formatters will now auto-format multiline log messages in order
to make them look related. Similarly, traceback will be formatted in
the same fashion.
 - `pelican.log.LimitFilter` was (ab)using logging message which
would result in awkward syntax for argumented logging style. This
functionality is moved to `extra` keyword argument.
 - Levels for errors that would result skipping a file (`read_file`)
changed from `warning` to `error` in order to make them stand out
among other logs.
 - Small consistency changes to log messages (i.e. changing all
to start with an uppercase letter) and quality-of-life improvements
(some log messages were dumping raw object information).
2014-07-22 12:39:39 -04:00
th3aftermath
990ddb5a5e Fix Issue #1165 allows extensions to be set by certain settings
PAGINATION_PATTERNS was hard coded so that all files had a ".html" extension. This fixes that and add a test to
ensure that the pagination code is not changing the filename incorrectly.
2014-03-08 20:33:23 -05:00
Nathan Yergler
5ffbf907de Create new formatting context dict instead of using self.__dict__
Using self.__dict__ is fine, but when its mutated it changes the
object's state. Creating a new dict avoids needing to think about
that, and doesn't introduce Python 3 issues (ie, where self.number is
accidentally set to '').
2013-08-03 13:49:43 -07:00
Nathan Yergler
74c7c72fb3 Use six.u instead of unicode. 2013-07-31 21:31:08 -07:00
Nathan Yergler
95890a2a61 Allow definition of pagination rules by page index. 2013-07-29 08:10:28 -04:00
Ross McFarland
71e83635ea remove u prefix from string literal, using unicode_literals 2013-07-29 08:09:45 -04:00
Ross McFarland
0caa101ec7 use six.string_types for python 3 compat 2013-07-29 08:09:44 -04:00
Ross McFarland
e07b39dfcb more robust PAGINATION_(URL|SAVE_AS) support
- add base_name and number_seperator to context to give more flexibility
  when naming things
2013-07-29 08:09:44 -04:00
Ross McFarland
c5eecd23eb PAGINATION_URL/PAGINATION_SAVE_AS implementation
allows the use of custom urls for pagination similar to *_URLS
2013-07-29 08:09:44 -04:00
Dirk Makowski
71995d5e1b Port pelican to python 3.
Stays compatible with 2.x series, thanks to an unified codebase.
2013-01-11 03:20:09 +01:00
Alexis Metaireau
6cde7fd27a PEP8-ify.
Wrap to 80 chars, sanitize imports.
2012-03-09 16:21:38 +01:00
Skami18
b909e4aac3 Removed a division by zero 2011-03-26 17:46:31 +01:00
Laureline Guerin
4111acd1c1 Pagination added for index and tag/category pages 2011-02-14 16:24:54 +01:00