1
0
Fork 0
forked from github/pelican
Commit graph

151 commits

Author SHA1 Message Date
Justin Mayer
6f36b0a246 Keep certain files when cleaning output; fix #574
If DELETE_OUTPUT_DIRECTORY is set to True, all files and directories are
deleted from the output directory. There are, however, several reasons
one might want to retain certain files/directories and avoid their
deletion from the output directory. One such use case is version control
system data: a versioned output directory can facilitate deployment via
Heroku and/or allow the user to easily revert to a prior version of the
site without having to rely on regeneration via Pelican.

This change introduces the OUTPUT_RETENTION setting, a tuple of
filenames that will be preserved when the clean_output_dir function in
pelican.utils is run. Setting OUTPUT_RETENTION = (".hg", ".git") would,
for example, prevent the relevant VCS data from being deleted when the
output directory is cleaned.
2013-06-25 19:03:32 -07:00
W. Trevor King
180cf9165f settings: Fix deprecation warning in configure_settings()
The broken code came from my 1d4d86c (settings: Rework the
LESS_GENERATOR removal warning for easy extension, 2013-03-24), where
I put formatting placeholders ({}) into the warning message, but
forgot to fill them in :/.
2013-06-13 21:18:57 -04:00
W. Trevor King
ce0a9b697e Document path metadata extraction 2013-06-12 17:37:22 -04:00
W. Trevor King
4058cfdea4 settings: Add a warning for folks using FILES_TO_COPY. 2013-06-12 17:37:21 -04:00
W. Trevor King
d43dc1b9d6 Add the EXTRA_PATH_METADATA setting
Useful for altering static output paths when you don't want to encode
extra metadata in the static file's source path.
2013-06-12 15:02:31 -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
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
W. Trevor King
8511915294 settings: Cleanup configure_settings() (standardization & types)
This pulls out some general patterns to make it easier to apply
existing processing to new settings.
2013-06-02 13:32:10 -04:00
W. Trevor King
1d4d86c876 settings: Rework the LESS_GENERATOR removal warning for easy extension
Setting migration is something that will happen for multiple settings,
and the more we can standardize the reporting procedure, the easier it
will be to add new warnings.
2013-06-02 13:32:10 -04:00
W. Trevor King
e9dc1dd478 settings: Make DEFAULT_CONFIG public
This dictionary is accessed by plugins (like `summary`) which add new
settings, so it should be public (i.e. no prefixed underscore).

The changed name length would have led to a re-indenting of the
default contents anyway, so I shifted them all to four spaces.
2013-06-02 13:32:10 -04:00
Deniz Turgut
be8837963a ignore emacs lock files and exception handling for watchers 2013-04-22 20:50:11 -04:00
Justin Mayer
bdd702384f Improve wording of "cannot find" errors 2013-04-20 08:08:31 -07:00
Justin Mayer
870ec0efe8 Fix outdated link to documentation 2013-04-19 11:12:20 -07:00
Deniz Turgut
68921fe94d remove warning for FEED_DOMAIN when SITEURL undefined 2013-04-13 17:07:48 -04:00
Deniz Turgut
bc4bd773a0 remove unittest2 and fix various warnings in py3 2013-04-13 16:36:05 -04:00
Justin Mayer
0a8678a8ae Change RELATIVE_URLS default to False - Fixes #829 2013-04-11 16:12:55 -07:00
Deniz Turgut
c2924402ad Fix for issue #428: Use PLUGIN_PATH properly 2013-04-05 02:39:12 -04:00
David Beitey
e042e11c23 Add new option for controlling whether to display categories on menu or not
Conflicts:
	docs/changelog.rst
	pelican/tests/output/basic/tag/bar.html
	pelican/tests/output/basic/tag/baz.html
	pelican/tests/output/basic/tag/foo.html
	pelican/tests/output/custom/tag/bar.html
	pelican/tests/output/custom/tag/baz.html
	pelican/tests/output/custom/tag/foo.html
2013-04-01 22:08:13 +10:00
Alexis Métaireau
cb5f66ffe0 Check all lists are not strings. 2013-03-23 19:56:45 -07:00
Dave King
bd54cb1b88 Prevent people from setting STATIC_PATHS to a str
Previously you could accidentally set for example site/css and pelican would iterate through the string and attempt to copy '/' into your output.
2013-03-23 19:56:14 -07: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
a5c1fdac58 settings: Use splitext to remove extensions, not rpartition 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
W. Trevor King
bfa8851af0 Add the PATH_METADATA setting
Sometimes the base filename doesn't have everything you need.

Remember that os.sep is platform dependent, so using it in a regular
expression for this setting may not be portable (boo MS Windows!).
2013-03-12 15:16:25 -07:00
W. Trevor King
49bf80ec39 contents: Convert StaticContent to Static, a Page subclass
Static needs a lot of the same handling as other pages, so make it a
subclass of Page.  The rename from StaticContent to Static makes for
cleaner configuration settings (STATIC_URL instead of
STATICCONTENT_URL).

