├── __init__.py ├── __init__.pyc ├── foundation_images.pyc ├── .gitignore ├── README.md ├── foundation_images.py └── LICENSE /__init__.py: -------------------------------------------------------------------------------- 1 | from .foundation_images import * 2 | -------------------------------------------------------------------------------- /__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/foundation_images/master/__init__.pyc -------------------------------------------------------------------------------- /foundation_images.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/foundation_images/master/foundation_images.pyc -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | build 11 | eggs 12 | parts 13 | bin 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | __pycache__ 21 | 22 | # Installer logs 23 | pip-log.txt 24 | 25 | # Unit test / coverage reports 26 | .coverage 27 | .tox 28 | nosetests.xml 29 | 30 | # Translations 31 | *.mo 32 | 33 | # Mr Developer 34 | .mr.developer.cfg 35 | .project 36 | .pydevproject 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | foundation_images 2 | ================= 3 | 4 | A simple Pelican plugin for inserting captioned images into my foundation-default-colours theme which you can download from https://github.com/FuzzyWuzzie/foundation-default-colours. 5 | 6 | It provides a macro in posts to easily insert the following chunk of html: 7 | 8 | ```html 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 |
17 | YOUR IMAGE CAPTION HERE 18 |
19 |
20 |
21 | ``` 22 | 23 | using the following shorthand: 24 | 25 | ``` 26 | {image-caption[YOUR IMAGE SOURCE HERE][YOUR IMAGE CAPTION HERE]} 27 | ``` 28 | -------------------------------------------------------------------------------- /foundation_images.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Foundation Images 4 | ================= 5 | 6 | This plugin is mostly for the foundation theme I'm building 7 | which allows one to easily insert centered images with captions 8 | into posts. It's extremely basic and niche for now, but I might 9 | make it more fully-featured later. 10 | """ 11 | 12 | from pelican import signals, contents 13 | import re 14 | 15 | replacementString = r'''
16 |
17 |
18 |
19 | 20 |
21 |
22 |
23 | \2 24 |
25 |
26 |
''' 27 | 28 | def processImages(content): 29 | if isinstance(content, contents.Static): 30 | return 31 | 32 | text = re.sub(r"\{image-caption\[(?P.*?)\]\[(?P.*?)\]\}", replacementString, content._content) 33 | content._content = text 34 | 35 | def register(): 36 | signals.content_object_init.connect(processImages) 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Kenton Hamaluik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | --------------------------------------------------------------------------------