pelican-gemini-capsule


Namepelican-gemini-capsule JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/flozz/pelican-gemini-capsule
SummaryPelican plugin to generate Gemini capsules
upload_time2023-03-20 18:13:04
maintainer
docs_urlNone
authorFabien LOISON
requires_python
licenseGPLv3
keywords pelican gemini capsule gemtext gmi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Pelican Gemini Capsule Plugin
=============================

|GitHub| |License| |Discord| |Github Actions| |Black|

Pelican Gemini Capsule is a Pelican plugin to generate Gemini capsules. Only
works with articles in reStructuredText formats.

**This project is currently work in progress.**


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

* Python >= 3.7
* rst2gemtext_


Installation
------------

::

    pip install pelican-gemini-capsule


Usage
-----

Once Pelican Gemini Capsule installed, simply add it to you Pelican configuration:

.. code-block:: python

    PLUGINS = [
        "pelican_gemini_capsule",
    ]


Configuration
-------------

You can configure this plugin by adding the following variables to your ``pelicanconf.py``:

.. code-block:: python

    # How many articles to display on the home page
    GEMINI_DISPLAYED_ARTICLE_COUNT_ON_HOME = 10

    # Template of the home page of the Gemlog
    GEMINI_TEMPLATE_HOME = """\
    # {{ SITENAME }}

    ## Latest Articles
    {% for i in range(articles_count_on_home) %}{% set article = articles[i] %}
    => {{ GEMSITEURL }}/{{ article.url | replace(".html", ".gmi") }} {{ article.date.strftime("%Y-%m-%d") }} {{ article.raw_title -}}
    {% endfor %}
    {% if articles | length > articles_count_on_home %}
    => {{ GEMSITEURL }}/all_articles.gmi ➕ All Articles
    {% endif %}
    """

    # Template of the "All Articles" page
    GEMINI_TEMPLATE_ARTICLES_INDEX_PAGE = """\
    # All Articles — {{ SITENAME }}
    {% for article in articles %}
    => {{ GEMSITEURL }}/{{ article.url | replace(".html", ".gmi") }} {{ article.date.strftime("%Y-%m-%d") }} {{ article.raw_title -}}
    {% endfor %}

    --------------------------------------------------------------------------------
    => {{ GEMSITEURL }}/ 🏠 Home
    """

    # Template of articles
    GEMINI_TEMPLATE_ARTICLE = """\
    # {{ article.raw_title }}
    {{ article.date.strftime("%Y-%m-%d") }}

    {{ article.content_gemtext }}

    --------------------------------------------------------------------------------
    => {{ GEMSITEURL }}/ 🏠 Home
    """


Contributing
------------

Questions
~~~~~~~~~

If you have any question, you can:

* `Open an issue <https://github.com/flozz/pelican-gemini-capsule/issues>`_ on GitHub
* `Ask on Discord <https://discord.gg/P77sWhuSs4>`_ (I am not always available to chat, but I try to answer to everyone)


Bugs
~~~~

Please `open an issue <https://github.com/flozz/pelican-gemini-capsule/issues>`_ on GitHub with as much information as possible if you found a bug:

* Your operating system / Linux distribution (and its version)
* How you installed the software
* All the logs and message outputted by the software
* etc.

If the issue is about the outputted Gemtext (wrong markup, unsupported reStructuredText feature,...), please report the bug to the rst2gemtext_ project.


Pull requests
~~~~~~~~~~~~~

Please consider `filing a bug <https://github.com/flozz/pelican-gemini-capsule/issues>`_ before starting to work on a new feature; it will allow us to discuss the best way to do it. It is obviously unnecessary if you just want to fix a typo or small errors in the code.

Please note that your code must follow the coding style defined by the `pep8 <https://pep8.org>`_ and pass tests. `Black <https://black.readthedocs.io/en/stable>`_ and `Flake8 <https://flake8.pycqa.org/en/latest>`_ are used on this project to enforce the coding style.


Check codding style
~~~~~~~~~~~~~~~~~~~

You must install `Nox <https://nox.thea.codes/>`__ first::

    pip3 install nox

Then you can check for lint error::

    nox --session lint

You can also fix coding style errors automatically with::

    nox -s black_fix


Support this project
--------------------

Want to support this project?

* `☕️ Buy me a coffee <https://www.buymeacoffee.com/flozz>`__
* `💵️ Give me a tip on PayPal <https://www.paypal.me/0xflozz>`__
* `❤️ Sponsor me on GitHub <https://github.com/sponsors/flozz>`__


Changelog
---------

* **[NEXT]** (changes on ``master``, but not released yet):

  * Nothing yet :)

* **v0.3.1:**

  * Fixed missing code blocks in outputed Gemtext (@flozz)

* **v0.3.0:**

  * Resolve internal links (``{filename}../foo/bar.rst``) (@flozz)

* **v0.2.0:**

  * Pass the articles source file name to docutils to allow the ``include``
    directive to work (@flozz)
  * Added a ``raw_title`` attibute on article with decoded HTML entities
    (@flozz)
  * Create the output folder before trying to write articles (@flozz)
  * Avoid having the same image linked twice in articles (@flozz)

