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
By using "//" instead of "http://" when referring to external resources
such as fonts (e.g., from within CSS files), warnings about "insecure"
content can be avoided.
aboutme, bitbucket, google-groups, hackernews, reddit,
slideshare, speakerdeck, vimeo, youtube
Also, fix spacing below a line-block.
Try this in resT::
| First line
| Second line
| Third line
New paragraph.
Another paragraph.
Notice how the line-block runs into the first paragraph without the new CSS.
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.
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!).
For easier re-use. I also extract the path metadata first, so
metadata explicitly listed in the file contents will take precedence
over metadata parsed from the filename.