Turn invalid characters into underscores, remove leading dots and enforce
a maximum length. Should be fine on main file systems used by Windows, Mac OS
and Linux.
Thanks to @Avaris for helping to clean my code.
When a WP XML file is imported, items with missing title are generated with a
title which is probably not the good one (instead of being dropped), and a
warning is displayed to the user.
Since feed generation is usually unnecessary during development (and can
produce potentially-confusing warnings when SITEURL is not set), running
"make html" will now skip feed generation by default. Feed generation
settings have been added to publishconf.py so feeds will be generated
when the site is published.
Also corrected some URLs in pelicanconf.py.
Tempdirs should have useful prefixes to aid in collecting information
about failed tests.
Implicit concatenation is better than backslash line continuation.
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.
Instead of just being a base class, we can use it to parse static
files. It won't actually do any parsing, but we will get path
metadata extraction from read_file, and this will make the
StaticGenerator implementation simpler.
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.
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