Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into hackerthemes
  • Loading branch information
ralsina committed May 2, 2018
2 parents 29e1c6f + 477f9a0 commit fe4bb0d
Show file tree
Hide file tree
Showing 118 changed files with 863 additions and 817 deletions.
47 changes: 40 additions & 7 deletions CHANGES.txt
@@ -1,10 +1,33 @@
New in master
=============

Important compatibility changes
-------------------------------

* Rename ``crumbs.tmpl`` to ``ui_helper.tmpl`` and the breadcrumbs
``bar`` function to ``breadcrumbs`` (your templates may need
changing as well)
* Rename ``post.is_mathjax`` to ``post.has_math``. Themes using
``post.is_mathjax`` must be updated; it is recommended that they are
changed to use ``math_helper.tmpl``.
* Reading reST docinfo metadata, including first heading as title,
requires ``USE_REST_DOCINFO_METADATA`` now (Issue #2987)
* RSS feeds might have changed their places due to ``RSS_PATH``
behavior changes (you may need to change ``RSS_PATH``,
``RSS_FILENAME_BASE``)
* Atom feeds for archives and Atom pagination are no longer supported
(Issue #3016)

Features
--------

* Support hackerthemes.com themes and renamed bootswatch_theme command subtheme (Issue #3049)
* Add ``DISABLE_MAIN_ATOM_FEED`` setting (Issue #3016, Issue #3039)
* Add ``ATOM_FILENAME_BASE`` setting (defaults to ``index`` for
existing sites, but ``feed`` for new sites) (Issue #3016)
* Tags ``draft``, ``private`` and ``mathjax`` are no longer treated
special if ``USE_TAG_METADATA`` is set to ``False`` (default for
new sites) (Issue #2761)
* Produce a better error message when a template referenced in another
template is missing (Issue #3055)
* Support captioned images and image ordering in galleries (Issue #3017)
Expand Down Expand Up @@ -62,7 +85,11 @@ Features
Bugfixes
--------

* Renamed ``DISABLE_INDEXES_PLUGIN_INDEX_AND_ATOM_FEED`` to ``DISABLE_INDEXES``
* Always follow ``FEED_LENGTH`` for Atom feeds
* Apply filters to all Atom feeds
* Read file metadata if compiler metadata exists and prefer it over
compiler metadata (Issue #3008)
* Rename ``DISABLE_INDEXES_PLUGIN_INDEX_AND_ATOM_FEED`` to ``DISABLE_INDEXES``
and ``DISABLE_INDEXES_PLUGIN_RSS_FEED`` to ``DISABLE_MAIN_RSS_FEED`` (Issue #3039)
* Make chart shortcode its own plugin and make the reST directive
depend on it.
Expand Down Expand Up @@ -110,6 +137,17 @@ Bugfixes
* Language was not passed to title and link generation for page indexes
* Addressed issue with snaps not allowing certain functions to work properly.

Removed conf.py settings
------------------------

The following settings have been removed. Nikola will now always
behave as if the value was what is displayed afer the setting name.

* ``FEED_PREVIEWIMAGE = True``
* ``SITEMAP_INCLUDE_FILELESS_DIRS = True``
* ``USE_OPEN_GRAPH = True``
* ``USE_BASE_TAG = False``

Removed features
----------------

Expand All @@ -124,12 +162,7 @@ Removed features
* Removed taxonomy option ``also_create_classifications_from_other_languages``
(Issue #2785)
* Removed old 7-line metadata format (Issue #2839)

Other changes
-------------

* Rename ``crumbs.tmpl`` to ``ui_helper.tmpl`` and the breadcrumbs
``bar`` function to ``breadcrumbs``
* Atom feeds are now limited to one page (Issue #3016)

New in v7.8.8
=============
Expand Down
37 changes: 21 additions & 16 deletions docs/manual.rst
Expand Up @@ -3,7 +3,8 @@
.. date: 2012-03-30 23:00:00 UTC-03:00
.. link:
.. description:
.. tags: mathjax
.. tags:
.. has_math: true
.. author: The Nikola Team
The Nikola Handbook
Expand Down Expand Up @@ -299,8 +300,14 @@ date
Adding a timezone is recommended. (required for posts)

tags
Comma-separated tags of the post. Some tags have special meaning, including
``draft``, ``private``, ``mathjax``
Comma-separated tags of the post.

status
Can be set to ``published`` (default), ``featured``, ``draft``, or ``private``.

has_math
If set to ``true`` or ``yes``, MathJax resp. KaTeX support is enabled
for this post.

category
Like tags, except each post can have only one, and they usually have
Expand Down Expand Up @@ -809,11 +816,11 @@ Or you can completely customize the link using the ``READ_MORE_LINK`` option.
Drafts
~~~~~~

If you add a "draft" tag to a post, then it will not be shown in indexes and feeds.
It *will* be compiled, and if you deploy it it *will* be made available, so use
with care. If you wish your drafts to be not available in your deployed site, you
can set ``DEPLOY_DRAFTS = False`` in your configuration. This will not work if
lazily include ``nikola build`` in your ``DEPLOY_COMMANDS``.
If you set the ``status`` metadata field of a post to ``draft``, it will not be shown
in indexes and feeds. It *will* be compiled, and if you deploy it it *will* be made
available, so use with care. If you wish your drafts to be not available in your
deployed site, you can set ``DEPLOY_DRAFTS = False`` in your configuration. This will
not work if lazily include ``nikola build`` in your ``DEPLOY_COMMANDS``.

Also if a post has a date in the future, it will not be shown in indexes until
you rebuild after that date. This behavior can be disabled by setting
Expand All @@ -826,9 +833,9 @@ Generally, you want FUTURE_IS_NOW and DEPLOY_FUTURE to be the same value.
Private Posts
~~~~~~~~~~~~~

If you add a "private" tag to a post, then it will not be shown in indexes and feeds.
It *will* be compiled, and if you deploy it it *will* be made available, so it will
not generate 404s for people who had linked to it.
If you set the ``status`` metadata field of a post to ``private``, it will not be shown
in indexes and feeds. It *will* be compiled, and if you deploy it it *will* be made
available, so it will not generate 404s for people who had linked to it.

Queuing Posts
~~~~~~~~~~~~~
Expand Down Expand Up @@ -967,8 +974,6 @@ Please note that tags are case-sensitive and that you cannot have two tags that
ERROR: Nikola: Tag Nikola is used in: posts/second-post.rst
ERROR: Nikola: Tag nikola is used in: posts/1.rst
Nikola uses some tags to mark a post as “special” — those are ``draft``, ``private``, ``mathjax`` (for math support).

You can also generate a tag cloud with the `tx3_tag_cloud <https://plugins.getnikola.com/#tx3_tag_cloud>`_ plugin.

Categories
Expand Down Expand Up @@ -2288,9 +2293,9 @@ Nikola uses MathJax by default. If you want to use KaTeX (faster and prettier,
but may not support every feature yet), set ``USE_KATEX = True`` in
``conf.py``.

To use mathematics in a post, you **must** add the ``mathjax`` tag, no matter
which renderer you are using. (Exception: posts that are Jupyter Notebooks are
automatically marked as math)
To use mathematics in a post, you **must** set the ``has_math`` metadata field
to ``true``. (Exception: posts that are Jupyter Notebooks are automatically
marked as math)

.. Note to editors: the paragraph below uses U+200B, zero-width space. Don’t break it.
Expand Down
2 changes: 0 additions & 2 deletions docs/template-variables.rst
Expand Up @@ -104,11 +104,9 @@ Name Type Descript
``twitter_card`` dict ``TWITTER_CARD`` setting, defaults to an empty dictionary
``url_replacer`` function ``Nikola.url_replacer`` function
``url_type`` str ``URL_TYPE`` setting
``use_base_tag`` bool ``USE_BASE_TAG`` setting
``use_bundles`` bool ``USE_BUNDLES`` setting
``use_cdn`` bool ``USE_CDN`` setting
``use_katex`` bool ``USE_KATEX`` setting
``use_open_graph`` bool ``USE_OPEN_GRAPH`` setting, defaults to True
``subtheme`` str? ``THEME_REVEAL_CONFIG_SUBTHEME`` setting (only if set — deprecated)
``transition`` str? ``THEME_REVEAL_CONFIG_TRANSITION`` setting (only if set — deprecated)
================================== ================================== ================================================================================
Expand Down
54 changes: 19 additions & 35 deletions nikola/conf.py.in
Expand Up @@ -505,16 +505,6 @@ FRONT_INDEX_HEADER = {
# absolute: a complete URL (that includes the SITE_URL)
# URL_TYPE = 'rel_path'

# If USE_BASE_TAG is True, then all HTML files will include
# something like <base href=http://foo.var.com/baz/bat> to help
# the browser resolve relative links.
# Most people don’t need this tag; major websites don’t use it. Use
# only if you know what you’re doing. If this is True, your website
# will not be fully usable by manually opening .html files in your web
# browser (`nikola serve` or `nikola auto` is mandatory). Also, if you
# have mirrors of your site, they will point to SITE_URL everywhere.
USE_BASE_TAG = False

# Extension for RSS feed files
# RSS_EXTENSION = ".xml"

Expand All @@ -528,10 +518,17 @@ USE_BASE_TAG = False
# RSS_PATH = ""

# Final location for the blog main Atom feed is:
# output / TRANSLATION[lang] / ATOM_PATH / index.atom
# output / TRANSLATION[lang] / ATOM_PATH / ATOM_FILENAME_BASE ATOM_EXTENSION
# (translatable)
# ATOM_PATH = ""

# Atom filename base (without extension); used for indexes.
# (translatable)
ATOM_FILENAME_BASE = "feed"

# Extension for Atom feed files
# ATOM_EXTENSION = ".atom"

# Slug the Tag URL. Easier for users to type, special characters are
# often removed or replaced as well.
# SLUG_TAG_PATH = True
Expand Down Expand Up @@ -929,14 +926,6 @@ COMMENT_SYSTEM_ID = ${COMMENT_SYSTEM_ID}
# it will instead /foo/default.html => /foo)
STRIP_INDEXES = ${STRIP_INDEXES}

# Should the sitemap list directories which only include other directories
# and no files.
# Default to True
# If this is False
# e.g. /2012 includes only /01, /02, /03, /04, ...: don't add it to the sitemap
# if /2012 includes any files (including index.html)... add it to the sitemap
# SITEMAP_INCLUDE_FILELESS_DIRS = True

# List of files relative to the server root (!) that will be asked to be excluded
# from indexing and other robotic spidering. * is supported. Will only be effective
# if SITE_URL points to server root. The list is used to exclude resources from
Expand Down Expand Up @@ -1071,9 +1060,6 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.c
# between each other. Old Atom feeds with no changes are marked as archived.
# GENERATE_ATOM = False

# Extension for Atom feed files
# ATOM_EXTENSION = ".atom"

# Only include teasers in Atom and RSS feeds. Disabling include the full
# content. Defaults to True.
# FEED_TEASERS = True
Expand All @@ -1084,12 +1070,6 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.c
# Number of posts in Atom and RSS feeds.
# FEED_LENGTH = 10

# Include preview image as a <figure><img></figure> at the top of the entry.
# Requires FEED_PLAIN = False. If the preview image is found in the content,
# it will not be included again. Image will be included as-is, aim to optmize
# the image source for Feedly, Apple News, Flipboard, and other popular clients.
# FEED_PREVIEWIMAGE = True

# RSS_LINK is a HTML fragment to link the RSS or Atom feeds. If set to None,
# the base.tmpl will use the feed Nikola generates. However, you may want to
# change it for a FeedBurner feed or something else.
Expand Down Expand Up @@ -1210,11 +1190,6 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.c
# Additional metadata that is added to a post when creating a new_post
# ADDITIONAL_METADATA = {}

# Nikola supports Open Graph Protocol data for enhancing link sharing and
# discoverability of your site on Facebook, Google+, and other services.
# Open Graph is enabled by default.
# USE_OPEN_GRAPH = True

# Nikola supports Twitter Card summaries, but they are disabled by default.
# They make it possible for you to attach media to Tweets that link
# to your content.
Expand Down Expand Up @@ -1242,10 +1217,10 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.c
# Plugins you don't want to use. Be careful :-)
# DISABLED_PLUGINS = ["render_galleries"]

# Special settings to disable only parts of the indexes plugin (to allow RSS
# but no blog indexes, or to allow blog indexes and Atom but no site-wide RSS).
# Special settings to disable only parts of the indexes plugin.
# Use with care.
# DISABLE_INDEXES = False
# DISABLE_MAIN_ATOM_FEED = False
# DISABLE_MAIN_RSS_FEED = False

# Add the absolute paths to directories containing plugins to use them.
Expand Down Expand Up @@ -1300,3 +1275,12 @@ GLOBAL_CONTEXT = {}
# GLOBAL_CONTEXT as parameter when the template is about to be
# rendered
GLOBAL_CONTEXT_FILLER = []

# If set to True, the tags 'draft', 'mathjax' and 'private' have special
# meaning. If set to False, these tags are handled like regular tags.
USE_TAG_METADATA = False

# If set to True, a warning is issued if one of the 'draft', 'mathjax'
# and 'private' tags are found in a post. Useful for checking that
# migration was successful.
WARN_ABOUT_TAG_METADATA = False
13 changes: 2 additions & 11 deletions nikola/data/themes/base-jinja/templates/base_helper.tmpl
Expand Up @@ -4,29 +4,20 @@
{% macro html_headstart() %}
<!DOCTYPE html>
<html \
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) or (comment_system == 'facebook') %}
prefix='
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %}
og: http://ogp.me/ns# article: http://ogp.me/ns/article#
{% endif %}
og: http://ogp.me/ns# article: http://ogp.me/ns/article#
{% if comment_system == 'facebook' %}
fb: http://ogp.me/ns/fb#
{% endif %}
' \
{% if use_open_graph or (twitter_card and twitter_card['use_twitter_cards']) %}
vocab="http://ogp.me/ns" \
{% endif %}
{% endif %}
vocab="http://ogp.me/ns" \
{% if is_rtl %}
dir="rtl"
{% endif %}

lang="{{ lang }}">
<head>
<meta charset="utf-8">
{% if use_base_tag %}
<base href="{{ abs_link(permalink) }}">
{% endif %}
{% if description %}
<meta name="description" content="{{ description|e }}">
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions nikola/data/themes/base-jinja/templates/math_helper.tmpl
Expand Up @@ -45,25 +45,25 @@
{% endmacro %}

{% macro math_scripts_ifpost(post) %}
{% if post.is_mathjax %}
{% if post.has_math %}
{{ math_scripts() }}
{% endif %}
{% endmacro %}

{% macro math_scripts_ifposts(posts) %}
{% if posts|selectattr("is_mathjax")|list %}
{% if posts|selectattr("has_math")|list %}
{{ math_scripts() }}
{% endif %}
{% endmacro %}

{% macro math_styles_ifpost(post) %}
{% if post.is_mathjax %}
{% if post.has_math %}
{{ math_styles() }}
{% endif %}
{% endmacro %}

{% macro math_styles_ifposts(posts) %}
{% if posts|selectattr("is_mathjax")|list %}
{% if posts|selectattr("has_math")|list %}
{{ math_styles() }}
{% endif %}
{% endmacro %}
32 changes: 15 additions & 17 deletions nikola/data/themes/base-jinja/templates/post_helper.tmpl
Expand Up @@ -41,31 +41,29 @@
{% endmacro %}

{% macro open_graph_metadata(post) %}
{% if use_open_graph %}
<meta property="og:site_name" content="{{ blog_title|e }}">
<meta property="og:title" content="{{ post.title()[:70]|e }}">
<meta property="og:url" content="{{ abs_link(permalink) }}">
{% if post.description() %}
<meta property="og:site_name" content="{{ blog_title|e }}">
<meta property="og:title" content="{{ post.title()[:70]|e }}">
<meta property="og:url" content="{{ abs_link(permalink) }}">
{% if post.description() %}
<meta property="og:description" content="{{ post.description()[:200]|e }}">
{% else %}
{% else %}
<meta property="og:description" content="{{ post.text(strip_html=True)[:200]|e }}">
{% endif %}
{% if post.previewimage %}
{% endif %}
{% if post.previewimage %}
<meta property="og:image" content="{{ url_replacer(permalink, post.previewimage, lang, 'absolute') }}">
{% endif %}
<meta property="og:type" content="article">
{% endif %}
<meta property="og:type" content="article">
{# Will only work with Pintrest and breaks everywhere else who expect a [Facebook] URI. #}
{# %if post.author(): #}
{# <meta property="article:author" content="{{ post.author()|e }}"> #}
{# %endif #}
{% if post.date.isoformat() %}
{% if post.date.isoformat() %}
<meta property="article:published_time" content="{{ post.formatted_date('webiso') }}">
{% endif %}
{% if post.tags %}
{% for tag in post.tags %}
<meta property="article:tag" content="{{ tag|e }}">
{% endfor %}
{% endif %}
{% endif %}
{% if post.tags %}
{% for tag in post.tags %}
<meta property="article:tag" content="{{ tag|e }}">
{% endfor %}
{% endif %}
{% endmacro %}

Expand Down

0 comments on commit fe4bb0d

Please sign in to comment.