Skip to main content

Pelican plugin to generate Gemini capsules

Project description

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

Installation

pip install pelican-gemini-capsule

Usage

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

PLUGINS = [
    "pelican_gemini_capsule",
]

Configuration

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

# 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:

Bugs

Please open an issue 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 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 and pass tests. Black and Flake8 are used on this project to enforce the coding style.

Check codding style

You must install Nox 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?

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican-gemini-capsule-0.3.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

pelican_gemini_capsule-0.3.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file pelican-gemini-capsule-0.3.1.tar.gz.

File metadata

File hashes

Hashes for pelican-gemini-capsule-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3a9fffeef98f67298e7adf219dcf5233d133f49b6b7a63b7249510f565afc336
MD5 9d56280ac58d1fda022c17a2e3c3a215
BLAKE2b-256 b38dc702ca616cfaf0f977b042df4fd0fdae75a56b7734e8649cdd1eebefee64

See more details on using hashes here.

File details

Details for the file pelican_gemini_capsule-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pelican_gemini_capsule-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f61a51ab6fd25a10a7af7554ead0f01d81721939d0d0d88bb50c27aa54c9a6e8
MD5 df61493591deec1fdbffe5343e024f47
BLAKE2b-256 c80330ad1da8257216e0a2cb0ff35fc60f62ee04d909c7f0b0c5f99087fdde93

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page