All currently generated Static instances override the save_as
attribute explicitly on initialization, but it isn't hard to imagine
wanting to adjust STATIC file output based on metadata (e.g. extracted
from their source filename).  With this union, the framework for
manipulating URLs and filenames is shared between all source file
types.
2013-03-10 23:19:56 -07:00
Alexis Métaireau
14cf5f014c Some doc + various enhancements 2013-03-10 22:57:08 -07:00
Alexis Métaireau
519dcdbcb3 Manual pass on sources for better standards. 2013-03-03 20:12:31 -08:00
Rıdvan Örsvuran
0288bf1f68 added IGNORE_FILES setting for autoreload 2013-01-23 01:02:46 +01:00
W. Trevor King
004adfa5cc content: Convert Path.filename to .source_path
Making everything consistent is a bit awkward, since this is a
commonly used attribute, but I've done my best.

Reasons for not consolidating on `filename`:

* It is often used for the "basename" (last component in the path).
  Using `source_path` makes it clear that this attribute can contain
  multiple components.

Reasons for not consolidating on `filepath`:

* It is barely used in the Pelican source, and therefore easy to
  change.
* `path` is more Pythonic.  The only place `filepath` ever show up in
  the documentation for `os`, `os.path`, and `shutil` is in the
  `os.path.relpath` documentation [1].

Reasons for not consolidating on `path`:

* The Page elements have both a source (this attribute) and a
  destination (.save_as).  To avoid confusion for developers not aware
  of this, make it painfully obvious that this attribute is for the
  source.  Explicit is better than implicit ;).

Where I was touching the line, I also updated the string formatting in
StaticGenerator.generate_output to use the forward compatible
'{}'.format() syntax.

[1]: http://docs.python.org/2/library/os.path.html#os.path.relpath
2013-01-18 07:57:35 -05:00
Alexis Metaireau
a7fb6b5eae Merge pull request #661 from wking/settings-abspath
settings: Fix abspath existence check for path settings
2013-01-15 10:56:57 -08:00
Dirk Makowski
71995d5e1b Port pelican to python 3.
Stays compatible with 2.x series, thanks to an unified codebase.
2013-01-11 03:20:09 +01:00
W. Trevor King
9eb5ad77ef settings: Fix abspath existence check for path settings
The path to check is `absp`.  `p` is the setting name.
2013-01-03 12:19:27 -05:00
Bruno Binet
8bb86d3e5d revert #523
we don't need a new MARKDOWN_EXTENSIONS setting because the equivalent setting
MD_EXTENSIONS already exists.
2012-12-03 22:35:11 +01:00
Bruno Binet
debd6fb3b4 add FILENAME_METADATA setting to extract metadata from filename
FILENAME_METADATA default to '(?P<date>\d{4}-\d{2}-\d{2}).*' which will allow
to extract date metadata from the filename.
2012-12-03 09:53:14 +01:00
Bruno Binet
fa82e19c1f change default value for DEFAULT_DATE to None
(was 'fs' => guess from file mtime)
2012-11-28 00:29:51 +01:00
Bruno Binet
801bc755b5 Merge branch 'pr/558'
Conflicts:
	docs/settings.rst
	pelican/signals.py
2012-11-23 15:32:17 +01:00
jawher
1b81f8b830 Move SITEURL check for feed generation from generators.py to settings.py 2012-11-12 23:01:17 +01:00
jawher
13f444260c Avoid iterating over all settings keys to detect if a feed is enabled 2012-11-12 23:01:17 +01:00
jawher
8a72b11e3d code style: remove unnecessary trailing \ 2012-11-12 23:01:17 +01:00
jawher
537e9df3ed Reworked the "unset feed_domain" warning to handle all feed variables 2012-11-12 23:01:16 +01:00
jawher
5593670759 The default settings sets up FEED_ALL_ATOM (instead of FEED_ATOM) to all.atom.xml 2012-11-12 23:01:16 +01:00
Simon
4cfb0cd24e Move Webassets in a plugin 2012-11-07 00:17:50 +01:00
Simon
1b20319074 add a warning for the users of the LESS_GENERATOR setting 2012-11-05 21:56:18 +01:00
Simon
d0f5875f66 remove the LessCSSGenerator and the related config option 2012-11-05 21:51:27 +01:00
Bruno Binet
e0e1b3eecf rename STATIC_PAGES to TEMPLATE_PAGES 2012-10-30 09:56:10 +01:00
Tarek Ziade
7127676f71 added a static pages generator
Conflicts:
	pelican/__init__.py
	pelican/generators.py
	pelican/settings.py
2012-10-30 09:56:08 +01:00
Martin Brochhaus
47c972e21a Added USE_FOLDER_AS_CATEGORY setting.
This allows users to organize their files in ways where the subfolder name
would not make a good category name (i.e. /2012/09/). Set this to ``False``
and the subfolder will no longer be used as a standard category,
`DEFAULT_CATEGORY` will be used instead.
2012-10-28 20:43:45 +01:00
jawher
a11726783e TRANSLATION_FEED is now split into TRANSLATION_FEED_ATOM and TRANSLATION_FEED_RSS to match the other feed configuration keys
Incidentally, Pelican can now generate RSS translation feeds.
2012-10-22 22:52:06 +02:00
Bruno Binet
4029f2ec82 refactoring so that command line options override settings
and Pelican class now accepts a single parameter ``settings``
2012-10-16 01:35:39 +02:00