mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
cleaning
This commit is contained in:
parent
3c983d62c9
commit
c393b011c4
1 changed files with 5 additions and 10 deletions
|
|
@ -169,13 +169,11 @@ def truncate_html_words(s, num, end_text='...'):
|
||||||
|
|
||||||
|
|
||||||
def process_translations(content_list):
|
def process_translations(content_list):
|
||||||
""" Finds all translation and returns
|
""" Finds all translation and returns tuple with two lists (index,
|
||||||
tuple with two lists (index, translations).
|
translations). Index list includes items in default language or items
|
||||||
Index list includes items in default language
|
which have no variant in default language.
|
||||||
or items which have no variant in default language.
|
|
||||||
|
|
||||||
Also, for each content_list item, it
|
Also, for each content_list item, it sets attribute 'translations'
|
||||||
sets attribute 'translations'
|
|
||||||
"""
|
"""
|
||||||
content_list.sort(key=attrgetter('slug'))
|
content_list.sort(key=attrgetter('slug'))
|
||||||
grouped_by_slugs = groupby(content_list, attrgetter('slug'))
|
grouped_by_slugs = groupby(content_list, attrgetter('slug'))
|
||||||
|
|
@ -185,10 +183,7 @@ def process_translations(content_list):
|
||||||
for slug, items in grouped_by_slugs:
|
for slug, items in grouped_by_slugs:
|
||||||
items = list(items)
|
items = list(items)
|
||||||
# find items with default language
|
# find items with default language
|
||||||
default_lang_items = filter(
|
default_lang_items = filter(attrgetter('in_default_lang'), items)
|
||||||
attrgetter('in_default_lang'),
|
|
||||||
items
|
|
||||||
)
|
|
||||||
len_ = len(default_lang_items)
|
len_ = len(default_lang_items)
|
||||||
if len_ > 1:
|
if len_ > 1:
|
||||||
warning(u'there are %s variants of "%s"' % (len_, slug))
|
warning(u'there are %s variants of "%s"' % (len_, slug))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue