Skip to content

Commit

Permalink
Merge pull request #1 from Scheirle/pypi
Browse files Browse the repository at this point in the history
prep for PyPI release
  • Loading branch information
Scheirle committed Feb 22, 2017
2 parents c551d13 + f35d9e1 commit ba1de94
Show file tree
Hide file tree
Showing 14 changed files with 288 additions and 106 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*~
dist/
*.egg-info
*.pyc
build/
54 changes: 0 additions & 54 deletions CHANGELOG.md

This file was deleted.

125 changes: 125 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
Change Log
==========

All notable changes to this project will be documented in this file.
This project adheres to `Semantic Versioning <http://semver.org/>`__.

1.4.0 – 2017-02-20
------------------
\

Added
~~~~~

- add ``setup.py`` to allow posting plugin to PyPI `PR
#862 <https://github.com/getpelican/pelican-plugins/pull/862>`__

1.3.0 – 2017-01-10
------------------
\

Added
~~~~~

- add
`blogger\_comment\_export.py <import/blogger_comment_export.py>`__
script to export comments from Blogger XML export and `associated
documentation <docs/import.md>`__ `PR
#835 <https://github.com/getpelican/pelican-plugins/pull/835>`__

1.2.2 – 2016-12-19
------------------
\

Fixed
~~~~~

- Correct jQuery expression in cancelReply method `PR
#820 <https://github.com/getpelican/pelican-plugins/pull/820>`__

1.2.1 – 2016-09-22
------------------
\

Fixed
~~~~~

- Add support for the autoreload mode of pelican `PR
#782 <https://github.com/getpelican/pelican-plugins/pull/782>`__
`Fixes
pelican#1949 <https://github.com/getpelican/pelican/issues/1949>`__

1.2.0 – 2016-05-23
------------------
\

Fixed - Documentation
~~~~~~~~~~~~~~~~~~~~~

- Correct template path `PR
#713 <https://github.com/getpelican/pelican-plugins/pull/713>`__

Added - Documentation
~~~~~~~~~~~~~~~~~~~~~

- Adds Quickstart guide + default theme `PR
#686 <https://github.com/getpelican/pelican-plugins/pull/686>`__

Fixed
~~~~~

- Fix mailto link: use '' instead of '' `PR
#720 <https://github.com/getpelican/pelican-plugins/pull/720>`__
- Fix comparison of offset-naive and offset-aware datetimes `PR
#722 <https://github.com/getpelican/pelican-plugins/pull/722>`__

Added
~~~~~

- Logs a warning if the parent of a comment can not be found `PR
#715 <https://github.com/getpelican/pelican-plugins/pull/715>`__

1.1.0 – 2016-02-18
------------------
\

Fixed – Documentation
~~~~~~~~~~~~~~~~~~~~~

- Updated old URLs `PR
#677 <https://github.com/getpelican/pelican-plugins/pull/677>`__

Changed
~~~~~~~

- Main logic runs a bit earlier (allows other plugins to access
comments earlier) `PR
#677 <https://github.com/getpelican/pelican-plugins/pull/677>`__
- The writer to generate the feeds can now be exchanged (via a normal
pelican writer plugin) `PR
#677 <https://github.com/getpelican/pelican-plugins/pull/677>`__

1.0.1 – 2015-10-04
------------------
\

Fixed – Documentation
~~~~~~~~~~~~~~~~~~~~~

- Add commas indicating tuple (``PELICAN_COMMENT_SYSTEM_AUTHORS``) `PR
#579 <https://github.com/getpelican/pelican-plugins/pull/579>`__

1.0.0 – 2014-11-05
------------------
\

Added
~~~~~

- Basic static comments
- Atom Feeds
- Replies to comments
- Avatars and identicons

This change log uses `Keep a CHANGELOG <http://keepachangelog.com/>`__
as a template.
71 changes: 71 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Pelican Comment System
======================

Pelican Comment System allows you to add static comments to your
articles.

Comments are stored in files in formats that can be processed by Pelican
(e.g., Markdown, reStructuredText). Each comment resides in its own
file.

Features
--------

- Static comments for each article
- Replies to comments
- Avatars and `Identicons <https://en.wikipedia.org/wiki/Identicon>`__
- Comment Atom feed for each article
- Easy styleable via themes
- Python 2 and 3 support

See it in action here:
`bernhard.scheirle.de <http://bernhard.scheirle.de/posts/2014/March/29/static-comments-via-email/>`__

