Skip to content

Commit

Permalink
Adjusting to updated version of flake8.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Nov 20, 2016
1 parent 0ecaff5 commit 7632df1
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions nikola/__main__.py
Expand Up @@ -247,6 +247,7 @@ def clean_tasks(self, tasks, dryrun):
shutil.rmtree(cache_folder)
return super(Clean, self).clean_tasks(tasks, dryrun)


# Nikola has its own "auto" commands that uses livereload.
# Expose original doit "auto" command as "doit_auto".
DoitAuto.name = 'doit_auto'
Expand Down
1 change: 1 addition & 0 deletions nikola/data/samplesite/listings/hello.py
Expand Up @@ -7,5 +7,6 @@ def hello(name='world'):
greeting = "hello " + name
print(greeting)


if __name__ == "__main__":
hello(*sys.argv[1:])
1 change: 1 addition & 0 deletions nikola/plugin_categories.py
Expand Up @@ -154,6 +154,7 @@ def help(self):
text.append(self.doc_description)
return "\n".join(text)


DoitCommand.help = help


Expand Down
1 change: 1 addition & 0 deletions nikola/plugins/compile/markdown/mdx_gist.py
Expand Up @@ -203,6 +203,7 @@ def makeExtension(configs=None): # pragma: no cover
"""Make Markdown extension."""
return GistExtension(configs)


if __name__ == '__main__':
import doctest

Expand Down
1 change: 1 addition & 0 deletions nikola/plugins/compile/markdown/mdx_podcast.py
Expand Up @@ -92,6 +92,7 @@ def makeExtension(configs=None): # pragma: no cover
"""Make Markdown extension."""
return PodcastExtension(configs)


if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=(doctest.NORMALIZE_WHITESPACE +
Expand Down
2 changes: 2 additions & 0 deletions nikola/plugins/compile/rest/__init__.py
Expand Up @@ -206,6 +206,7 @@ def shortcode_role(name, rawtext, text, lineno, inliner,
"""A shortcode role that passes through raw inline HTML."""
return [docutils.nodes.raw('', text, format='html')], []


roles.register_canonical_role('raw-html', shortcode_role)
roles.register_canonical_role('html', shortcode_role)
roles.register_canonical_role('sc', shortcode_role)
Expand Down Expand Up @@ -297,6 +298,7 @@ def rst2html(source, source_path=None, source_class=docutils.io.StringInput,

return pub.writer.parts['docinfo'] + pub.writer.parts['fragment'], pub.document.reporter.max_level, pub.settings.record_dependencies


# Alignment helpers for extensions
_align_options_base = ('left', 'center', 'right')

Expand Down
1 change: 1 addition & 0 deletions nikola/plugins/compile/rest/listing.py
Expand Up @@ -119,6 +119,7 @@ def run(self):

return [node]


# Monkey-patch: replace insane docutils CodeBlock with our implementation.
docutils.parsers.rst.directives.body.CodeBlock = CodeBlock
docutils.parsers.rst.directives.misc.CodeBlock = CodeBlock
Expand Down
1 change: 1 addition & 0 deletions nikola/plugins/compile/rest/post_list.py
Expand Up @@ -307,5 +307,6 @@ def _do_post_list(start=None, stop=None, reverse=False, tags=None, categories=No
template, None, template_data)
return output, template_deps


# Request file name from shortcode (Issue #2412)
_do_post_list.nikola_shortcode_pass_filename = True
1 change: 1 addition & 0 deletions nikola/plugins/task/sitemap/__init__.py
Expand Up @@ -322,6 +322,7 @@ def get_lastmod(self, p):
lastmod = datetime.datetime.utcfromtimestamp(os.stat(p).st_mtime).replace(tzinfo=dateutil.tz.gettz('UTC'), second=0, microsecond=0).isoformat().replace('+00:00', 'Z')
return lastmod


if __name__ == '__main__':
import doctest
doctest.testmod()
2 changes: 2 additions & 0 deletions nikola/utils.py
Expand Up @@ -165,6 +165,7 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
n = str(category)
get_logger(n, STDERR_HANDLER).warn('{0}:{1}: {2}'.format(filename, lineno, message))


warnings.showwarning = showwarning


Expand Down Expand Up @@ -761,6 +762,7 @@ def remove_file(source):
elif os.path.isfile(source) or os.path.islink(source):
os.remove(source)


# slugify is adopted from
# http://code.activestate.com/recipes/
# 577257-slugify-make-a-string-usable-in-a-url-or-filename/
Expand Down

0 comments on commit 7632df1

Please sign in to comment.