Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
PEP 257 compliance for path docstrings
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Sep 4, 2015
1 parent 468d972 commit 2cd8d8e
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 28 deletions.
20 changes: 14 additions & 6 deletions nikola/nikola.py
Expand Up @@ -811,7 +811,7 @@ def init_plugins(self, commands_only=False):
# Remove compiler extensions we don't need
if p[-1].details.has_option('Nikola', 'compiler') and p[-1].details.get('Nikola', 'compiler') in self.disabled_compilers:
bad_candidates.add(p)
utils.LOGGER.debug('Not loading comopiler extension {}', p[-1].name)
utils.LOGGER.debug('Not loading compiler extension {}', p[-1].name)
self.plugin_manager._candidates = list(set(self.plugin_manager._candidates) - bad_candidates)
self.plugin_manager.loadPlugins()

Expand Down Expand Up @@ -1365,7 +1365,9 @@ def path(self, kind, name, lang=None, is_link=False):
return ""

def post_path(self, name, lang):
"""Link to the destination of an element in the POSTS/PAGES settings. For example:
"""Link to the destination of an element in the POSTS/PAGES settings.
Example:
link://post_path/posts => /blog
"""
Expand All @@ -1374,10 +1376,12 @@ def post_path(self, name, lang):
self.config['INDEX_FILE']] if _f]

def root_path(self, name, lang):
"""Link to the current language's root. For example:
"""Link to the current language's root.
Example:
link://root_path => /
link://root_path => /translations/spanish/
"""
d = self.config['TRANSLATIONS'][lang]
Expand All @@ -1387,7 +1391,9 @@ def root_path(self, name, lang):
return []

def slug_path(self, name, lang):
"""A link to a post with given slug, if not ambiguous. For example:
"""A link to a post with given slug, if not ambiguous.
Example:
links://slug/yellow-camaro => /posts/cars/awful/yellow-camaro/index.html
"""
Expand All @@ -1400,7 +1406,9 @@ def slug_path(self, name, lang):
return [_f for _f in results[0].permalink(lang).split('/') if _f]

def filename_path(self, name, lang):
"""Link to post or story by source filename. For example:
"""Link to post or story by source filename.
Example:
link://filename/manual.txt => /docs/handbook.html
"""
Expand Down
8 changes: 6 additions & 2 deletions nikola/plugins/task/archive.py
Expand Up @@ -223,7 +223,9 @@ def gen_tasks(self):
yield self._prepare_task(kw, None, lang, None, items, "list.tmpl", kw["messages"][lang]["Archive"])

def archive_path(self, name, lang, is_feed=False):
"""Link to archive path, name is the year. For example:
"""Link to archive path, name is the year.
Example:
link://archive/2013 => /archives/2013/index.html
"""
Expand All @@ -244,7 +246,9 @@ def archive_path(self, name, lang, is_feed=False):
archive_file] if _f]

def archive_atom_path(self, name, lang):
"""Link to atom archive path, name is the year. For example:
"""Link to atom archive path, name is the year.
Example:
link://archive_atom/2013 => /archives/2013/index.atom
"""
Expand Down
16 changes: 12 additions & 4 deletions nikola/plugins/task/authors.py
Expand Up @@ -252,7 +252,9 @@ def slugify_author_name(self, name):
return name

def author_index_path(self, name, lang):
"""Link to the author's index. For example:
"""Link to the author's index.
Example:
link://authors/ => /authors/index.html
"""
Expand All @@ -261,7 +263,9 @@ def author_index_path(self, name, lang):
self.site.config['INDEX_FILE']] if _f]

def author_path(self, name, lang):
"""Link to an author's page. For example:
"""Link to an author's page.
Example:
link://author/joe => /authors/joe.html
"""
Expand All @@ -278,7 +282,9 @@ def author_path(self, name, lang):
self.slugify_author_name(name) + ".html"] if _f]

def author_atom_path(self, name, lang):
"""Link to an author's Atom feed. For example:
"""Link to an author's Atom feed.
Example:
link://author_atom/joe => /authors/joe.atom
"""
Expand All @@ -287,7 +293,9 @@ def author_atom_path(self, name, lang):
_f]

def author_rss_path(self, name, lang):
"""Link to an author's RSS feed. For example:
"""Link to an author's RSS feed.
Example:
link://author_rss/joe => /authors/joe.rss
"""
Expand Down
16 changes: 12 additions & 4 deletions nikola/plugins/task/indexes.py
Expand Up @@ -217,7 +217,9 @@ def cat_path(i, displayed_i, num_pages, force_addition, extension=None):
yield task

def index_path(self, name, lang, is_feed=False):
"""Link to a numbered index. For example:
"""Link to a numbered index.
Example:
link://index/3 => /index-3.html
"""
Expand All @@ -237,7 +239,9 @@ def index_path(self, name, lang, is_feed=False):
extension=extension)

def index_section_path(self, name, lang, is_feed=False):
"""Link to the index for a section. For example:
"""Link to the index for a section.
Example:
link://section_index/cars => /cars/index.html
"""
Expand All @@ -258,14 +262,18 @@ def index_section_path(self, name, lang, is_feed=False):
extension=extension)

def index_atom_path(self, name, lang):
"""Link to a numbered Atom index. For example:
"""Link to a numbered Atom index.
Example:
link://index_atom/3 => /index-3.atom
"""
return self.index_path(name, lang, is_feed=True)

def index_section_atom_path(self, name, lang):
"""Link to the Atom index for a section. For example:
"""Link to the Atom index for a section.
Example:
link://section_index_atom/cars => /cars/index.atom
"""
Expand Down
9 changes: 6 additions & 3 deletions nikola/plugins/task/listings.py
Expand Up @@ -255,11 +255,14 @@ def render_listing(in_name, out_name, input_folder, output_folder, folders=[], f
}, self.kw["filters"])

def listing_path(self, namep, lang):
"""A link to a listing. It will try to use the file name if
it's not ambiguous, or the file path. For example:
"""A link to a listing.
It will try to use the file name if it's not ambiguous, or the file path.
Example:
link://listing/hello.py => /listings/tutorial/hello.py.html
link://listing/tutorial/hello.py => /listings/tutorial/hello.py.html
"""
namep = namep.replace('/', os.sep)
Expand Down
4 changes: 3 additions & 1 deletion nikola/plugins/task/rss.py
Expand Up @@ -106,7 +106,9 @@ def gen_tasks(self):
yield utils.apply_filters(task, kw['filters'])

def rss_path(self, name, lang):
"""A link to the RSS feed path. For example:
"""A link to the RSS feed path.
Example:
link://rss => /blog/rss.xml
"""
Expand Down
32 changes: 24 additions & 8 deletions nikola/plugins/task/tags.py
Expand Up @@ -394,7 +394,9 @@ def slugify_tag_name(self, name):
return name

def tag_index_path(self, name, lang):
"""A link to the tag index. For example:
"""A link to the tag index.
Example:
link://tag_index => /tags/index.html
"""
Expand All @@ -403,7 +405,9 @@ def tag_index_path(self, name, lang):
self.site.config['INDEX_FILE']] if _f]

def category_index_path(self, name, lang):
"""A link to the category index. For example:
"""A link to the category index.
Example:
link://category_index => /categories/index.html
"""
Expand All @@ -412,7 +416,9 @@ def category_index_path(self, name, lang):
self.site.config['INDEX_FILE']] if _f]

def tag_path(self, name, lang):
"""A link to a tag's page. For example:
"""A link to a tag's page.
Example:
link://tag/cats => /tags/cats.html
"""
Expand All @@ -429,7 +435,9 @@ def tag_path(self, name, lang):
self.slugify_tag_name(name) + ".html"] if _f]

def tag_atom_path(self, name, lang):
"""A link to a tag's Atom feed. For example:
"""A link to a tag's Atom feed.
Example:
link://tag_atom/cats => /tags/cats.atom
"""
Expand All @@ -438,7 +446,9 @@ def tag_atom_path(self, name, lang):
_f]

def tag_rss_path(self, name, lang):
"""A link to a tag's RSS feed. For example:
"""A link to a tag's RSS feed.
Example:
link://tag_rss/cats => /tags/cats.xml
"""
Expand All @@ -462,7 +472,9 @@ def _add_extension(self, path, extension):
return path

def category_path(self, name, lang):
"""A link to a category. For example:
"""A link to a category.
Example:
link://category/dogs => /categories/dogs.html
"""
Expand All @@ -476,7 +488,9 @@ def category_path(self, name, lang):
_f] + self._add_extension(self.slugify_category_name(name), ".html")

def category_atom_path(self, name, lang):
"""A link to a category's Atom feed. For example:
"""A link to a category's Atom feed.
Example:
link://category_atom/dogs => /categories/dogs.atom
"""
Expand All @@ -485,7 +499,9 @@ def category_atom_path(self, name, lang):
_f] + self._add_extension(self.slugify_category_name(name), ".atom")

def category_rss_path(self, name, lang):
"""A link to a category's RSS feed. For example:
"""A link to a category's RSS feed.
Example:
link://category_rss/dogs => /categories/dogs.xml
"""
Expand Down

0 comments on commit 2cd8d8e

Please sign in to comment.