1
0
Fork 0
forked from github/pelican
Commit graph

86 commits

Author SHA1 Message Date
John T. Wodder II
c7cb9a7587 Lowercase metadata field name when comparing with FORMATTED_FIELDS in rST reader 2020-08-20 11:27:49 +02:00
Deniz Turgut
2e482b207b
Fix Windows tests
* Unskip passable tests
* Fix broken tests
2020-05-09 16:17:14 +03:00
Deniz Turgut
839629b102
Cleanup test environment and requirements
- pytest: verbose isn't needed but show skipped tests
- mock is not needed anymore. it is part of stdlib
- Unpin Sphinx and fix warning about lexer
- Mirror tox command for doc build in tasks.py
2020-05-09 16:17:14 +03:00
(GalaxyMaster)
e6df353302
Set "modified:" from "date:" when the latter was set from the filesystem (#2748)
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.
2020-05-03 17:45:25 +02:00
Justin Mayer
d43b786b30 Modernize code base to Python 3+ syntax
Replaces syntax that was relevant in earlier Python versions but that
now has modernized equivalents.
2020-04-27 09:45:31 +02:00
fancsali
f610801ee8
Add Typogrify/SmartyPants dashes config parameter (#2615) 2020-04-16 13:32:19 +02:00
Justin Mayer
7d19bcf5d4
Add settings for custom Jinja globals and tests (#2715)
Pelican has a setting for custom Jinja filters but not custom tests or
custom environment namespace globals. This adds both of the latter.
2020-04-12 17:03:53 +02:00
Annika Backstrom
5d6513c36c Skip Markdown metadata parsing within metadata 2020-04-12 11:40:43 +02:00
Deniz Turgut
49bc6ed47f Further remove python2-isms 2019-11-26 06:17:04 +09:00
Kevin Yap
1e0e541b57 Initial pass of removing Python 2 support
This commit removes Six as a dependency for Pelican, replacing the
relevant aliases with the proper Python 3 imports. It also removes
references to Python 2 logic that did not require Six.
2019-11-26 06:16:41 +09:00
Stuart Axon
eaccca52dd Support inline SVGs (don't break on title in inline SVG). 2019-10-15 22:41:44 +01:00
MinchinWeb
2ee423017b Skip some non-Windows tests on Windows
Some tests will never pass on Windows due to differences in filesystems between
Windows and Linux.
2019-08-21 11:27:31 -06:00
Marcin Juszkiewicz
8520840be6 Provide 'all_articles' variable to period pages
This allows 'recent posts' functionality to work properly.
2019-04-19 19:45:23 +02:00
Justin Mayer
d974ba898c
Merge branch 'master' into html_list_tags 2018-11-11 11:30:28 +01:00
Oliver Urs Lenz
048ea4dc0c automatically copy linked static files 2018-11-01 18:08:11 +01:00
Justin Mayer
11de7b2e47
Merge branch 'master' into html_list_tags 2018-11-01 15:43:14 +01:00
Oliver Urs Lenz
62128fb948 control pagination per template 2018-07-12 17:39:51 +02:00
Justin Mayer
dc465d5c5f Merge fix for broken symlink test on macOS 2018-07-08 21:29:17 +02:00
Thomas Fan
6e0ed07446 Resolve symlinks before comparison test
Fixes #2358
2018-07-08 21:27:42 +02:00
Oliver Urs Lenz
576229ad19 allows pages to have draft status, like articles 2018-07-03 12:53:46 +02:00
Justin Mayer
81b7e7481f
Merge pull request #2238 from mosra/feed-urls
Feed URL settings, making feeds aware of absolute URLs
2018-03-23 13:36:51 +01:00
Justin Mayer
72756a5c0d
Merge pull request #2072 from drounin/overrides_ref2021+merge_update
Add THEME_TEMPLATE_OVERRIDES. Refs #2021
2018-03-05 07:50:12 -08:00
Justin Mayer
f7681f7259
Merge pull request #2246 from mosra/theme-static-paths-files
Make THEME_STATIC_PATHS work for files as well
2018-02-10 11:29:06 -08:00
Justin Mayer
59fc1d02a7
Merge pull request #2235 from mosra/paginator-pattern-url
Allow using page URL in pagination patterns
2018-02-10 11:27:02 -08:00
Vladimír Vondruš
182fb11c80 Allow to use page URL in pagination pattern.
Currently it was only possible to use page "save as" name or part of it
for generating pagination links. That's not sufficient when page URLs
differ a lot from actual filenames. With this patch it's possible to use
the `{url}` placeholder in PAGINATION_PATTERNS setting. For example, the
paginated archives would be saved to:

    blog/index.html
    blog/2/index.html
    blog/3/index.html

while the actual URLs would be like this (with the help of Apache's
mod_rewrite):

    http://blog.my.site/
    http://blog.my.site/2/
    http://blog.my.site/3/

The configuration that corresponds to this is roughly the following:

    ARCHIVES_SAVE_AS = 'blog/index.html'
    ARCHIVES_URL = 'http://blog.my.site/'
    PAGINATION_PATTERNS = [
        (1, '/{url}', '{base_name}/index.html'),
        (2, '/{url}{number}/', '{base_name}/{number}/index.html')
    ]

Also added YEAR_ARCHIVE_URL, MONTH_ARCHIVE_URL and DAY_ARCHIVE_URL
settings, as they were missing and now they make sense.
2018-02-10 18:26:55 +01:00
Vladimír Vondruš
4995a5c641 test: explicitly verify that all static files are present. 2018-02-10 18:12:46 +01:00
Mr. Senko
f62217f38e Make HTMLReader parse multiple occurences of metadata tags as list
this means you can now specify:
<meta name="custom_field" content="value_1" />
<meta name="custom_field" content="value_2" />

and the resulting object.custom_field will be ['value_1', 'value_2']
2017-12-02 13:21:46 +02:00
Justin Mayer
8ebc120f36 Align import style with flake8-import-order 0.15
Addresses: https://github.com/PyCQA/flake8-import-order/issues/120

Refs #2246
2017-11-07 04:18:03 -08:00
Vladimír Vondruš
19a9eeb975 Test that THEME_STATIC_PATHS works for both dirs and files.
It's documented like that. Doesn't work for files, though.
2017-11-03 16:03:35 +01:00
Vladimír Vondruš
343e24a26f Make it possible to specify custom URLs for feeds.
With this patch, there are new FEED_*_URL configuration options that
allow to specify custom URLs for feeds, which is helpful in case the
feed filename and the actual URL differ a lot -- for example if a feed
is saved to

    blog/feeds/all.atom.xml

but the actual URL from the user PoV is

    http://blog.your.site/feeds/all.atom.xml

This setting currently affects only the generated feed XML. This change
is also fully backwards compatible, so if the FEED_*_URL setting is not
present, the value of FEED_* is used for both file location and URL.
2017-10-29 21:35:23 +01:00
Pedro H
50af2ed45d Add THEME_TEMPLATE_OVERRIDES. Refs 2021
Allow for overriding individual templates from the theme by configuring
the Jinja2 `Environment` loader to search for templates in the
`THEME_TEMPLATES_OVERRIDES` path before the theme's `templates/`
directory.
2017-10-10 14:33:20 +08:00
Alexandre de Verteuil
b46fbb7879 Add two STATIC_ settings. Fix #1982
STATIC_CREATE_LINKS = False

Create links instead of copying files. If the content and output
directories are on the same device, then create hard links. Falls
back to symbolic links if the output directory is on a different
filesystem. If symlinks are created, don’t forget to add the -L or
--copy-links option to rsync when uploading your site.

STATIC_CHECK_IF_MODIFIED = False

If set to True, and STATIC_CREATE_LINKS is False, compare mtimes of
content and output files, and only copy content files that are newer
than existing output files.
2016-12-30 02:45:37 -05:00
Ryan M
335c40d23e Allow setting Jinja environment arguments from settings
fix flake8 warnings

Set jinja environment defaults within settings

updating docs to remove JINJA_EXTENSIONS

update logger warning and defaults documentation

better way to grab jinja environment

updating settings after refactor
2016-12-03 10:27:27 -08:00
Bernhard Scheirle
577b748f5f Fixes unit test test_period_in_timeperiod_archive (TestArticlesGenerator)
On systems with a none english default locale this test failed because the
period is a tuple of year and month name and the month name depends on the
locale.
2016-09-25 10:31:56 +02:00
Jesús Fernández
7f795ed558 Remove duplicate tags and authors in metadata 2015-08-26 12:07:38 +02:00
derwinlu
8993c55e6e fulfil pep8 standard 2015-08-17 13:34:32 +02:00
Jonathan Lange
108b67282a Export hidden pages in context
The `PageGenerator` was building hidden pages, but was not making them
available in the context. This makes it difficult for other plugins to
operate on hidden pages.

This patch updates `PageGenerator` to export the hidden pages it finds
in the context as `hidden_pages`.

It also updates the article generator to export `drafts`.
2015-06-20 11:21:39 +01:00
Deniz Turgut
da8b469ab8 Fix #1647: Fix ARTICLE_ORDER_BY and add the ability to reverse order
ARTICLE_ORDER_BY wasn't doing anything because the ArticlesGenerator
was sorting articles after ARTICLE_ORDER_BY was applied. This fixes
that by adding the ability to reverse metadata order by adding the
option prefix 'reversed-' to metadata and changing the default value
to 'reversed-date'.

Relevant documentation is also updated and moved into a more appropriate
place ('Ordering Content' instead of 'URL settings').
2015-06-12 18:14:54 -04:00
Justin Mayer
b7e8af5977 Merge pull request #1747 from ingwinlu/fix_cache
Fix caching and disable by default
2015-06-09 08:42:51 -07:00
derwinlu
b7e6390f04 fix caching
*  break out cache into cache.py
*  break out cache-tests into test_cache.py
*  fix broken cache tests
   *  replace non existing assert calls with self.assertEqual
   *  fix path for page caching test (was invalid)
   *  cleanup test code
*  restructure generate_context in Article and Path Generator
   * destinguish between valid/invalid files correctly and cache accordingly
*  use cPickle if available for increased performance
2015-06-08 09:34:30 +02:00
Zack Weinberg
c918380802 Support semicolon-separated author/tag lists.
Idea borrowed from Docutils.  This allows one to write author lists in
lastname,firstname format.  The code change also means that readers with
fancy metadata that can natively represent lists (e.g. Docutils itself,
or MD-Yaml) don't have to merge 'em back together for process_metadata's
sake.
2015-06-04 17:31:20 -04:00
winlu
bf7d113caa add skips for tests relying on dev_requirements modules 2015-04-11 22:45:31 +02:00
Deniz Turgut
3ea4542015 Make sure Content uses URLWrappers 2015-03-06 16:06:20 -05:00
Kevin Yap
6549f51591 Add tests for Pelican and pelican_import tool
Added tests to ensure that:
- THEME and deprecated *_DIR settings result in the expected configurations
- Post headers are formatted correctly in both Markdown and reStructuredText
- Files specified in IGNORE_FILES setting are properly ignored
- Generator.get_files()'s `paths` argument is backwards-compatible with strings
2015-02-17 18:26:41 -08:00
Kevin Yap
95860c6b1b Remove unused modules/variables from tests 2015-02-17 18:25:44 -08:00
Elana Hashman
49668f711a Generate {tag}-style links on pages correctly. Fixes #1513 2015-01-02 01:20:57 -07:00
Forest
0fe290c321 Make PAGE_EXCLUDES work with subdirs. Fixes #1500.
The old code was naively comparing the strings in PAGE_EXCLUDES to the
subdirectory names produced by os.walk(). (Same with ARTICLE_EXCLUDES.)
This had two surprising effects:

Setting PAGE_EXCLUDES=['foo'] would exclude all directories named foo,
regardless of whether they were in the top-level content directory or
nested deep within a directory whose contents should not be excluded.

Setting PAGE_EXCLUDES=['subdir/foo'] would never exclude any directories.

In other words, there is no way to exclude a subdirectory without risking
the accidental exclusion of other directories with the same name elsewhere
in the file system.

This change fixes the problem, so 'subdir/foo' and 'foo' will be distinct
and both work as expected. If anyone out there is depending on the old
behavior, they will have to update their settings. I don't expect it to
affect most users yet, since Pelican doesn't yet make nested directory
structures very useful. When it does, this fix will become important to
more people.
2014-11-01 17:38:20 -07:00
Forest
48f4f0850d Make StaticGenerator skip content sources. Refs #1019.
This change partially addresses issue #1019, by teaching Pelican to distinguish
between static files and content source files. A user can now safely add the
same directory to both STATIC_PATHS and PAGE_PATHS (or ARTICLE_PATHS). Pelican
will then process the content source files in that directory normally, and
treat the remaining files as static, without copying the raw content source
files to the output directory. (The OUTPUT_SOURCES setting still works.)

In other words, images and markdown/reST files can now safely live together.

To keep those files together in the generated site, STATIC_SAVE_AS and
PAGE_SAVE_AS (or ARTICLE_SAVE_AS) should point to the same output directory.

There are two new configuration settings:

STATIC_EXCLUDES=[]  # This works just like PAGE_EXCLUDES and ARTICLE_EXCLUDES.
STATIC_EXCLUDE_SOURCES=True  # Set this to False to get the old behavior.

Two small but noteworthy internal changes:

StaticGenerator now runs after all the other generators. This allows it to see
which files are meant to be processed by other generators, and avoid them.

Generators now include files that they fail to process (e.g. those with missing
mandatory metadata) along with all the other paths in context['filenames'].
This allows such files to be excluded from StaticGenerator's file list, so they
won't end up accidentally published. Since these files have no Content object,
their value in context['filenames'] is None. The code that uses that dict has
been updated accordingly.
2014-10-31 16:46:01 -07:00
Deniz Turgut
dec6023fe6 Fix for broken test in #1348 2014-09-18 20:09:12 -04:00
Justin Mayer
1d9981b4f9 Merge pull request #1348 from vjousse/davidmarble-page-order-by
Support ordering pages and articles when iterating in templates.
2014-09-18 16:12:51 -07:00