1
0
Fork 0
forked from github/pelican

control scope of identification of translations with new settings

This commit is contained in:
Oliver Urs Lenz 2018-03-22 23:47:51 +01:00
commit 77c967f1db
8 changed files with 165 additions and 99 deletions

View file

@ -17,6 +17,7 @@ from tempfile import mkdtemp
from six import StringIO
from pelican.contents import Article
from pelican.readers import default_metadata
from pelican.settings import DEFAULT_CONFIG
__all__ = ['get_article', 'unittest', ]
@ -113,9 +114,10 @@ def mute(returns_output=False):
return decorator
def get_article(title, slug, content, lang, extra_metadata=None):
metadata = {'slug': slug, 'title': title, 'lang': lang}
if extra_metadata is not None:
def get_article(title, content, **extra_metadata):
metadata = default_metadata(settings=DEFAULT_CONFIG)
metadata['title'] = title
if extra_metadata:
metadata.update(extra_metadata)
return Article(content, metadata=metadata)