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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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