Skip to content

Commit

Permalink
Merge branch 'master' into use-rst-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Alsina committed Mar 15, 2018
2 parents 8fcc932 + 2b4a8d5 commit f304a60
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Support for Commento comment system (Issue #2773)
* New PRESERVE_ICC_PROFILES option to control whether ICC profiles are
preserved when copying images.
* Use baguetteJS in bootstrap theme (part of Issue #2777)
Expand Down Expand Up @@ -32,6 +33,7 @@ Features
Bugfixes
--------

* Handle '/' and other absolute paths better in POSTS / PAGES
* Support KaTeX for reST display math (Issue #2888)
* Use npm for asset management instead of bower, which was deprecated
(Issue #2790)
Expand Down
9 changes: 6 additions & 3 deletions docs/manual.rst
Expand Up @@ -1748,12 +1748,13 @@ Nikola supports several third party comment systems:
* `DISQUS <http://disqus.com>`_
* `IntenseDebate <http://www.intensedebate.com/>`_
* `LiveFyre <http://www.livefyre.com/>`_
* `Moot <http://moot.it>`_
* `Muut (Formerly moot) <http://muut.com>`_
* `Facebook <http://facebook.com/>`_
* `isso <http://posativ.org/isso/>`_
* `Commento <https://github.com/adtac/commento>`_

By default it will use DISQUS, but you can change by setting ``COMMENT_SYSTEM``
to one of "disqus", "intensedebate", "livefyre", "moot", "facebook" or "isso"
to one of "disqus", "intensedebate", "livefyre", "moot", "facebook", "isso" or "commento"

.. sidebar:: ``COMMENT_SYSTEM_ID``

Expand All @@ -1763,13 +1764,15 @@ to one of "disqus", "intensedebate", "livefyre", "moot", "facebook" or "isso"
* For DISQUS it's called the **shortname**
* In IntenseDebate it's the **IntenseDebate site acct**
* In LiveFyre it's the **siteId**
* In Moot it's your **username**
* In Muut it's your **username**
* 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, encoded with
Punycode (if using Internationalized Domain Names) and **have a trailing slash**,
default ``http://localhost:8080/``)
* For commento it's the URL of the commento instance as required by the ``serverUrl``
parameter in commento's documentation.

To use comments in a visible site, you should register with the service and
then set the ``COMMENT_SYSTEM_ID`` option.
Expand Down
7 changes: 7 additions & 0 deletions nikola/data/themes/base/templates/comments_helper.tmpl
Expand Up @@ -6,6 +6,7 @@
<%namespace name="muut" file="comments_helper_muut.tmpl"/>
<%namespace name="facebook" file="comments_helper_facebook.tmpl"/>
<%namespace name="isso" file="comments_helper_isso.tmpl"/>
<%namespace name="commento" file="comments_helper_commento.tmpl"/>

<%def name="comment_form(url, title, identifier)">
%if comment_system == 'disqus':
Expand All @@ -20,6 +21,8 @@
${facebook.comment_form(url, title, identifier)}
% elif comment_system == 'isso':
${isso.comment_form(url, title, identifier)}
% elif comment_system == 'commento':
${commento.comment_form(url, title, identifier)}
%endif
</%def>

Expand All @@ -36,6 +39,8 @@
${facebook.comment_link(link, identifier)}
% elif comment_system == 'isso':
${isso.comment_link(link, identifier)}
% elif comment_system == 'commento':
${commento.comment_link(link, identifier)}
%endif
</%def>

Expand All @@ -52,5 +57,7 @@
${facebook.comment_link_script()}
% elif comment_system == 'isso':
${isso.comment_link_script()}
% elif comment_system == 'commento':
${commento.comment_link_script()}
%endif
</%def>
19 changes: 19 additions & 0 deletions nikola/data/themes/base/templates/comments_helper_commento.tmpl
@@ -0,0 +1,19 @@
## -*- coding: utf-8 -*-
<%def name="comment_form(url, title, identifier)">
<div id="commento"></div>
</%def>

<%def name="comment_link(link, identifier)">
</%def>


<%def name="comment_link_script()">
<script src="${comment_system_id}/assets/js/commento.min.js"></script>
<script>
window.onload = function() {
Commento.init({
serverUrl: "${comment_system_id}",
});
}
</script>
</%def>
6 changes: 3 additions & 3 deletions nikola/post.py
Expand Up @@ -182,14 +182,14 @@ def __init__(
# Fill default_metadata with stuff from the other languages
for lang in sorted(self.translated_to):
default_metadata.update(self.meta[lang])

# Compose paths
if self.folder_base is not None:
# Use translatable destination folders
self.folders = {}
for lang in self.config['TRANSLATIONS'].keys():
self.folders[lang] = os.path.normpath(os.path.join(
self.folder_base(lang), self.folder_relative))
if os.path.isabs(self.folder_base(lang)): # Issue 2982
self.folder_base[lang] = os.path.relpath(self.folder_base(lang), '/')
self.folders[lang] = os.path.normpath(os.path.join(self.folder_base(lang), self.folder_relative))
else:
# Old behavior (non-translatable destination path, normalized by scanner)
self.folders = {lang: self.folder_relative for lang in self.config['TRANSLATIONS'].keys()}
Expand Down

0 comments on commit f304a60

Please sign in to comment.