Skip to main content

Pelican plugin to make a multi-byte slug the alphabetical one.

Project description

Pelican is good project but slugify function is a little bit unuseful and not customizable. This problem will appear if you are a developer using multi-byte language. So we wanna exchange multi-byte words to alphabetical words caused by multi-byte url problem.

URL encoded word is not beautiful, Japanese word Otaku will change like this “%83I%83%5E%83N”. If we can use an URL containing only alphabets and other marks not multi-byte, we wanna do that.

Pelican try to automatically exchange it. But Japanese and some multi-byte languages are very complex that because they are having some pronounciations. This try will absolutely be failure and they make funny words we could not read it.

This plugin will help these situation. You can define some slugs for your categories like this:

CATEGORY_SLUGS = (
    (u'オタク', u'otaku'),
    (u'寿司', u'sushi'),
)

Another feature is that to define your slugify function like this:

def SLUG_FUNC(value, substitutions=()):
    value = value.replace(u'禅', 'zen')
    return value

These settings are on your pelicanconf.py then just work.

Installation

This plugin is not registered on PyPI. You should clone this repository and install through pip:

git clone git@github.com:wutali/pelican_slug.git
cd pelican_slug
pip install -e .

Configuration

Put this code on your pelicanconf.py and customize it:

PLUGINS = ['pelican_slug']

def SLUG_FUNC(value, substitutions=()):
    # Do something you want.
    return value

CATEGORY_SLUGS = (
    (u'オタク', u'otaku'),
    (u'寿司', u'sushi'),
)

License

Pelican Slug is released under the MIT License. http://www.opensource.org/licenses/mit-license

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

pelican_slug-0.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

pelican_slug-0.1-py2.7.egg (3.9 kB view details)

Uploaded Egg

File details

Details for the file pelican_slug-0.1.tar.gz.

File metadata

  • Download URL: pelican_slug-0.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pelican_slug-0.1.tar.gz
Algorithm Hash digest
SHA256 e3eecdd3ee73546c3c0103d12f19eef15becbf89ce7da1339fa414f23b58923c
MD5 2d21ed95938309eafef7a617ff2167ba
BLAKE2b-256 5ce8cd791a703b5ac4ab63a94ba9335224e216694ca7572492e8b2a392059ffc

See more details on using hashes here.

File details

Details for the file pelican_slug-0.1-py2.7.egg.

File metadata

File hashes

Hashes for pelican_slug-0.1-py2.7.egg
Algorithm Hash digest
SHA256 3725a302ed0cbb602aa1fa6e0db30aae5c421ed57385e5deafa98ce6b3579c41
MD5 662a0c6be3a2ed4244946becbe9959f6
BLAKE2b-256 7f14753e3cbb87ea132ca22b0c41066f932ea93aabd047e0e2634084eee66cbf

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