1
0
Fork 0
forked from github/pelican
Commit graph

165 commits

Author SHA1 Message Date
Justin Mayer
2eb9c26cdb
Merge pull request #2750 from avaris/autoreload
Refactor file/folder watchers and autoreload
2020-05-10 07:29:27 +02:00
Deniz Turgut
48d842faa7
Refactor file/folder watchers and autoreload
Combined file and folder watchers under a class and refactored
common watcher related code from __init__.py to the class.
This simplifies the main and autoreload functions in __init__
as well as fix the problem with crashes related to multiprocessing
on systems where default spawn mode is "spawn" instead of "fork".
2020-05-09 16:22:36 +03:00
Deniz Turgut
2e482b207b
Fix Windows tests
* Unskip passable tests
* Fix broken tests
2020-05-09 16:17:14 +03:00
Kernc
b8f7c584c5
Fix error strings whitespace 2020-04-29 18:08:38 +02:00
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
03d9c38871 Rewrite pelican.utils.slugify to use unicode and add tests
Adds a use_unicode kwarg to slugify to keep unicode
characters as is (no ASCII-fying) and add tests for
it. Also reworks how slugification logic.

slugify started with the Django method for slugiying:
 - Normalize to compatibility decomposed from (NFKD)
 - Encode and decode with 'ascii'

This works fine if the decomposed form contains ASCII
characters (i.e. ç can be changed in to c+CEDILLA and
ASCII would keep c only), but fails when decomposition
doesn't result in ASCII characters (i.e. Chinese). To
solve that 'unidecode' was added, which works fine for
both cases. However, old method is now redundant but
was kept. This commit removes the old method and
adjusts logic slightly.

Now slugify will normalize all text with composition
mode (NFKC) to unify format for regex substitutions.
And then if use_unicode is False, uses unidecode to
convert it to ASCII.
2020-04-19 20:10:46 +03:00
Justin Mayer
8ba00dd9f1 Preserve category case in importer
Adds a `preserve_case` parameter to the `slugify()` function and uses it
to preserve capital letters in category names when using the Pelican
importer.
2020-04-15 20:42:21 +02: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
Justin Mayer
bbee493961
Merge pull request #2473 from bryanbrattlof/issue/2467
List files missing tag needed to order content
2019-06-17 16:18:14 +02:00
Justin Mayer
24515c2cf0
Merge pull request #2476 from oulenz/collections
Try importing from collections.abc for compatibility with Python 3.8
2019-04-25 14:05:31 +02:00
Oliver Urs Lenz
c9dc3223eb Fix bug in process_translations warning message generation that caused error with empty slugs 2019-02-24 11:19:12 +01:00
John Franey
3395e71570 Fix linting issues
Fixes linting issues that caused the `flake8` CI stage to fail.
2019-02-06 10:22:57 -04:00
Bryan Brattlof
497271ea7e
List files missing tag needed to order content 2018-11-25 13:11:48 -06:00
Oliver Urs Lenz
9ae32b8ff9 Try importing from collections.abc for compatibility with Python 3.8 2018-11-24 21:59:40 +01:00
Oliver Urs Lenz
048ea4dc0c automatically copy linked static files 2018-11-01 18:08:11 +01:00
Oliver Urs Lenz
77c967f1db control scope of identification of translations with new settings 2018-11-01 10:12:47 +01:00
Oliver Urs Lenz
5199fa51ea control slug substitutions from settings with regex 2018-10-31 16:20:21 +01:00
Justin Mayer
b4d5e4285e
Merge pull request #2285 from andreacorbellini/2263-handle-invalid-refs
Fix utils.truncate_html_words() to work with invalid HTML references
2018-07-04 18:28:17 +02:00
Jorge Maldonado Ventura
bdeb84adb9 Fix typo 2018-06-27 20:40:52 +02:00
Justin Mayer
5ca1cabe78
Merge pull request #2292 from oulenz/article_order
Remove hardcoded sorting of articles within categories, tags, authors, feeds
2018-04-06 12:08:29 -07:00
Oliver Urs Lenz
c160cb73cc remove hardcoded sorting of articles within categories, tags, authors, feeds 2018-03-18 12:21:56 +01:00
Deniz Turgut
beef062bb8 Fixes #2305: Follow symlinks while copying in static generator 2018-03-16 00:36:19 +03:00
Andrea Corbellini
01480a539f more accurate code and tests 2018-02-08 20:10:08 +01:00
Andrea Corbellini
fc7af9e1c3 flake8 fixes 2018-02-08 18:39:29 +01:00
Andrea Corbellini
b573576b00 Fix utils.truncate_html_words() to work with invalid HTML references
Invalid references like those missing semicolons (e.g. `&mdash`) or
those causing overflows (e.g. `�`) are now gracefully
handled and no exception is thrown.

This commit also adds tests and comments where needed.
2018-02-08 18:30:09 +01:00
derwinlu
89b28fd36b Fix warnings originating from bad regexes
Starting with python 3.6 warnings are issued for invalid escape
sequences in regular expressions. This commit corrects all
DeprecationWarning's via properly declaring the offending
regular expressions as raw strings.

