Commit graph

1,839 commits

Author SHA1 Message Date
Justin Mayer
ddb6d89be3 Document how to stop generation of certain pages
The documentation doesn't make it very clear how to prevent certain
pages from being generated, such as the Authors, Tags, and Categories
collection pages. This change makes it slightly more obvious how to
prevent these pages from being generated. Fixes #940.
2013-06-28 19:59:00 -07:00
Justin Mayer
1448db9603 Merge pull request #951 from dbrgn/document_tags_save_as
More explicit settings docs concerning list templates
2013-06-27 19:16:50 -07:00
Danilo Bargen
931d571606 More explicit settings docs concerning list templates
I think the author list and tag list are so common that they should be
listed explicitly in the settings.
2013-06-28 00:55:22 +02:00
Justin Mayer
5c70e2bcb1 Merge pull request #948 from justinmayer/make-clean
Remove "clean" task from "make html"; revert "make clean" behavior to "rm -rf"
2013-06-26 17:08:19 -07:00
Justin Mayer
5d000ca290 Add more missing -s flags to tips doc page 2013-06-26 06:39:09 -07:00
Justin Mayer
7d37cfa748 Missing -s flag added to command on tips doc page 2013-06-25 19:17:40 -07:00
Justin Mayer
d2ef893b72 Merge pull request #944 from justinmayer/vcs-data
Keep certain files when cleaning output; fix #574
2013-06-25 19:12:57 -07:00
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
Justin Mayer
bf0a50880d Revert "make clean" behavior to rm -rf. Fixes #773
The change to the "make clean" task in 764a2cf from "rm -rf" to instead
relying on GNU "find" appears to have broken cross-platform portability,
likely causing problems on *BSD and other platforms. This commit reverts
that change back to the previous "rm -rf" behavior.
2013-06-24 13:40:32 -07:00
Justin Mayer
e9fec3b1dc Remove "clean" task from "make html"; fixes #637
This change removes the "clean" task from the "html" and "regenerate"
tasks in the default Makefile generated by pelican-quickstart. The
previous behavior ignored whether the DELETE_OUTPUT_DIRECTORY
setting was set to True or not and deleted everything in the output
directory every time the "make html" or "make regenerate" task was run.
In addition to violating the Principle of Least Astonishment, there was
also the potential for data loss if the user wasn't careful when
defining the output directory location in the Makefile.

The new behavior therefore relies primarily on the
DELETE_OUTPUT_DIRECTORY setting to control if and when the output
directory is cleaned. The default settings and Makefile generated by the
pelican-quickstart command, for example, no longer clean the output
directory when the "make html" task is run. If the user wants to change
this behavior and have the output directory cleaned on every "make html"
run, the recommended method would be to set DELETE_OUTPUT_DIRECTORY to
True in pelicanconf.py. Alternatively, the user can manually run "make
clean", with the caveat that the output directory and its contents will
be entirely destroyed, including any otherwise to-be-retained files or
folders specified in the OUTPUT_RETENTION setting. It is for that reason
that relying on the DELETE_OUTPUT_DIRECTORY setting is instead
recommended.

As before, DELETE_OUTPUT_DIRECTORY is set to True in the publishconf.py
settings file generated by the pelican-quickstart script. This way, any
potentially old and irrelevant files will be automatically removed
before the latest version of the site is transferred to the production
server environment.

In summary, this change allows for the sanest possible default settings,
while still allowing end users to customize output cleaning to their
preferred behavior with a minimum of confusion.
2013-06-24 13:05:00 -07:00
Justin Mayer
dd9f55c8bb Clean up minor text formatting, spelling, grammar 2013-06-22 12:28:37 -07:00
Alexis Metaireau
4a204f19c9 Merge pull request #936 from dbrgn/isinstance_iterable
Better duck typing in isinstance check
2013-06-19 15:33:04 -07:00
Danilo Bargen
d8c9fb31d0 Better duck typing in isinstance check 2013-06-20 00:13:57 +02: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
Alexis Metaireau
4f444ee6a8 Merge pull request #934 from wking/generator-init-kwargs
Use keyword arguments to initialize Generators
2013-06-19 00:57:50 -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
6e527e7416 test_generators: Use keyword arguments to initialize Generators 2013-06-16 13:30:59 -04:00
W. Trevor King
0d1866b393 Pelican.run: Use keyword arguments when initializing generators
This makes it easier to add new arguments to Generator subclasses.
2013-06-16 12:15:26 -04:00
Justin Mayer
8f295f7a03 PyPI now has CDN; Travis shouldn't use mirrors
Now that PyPI utilizes a CDN, the "--use-mirrors" setting slows down the
install process and has essentially been deprecated.
2013-06-16 08:53:45 -07:00
Justin Mayer
a650dd9d64 Merge pull request #933 from wking/no-static-for-pictures
samples: Remove EXTRA_PATH_METADATA entries for pictures
2013-06-16 08:38:23 -07:00
W. Trevor King
0dee76f259 samples: Remove EXTRA_PATH_METADATA entries for pictures
I'd added them earlier to test that a configuration edit could
preserve the original output locations.  However, it is likely that
you have quite a number of static files, and we shouldn't recommend
listing explicit paths for all of them.  With this configuration
change, the pictures will be copied into the output directory using
their original relative path (e.g. `pictures/Fat_Cat.jpg` without the
`static`).  Any |filename|-style links will be updated automatically.

