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.4.0:

    • fix: Deduplicates identical links that follow each other in the document (@flozz)

    • misc(packaging): Modernized packaging: replaced setup.py and setuptools by pyproject.toml and flit (@flozz)

    • misc: Added Python 3.12, 3.13 support (@flozz)

    • misc!: Removed Python 3.7, 3.8 support (@flozz)

  • v0.3.1:

    • fix: Fixed missing code blocks in outputed Gemtext (@flozz)

  • v0.3.0:

    • feat: Resolve internal links ({filename}../foo/bar.rst) (@flozz)

  • v0.2.0:

    • feat: Pass the articles source file name to docutils to allow the include directive to work (@flozz)

    • feat: Added a raw_title attibute on article with decoded HTML entities (@flozz)

    • fix: Create the output folder before trying to write articles (@flozz)

    • fix: 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.4.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pelican_gemini_capsule-0.4.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file pelican_gemini_capsule-0.4.0.tar.gz.

File metadata

  • Download URL: pelican_gemini_capsule-0.4.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pelican_gemini_capsule-0.4.0.tar.gz
Algorithm Hash digest
SHA256 15e30853d3d84b3571e83dd2a34f5df552df3fc6a85a2fc616f7e968c04776ec
MD5 b2c598b36c3ead2f867315c8f2529880
BLAKE2b-256 c35507452a8f517d9ae58de3aab727b49f2f7a58b8dfdf2b649cc94e07fa6089

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pelican_gemini_capsule-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e42b38aa5e5fa30140ab044e863aea3a1b46a15415be7d0592bef4bf7514966
MD5 150deda40fc14cda9c88fd747c365174
BLAKE2b-256 2a81a2a1e88f8659f88d4ee3e3176c50db515517f088bf8050a009015d394790

See more details on using hashes here.

Supported by

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