Resolves #2095.
2017-03-27 16:09:08 +02:00
Jonas Wielicki
018f4468cc Check safety of save_as earlier if possible
The check in the writer still serves as a safety net.
2017-02-27 21:49:17 +01:00
Rogdham
6cc053b920 Improve logging in translation detection 2016-11-21 23:21:34 +01:00
Rogdham
4645def789 Fix translation metadata support 2016-11-20 20:01:56 +01:00
Jerry Asher
f8031203d2 Python's shutil.copy2 fails on Android
Python's shutil.copy2 fails on Android when copying a file's meta data (perm bits, access times) onto certain filesystems. This is documented as python issue28141 https://bugs.python.org/issue28141

These commits workaround that bug by

+ creating a new function copy_file_metadata in utils.py
+ wrapping calls to copy2 in a try/except clause that logs any errors that occur but keep execution going
+ changing the calls to shutil.copy2 to calls to the new function
2016-10-07 11:10:09 -07:00
Will Thompson
5d860471ac pelican_open: don't raise IndexError on empty files
If the file is empty, content[0] raises IndexError.
2016-08-11 07:46:53 +01: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
Daniel Himmelstein
f864dd832c Change ... (periods) to … (ellipsis) in summary
Also update HTML output by running (after making sure to have the fr_FR.utf8
locale installed):

```sh
LC_ALL=en_US.utf8 pelican -o pelican/tests/output/custom/ -s samples/pelican.conf.py samples/content/
LC_ALL=fr_FR.utf8 pelican -o pelican/tests/output/custom_locale/ -s samples/pelican.conf_FR.py samples/content/
LC_ALL=en_US.utf8 pelican -o pelican/tests/output/basic/ samples/content/
```
as described at
http://docs.getpelican.com/en/3.6.3/contribute.html#running-the-test-suite
2016-02-22 13:03:47 -08:00
Justin Mayer
880ba20a98 Merge pull request #1850 from ingwinlu/deprecation_warnings
Make Pelican Python 3.5 compatible
2015-11-03 07:22:12 -08:00
derwinlu
8b299098c9 Make HTMLParser Python 3.5 ready 2015-10-22 09:45:10 +02:00
Simon StJG
d333ed12c6 Fix quote escaping in read html attributes.
* Wrap HTML attributes in quotes according to their content.  If it contains a double quote use single quotes, otherwise escape with double quotes.
* Add escape_html utility to ensure quote entities are converted identically across Python versions.

Fixes #1260
2015-10-14 21:03:01 +01:00
Justin Mayer
72ee73f886 Merge pull request #1828 from andreacorbellini/chr-to-unichr
Use unichr() instead of chr() with Python 2.
2015-09-23 09:00:09 -07:00
Andrea Corbellini
c255a35800 Use unichr() instead of chr() with Python 2. 2015-09-22 23:25:24 +02:00
Andrea Corbellini
d583efb861 When truncating, stop parsing the document immediately after finding the last word. 2015-09-20 11:19:41 +02:00
Andrea Corbellini
9d0804de7a When truncating, consider hypens, apostrophes and HTML entities. 2015-08-28 13:22:54 +02:00
derwinlu
8993c55e6e fulfil pep8 standard 2015-08-17 13:34:32 +02:00
Andrea Corbellini
379f8666c1 Rewrite pelican.utils.truncate_html_words() to use an HTML parser instead of regular expressions. 2015-07-30 21:04:28 +02:00
guanidene
ba9b4a1d9b Watch for changes in mtime of symlinked folders and files too 2015-06-30 20:56:21 +05:30
Deniz Turgut
da8b469ab8 Fix #1647: Fix ARTICLE_ORDER_BY and add the ability to reverse order
ARTICLE_ORDER_BY wasn't doing anything because the ArticlesGenerator
was sorting articles after ARTICLE_ORDER_BY was applied. This fixes
that by adding the ability to reverse metadata order by adding the
option prefix 'reversed-' to metadata and changing the default value
to 'reversed-date'.

Relevant documentation is also updated and moved into a more appropriate
place ('Ordering Content' instead of 'URL settings').
2015-06-12 18:14:54 -04:00
Justin Mayer
e17c4377da Merge pull request #1740 from ingwinlu/count_hidden_pages
Improve pluralization, fixing display count of hidden pages
2015-06-11 07:27:41 -07:00
Justin Mayer
1da84349c4 Merge pull request #1693 from zackw/static-honor-ignore-files
Honor 'IGNORE_FILES' in StaticGenerator._copy_paths (#1692).
2015-06-10 11:54:29 -07:00
derwinlu
b7e6390f04 fix caching
*  break out cache into cache.py
*  break out cache-tests into test_cache.py
*  fix broken cache tests
   *  replace non existing assert calls with self.assertEqual
   *  fix path for page caching test (was invalid)
   *  cleanup test code
*  restructure generate_context in Article and Path Generator
   * destinguish between valid/invalid files correctly and cache accordingly
*  use cPickle if available for increased performance
2015-06-08 09:34:30 +02:00
Zack Weinberg
0a48371985 Give utils.copy the ability to ignore files (issue 1692)
This requires a significant overhaul because we want to be able to have
IGNORE_FILES apply at every level of a recursively copied directory
(e.g. the theme static directory).  Since I was overhauling it anyway
I changed it to use os.walk, which should be more efficient.
2015-06-04 17:57:06 -04:00