1
0
Fork 0
forked from github/pelican
Commit graph

149 commits

Author SHA1 Message Date
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
derwinlu
39fd4936b5 improve result output of a pelican run
*  display count of hidden pages
*  pluralize only if necessary
*  add maybe_pluralize to utils
*  add tests for maybe_pluralize
2015-06-03 08:58:59 +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
Justin Mayer
de8b437549 Merge pull request #1466 from cgar/spelling
Minor spelling fixes
2014-11-02 12:20:30 -08:00
Justin Mayer
1d9981b4f9 Merge pull request #1348 from vjousse/davidmarble-page-order-by
Support ordering pages and articles when iterating in templates.
2014-09-18 16:12:51 -07:00
Carlos E. Garcia
f5775bcba0 minor spelling fixes 2014-09-15 20:29:00 -04:00
Justin Mayer
1fae9534d5 Merge pull request #1446 from avaris/enhanced_strftime
Fixes #1395: extends pelican.utils.strftime with `-` prefix to strip leading zeros
2014-08-28 11:17:28 -07:00
Justin Mayer
2ecd85d7b3 Merge pull request #1412 from avaris/refactor_logging
Refactor logging handling
2014-08-13 14:17:09 -07: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
Deniz Turgut
7c3cc8fc0d Fixes #1395: extends pelican.utils.strftime with - prefix to strip leading zeros
Adds the ability to use `-` prefix with C89 format codes to strip any
leading zeros.
2014-07-16 03:40:53 -04:00
OGINO Masanori
2c50ccb764 Add timezone to datetime objects. Refs #962.
Based on https://github.com/getpelican/pelican/pull/977, but it adds
timezone information before formatting.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-04 01:23:57 +09:00
Deniz Turgut
009543b7e4 Fix test errors on OSX
On OSX, if LC_TIME and LC_CTYPE differs the output of strftime is not properly decoded
in Python 3. This makes sure that the 'utils.DateFormatter' and the related Jinja filter
'strftime' set the same value for LC_TIME and LC_CTYPE while formatting.

Also, '%a' is removed from DEFAULT_DATE_FORMAT in 'custom_locale' tests. OSX and *nix have
different conversions for '%a' ('Jeu' vs 'jeu.') and there is not a feasible way to handle
the difference for tests.
2014-06-26 01:01:42 -04:00
Ondrej Grover
3f6b130d6e Fix #1198, enable custom locale in template rendering, fixes links
reverts getpelican/pelican@ddcccfeaa9

If one used a locale that made use of unicode characters (like fr_FR.UTF-8)
the files on disk would be in correct locale while links would be to C.

Uses a SafeDatetime class that works with unicode format strigns
by using custom strftime to prevent ascii decoding errors with Python2.

Also added unicode decoding for the calendar module to fix period
archives.
2014-06-26 00:00:19 -04:00
Ondrej Grover
ef96705677 catch arbitrary exceptions during cache unpickling
It is hard to forsee what could be raised.
2014-06-08 11:32:10 +02:00
Mark Lee
b572cbeef1 Addressed comments from @avaris in PR getpelican/pelican#1348 2014-05-27 11:42:37 -07:00
Mark Lee
144cddaf39 Address code review comments from PR getpelican/pelican#1348
The text about the sort-by-key function comes from:
https://docs.python.org/2/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange

Minor style cleanup as well.
2014-05-20 13:53:02 -07:00
Vincent Jousse
ebf0da0f7b Merge remote-tracking branch 'remotes/malept/davidmarble-page-order-by' into davidmarble-page-order-by
Conflicts:
	docs/settings.rst
	pelican/generators.py
	pelican/tests/test_generators.py
2014-05-14 10:48:41 +02:00