mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Static site generator that supports Markdown and reST syntax. Powered by Python.
- Python 85.3%
- CSS 8.7%
- Jinja 6%
Some metadata values cause problems when empty. For example, a markdown file
containing a Slug: line with no additional text causing Pelican to produce a
file named ".html" instead of generating a proper file name. Others, like
those created by a PATH_METADATA regex, must be preserved even if empty,
so things like PAGE_URL="filename{customvalue}.html" will always work.
Essentially, we want to discard empty metadata that we know will be useless
or problematic. This is better than raising an exception because (a) it
allows users to deliberately keep empty metadata in their source files for
filling in later, and (b) users shouldn't be forced to fix empty metadata
created by blog migration tools (see #1398).
The metadata processors are the ideal place to do this, because they know
the type of data they are handling and whether an empty value is wanted.
Unfortunately, they can't discard items, and neither can process_metadata(),
because their return values are always saved by calling code. We can't
safely change the calling code, because some of it lives in custom reader
classes out in the field, and we don't want to break those working systems.
Discarding empty values at the time of use isn't good enough, because that
still allows useless empty values in a source file to override configured
defaults.
My solution:
- When processing a list of values, a metadata processor will omit any
unwanted empty ones from the list it returns.
- When processing an entirely unwanted value, it will return something easily
identifiable that will pass through the reader code.
- When collecting the processed metadata, read_file() will filter out items
identified as unwanted.
These metadata are affected by this change:
author, authors, category, slug, status, tags.
I also removed a bit of now-superfluous code from generators.py that was
discarding empty authors at the time of use.
|
||
|---|---|---|
| docs | ||
| pelican | ||
| samples | ||
| .coveragerc | ||
| .gitattributes | ||
| .gitignore | ||
| .mailmap | ||
| .travis.yml | ||
| bumpr.rc | ||
| CONTRIBUTING.rst | ||
| dev_requirements.txt | ||
| LICENSE | ||
| MANIFEST.in | ||
| README.rst | ||
| setup.cfg | ||
| setup.py | ||
| THANKS | ||
| tox.ini | ||
Pelican |build-status| |coverage-status| ======================================== Pelican is a static site generator, written in Python_. * Write content in reStructuredText_ or Markdown_ using your editor of choice * Includes a simple command line tool to (re)generate site files * Easy to interface with version control systems and web hooks * Completely static output is simple to host anywhere Features -------- Pelican currently supports: * Chronological content (e.g., articles, blog posts) as well as static pages * Integration with external services (e.g., Google Analytics and Disqus) * Site themes (created using Jinja2_ templates) * Publication of articles in multiple languages * Generation of Atom and RSS feeds * Syntax highlighting via Pygments_ * Importing existing content from WordPress, Dotclear, and other services * Fast rebuild times due to content caching and selective output writing Check out `Pelican's documentation`_ for further information. How to get help, contribute, or provide feedback ------------------------------------------------ See our `contribution submission and feedback guidelines <CONTRIBUTING.rst>`_. Source code ----------- Pelican's source code is `hosted on GitHub`_. If you feel like hacking, take a look at `Pelican's internals`_. Why the name "Pelican"? ----------------------- "Pelican" is an anagram of *calepin*, which means "notebook" in French. .. Links .. _Python: http://www.python.org/ .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Markdown: http://daringfireball.net/projects/markdown/ .. _Jinja2: http://jinja.pocoo.org/ .. _Pygments: http://pygments.org/ .. _`Pelican's documentation`: http://docs.getpelican.com/ .. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html .. _`hosted on GitHub`: https://github.com/getpelican/pelican .. |build-status| image:: https://img.shields.io/travis/getpelican/pelican/master.svg :target: https://travis-ci.org/getpelican/pelican :alt: Travis CI: continuous integration status .. |coverage-status| image:: https://img.shields.io/coveralls/getpelican/pelican.svg :target: https://coveralls.io/r/getpelican/pelican :alt: Coveralls: code coverage status