1
0
Fork 0
forked from github/pelican
Commit graph

253 commits

Author SHA1 Message Date
Ondrej Grover
7fabd712a1 Generator.get_files backwards compatibility for 1 path
This should prevent outdated plugins with generators from failing.
Also fixes #1382.
2014-06-27 20:18:17 +02: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
d635a347d1 move {ARTICLE,PAGE}_DIR -> {ARTICLE,PAGE}_PATHS
Instead of one path a list can be given. This is due to popular request.
Should help people not wanting to use Pelican for blogging.
Maintain backward compatibility though.
Thanks to @ingwinlu for pointing out the change in StaticGenerator.
2014-05-14 14:04:50 +02:00
Justin Mayer
ddc5367231 Merge pull request #1328 from Scheirle/StaticGeneratorSignals
Send the static_generator_{init, finalized} signals
2014-04-26 10:25:13 -07:00
Ondrej Grover
ad6dc3f8ba use correct CachingGenerator class in super() call
This was a leftover from code moving in c1324b0.
Detected by pylint.
2014-04-25 19:44:26 +02:00
Bernhard Scheirle
30e2cac753 send the static_generator_{init, finalized} signals.
Note: The two signals were already present but were never sent.
2014-04-24 15:30:34 +02:00
Ondrej Grover
c1324b0206 split content caching into two layers
This is a reworked and improved version of content caching.
Notable changes:
- by default only raw content and metadata returned by readers are
  cached which should prevent conficts with plugins, the speed benefit
  of content objects caching is not very big with a simple setup
- renamed --full-rebuild to --ignore-cache
- added more elaborate logging to caching code
2014-04-20 14:34:52 +02:00
Shauna
e6be02264a Add feeds for each author 2014-04-18 14:29:18 -07:00
Antoine Brenner
e97e9b5ae5 Fix unittest issue related to python2/python3 differences
Under python 2, with non-ascii locales, u"{:%b}".format(date) can raise UnicodeDecodeError
because u"{:%b}".format(date) will call date.__format__(u"%b"), which will return a byte string
and not a unicode string.
eg:
locale.setlocale(locale.LC_ALL, 'ja_JP.utf8')
date.__format__(u"%b") == '12\xe6\x9c\x88' # True

