Skip to content
Permalink
Browse files

Make TAG_PATH and CATEGORY_PATH translatable (part of #1914)

  • Loading branch information
ralsina committed Sep 4, 2015
1 parent 1b784d5 commit 9d1a50581f0feb14bd5ea4e28d9adb0c4d5e645e
Showing with 20 additions and 14 deletions.
  1. +5 −2 CHANGES.txt
  2. +2 −2 nikola/conf.py.in
  3. +4 −1 nikola/nikola.py
  4. +9 −9 nikola/plugins/task/tags.py
@@ -4,6 +4,9 @@ New in master
Features
--------

* Made TAG_PATH translatable (Issue #1914)
* Made CATEGORY_PATH translatable (Issue #1914)

Bugfixes
--------

@@ -44,8 +47,8 @@ Bugfixes
* Make nikola tabcompletion work outside sites (Issue #1983)
* Fix display of categories list in bootstrap theme (Issue #2002)
* If webassets is not installed, use unbundled assets (Issue #1992)
* Check links in Atom and sitemap files (Issue #1993)
* Link checker should check all absolute URLs to self (Issue #1991)
* Check links in Atom and sitemap files (Issue #1993)
* Link checker should check all absolute URLs to self (Issue #1991)
* Check ``img|source[@srcset]`` as part of ``check -l`` (Issue #1989)
* Clean up translations for third party components
* ``pagekind["main_index"]`` set on the main indexes to differentiate
@@ -271,7 +271,7 @@ POSTS_SECTIONS = True
# output / TRANSLATION[lang] / TAG_PATH / index.html (list of tags)
# output / TRANSLATION[lang] / TAG_PATH / tag.html (list of posts for a tag)
# output / TRANSLATION[lang] / TAG_PATH / tag.xml (RSS feed for a tag)
# TAG_PATH = "categories"
# TAG_PATH = "categories" # Translatable

# If TAG_PAGES_ARE_INDEXES is set to True, each tag's page will contain
# the posts themselves. If set to False, it will be just a list of links.
@@ -310,7 +310,7 @@ HIDDEN_TAGS = ['mathjax']
# output / TRANSLATION[lang] / CATEGORY_PATH / index.html (list of categories)
# output / TRANSLATION[lang] / CATEGORY_PATH / CATEGORY_PREFIX category.html (list of posts for a category)
# output / TRANSLATION[lang] / CATEGORY_PATH / CATEGORY_PREFIX category.xml (RSS feed for a category)
# CATEGORY_PATH = "categories"
# CATEGORY_PATH = "categories" # Translatable
# CATEGORY_PREFIX = "cat_"

# If CATEGORY_ALLOW_HIERARCHIES is set to True, categories can be organized in
@@ -549,7 +549,10 @@ def __init__(self, **config):
'POSTS_SECTION_NAME',
'POSTS_SECTION_TITLE',
'INDEXES_PAGES',
'INDEXES_PRETTY_PAGE_URL',)
'INDEXES_PRETTY_PAGE_URL',
# PATH options (Issue #1914)
'TAG_PATH',
)

self._GLOBAL_CONTEXT_TRANSLATABLE = ('blog_author',
'blog_title',
@@ -396,7 +396,7 @@ def slugify_tag_name(self, name):
def tag_index_path(self, name, lang):
"""Return path to the tag index."""
return [_f for _f in [self.site.config['TRANSLATIONS'][lang],
self.site.config['TAG_PATH'],
self.site.config['TAG_PATH'][lang],
self.site.config['INDEX_FILE']] if _f]

def category_index_path(self, name, lang):
@@ -410,25 +410,25 @@ def tag_path(self, name, lang):
if self.site.config['PRETTY_URLS']:
return [_f for _f in [
self.site.config['TRANSLATIONS'][lang],
self.site.config['TAG_PATH'],
self.site.config['TAG_PATH'][lang],
self.slugify_tag_name(name),
self.site.config['INDEX_FILE']] if _f]
else:
return [_f for _f in [
self.site.config['TRANSLATIONS'][lang],
self.site.config['TAG_PATH'],
self.site.config['TAG_PATH'][lang],
self.slugify_tag_name(name) + ".html"] if _f]

def tag_atom_path(self, name, lang):
"""Return path to a tag Atom feed."""
return [_f for _f in [self.site.config['TRANSLATIONS'][lang],
self.site.config['TAG_PATH'], self.slugify_tag_name(name) + ".atom"] if
self.site.config['TAG_PATH'][lang], self.slugify_tag_name(name) + ".atom"] if
_f]

def tag_rss_path(self, name, lang):
"""Return path to a tag RSS feed."""
return [_f for _f in [self.site.config['TRANSLATIONS'][lang],
self.site.config['TAG_PATH'], self.slugify_tag_name(name) + ".xml"] if
self.site.config['TAG_PATH'][lang], self.slugify_tag_name(name) + ".xml"] if
_f]

def slugify_category_name(self, name):
@@ -450,21 +450,21 @@ def category_path(self, name, lang):
"""Return path to a category."""
if self.site.config['PRETTY_URLS']:
return [_f for _f in [self.site.config['TRANSLATIONS'][lang],
self.site.config['CATEGORY_PATH']] if
self.site.config['CATEGORY_PATH'][lang]] if
_f] + self.slugify_category_name(name) + [self.site.config['INDEX_FILE']]
else:
return [_f for _f in [self.site.config['TRANSLATIONS'][lang],
self.site.config['CATEGORY_PATH']] if
self.site.config['CATEGORY_PATH'][lang]] if
_f] + self._add_extension(self.slugify_category_name(name), ".html")

def category_atom_path(self, name, lang):
"""Return path to a category Atom feed."""
return [_f for _f in [self.site.config['TRANSLATIONS'][lang],
self.site.config['CATEGORY_PATH']] if
self.site.config['CATEGORY_PATH'][lang]] if
_f] + self._add_extension(self.slugify_category_name(name), ".atom")

def category_rss_path(self, name, lang):
"""Return path to a category RSS feed."""
return [_f for _f in [self.site.config['TRANSLATIONS'][lang],
self.site.config['CATEGORY_PATH']] if
self.site.config['CATEGORY_PATH'][lang]] if
_f] + self._add_extension(self.slugify_category_name(name), ".xml")

0 comments on commit 9d1a505

Please sign in to comment.