Python special cases single Mapping arguments to logging. This
adjusts BaseFormatter to skip "fancy" formatting if argument
is of type Mapping. Also adds various formatted log outputs.
Sets the `modified:` metadata from `date:` if the user asked us
to use the filesystem for determining timestamps. Fixes#2497
* Added tests (ab)using the HTML reader a bit
There seems to be no way to test this generically since we need
to produce a valid document with meta information to be able to
compare, hence I used the lightest reader out there to do the
parsing of the samples.
* Fixed tests for generators since there were 4 more articles
introduced to the test content directory.
Instead of serving on localhost by default with no way to override, the
host can now be configured, allowing both `serve` and `livereload` tasks
to serve output on non-localhost addresses such as `0.0.0.0`.
TestArticle was a subclass of TestPage and therefore included all
the tests TestPage already had. Effectively tests from TestPage
were run twice. This splits the common parts of TestPage to a
base class called TestBase and TestPage/TestArticle will both
inherit from it.
Adds a use_unicode kwarg to slugify to keep unicode
characters as is (no ASCII-fying) and add tests for
it. Also reworks how slugification logic.
slugify started with the Django method for slugiying:
- Normalize to compatibility decomposed from (NFKD)
- Encode and decode with 'ascii'
This works fine if the decomposed form contains ASCII
characters (i.e. ç can be changed in to c+CEDILLA and
ASCII would keep c only), but fails when decomposition
doesn't result in ASCII characters (i.e. Chinese). To
solve that 'unidecode' was added, which works fine for
both cases. However, old method is now redundant but
was kept. This commit removes the old method and
adjusts logic slightly.
Now slugify will normalize all text with composition
mode (NFKC) to unify format for regex substitutions.
And then if use_unicode is False, uses unidecode to
convert it to ASCII.
Calling read_settings to clear the options put into
pelican.settings.PYGMENTS_RST_OPTIONS in tearDown so
that tests that are run after are not affected
Adds a `preserve_case` parameter to the `slugify()` function and uses it
to preserve capital letters in category names when using the Pelican
importer.
The intention was to prevent accidental source content data loss by
skipping output directory deletion if the output directory is a parent
of the source content directory. But the previous implementation did so
by checking path *strings*, resulting in scenarios where the following
settings would erroneously skip deletion of the output directory:
PATH = "/repo/docs-src/content"
OUTPUT_PATH = "/repo/docs"
The output directory should have been deleted but wasn't because the
PATH string contains "/repo/docs". This change eschews string comparison
and instead compares actual paths to ensure that the output path is not
a parent of the source content directory.
* Document _URL/_SAVE_AS path matching req. Fix#2158
This commit addresses the fact that some URLs (primarily {attach}) are based
on the *_SAVE_AS path instead of the *_URL path. It updates the documentation
to point out that the paths of corresponding _URL and _SAVE_AS settings should
match, and that the OUTPUT directory should correspond to the web server's
document root, in order to avoid producing these incorrect URLs.
* Clarify {attach} and *_URL / *_SAVE_AS caveat
Co-authored-by: Justin Mayer <entroP@gmail.com>