summaryrefslogtreecommitdiff
path: root/pelican/urlwrappers.py
Commit message (Collapse)AuthorAgeFilesLines
* Convert super() calls to py3 styleDeniz Turgut2019-11-261-1/+1
|
* Further remove python2-ismsDeniz Turgut2019-11-261-1/+1
|
* Initial pass of removing Python 2 supportKevin Yap2019-11-261-10/+6
| | | | | | This commit removes Six as a dependency for Pelican, replacing the relevant aliases with the proper Python 3 imports. It also removes references to Python 2 logic that did not require Six.
* Make URLWrapper.slug settable againDeniz Turgut2018-11-111-31/+13
| | | | Fixes #2242, Supersedes #2243
* control slug substitutions from settings with regexOliver Urs Lenz2018-10-311-13/+20
|
* Add AUTHOR_SUBSTITUTIONSMr. Senko2016-04-011-1/+6
|
* More granular control of tags and categories slugs. Fixes #1873Mr. Senko2016-04-011-1/+16
| | | | | - add TAG_SUBSTITUTIONS AND CATEGORY_SUBSTITURIONS settings - make slugify keep non-alphanumeric characters if configured
* fulfil pep8 standardderwinlu2015-08-171-1/+2
|
* improve URLWrapper comparisonderwinlu2015-06-271-9/+20
| | | | | | | | | | | | | | | * speed up via reduced slugify calls (only call when needed) * fix __repr__ to not contain str, should call repr on name * add test_urlwrappers and move URLWrappers tests there * add new equality test * cleanup header additionally: * Content is now decorated with python_2_unicode_compatible instead of treating __str__ differently * better formatting for test_article_metadata_key_lowercase to actually output the conflict instead of a non descriptive error
* Change URLWrapper.slug to a propertyDeniz Turgut2015-04-161-5/+20
| | | | | | | | | | | | | Main goal is to delay `slugify` call until `slug` is needed. `slugify` can be expensive depending on the input string (see #1172). Changing it to a property gives plugins time to place custom `slug`s before `name` is unnecessarily slugified. With this change, default behavior is same except the time slugification happens. But if you set custom slug, `slugify` won't be used at all. So, this is a partial solution to #1172. The rest, setting a custom slug, would best be handled by a plugin.
* fix the parameters for a logging.warning callStéphane Wirtel2014-10-121-1/+1
|
* Refactor logging handlingDeniz Turgut2014-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Allow text substitutions when generating slugsAndy Pearce2013-07-041-4/+5
| | | | | | | | | | | | The `slugify()` function used by Pelican is in general very good at coming up with something both readable and URL-safe. However, there are a few specific cases where it causes conflicts. One that I've run into is using the strings `C++` and `C` as tags, both of which transform to the slug `c`. This commit adds an optional `SLUG_SUBSTITUTIONS` setting which is a list of 2-tuples of substitutions to be carried out case-insensitively just prior to stripping out non-alphanumeric characters. This allows cases like `C++` to be transformed to `CPP` or similar. This can also improve the readability of slugs.
* Make tags and cats case insensitive. Fixes #704.Rogdham2013-05-031-5/+19
| | | | | | | | More precisely, group tags or categories without considering the case. This fixes the bug where two categories with just the case as difference were considered as distinct, but generate the same file: one overwriting the other. Thanks to @Avaris for helping with the tests.
* contents: Add URLWrapper.__repr__W. Trevor King2013-03-121-0/+3
| | | | | | This makes it easier to troubleshoot collections of URLWrappers, because printing the collection will give you something you can actually read ;).
* Some doc + various enhancementsAlexis Métaireau2013-03-101-0/+79