mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Ignore empty tags and authors. Fixes #1398.
This commit is contained in:
parent
55c2fcb2d5
commit
6541dacde2
1 changed files with 8 additions and 2 deletions
|
|
@ -28,14 +28,20 @@ from pelican.contents import Page, Category, Tag, Author
|
|||
from pelican.utils import get_date, pelican_open, FileStampDataCacher, SafeDatetime
|
||||
|
||||
|
||||
def strip_split(text, sep=','):
|
||||
"""Return a list of stripped, non-empty substrings, delimited by sep."""
|
||||
items = [x.strip() for x in text.split(sep)]
|
||||
return [x for x in items if x]
|
||||
|
||||
|
||||
METADATA_PROCESSORS = {
|
||||
'tags': lambda x, y: [Tag(tag, y) for tag in x.split(',')],
|
||||
'tags': lambda x, y: [Tag(tag, y) for tag in strip_split(x)],
|
||||
'date': lambda x, y: get_date(x),
|
||||
'modified': lambda x, y: get_date(x),
|
||||
'status': lambda x, y: x.strip(),
|
||||
'category': Category,
|
||||
'author': Author,
|
||||
'authors': lambda x, y: [Author(author.strip(), y) for author in x.split(',')],
|
||||
'authors': lambda x, y: [Author(author, y) for author in strip_split(x)],
|
||||
}
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue