Static site generator that supports Markdown and reST syntax. Powered by Python.
  • Python 85.3%
  • CSS 8.7%
  • Jinja 6%
Find a file
Forest db2e517450 Ignore empty metadata. Fixes #1469. Fixes #1398.
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.
2015-03-24 11:37:07 -07:00
docs Merge pull request #1481 from hrbonz/template_context_docs 2015-03-24 09:57:32 -07:00
pelican Ignore empty metadata. Fixes #1469. Fixes #1398. 2015-03-24 11:37:07 -07:00
samples Change documented type of various settings 2015-01-17 18:15:24 -08:00
.coveragerc [coveralls] Exclude tests from coverage 2014-06-24 22:29:36 +01:00
.gitattributes Fixed line ending problems by adding a .gitattributes file 2012-11-29 15:00:44 +01:00
.gitignore Port pelican to python 3. 2013-01-11 03:20:09 +01:00
.mailmap .mailmap: Add mappings to consolidate author names and emails 2013-04-12 10:51:48 -04:00
.travis.yml Standardize formatting of .travis.yml 2015-03-07 01:03:25 -08:00
bumpr.rc Build binary wheels when publishing to PyPI 2014-07-01 12:16:45 -07:00
CONTRIBUTING.rst fix headers, this fixes issues with docs/contributing.rst throwing errors because of the different content structure 2015-01-05 12:36:35 +01:00
dev_requirements.txt Build binary wheels when publishing to PyPI 2014-07-01 12:16:45 -07:00
LICENSE Include the complete license rather than the short version. See #103 2011-04-26 13:46:02 +01:00
MANIFEST.in Don't include all the .py files in the root folder 2013-06-07 00:50:51 +02:00
README.rst Minor improvements to README 2015-03-05 12:04:39 -08:00
setup.cfg Revert setup.py changes. Ensure universal wheels. 2014-07-01 14:33:04 -07:00
setup.py Increment version to 3.5 2014-11-04 19:43:14 -08:00
THANKS minor spelling fixes 2014-09-15 20:29:00 -04:00
tox.ini Add python 3.4 to tox config. 2014-04-17 22:57:26 +02:00

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