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.
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.
When importing from Wordpress, the --dir-page directive (disabled by
default) automatically adds files to the pages/ when they are recognised
as pages, as opposed to posts.
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.
- if the output directory does not exist the 'make clean' command fails,
which also means that the 'make html' command which would otherwise
create the output directory also fails without generating the output
Quick fix for this traceback:
$ pelican-import --wpfile ~/Downloads/mysite.wordpress.2013-02-24.xml
Traceback (most recent call last):
File "/Users/me/.virtualenvs/pelican/bin/pelican-import", line 8, in <module>
load_entry_point('pelican==3.2', 'console_scripts', 'pelican-import')()
File "/Users/me/.virtualenvs/pelican/src/pelican/pelican/tools/pelican_import.py", line 363, in main
disable_slugs=args.disable_slugs or False)
File "/Users/me/.virtualenvs/pelican/src/pelican/pelican/tools/pelican_import.py", line 238, in fields2pelican
for title, content, filename, date, author, categories, tags, in_markup in fields:
File "/Users/me/.virtualenvs/pelican/src/pelican/pelican/tools/pelican_import.py", line 37, in wp2fields
if item.fetch('wp:status')[0].contents[0] == "publish":
TypeError: 'NoneType' object is not callable
I'm a BeautifulSoup novice but these changes allowed me to import two of my wordpress.xml files.
After waiting for pelican and server to come up, if either one has
died then give a more helpful message and clean up. Previously did not
check for this, so script informed user that everything was running even
if one or both parts failed for whatever reason.
This is meant to provide a little more user-friendliness
in those cases where user has a develop_server.sh in project directory
but forgot to (re)install pelican, activate relevant virtualenv, etc.
as well as other unforeseen situations where one of the processes does
not start.