* **v0.1.0:**

  * Initial release.
  * Generates home page
  * Generates articles index page
  * Generates articles
  * Configurable templates


.. _rst2gemtext: https://github.com/flozz/rst2gemtext

.. |GitHub| image:: https://img.shields.io/github/stars/flozz/pelican-gemini-capsule?label=GitHub&logo=github
   :target: https://github.com/flozz/pelican-gemini-capsule

.. |License| image:: https://img.shields.io/github/license/flozz/pelican-gemini-capsule
   :target: https://github.com/flozz/pelican-gemini-capsule/blob/master/COPYING

.. |Discord| image:: https://img.shields.io/badge/chat-Discord-8c9eff?logo=discord&logoColor=ffffff
   :target: https://discord.gg/P77sWhuSs4

.. |Github Actions| image:: https://github.com/flozz/pelican-gemini-capsule/actions/workflows/python-ci.yml/badge.svg
   :target: https://github.com/flozz/pelican-gemini-capsule/actions

.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://black.readthedocs.io/en/stable

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/flozz/pelican-gemini-capsule",
    "name": "pelican-gemini-capsule",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pelican gemini capsule gemtext gmi",
    "author": "Fabien LOISON",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b3/8d/c702ca616cfaf0f977b042df4fd0fdae75a56b7734e8649cdd1eebefee64/pelican-gemini-capsule-0.3.1.tar.gz",
    "platform": null,
    "description": "Pelican Gemini Capsule Plugin\n=============================\n\n|GitHub| |License| |Discord| |Github Actions| |Black|\n\nPelican Gemini Capsule is a Pelican plugin to generate Gemini capsules. Only\nworks with articles in reStructuredText formats.\n\n**This project is currently work in progress.**\n\n\nRequirements\n------------\n\n* Python >= 3.7\n* rst2gemtext_\n\n\nInstallation\n------------\n\n::\n\n    pip install pelican-gemini-capsule\n\n\nUsage\n-----\n\nOnce Pelican Gemini Capsule installed, simply add it to you Pelican configuration:\n\n.. code-block:: python\n\n    PLUGINS = [\n        \"pelican_gemini_capsule\",\n    ]\n\n\nConfiguration\n-------------\n\nYou can configure this plugin by adding the following variables to your ``pelicanconf.py``:\n\n.. code-block:: python\n\n    # How many articles to display on the home page\n    GEMINI_DISPLAYED_ARTICLE_COUNT_ON_HOME = 10\n\n    # Template of the home page of the Gemlog\n    GEMINI_TEMPLATE_HOME = \"\"\"\\\n    # {{ SITENAME }}\n\n    ## Latest Articles\n    {% for i in range(articles_count_on_home) %}{% set article = articles[i] %}\n    => {{ GEMSITEURL }}/{{ article.url | replace(\".html\", \".gmi\") }} {{ article.date.strftime(\"%Y-%m-%d\") }} {{ article.raw_title -}}\n    {% endfor %}\n    {% if articles | length > articles_count_on_home %}\n    => {{ GEMSITEURL }}/all_articles.gmi \u2795 All Articles\n    {% endif %}\n    \"\"\"\n\n    # Template of the \"All Articles\" page\n    GEMINI_TEMPLATE_ARTICLES_INDEX_PAGE = \"\"\"\\\n    # All Articles \u2014 {{ SITENAME }}\n    {% for article in articles %}\n    => {{ GEMSITEURL }}/{{ article.url | replace(\".html\", \".gmi\") }} {{ article.date.strftime(\"%Y-%m-%d\") }} {{ article.raw_title -}}\n    {% endfor %}\n\n    --------------------------------------------------------------------------------\n    => {{ GEMSITEURL }}/ \ud83c\udfe0 Home\n    \"\"\"\n\n    # Template of articles\n    GEMINI_TEMPLATE_ARTICLE = \"\"\"\\\n    # {{ article.raw_title }}\n    {{ article.date.strftime(\"%Y-%m-%d\") }}\n\n    {{ article.content_gemtext }}\n\n    --------------------------------------------------------------------------------\n    => {{ GEMSITEURL }}/ \ud83c\udfe0 Home\n    \"\"\"\n\n\nContributing\n------------\n\nQuestions\n~~~~~~~~~\n\nIf you have any question, you can:\n\n* `Open an issue <https://github.com/flozz/pelican-gemini-capsule/issues>`_ on GitHub\n* `Ask on Discord <https://discord.gg/P77sWhuSs4>`_ (I am not always available to chat, but I try to answer to everyone)\n\n\nBugs\n~~~~\n\nPlease `open an issue <https://github.com/flozz/pelican-gemini-capsule/issues>`_ on GitHub with as much information as possible if you found a bug:\n\n* Your operating system\u00a0/ Linux distribution (and its version)\n* How you installed the software\n* All the logs and message outputted by the software\n* etc.\n\nIf the issue is about the outputted Gemtext (wrong markup, unsupported reStructuredText feature,...), please report the bug to the rst2gemtext_ project.\n\n\nPull requests\n~~~~~~~~~~~~~\n\nPlease consider `filing a bug <https://github.com/flozz/pelican-gemini-capsule/issues>`_ before starting to work on a new feature; it will allow us to discuss the best way to do it. It is obviously unnecessary if you just want to fix a typo or small errors in the code.\n\nPlease note that your code must follow the coding style defined by the `pep8 <https://pep8.org>`_ and pass tests. `Black <https://black.readthedocs.io/en/stable>`_ and `Flake8 <https://flake8.pycqa.org/en/latest>`_ are used on this project to enforce the coding style.\n\n\nCheck codding style\n~~~~~~~~~~~~~~~~~~~\n\nYou must install `Nox <https://nox.thea.codes/>`__ first::\n\n    pip3 install nox\n\nThen you can check for lint error::\n\n    nox --session lint\n\nYou can also fix coding style errors automatically with::\n\n    nox -s black_fix\n\n\nSupport this project\n--------------------\n\nWant to support this project?\n\n* `\u2615\ufe0f Buy me a coffee <https://www.buymeacoffee.com/flozz>`__\n* `\ud83d\udcb5\ufe0f Give me a tip on PayPal <https://www.paypal.me/0xflozz>`__\n* `\u2764\ufe0f Sponsor me on GitHub <https://github.com/sponsors/flozz>`__\n\n\nChangelog\n---------\n\n* **[NEXT]** (changes on ``master``, but not released yet):\n\n  * Nothing yet :)\n\n* **v0.3.1:**\n\n  * Fixed missing code blocks in outputed Gemtext (@flozz)\n\n* **v0.3.0:**\n\n  * Resolve internal links (``{filename}../foo/bar.rst``) (@flozz)\n\n* **v0.2.0:**\n\n  * Pass the articles source file name to docutils to allow the ``include``\n    directive to work (@flozz)\n  * Added a ``raw_title`` attibute on article with decoded HTML entities\n    (@flozz)\n  * Create the output folder before trying to write articles (@flozz)\n  * Avoid having the same image linked twice in articles (@flozz)\n\n* **v0.1.0:**\n\n  * Initial release.\n  * Generates home page\n  * Generates articles index page\n  * Generates articles\n  * Configurable templates\n\n\n.. _rst2gemtext: https://github.com/flozz/rst2gemtext\n\n.. |GitHub| image:: https://img.shields.io/github/stars/flozz/pelican-gemini-capsule?label=GitHub&logo=github\n   :target: https://github.com/flozz/pelican-gemini-capsule\n\n.. |License| image:: https://img.shields.io/github/license/flozz/pelican-gemini-capsule\n   :target: https://github.com/flozz/pelican-gemini-capsule/blob/master/COPYING\n\n.. |Discord| image:: https://img.shields.io/badge/chat-Discord-8c9eff?logo=discord&logoColor=ffffff\n   :target: https://discord.gg/P77sWhuSs4\n\n.. |Github Actions| image:: https://github.com/flozz/pelican-gemini-capsule/actions/workflows/python-ci.yml/badge.svg\n   :target: https://github.com/flozz/pelican-gemini-capsule/actions\n\n.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://black.readthedocs.io/en/stable\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Pelican plugin to generate Gemini capsules",
    "version": "0.3.1",
    "split_keywords": [
        "pelican",
        "gemini",
        "capsule",
        "gemtext",
        "gmi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c80330ad1da8257216e0a2cb0ff35fc60f62ee04d909c7f0b0c5f99087fdde93",
                "md5": "df61493591deec1fdbffe5343e024f47",
                "sha256": "f61a51ab6fd25a10a7af7554ead0f01d81721939d0d0d88bb50c27aa54c9a6e8"
            },
            "downloads": -1,
            "filename": "pelican_gemini_capsule-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "df61493591deec1fdbffe5343e024f47",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17795,
            "upload_time": "2023-03-20T18:13:02",
            "upload_time_iso_8601": "2023-03-20T18:13:02.601522Z",
            "url": "https://files.pythonhosted.org/packages/c8/03/30ad1da8257216e0a2cb0ff35fc60f62ee04d909c7f0b0c5f99087fdde93/pelican_gemini_capsule-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b38dc702ca616cfaf0f977b042df4fd0fdae75a56b7734e8649cdd1eebefee64",
                "md5": "9d56280ac58d1fda022c17a2e3c3a215",
                "sha256": "3a9fffeef98f67298e7adf219dcf5233d133f49b6b7a63b7249510f565afc336"
            },
            "downloads": -1,
            "filename": "pelican-gemini-capsule-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9d56280ac58d1fda022c17a2e3c3a215",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17418,
            "upload_time": "2023-03-20T18:13:04",
            "upload_time_iso_8601": "2023-03-20T18:13:04.196979Z",
            "url": "https://files.pythonhosted.org/packages/b3/8d/c702ca616cfaf0f977b042df4fd0fdae75a56b7734e8649cdd1eebefee64/pelican-gemini-capsule-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-20 18:13:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "flozz",
    "github_project": "pelican-gemini-capsule",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pelican-gemini-capsule"
}
        
Elapsed time: 0.06745s