Skip to content
Permalink
Browse files

Merge branch 'master' into taxonomy-lang-refs

  • Loading branch information
felixfontein committed May 22, 2017
2 parents edbd156 + e5cf7fd commit af939e7b1849f00db13515c47662d68a0e692cfa
@@ -1,21 +1,18 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,yml,yaml}]
indent_size = 2

[CHANGES.txt]
max_line_length = 70

[*.py]
trim_trailing_whitespace = true

[nikola/data/themes/base/assets/css/theme.css]
indent_style = tab

[{appveyor.yml,.travis.yml}]
indent_style = space
indent_size = 2
@@ -1,29 +1,199 @@
*.py[co]
*.db
*~
/dist
*.log
*.diff
*.patch
tmp/
cache/
output/
build/

# GitHub token
.pypt/gh-token

#
.DS_Store

# All of .idea should be ignored
.idea/

# Created by https://www.gitignore.io/api/pydev,python,pycharm,vim

### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### pydev ###
.pydevproject

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.cache/
.installed.cfg
*.egg

# virtualenvwrapper oh-my-zsh plugin
.venv
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# coverage.py
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# GitHub token
.pypt/gh-token
# celery beat schedule file
celerybeat-schedule

#
.DS_Store
# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

### Vim ###
# swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# session
Session.vim
# temporary
.netrwhist
*~

# Demo for Bagguette
bower_components/baguettebox.js/demo
# End of https://www.gitignore.io/api/pydev,python,pycharm,vim
@@ -22,6 +22,11 @@ Features
Bugfixes
--------

* Save dependencies for template hooks properly (using .__doc__ or
.template_registry_identifier for callables)
* Enable larger panorama thumbnails (Issue #2780)
* Disable ``archive_rss`` link handler, which was useless because no
such RSS was ever generated (Issue #2783)
* Ignore files ending wih "bak" (Issue #2740)
* Use page.tmpl by default, which is inherited from story.tmpl (Issue
#1891)
@@ -18,6 +18,9 @@ In goes content, out comes a website, ready to deploy.
.. image:: http://img.shields.io/badge/license-MIT-green.svg
:target: https://github.com/getnikola/nikola/blob/master/LICENSE.txt

.. image:: https://build.snapcraft.io/badge/getnikola/nikola.svg
:target: https://build.snapcraft.io/user/getnikola/nikola

Why Static Websites?
--------------------

@@ -537,21 +537,22 @@ HTML:

# In set_site
def generate_html_bit(name, ftype='js'):
"""Generate HTML for an asset."""
return '<script src="/assets/{t}/{n}.{t}">'.format(n=name, t=ftype)

site.template_hooks['extra_head'].append(generate_html_bit, False, 'fancyplugin', type='js')
site.template_hooks['extra_head'].append(generate_html_bit, False, 'fancyplugin', ftype='js')


The second argument to ``append()`` is used to determine whether the function
needs access to the current template context and the site. If it is set to
``True``, the function will also receive ``site`` and ``context`` keyword
arguments. Example use:


.. code-block:: python

# In set_site
def greeting(addr, endswith='', site=None, context=None):
"""Greet someone."""
if context['lang'] == 'en':
greet = u'Hello'
elif context['lang'] == 'es':
@@ -564,6 +565,13 @@ arguments. Example use:

site.template_hooks['page_header'].append(greeting, True, u'Nikola Tesla', endswith=u'!')

Dependencies for template hooks:

* if the input is a string, the string value, alongside arguments to ``append``, is used for calculating dependencies
* if the input is a callable, it attempts ``input.template_registry_identifier``, then ``input.__doc__``, and if neither is available, it uses a static string.

Make sure to provide at least a docstring, or a identifier, to ensure rebuilds work properly.

Shortcodes
==========

@@ -579,7 +587,7 @@ So, if you are creating a plugin that generates markup, it may be a good idea
to register it as a shortcode in addition of to restructured text directive or
markdown extension, thus making it available to all markup formats.

To implement your own shortcodes from a plugin, you can create a plugin inheriting ``ShortcodePlugin`` and
To implement your own shortcodes from a plugin, you can create a plugin inheriting ``ShortcodePlugin`` and
from its ``set_site`` method, call

``Nikola.register_shortcode(name, func)`` with the following arguments:
@@ -610,7 +618,7 @@ variable keyword arguments):
between them, otherwise ``None``.

``lang``:
The current language.
The current language.

If the shortcode tag has arguments of the form ``foo=bar`` they will be
passed as named arguments. Everything else will be passed as positional
@@ -303,9 +303,8 @@ The archive navigation variables are available only if ``create_archive_navigati

============================== ============== ========================================================================
Name Type Description
============================== ============== ========================================================================
``kind`` str Always ``"archive"``
``archive_name`` str? Name of the archive (only if using indexes)
``archive_name`` str? Name of the archive
``create_archive_navigation`` bool ``CREATE_ARCHIVE_NAVIGATION`` setting
``has_archive_navigation`` bool Whether or not archive navigation is available
``up_archive`` str? Link to the archive one level up
@@ -385,15 +384,16 @@ Name Type Description
``source_link`` str Link to the source file
================== ========== ========================================

Variables available in section pages
------------------------------------
Variables available in sections
-------------------------------

.. class:: table table-bordered table-striped

=================== =========== ===========================================================================
Name Type Description
=================== =========== ===========================================================================
``kind`` str Always ``"section"``
``section`` str Section name (internal)
``other_languages`` list<tuple> List of tuples ``(lang, section, name)`` of same section in other languages
=================== =========== ===========================================================================

@@ -284,9 +284,10 @@ def load_tasks(self, cmd, opt_values, pos_args):
self.nikola.gen_tasks('post_render', "LateTask", 'Group of tasks to be executed after site is rendered.'))
signal('initialized').send(self.nikola)
except Exception:
LOGGER.error('Error loading tasks')
LOGGER.error('Error loading tasks. An unhandled exception occurred.')
if self.nikola.debug:
raise
_print_exception()
sys.exit(3)
return tasks + latetasks, DOIT_CONFIG

@@ -372,8 +373,10 @@ def run(self, cmd_args):
try:
return super(DoitNikola, self).run(cmd_args)
except Exception:
LOGGER.error('An unhandled exception occurred.')
if self.nikola.debug:
raise
_print_exception()
return 1

@staticmethod
@@ -410,5 +413,12 @@ def levenshtein(s1, s2):
return previous_row[-1]


def _print_exception():
"""Print an exception in a friendlier, shorter style."""
etype, evalue, _ = sys.exc_info()
LOGGER.error(''.join(traceback.format_exception(etype, evalue, None, limit=0, chain=False)).strip())
LOGGER.notice("To see more details, run Nikola in debug mode (set environment variable NIKOLA_DEBUG=1)")


if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
@@ -44,7 +44,7 @@
{{ comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path) }}
</section>
{% endif %}
{{ math.math_styles_ifpost(post) }}
{{ math.math_scripts_ifpost(post) }}
</article>
{{ comments.comment_link_script() }}
{% endblock %}

0 comments on commit af939e7

Please sign in to comment.