Skip to content

Commit

Permalink
Make sure the theme works with latest Pelican's version
Browse files Browse the repository at this point in the history
  • Loading branch information
kplaube committed Apr 5, 2023
1 parent 0481549 commit a35ff3c
Show file tree
Hide file tree
Showing 7 changed files with 250 additions and 76 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode
.python-version
node_modules
static/vendor
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name = "pypi"
[packages]
Babel = "*"
"Jinja2" = "*"
pelican-webassets = "*"

[dev-packages]

Expand Down
215 changes: 175 additions & 40 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 53 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,53 @@

Yapeme (Yet Another PElican theME) is a responsive theme for Pelican.

Contributions are welcome!

## Installing

Before installing the theme, make sure you have [Yarn](https://yarnpkg.com/en/) and [Pipenv](https://github.com/pypa/pipenv) installed:
Before installing the theme, make sure to have [Yarn](https://yarnpkg.com/en/) (or [NPM](https://www.npmjs.com)) installed.

First, solve the Javascript dependencies by running the following:


```text
yarn global add postcss-cli
yarn install
```

And finally, the Python dependencies:

$ brew install node pipenv
```text
pip install -r requirements.txt
```

If you are running your blog/website in a Python `virtualenv`, make sure to install the template's dependencies there.

Now you can install all project's dependencies via `install` task:
## Plugins

$ make install
This theme uses the following Pelican plugins:

The `build` task will make some public assets available for Pelican:
- Installed with `requirements.txt` (no action needed):
- [webassets](https://github.com/pelican-plugins/webassets) `(required)`
- Installed [through forking](https://github.com/getpelican/pelican-plugins/tree/master#how-to-use-plugins) `pelican-plugins` repository:
- [i18n_subsites](https://github.com/getpelican/pelican-plugins/tree/master/i18n_subsites) `(required)`
- [summary](https://github.com/getpelican/pelican-plugins/tree/master/summary) `(recommended)`

$ make build
- Installed through manual intervention:
- [extended_meta](https://github.com/kplaube/extended_meta) `(optional)`

## Configuration

You need to edit your settings and add the following parameters:
A mandatory thing is to have `jinja2.ext.i18n` listed as a Jinja extension:

```python
JINJA_ENVIRONMENT = {"extensions": ["jinja2.ext.i18n"]}
```

Also, set `I18N_TEMPLATES_LANG` to `pt_BR` if you want the theme
in Brazilian Portuguese 🇧🇷

Bellow you can see the list of all parameters used by the theme:

```text
AUTHOR = "Author's name"
DISQUS_SITENAME = "Your Disqus sitename"
FACEBOOK_APP_ID = "Add your Facebook APP ID to check out insigths"
Expand All @@ -42,39 +68,39 @@ SOURCE_CODE_REPOSITORY = "GitHub"
SOURCE_CODE_URL = "Where the source code of your blog is"
```

## Plugins

This theme uses the following Pelican plugins:

- [assets](https://github.com/getpelican/pelican-plugins/tree/master/assets)
- [extended_meta](https://github.com/kplaube/extended_meta)
- [i18n_subsites](https://github.com/getpelican/pelican-plugins/tree/master/i18n_subsites)
- [liquid_tags](https://github.com/getpelican/pelican-plugins/tree/master/liquid_tags)
- [representative image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image)

## Translations

You can find our translations inside `translations/` folder. If you want to contribute, please follow the instructions below:
You can find the translations inside `translations/` folder. If you want to contribute, please follow the instructions below:

$ pybabel extract --mapping babel.cfg --output translations/messages.pot ./
```text
pybabel extract --mapping babel.cfg --output translations/messages.pot ./
```

This is going to create the "translations template" for the project. After that, if you want to create a new language translation:

$ pybabel init --input-file translations/messages.pot --output-dir translations/ --locale pt-br --domain messages
```text
pybabel init --input-file translations/messages.pot --output-dir translations/ --locale pt-br --domain messages
```

Or if you want to update a already created language file:

$ pybabel update --input-file translations/messages.pot --output-dir translations --locale pt-br --domain messages
```text
pybabel update --input-file translations/messages.pot --output-dir translations --locale pt-br --domain messages
```

Now you can update the `msgstr` with the proper translation:

#: templates/includes/article.html:35
msgid "By"
msgstr "Por"
```text
#: templates/includes/article.html:35
msgid "By"
msgstr "Por"
```

To conclude the translation, we need to compile the language file:

$ pybabel compile -d translations
```text
pybabel compile -d translations
```

Don't forget to configure your [Pelican instance properly](http://docs.getpelican.com/en/stable/content.html#translations).

Expand Down
19 changes: 19 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-i https://pypi.org/simple
babel==2.12.1
blinker==1.6 ; python_version >= '3.7'
docutils==0.19 ; python_version >= '3.7'
feedgenerator==2.0.0 ; python_version >= '3.6'
jinja2==3.1.2
markdown-it-py==2.2.0 ; python_version >= '3.7'
markupsafe==2.1.2 ; python_version >= '3.7'
mdurl==0.1.2 ; python_version >= '3.7'
pelican==4.8.0 ; python_version >= '3.6' and python_version < '4.0'
pelican-webassets==2.0.0
pygments==2.14.0 ; python_version >= '3.6'
python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pytz==2023.3 ; python_version < '3.9'
rich==13.3.3 ; python_full_version >= '3.7.0'
six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
typing-extensions==4.5.0 ; python_version >= '3.7'
unidecode==1.3.6 ; python_version >= '3.5'
webassets==2.0
Loading

0 comments on commit a35ff3c

Please sign in to comment.