1
0
Fork 0
forked from github/pelican
Commit graph

19 commits

Author SHA1 Message Date
Justin Mayer
d43b786b30 Modernize code base to Python 3+ syntax
Replaces syntax that was relevant in earlier Python versions but that
now has modernized equivalents.
2020-04-27 09:45:31 +02:00
Deniz Turgut
bd699d34e8 Expose preserve_case option from slugify 2020-04-21 00:26:00 +03:00
Deniz Turgut
97fe235e60 Expose use_unicode setting of slugify in settings and use it 2020-04-19 20:21:00 +03:00
Deniz Turgut
16968834ce Convert super() calls to py3 style 2019-11-26 06:17:04 +09:00
Deniz Turgut
49bc6ed47f Further remove python2-isms 2019-11-26 06:17:04 +09:00
Kevin Yap
1e0e541b57 Initial pass of removing Python 2 support
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.
2019-11-26 06:16:41 +09:00
Deniz Turgut
bc84075ded Make URLWrapper.slug settable again
Fixes #2242, Supersedes #2243
2018-11-11 21:35:51 +03:00
Oliver Urs Lenz
5199fa51ea control slug substitutions from settings with regex 2018-10-31 16:20:21 +01:00
Mr. Senko
fcd4f9aa0d Add AUTHOR_SUBSTITUTIONS 2016-04-01 23:01:57 +03:00
Mr. Senko
648165b839 More granular control of tags and categories slugs. Fixes #1873
- add TAG_SUBSTITUTIONS AND CATEGORY_SUBSTITURIONS settings
- make slugify keep non-alphanumeric characters if configured
2016-04-01 23:00:08 +03:00
derwinlu
8993c55e6e fulfil pep8 standard 2015-08-17 13:34:32 +02:00
derwinlu
5389543a39 improve URLWrapper comparison
* 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
2015-06-27 19:13:50 +02:00
Deniz Turgut
dceea3aabe Change URLWrapper.slug to a property
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.
2015-04-16 19:16:23 -04:00
Stéphane Wirtel
17fd176461 fix the parameters for a logging.warning call 2014-10-12 12:37:04 +01: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
Andy Pearce
39518e15ef Allow text substitutions when generating slugs
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.
2013-07-04 12:17:21 +01:00
Rogdham
91337940d3 Make tags and cats case insensitive. Fixes #704.
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.
2013-05-03 17:37:45 +01:00
W. Trevor King
9a62b5ec62 contents: Add URLWrapper.__repr__
This makes it easier to troubleshoot collections of URLWrappers,
because printing the collection will give you something you can
actually read ;).
2013-03-12 20:41:56 -04:00
Alexis Métaireau
14cf5f014c Some doc + various enhancements 2013-03-10 22:57:08 -07:00