+---------------------+-------------------------------+-------------------------------+
| Author | Website | Github |
+=====================+===============================+===============================+
| Bernhard Scheirle | http://bernhard.scheirle.de | https://github.com/Scheirle |
+---------------------+-------------------------------+-------------------------------+

Instructions
------------

- `Quickstart Guide <doc/quickstart.md>`__
- `Installation and basic usage <doc/installation.md>`__
- `Import existing comments <doc/import.md>`__
- `Avatars and identicons <doc/avatars.md>`__
- `Comment Atom feed <doc/feed.md>`__
- `[Developer] How to do a release <doc/how-to-release.md>`__

PyPi
------------
The Pelican Comment System is now also in the Python Package Index and can easily installed via:

::

pip install pelican_comment_system


Requirements
------------

Pelican 3.4 or newer is required.

To create identicons, the Python Image Library is needed. Therefore you
either need PIL **or** Pillow (recommended).

**Install Pillow via:**

::

pip install Pillow

If you don't want avatars or identicons, this plugin works fine without
PIL/Pillow. You will, however, see a warning that identicons are
deactivated (as expected).

Change Log
----------

The change log can be found in the `CHANGELOG.rst <./CHANGELOG.rst>`__
file.
45 changes: 0 additions & 45 deletions Readme.md

This file was deleted.

17 changes: 17 additions & 0 deletions doc/how-to-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# How to do a release

1. Update the [change log](../CHANGELOG.rst)
2. Create a new git tag:
* e.g. `git tag -a v1.2.1`
* e.g. `git push origin v.1.2.1`
3. Package the project
* Source Distribution: `python setup.py sdist`
* Universal Wheels: `python setup.py bdist_wheel --universal` (only valid as long as we support python 2 and 3)
* [Further Help](https://packaging.python.org/distributing/#packaging-your-project)
4. Upload packages:
* `twine upload dist/*`
* [Twine Help](https://pypi.python.org/pypi/twine)
5. Add a new heading in the [change log](../CHANGELOG.rst)

# PyPi - Register project [Already done]
`twine register -r testpypi dist/pelican_comment_system-1.4.0-py2.py3-none-any.whl`
18 changes: 12 additions & 6 deletions pelican_comment_system.py → pelican_comment_system/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
from . import avatars


__version__ = "1.3.0"
__version__ = "1.4.0"


_all_comments = []
_pelican_writer = None
_pelican_obj = None


def setdefault(pelican, settings):
from pelican.settings import DEFAULT_CONFIG
for key, value in settings:
Expand Down Expand Up @@ -88,18 +89,20 @@ def initialize(article_generator):
_pelican_writer = _pelican_obj.get_writer()
_all_comments = []


def warn_on_slug_collision(items):
slugs = {}
for comment in items:
if not comment.slug in slugs:
if comment.slug not in slugs:
slugs[comment.slug] = [comment]
else:
slugs[comment.slug].append(comment)

for slug, itemList in slugs.items():
len_ = len(itemList)
if len_ > 1:
logger.warning('There are %s comments with the same slug: %s', len_, slug)
logger.warning('There are %s comments with the same slug: %s',
len_, slug)
for x in itemList:
logger.warning(' %s', x.source_path)

Expand Down Expand Up @@ -138,11 +141,13 @@ def process_comments(article_generator):
for article in article_generator.articles:
add_static_comments(article_generator, article)


def mirror_to_translations(article):
for translation in article.translations:
translation.comments_count = article.comments_count
translation.comments = article.comments


def add_static_comments(gen, content):
if gen.settings['PELICAN_COMMENT_SYSTEM'] is not True:
return
Expand Down Expand Up @@ -204,9 +209,10 @@ def add_static_comments(gen, content):
found_parent = True
break
if not found_parent:
logger.warning('Comment "%s/%s" is a reply to non-existent comment "%s". '
'Make sure the replyto attribute is set correctly.',
content.slug, reply.slug, reply.replyto)
logger.warning('Comment "%s/%s" is a reply to non-existent '
'comment "%s". Make sure the replyto attribute is '
'set correctly.',
content.slug, reply.slug, reply.replyto)

count = 0
for comment in comments:
Expand Down
2 changes: 1 addition & 1 deletion avatars.py → pelican_comment_system/avatars.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def getAvatarPath(comment_id, metadata):

code = md5.hexdigest()

if not code in _missingAvatars:
if code not in _missingAvatars:
_missingAvatars.append(code)

return os.path.join(_identicon_output_path, '%s.png' % code)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ba1de94

Please sign in to comment.