This commit catches UnicodeDecodeError and calls date.__format__() with byte strings instead
of characters, since it to work with character strings
2014-04-15 16:44:15 +02:00
Ondrej Grover
fd77926700 Cache content to speed up reading. Fixes #224.
Cache read content so that it doesn't have to be read next time if its
source has not been modified.
2014-04-15 08:57:38 -04:00
Stefan hr Berder
652eb3686f add lang support for drafts (#826 & #1107)
Fix #826
Fix #1107
2014-02-23 14:03:09 +01:00
Anatoly Bubenkov
2c25e488c4 multiple authors implemented 2014-02-14 03:21:06 +01:00
Justin Mayer
9b36437d97 Merge pull request #1246 from fenekku/period-to-archive-context
Add period to period_archives context. Refs #1044.
2014-02-08 12:19:36 -08:00
Ondrej Grover
22762f2c16 add signal article_generator_pretaxonomy
invoked before categories and tags lists are created
useful when e.g. modifying the list of articles to be generated
so that removed articles are not leaked in categories or tags
2014-02-07 08:34:27 +01:00
Justin Mayer
dcadf33988 Merge pull request #1183 from Rogdham/pelican-fixcopy
Fix `utils.copy` for copying files
2014-02-05 08:19:34 -08:00
fenekku
f6e27617f8 Add period to period_archives context. Refs #1044.
* Adds period tuple of (year, month, day) matching the time
  period of the current archive. Note that this is done
  to the archive context if period_archives.html doesn't exist.
* Adds tests to verify this.
* Adds documentation in themes.rst about period in period_archives.html.
2014-02-03 20:26:38 -05:00
Alistair Magee
752e862b80 Needed a signal for my subcategory plugin 2014-01-24 06:31:26 +00:00
Simon Conseil
c90a62ea13 pep8 fixes 2014-01-05 23:34:46 +01:00
Stefan hr Berder
f750f38d60 add a signal on article writing 2014-01-03 05:03:25 +01:00
Rogdham
fd7fc2e202 Simplify usage of utils.copy
Remove confusing parameters, clarify usage in __doc__
2013-12-07 21:11:15 +01:00
Jamie Culpon
c9b84abe46 Make marking articles as drafts case-insensitive
Previously if you tried to mark an article as a draft by using a different
casing (for example, draft) you would get a warning when building:
`Unknown status Draft for file foo.md, skipping it.` This uses a
case-insensitive comparison when looking at article status instead. I
believe this behavior is a little easier for new Pelican users.
2013-12-04 09:32:52 -08:00
Justin Mayer
f4e78d7254 Merge pull request #1144 from idning/master
Check IGNORE_FILES on get_files. Closes #1130.
2013-11-27 16:52:03 -08:00
idning
7fadbd682a check IGNORE_FILES on get_files 2013-11-03 18:08:08 +08:00
zhouji
eb6d4bb008 Preserve file metadata (esp. timestamps) when copy static files to output folder. 2013-10-15 10:37:03 +08:00
bmcorser
b144c3cfbd Hack out overwrite param 2013-08-24 14:38:06 +01:00
Ken Jung
6191b2919e StaticGenerator now stores file list in context.
This allows plugins and other generators to easily add files to be
simply copied over.
2013-08-16 13:31:14 -07:00
Simon Conseil
4bc4b1500c Refactor readers and remove MARKUP
Add a `Readers` class which contains a dict of file extensions / `Reader`
instances. This dict can be overwritten with a `READERS` settings, for instance
to avoid processing *.html files:

    READERS = {'html': None}

Or to add a custom reader for the `foo` extension:

    READERS = {'foo': FooReader}

This dict is no storing the Reader classes as it was done before with
`EXTENSIONS`. It stores the instances of the Reader classes to avoid instancing
for each file reading.
2013-08-06 23:42:41 +02:00
Kyle Mahan
dfc3a7ce2f Move PDF generation to a plugin. Fixes #1009 2013-08-04 18:01:56 -07:00
Rogdham
a495527e2b Delib. overriding and overwrite detect. Fixes #938
Make deliberate overriding (*) works with overwrites detection.

(*) first introduced by d0e9c52410

The following are decided to be deliberate override:
 - articles using the `save_as` metadata
 - pages using the `save_as` metadata
 - template pages (always)

Pelican now exits in the following 2 cases:
 - at least 2 not deliberate writes to the same file name (behaviour introduced
   by the overwrite detection feature ff7410ce2a)
 - at least 2 deliberate writes to the same file name (new behaviour)

Also added info logging when deliberate overrides are performed.

Switched to StandardError instead of IOError, thanks to @ametaireau and
@russkel.
2013-08-04 12:09:26 +01:00
Dane Knecht
10dc5ef0b7 sort author and category pages same way as tags 2013-08-03 19:17:14 -07:00
Justin Mayer
76fa457654 Normalize whitespace via lstrip Jinja parameter
This adds the lstrip_blocks Jinja parameter and removes unnecessary
whitespace from a few notmyidea templates.

Note: The lstrip_blocks parameter requires Jinja 2.7+, which has been
noted in Pelican's setup.py.

Credit for this commit goes entirely to Russ Webber, who has earned my
eternal thanks for discovering and applying this useful Jinja parameter.

Refs #969
2013-08-03 16:17:26 -07:00
Russ Webber
89034f8b3f added THEME_STATIC_DIR setting
The theme static output directory path is now customisable via settings.
i.e. you can now use 'assets' instead of 'theme'.
2013-08-01 11:02:38 +08:00
Justin Mayer
2188f4de68 Merge pull request #898 from saimn/fix-markup-cli
Ensure that markup is a tuple.
2013-06-19 06:51:59 -07:00
W. Trevor King
12dd35ef36 generators: Remove wonky argument handling from Generator.__init__ 2013-06-16 13:31:16 -04:00
W. Trevor King
9b42b2a130 generators: get_files() should use paths relative to Generator.path
All paths should be relative to Generator.path unless we're actively
accessing the filesystem.  This makes the argument less ambiguous, so
we have less likelyhood of joining paths multiple times.
2013-06-12 17:37:22 -04:00
W. Trevor King
1ca0e06a27 Remove the FILES_TO_COPY setting
We no longer instantiate the Static object in the StaticGenerator, so
we can't set the save_as argument anymore.  If you want to adjust the
output path, use the upcoming EXTRA_PATH_METADATA setting.
2013-06-12 15:02:31 -04:00
W. Trevor King
1bc5b100ec generators: Convert StaticGenerator to use the new read_file 2013-06-12 15:02:31 -04:00
W. Trevor King
7be16dd524 generators: Update PagesGenerator to use new read_file
Also standardize signal names.  If `article_generator_*` is singular,
`page_generator_*` should be as well.  Fix it from the older
`pages_generator_*`.
2013-06-12 15:02:31 -04:00
W. Trevor King
a9c530281e Move Article metadata extraction from generators to readers
There's no reason why this information should be Article-specific.

This commit breaks the other generators for the moment.  I'll fix them
shortly.
2013-06-12 15:02:30 -04:00
Simon Conseil
3f91165f09 Ensure that markup is a tuple.
`self.markup` is a list when using the `-m|--markup` cli option, but testing the
extension with `endswith` works only with tuples.
2013-06-02 22:49:16 +02:00
W. Trevor King
8ff34e6c5d Replace settings.get(key) with settings[key] for default settings
If a setting exists in DEFAULT_CONFIG, assume it will be there
(instead of checking and/or providing a local default).  The earlier
code was split between the two idioms, which was confusing.
2013-06-02 14:24:27 -04:00
Deniz Turgut
2790446906 adds a 'strftime' jinja fiter that uses LOCALE 2013-04-21 18:00:12 -04:00
Rogdham
ec8e257fde Output sources for translations as well. 2013-04-14 22:19:57 +01:00
Deniz Turgut
e6f3126ba6 Fix for issue #219: tags should list only main articles, not translations 2013-03-26 01:28:42 -04:00
W. Trevor King
29cdb37af3 generators: Use the static format to read Static metadata
This cuts down on the remaining difference between static files and
articles/pages.  The main difference is that path-based metadata is
now parsed for static content.
2013-03-21 14:17:50 -04:00
W. Trevor King
ae4fc5a25e utils: Add path_to_url() and generalize get_relative_path()
The old get_relative_path() implementation assumed os.sep == '/',
which doesn't hold on MS Windows.  The new implementation uses
split_all() for a more general component count.

I added path_to_url(), because the:

  '/'.join(split_all(path))

idiom was showing up in a number of cases, and it's easier to
understand what's going on when that reads:

  path_to_url(path)

This will fix a number of places where I think paths and URLs were
conflated, and should improve MS Windows support.
2013-03-21 12:44:44 -04:00
W. Trevor King
b59da89e80 Convert '.' and '..' to the less magical os.curdir and os.pardir
While I'm cleaning up path manipulation, I might as well make things
more semantic.
2013-03-21 12:44:44 -04:00
W. Trevor King
e5e455e0e5 Replace os.sep.join with the more robust os.path.join
From the Python docs for os.sep [1]:

  Note that knowing this is not sufficient to be able to parse or
  concatenate pathnames - use os.path.split() and os.path.join()...

Where I touched a line, I also changed double quoted string literals
to single quotes, since they are used more often in the source:

  wking@mjolnir ~/src/pelican $ git grep "'" pelican/*.py | wc -l
  683
  wking@mjolnir ~/src/pelican $ git grep '"' pelican/*.py | wc -l
  181

[1]: http://docs.python.org/3/library/os.html#os.sep
2013-03-21 11:38:14 -04:00
John Mastro
f92c800216 Add a period archives feature and brief docs.
Allows users to have per-year, per-month, and per-day archives of posts
automatically generated. The feature is disabled by default; to enable
it a user must supply format strings for a period's respective
`_SAVE_AS` setting.
2013-03-15 17:22:42 -07:00
Alexis Métaireau
14d548fc44 Introduce all_articles where articles is shadowed. 2013-03-11 23:07:54 -07:00