Skip to content

Commit

Permalink
merged master
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed May 4, 2015
2 parents d1dd872 + 6863ace commit ee90115
Show file tree
Hide file tree
Showing 31 changed files with 738 additions and 170 deletions.
26 changes: 26 additions & 0 deletions CHANGES.txt
Expand Up @@ -5,6 +5,24 @@ Features
--------

* Support [code] in wordpress importers (Issue #1186)
* Substitutions for RSS_LINKS_APPEND_QUERY for identifying
the source feed (feedRelUri) and the kind of feed (feedFormat).
* New option GENERATE_ATOM, off by default
* Current and archive Atom feeds for indexes; category, tag, and archive indexes (RFC-4287 and RFC-5005)
* Atom feed auto-discovery in HTML indexes and category/tag indexes
* .atom included in the sitemap index
* New post metadata "updated", inherits "date" if unset
* Allow IPv6 in `nikola auto` (Issue #1682)
* Allow IPv6 in `nikola serve` (Issue #1682)
* Set default new site URL to https://example.com/
* Plugins can manipulate task dependencies (Issue #1679)
* LINK_CHECK_WHITELIST now works with output relative and full fs paths
* Four new filters: html_tidy_nowrap, html_tidy_wrap, html_tidy_wrap_attr,
and html_tidy_mini for prettification and minification. Requires tidy5.
* Multilingual sitemaps (Issue #1610)
* Compatibility with doit v0.28.0 (Issue #1655)
* AddThis is no longer added by default to users’ sites
>>>>>>> master
* New translations (az, fil, tl, uk, zh_TW)
* Add reStructuredText transform support (Issue #1647)
* Produce Unicode output in ``nikola init`` (via Issue #1644)
Expand All @@ -17,6 +35,14 @@ Features
Bugfixes
--------

* RSS_LINKS_APPEND_QUERY not working in RSS feeds for tags
* `nikola check -l` didn’t scan posts
* Don’t use sets for ``FAVICONS`` (Issue #1674)
* Posts/Pages that use post-list will never be up to date (Issue #1671)
* Support using post.text() in post_list_directive.tmpl (Issue #1671)
* Avoid recursive dep when using post-list in a post (Issue #1671)
* Encode IDNs to Punycode in ``nikola init`` and in links;
show an error if the site URL is not Punycode (Issue #1644)
* Make ``images`` the default output directory for IMAGE_FOLDERS
(Issue #1663)
* Don't default to any swatch in bootswatch_theme (Issue #1656)
Expand Down
26 changes: 23 additions & 3 deletions docs/manual.txt
Expand Up @@ -1182,7 +1182,8 @@ to one of "disqus", "intensedebate", "livefyre", "moot", "googleplus",
* For Facebook, you need to `create an app
<https://developers.facebook.com/apps>` (turn off sandbox mode!)
and get an **App ID**
* For isso, it is the URL of isso (must be world-accessible and **have a trailing slash**,
* For isso, it is the URL of isso (must be world-accessible, encoded with
Punycode (if using Internationalized Domain Names) and **have a trailing slash**,
default ``http://localhost:8080/``)

To use comments in a visible site, you should register with the service and
Expand Down Expand Up @@ -1228,7 +1229,7 @@ You can disable comments for a post by adding a "nocomments" metadata field to i
#639).

An alternative or complement to comments are annotations. Nikola integrates
the annotation service provided by `AnnotateIt. <annotateit.org>`_
the annotation service provided by `AnnotateIt. <http://annotateit.org/>`_
To use it, set the ``ANNOTATIONS`` option to True. This is specially useful
if you want feedback on specific parts of your writing.

Expand Down Expand Up @@ -1272,7 +1273,7 @@ The ``conf.py`` options affecting images and gallery pages are these::
# destination folder. A thumbnail will also be created in the same folder with
# ``.thumbnail`` inserted in the file name before the file extension
# (e.g. ``tesla.thumbnail.jpg``).
IMAGE_FOLDERS = {'images': ''}
IMAGE_FOLDERS = {'images': 'images'}
# More image/gallery options:
THUMBNAIL_SIZE = 180
IMAGE_THUMBNAIL_SIZE = 400
Expand Down Expand Up @@ -1346,6 +1347,18 @@ The currently available filters are:
".html": [apply_to_text_file(string.upper)]
}

html_tidy_nowrap
Prettify HTML 5 documents with `tidy5 <http://www.html-tidy.org/>`_

html_tidy_wrap
Prettify HTML 5 documents wrapped at 80 characters with `tidy5 <http://www.html-tidy.org/>`_

html_tidy_wrap_attr
Prettify HTML 5 documents and wrap lines and attributes with `tidy5 <http://www.html-tidy.org/>`_

html_tidy_mini
Minify HTML 5 into smaller documents with `tidy5 <http://www.html-tidy.org/>`_

minify_lines
**THIS FILTER HAS BEEN TURNED INTO A NOOP** and currently does nothing.

Expand Down Expand Up @@ -1634,6 +1647,13 @@ and it will produce:
Post List
~~~~~~~~~

.. WARNING::

Any post or page that uses this directive will **never** be considered up-to-date,
meaning that every time you build the site, that post/page and everything that
depends on it (tag pages, RSS feeds, sitemap, etc.) will be rebuilt.


This directive can be used to generate a list of posts. You could use it, for
example, to make a list of the latest 5 blog posts, or a list of all blog posts
with the tag ``nikola``::
Expand Down
2 changes: 1 addition & 1 deletion dodo.py
Expand Up @@ -38,7 +38,7 @@ def set_nikola_test_locales():
lang = line.split('_')[0]
if lang not in languages:
try:
locale.setlocale(locale.LC_ALL, line)
locale.setlocale(locale.LC_ALL, str(line))
except:
continue
languages.add(lang)
Expand Down
17 changes: 9 additions & 8 deletions nikola/__main__.py
Expand Up @@ -25,7 +25,6 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import print_function, unicode_literals
from operator import attrgetter
import os
import shutil
try:
Expand Down Expand Up @@ -75,7 +74,7 @@ def main(args=None):
conf_filename = 'conf.py'
conf_filename_changed = False
for index, arg in enumerate(args):
if arg[:7] == '--conf=':
if arg[:7] == b'--conf=':
del args[index]
conf_filename = arg[7:]
conf_filename_changed = True
Expand Down Expand Up @@ -172,8 +171,9 @@ def print_usage(cmds):

print("Nikola is a tool to create static websites and blogs. For full documentation and more information, please visit http://getnikola.com/\n\n")
print("Available commands:")
for cmd in sorted(cmds.values(), key=attrgetter('name')):
print(" nikola %-*s %s" % (20, cmd.name, cmd.doc_purpose))
for cmd_name in sorted(cmds.keys()):
cmd = cmds[cmd_name]
print(" nikola {:20s} {}".format(cmd_name, cmd.doc_purpose))
print("")
print(" nikola help show help / reference")
print(" nikola help <command> show command usage")
Expand Down Expand Up @@ -265,20 +265,21 @@ class DoitNikola(DoitMain):
TASK_LOADER = NikolaTaskLoader

def __init__(self, nikola, quiet=False):
super(DoitNikola, self).__init__()
self.nikola = nikola
nikola.doit = self
self.task_loader = self.TASK_LOADER(nikola, quiet)

def get_commands(self):
def get_cmds(self):
# core doit commands
cmds = DoitMain.get_commands(self)
cmds = DoitMain.get_cmds(self)
# load nikola commands
for name, cmd in self.nikola._commands.items():
cmds[name] = cmd
return cmds

def run(self, cmd_args):
sub_cmds = self.get_commands()
sub_cmds = self.get_cmds()
args = self.process_args(cmd_args)
args = [sys_decode(arg) for arg in args]

Expand Down Expand Up @@ -306,7 +307,7 @@ def run(self, cmd_args):
if args[0] not in sub_cmds.keys():
LOGGER.error("Unknown command {0}".format(args[0]))
return 3
if not isinstance(sub_cmds[args[0]], (Command, Help)): # Is a doit command
if sub_cmds[args[0]] is not Help and not isinstance(sub_cmds[args[0]], Command): # Is a doit command
if not self.nikola.configured:
LOGGER.error("This command needs to run inside an "
"existing Nikola site.")
Expand Down
68 changes: 41 additions & 27 deletions nikola/conf.py.in
Expand Up @@ -388,7 +388,7 @@ REDIRECTIONS = ${REDIRECTIONS}
# side optimization for very high traffic sites or low memory servers.
# GZIP_FILES = False
# File extensions that will be compressed
# GZIP_EXTENSIONS = ('.txt', '.htm', '.html', '.css', '.js', '.json', '.xml')
# GZIP_EXTENSIONS = ('.txt', '.htm', '.html', '.css', '.js', '.json', '.atom', '.xml')
# Use an external gzip command? None means no.
# Example: GZIP_COMMAND = "pigz -k {filename}"
# GZIP_COMMAND = None
Expand Down Expand Up @@ -492,28 +492,28 @@ IMAGE_FOLDERS = {'images': 'images'}
# algol
# algol_nu
# arduino
# autumn
# borland
# bw
# colorful
# default
# emacs
# friendly
# fruity
# autumn
# borland
# bw
# colorful
# default
# emacs
# friendly
# fruity
# igor
# lovelace
# manni
# monokai
# murphy
# native
# monokai
# murphy
# native
# paraiso_dark
# paraiso_light
# pastie
# perldoc
# rrt
# tango
# trac
# vim
# pastie
# perldoc
# rrt
# tango
# trac
# vim
# vs
# xcode
# This list MAY be incomplete since pygments adds styles every now and then.
Expand All @@ -529,12 +529,12 @@ IMAGE_FOLDERS = {'images': 'images'}
# You can also use: page/concave/linear/none/default

# FAVICONS contains (name, file, size) tuples.
# Used for create favicon link like this:
# Used to create favicon link like this:
# <link rel="name" href="file" sizes="size"/>
# FAVICONS = {
# FAVICONS = (
# ("icon", "/favicon.ico", "16x16"),
# ("icon", "/icon_128x128.png", "128x128"),
# }
# )

# Show only teasers in the index pages? Defaults to False.
# INDEX_TEASERS = False
Expand All @@ -556,10 +556,14 @@ INDEX_READ_MORE_LINK = ${INDEX_READ_MORE_LINK}
# 'Read more...' for the RSS_FEED, if RSS_TEASERS is True (translatable)
RSS_READ_MORE_LINK = ${RSS_READ_MORE_LINK}

# Append a URL query to the RSS_READ_MORE_LINK and the //rss/item/link in
# RSS feeds. Minimum example for Piwik "pk_campaign=rss" and Google Analytics
# "utm_source=rss&utm_medium=rss&utm_campaign=rss". Advanced option used for
# traffic source tracking.
# Append a URL query to the RSS_READ_MORE_LINK in Atom and RSS feeds. Advanced
# option used for traffic source tracking.
# Minimum example for use with Piwik: "pk_campaign=feed"
# The following tags exist and are replaced for you:
# {feedRelUri} A relative link to the feed.
# {feedFormat} The name of the syndication format.
# Example using replacement for use with Google Analytics:
# "utm_source={feedRelUri}&utm_medium=nikola_feed&utm_campaign={feedFormat}_feed"
RSS_LINKS_APPEND_QUERY = False

# A HTML fragment describing the license, for the sidebar.
Expand Down Expand Up @@ -721,7 +725,8 @@ COMMENT_SYSTEM_ID = ${COMMENT_SYSTEM_ID}
# PANDOC_OPTIONS = []

# Social buttons. This is sample code for AddThis (which was the default for a
# long time). Insert anything you want here, or even make it empty.
# long time). Insert anything you want here, or even make it empty (which is
# the default right now)
# (translatable)
# SOCIAL_BUTTONS_CODE = """
# <!-- Social buttons -->
Expand Down Expand Up @@ -752,12 +757,21 @@ COMMENT_SYSTEM_ID = ${COMMENT_SYSTEM_ID}
# links to it. Set this to False to disable everything RSS-related.
# GENERATE_RSS = True

# By default, Nikola does not generates Atom files for indexes and links to
# them. Generate Atom for tags by setting TAG_PAGES_ARE_INDEXES to True.
# Atom feeds are built based on INDEX_DISPLAY_POST_COUNT and not FEED_LENGTH
# Switch between plain-text summaries and full HTML content using the
# RSS_TEASER option. RSS_LINKS_APPEND_QUERY is also respected. Atom feeds
# are generated even for old indexes and have pagination link relations
# between each other. Old Atom feeds with no changes are marked as archived.
# GENERATE_ATOM = False

# 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.
# RSS_LINK = None

# Show only teasers in the RSS feed? Default to True
# Show only teasers in the RSS and Atom feeds? Default to True
# RSS_TEASERS = True

# Strip HTML in the RSS feed? Default to False
Expand Down
28 changes: 28 additions & 0 deletions nikola/data/themes/base/assets/xml/atom.xsl
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width"/>
<title><xsl:value-of select="feed/title"/> (Atom feed)</title>
<style><![CDATA[html{margin:0;padding:0;}body{color:hsl(180,1%,31%);font-family:Helvetica,Arial,sans-serif;font-size:17px;line-height:1.4;margin:5%;max-width:35rem;padding:0;}input{min-width:20rem;margin-left:.2rem;padding-left:.2rem;padding-right:.2rem;}ol{list-style-type:disc;padding-left:1rem;}h2{font-size:22px;font-weight:inherit;}]]></style>
</head>
<body>
<h1><xsl:value-of select="feed/title"/> (Atom feed)</h1>
<p>This is an Atom feed. To subscribe to it, copy its address and paste it when your feed reader asks for it. It will be updated periodically in your reader. New to feeds? <a href="https://duckduckgo.com/?q=how+to+get+started+with+rss+feeds" title="Search on the web to learn more">Learn more</a>.</p>
<p>
<label for="address">Atom feed address:</label>
<input><xsl:attribute name="id">address</xsl:attribute><xsl:attribute name="spellcheck">false</xsl:attribute><xsl:attribute name="value"><xsl:value-of select="feed/link[@rel='self']/@href"/></xsl:attribute></input>
</p>
<p>Preview of the feed’s current headlines:</p>
<ol>
<xsl:for-each select="feed/entry">
<li><h2><a><xsl:attribute name="href"><xsl:value-of select="link[@rel='alternate']/@href"/></xsl:attribute><xsl:value-of select="title"/></a></h2></li>
</xsl:for-each>
</ol>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
6 changes: 3 additions & 3 deletions nikola/data/themes/base/assets/xml/rss.xsl
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.0">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width"/>
<title><xsl:value-of select="rss/channel/title"/> (RSS)</title>
<style><![CDATA[html{margin:0;pdding:0;}body{color:hsl(180,1%,31%);font-family:Helvetica,Arial,sans-serif;font-size:17px;line-height:1.4;margin:5%;max-width:35rem;padding:0;}input{min-width:20rem;margin-left:.2rem;padding-left:.2rem;padding-right:.2rem;}ol{list-style-type:disc;padding-left:1rem;}h2{font-size:22px;font-weight:inherit;}]]></style>
<style><![CDATA[html{margin:0;padding:0;}body{color:hsl(180,1%,31%);font-family:Helvetica,Arial,sans-serif;font-size:17px;line-height:1.4;margin:5%;max-width:35rem;padding:0;}input{min-width:20rem;margin-left:.2rem;padding-left:.2rem;padding-right:.2rem;}ol{list-style-type:disc;padding-left:1rem;}h2{font-size:22px;font-weight:inherit;}]]></style>
</head>
<body>
<h1><xsl:value-of select="rss/channel/title"/> (RSS)</h1>
Expand All @@ -18,7 +18,7 @@
</p>
<p>Preview of the feed’s current headlines:</p>
<ol>
<xsl:for-each select="rss/channel/item">
<xsl:for-each select="rss/channel/item">
<li><h2><a><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><xsl:value-of select="title"/></a></h2></li>
</xsl:for-each>
</ol>
Expand Down
11 changes: 11 additions & 0 deletions nikola/data/themes/base/templates/archiveindex.tmpl
@@ -1,2 +1,13 @@
## -*- coding: utf-8 -*-
<%inherit file="index.tmpl"/>

<%block name="extra_head">
${parent.extra_head()}
%if len(translations) > 1 and generate_atom:
%for language in translations:
<link rel="alternate" type="application/atom+xml" title="Atom for the ${archive_name} section (${language})" href="${_link("archive_atom", archive_name, language)}">
%endfor
%elif generate_atom:
<link rel="alternate" type="application/atom+xml" title="Atom for the ${archive_name} archive" href="${_link("archive_atom", archive_name)}">
%endif
</%block>
9 changes: 9 additions & 0 deletions nikola/data/themes/base/templates/base_helper.tmpl
Expand Up @@ -93,6 +93,15 @@ lang="${lang}">
<link rel="alternate" type="application/rss+xml" title="RSS" href="${_link('rss', None)}">
%endif
%endif
%if generate_atom:
%if len(translations) > 1:
%for language in translations:
<link rel="alternate" type="application/atom+xml" title="Atom (${language})" href="${_link('index_atom', None, language)}">
%endfor
%else:
<link rel="alternate" type="application/atom+xml" title="Atom" href="${_link('index_atom', None)}">
%endif
%endif
</%def>

<%def name="html_translations()">
Expand Down
11 changes: 11 additions & 0 deletions nikola/data/themes/base/templates/tagindex.tmpl
@@ -1,2 +1,13 @@
## -*- coding: utf-8 -*-
<%inherit file="index.tmpl"/>

<%block name="extra_head">
${parent.extra_head()}
%if len(translations) > 1 and generate_atom:
%for language in translations:
<link rel="alternate" type="application/atom+xml" title="Atom for the ${tag} section (${language})" href="${_link(kind + "_atom", tag, language)}">
%endfor
%elif generate_atom:
<link rel="alternate" type="application/atom+xml" title="Atom for the ${tag} section" href="${_link("tag" + "_atom", tag)}">
%endif
</%block>

0 comments on commit ee90115

Please sign in to comment.