If you *want* the pictures to end up in a `static` directory, it's
easier to just organize your source that way.
2013-06-15 20:52:16 -04:00
Justin Mayer
dfb29b5388 Update changelog 2013-06-15 12:24:48 -07:00
Justin Mayer
5d9b3d7777 Merge pull request #795 from wking/read-file
Generate context objects in read_file()
2013-06-15 11:54:32 -07:00
Justin Mayer
6fcb6d3766 Merge pull request #928 from wking/iso-8601
utils: Add some ISO 8601 forms to get_date()
2013-06-14 08:27:37 -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
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
ce0a9b697e Document path metadata extraction 2013-06-12 17:37:22 -04:00
W. Trevor King
8797f0ebef docs/plugins.rst: Document signal name changes 2013-06-12 17:37:21 -04:00
W. Trevor King
38c22e83b6 readers: Ensure the reader class is enabled before instantiating
Otherwise the MarkdownReader fails with:

  'bool' object is not callable

if Markdown is not installed.

Reported-by: Deniz Turgut <dturgut@gmail.com>
2013-06-12 17:37:21 -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
29f0aa39d2 content: Don't update static content 2013-06-12 17:37:21 -04:00
W. Trevor King
fdde17281d contents: Page fallbacks for context and localsiteurl 2013-06-12 17:37:21 -04:00
W. Trevor King
f63325aa9a test_generators: Replace CUR_DIR with CONTENT_DIR for subdir cat. detection
In situations where I've cleared ARTICLE_DIR, I've done so to ensure
that there are no directories that will override the DEFAULT_CATEGORY
due to USE_FOLDER_AS_CATEGORY.
2013-06-12 17:36:01 -04:00
W. Trevor King
06121eda76 test_readers: Update to new readers.read_file 2013-06-12 15:02:31 -04:00
W. Trevor King
7de7bd0e37 Update sample configurations from FILES_TO_COPY to EXTRA_PATH_METADATA 2013-06-12 15:02:31 -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
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
W. Trevor King
f2d6f77462 signals: Fix *_generate_* signals -> *_generator_*
For example, article_generate_preread is now article_generator_preread
for consistency with the other preread and context signals.
2013-06-12 15:02:30 -04:00
W. Trevor King
386cd1f3f0 signals: Add missing signals
Note that the `pages_*` names are plural , while the `article_*` names
are singular.  I'll fix this once I update the PagesGenerator.
2013-06-12 15:02:30 -04:00
W. Trevor King
effe7e5e12 signals: Sort signals into categories 2013-06-12 15:02:30 -04:00
W. Trevor King
e38e170656 readers: Log signal sending for read_file() 2013-06-12 15:02:30 -04:00
W. Trevor King
4e118eff01 readers: Add debugging logging to read_file 2013-06-12 15:02:30 -04:00
W. Trevor King
ecf5682930 readers: Instrument read_file to return Content objects
The assorted generators all use read_file() to read in the file
contents and metadata.  Previously, they sometimes parse additional
metadata, fire off signals, and initialize a pelican.contents.Content
subclass on their own.  We can reduce duplicated code and increase
consistency by shifting all that stuff into read_file() itself, and
this commit is a step in that direction.
2013-06-12 15:02:29 -04:00
Justin Mayer
ed82f62a5a Merge pull request #930 from wking/specific-assertions
tests: Avoid hidden logic with better .assert*() method choices
2013-06-12 12:01:41 -07:00
W. Trevor King
5a61600bc9 tests: Avoid hidden logic with better .assert*() method choices
We'll get better failure messages if we use an assertion method that
understands the comparison we're trying to make.  If you make the
comparison by hand and assertTrue(), you don't get much constructive
feedback ;).
2013-06-12 14:52:23 -04:00
W. Trevor King
1102143c33 utils: Use pytz instead of datetime.timezone for timezones
datetime.timezone is new in Python 3.2 [1], so pytz allows us to keep
support for Python 2.7.

[1]: http://docs.python.org/dev/library/datetime.html#datetime.timezone
2013-06-11 22:54:01 -04:00
W. Trevor King
228fc82fc9 utils: Add some ISO 8601 forms to get_date()
Support the forms listed by the W3C [1].  I also removed the
'%Y-%d-%m' form, which can be confused with the '%Y-%m-%d' ISO form.
The new ISO forms can use 'Z' to designate UTC or '[+-]HHMM' to
specify offsets from UTC.  Other time zone designators are not
supported.

The '%z' directive has only been supported since Python 3.2 [2], so if
you're running Pelican on Python 2.7, you're stuck with 'Z' for UTC.
Conveniently, we get ValueErrors for both invalid directives and
data/format missmatches, so we don't need special handling for the 2.7
case inside get_date().

[1]: http://www.w3.org/TR/NOTE-datetime
[2]: http://bugs.python.org/issue6641
2013-06-11 22:53:21 -04:00