Download raw (6.4 KB)
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals from mdx_figcaption import FigcaptionExtension from mdx_outline import OutlineExtension import os.path # Default author (usually your name). AUTHOR = u'Balsamine' # Your site name SITENAME = u'Balsamine' # Base URL of your website. Not defined by default, so it is best to specify # your SITEURL; if you do not, feeds will not be generated with properly-formed # URLs. You should include `http://` and your domain, with no trailing slash at # the end. Example: `SITEURL = 'http://mydomain.com'` # SITEURL = 'http://balsamine.be' SITEURL = '' # Path to content directory to be processed by Pelican. If undefined, and # content path is not specified via an argument to the `pelican` command, # Pelican will use the current working directory. PATH = 'content' STATIC_PATHS = ['doc'] TIMEZONE = 'Europe/Paris' DEFAULT_LANG = u'fr' DEFAULT_DATE_FORMAT = '%A %d %B %Y' LOCALE = ('fr_BE.UTF-8', 'en_US.UTF-8') DATE_FORMATS = { 'en': ('en_US.UTF-8','%a, %d %b %Y'), 'fr': ('fr_BE.UTF-8','%A %-d %B %Y'), } THEME = "theme/balsamine-19-20" # CSS_FILE = 'screen.css' CSS_FILE = 'balsa.css' # Whether to display categories on the menu of the template. Templates may or # not honor this setting. DISPLAY_CATEGORIES_ON_MENU = False # Whether to display pages on the menu of the template. Templates may or may # not honor this setting. DISPLAY_PAGES_ON_MENU = True ARTICLE_ORDER_BY = 'date' # Feed generation is usually not desired when developing FEED_ALL_ATOM = None CATEGORY_FEED_ATOM = None TRANSLATION_FEED_ATOM = None AUTHOR_FEED_ATOM = None AUTHOR_FEED_RSS = None # Social widget SOCIAL = (('You can add links in your config file', '#'), ('Another social link', '#'),) FACEBOOK = 'https://www.facebook.com/balsamine.theatre' TWITTER = 'https://twitter.com/balsatheatre' INSTAGRAM = 'https://www.instagram.com/balsamine1030/' DEFAULT_PAGINATION = 100 # Uncomment following line if you want document-relative URLs when developing # RELATIVE_URLS = True # Global metadata to all the contents DEFAULT_METADATA = { 'color': '#CCCCCC', 'time': 'tbd' } # Extends pelican for our specific needs PLUGINS = [ 'minchin.pelican.plugins.image_process', 'pelican_balsa', ] # URL settings ARTICLE_URL = '{category}/{slug}.html' ARTICLE_SAVE_AS = '{category}/{slug}.html' PAGE_URL = '{slug}.html' PAGE_SAVE_AS = '{slug}.html' CATEGORY_URL = '{slug}.html' CATEGORY_SAVE_AS = '{slug}.html' ARTICLE_LANG_URL = '{category}/{slug}-{lang}.html' ARTICLE_LANG_SAVE_AS = '{category}/{slug}-{lang}.html' PAGE_LANG_URL = '{slug}-{lang}.html' PAGE_LANG_SAVE_AS = '{slug}-{lang}.html' DRAFT_SAVE_AS = ARTICLE_SAVE_AS # def tac_filter(value): # return value[::-1] # JINJA_FILTERS = {'tac': tac_filter } def pagename(value, *args): val = "%s" % value return val.split("/")[-1].split(".")[0] # from datetime import datetime # def format_datetime(value, *args): # datetime_object = datetime.strptime(value, "%Y/%m/%d %Hh%M") # return datetime_object from datetime import datetime def format_datetime(value, *args): try: datetime_object = datetime.strptime(value, "%Y/%m/%d %Hh%M") except ValueError as v: value = value[:-9] datetime_object = datetime.strptime(value, "%Y/%m/%d %Hh%M") status = 'full' return datetime_object def processable_image(value): ext = os.path.splitext(value)[1] forbidden = ['.gif', '.svg'] if ext.lower() in forbidden: return False else: return True def is_date_range(value): return ('end_date' in value) JINJA_FILTERS = { 'pagename': pagename, 'format_datetime': format_datetime, 'processable_image': processable_image, 'is_date_range': is_date_range } # Extra configuration settings for the Markdown processor. Refer to the Python # Markdown documentation’s Options section for a complete list of supported # options. The extensions option will be automatically computed from the # extension_configs option. MARKDOWN = { 'extensions': [ FigcaptionExtension(), OutlineExtension({"wrapper_tag": "div", "wrapper_cls": 'level%(LEVEL)d'}) ], 'extension_configs': { 'markdown.extensions.extra': {}, 'markdown.extensions.meta': {}, 'markdown.extensions.toc': {"anchorlink": False} # 'markdown.extensions.toc': {"anchorlink": True} # 'markdown.extensions.attr_list': {}, }, 'output_format': 'html5', } # A list of metadata fields containing reST/Markdown content to be parsed and # translated to HTML. # FORMATTED_FIELDS = ['summary'] # See <https://github.com/MinchinWeb/minchin.pelican.plugins.image_process> for # configuration options IMAGE_PROCESS = { 'timeline': ["scale_in 420 9999 True"], 'thumbnail': ["scale_in 9999 70 False"], 'detail': ["scale_in 9999 600 False"], 'responsive': { 'type': 'responsive-image', 'srcset': [ ('1x', ["scale_in 800 600 True"]), # default laptop screens, thinkpads, etc ('1.5', ["scale_in 1200 900 True"]), # nexus s, htc desire, kindle fire hd, fair few devices register at 1.3 also, those browsers will probably pick 1.5 ('2x', ["scale_in 1600 1200 True"]), # nexus 4, iphone4 -> iphone 6, Samsung S3 ('3x', ["scale_in 2400 1800 True"]), # nexus 5, Samsung s4, sony experia Z ('4x', ["scale_in 3200 2400 True"]), # just suitable enough for 4k monitors, en toute impudence ], 'default': '1x', }, 'large': { 'type': 'responsive-image', 'sizes': '(min-width: 1200px) 800px, \ (min-width: 992px) 650px, \ (min-width: 768px) 718px, 100vw', 'srcset': [ ('70h', ["scale_in 999 70 True"]), ('200w', ["scale_in 200 400 True"]), ('500w', ["scale_in 500 600 True"]), ], 'default': '500w', }, } IGNORE_FILES = ["*.swo", "*.swp", "saison-17-18", "book0", "book1", "saison-18-19"] # Fixes slow generation caused by overzealous copying of images # Requires patched version of Pelican (see requirements.txt), at # <https://github.com/aleray/pelican> STATIC_CHECK_IF_MODIFIED = True STATIC_PATHS = ['doc', 'images'] MENU_ITEMS = ( ('La Balsamine', 'la-balsamine.html'), ('Pratique', 'pratique.html'), ('Billetterie', 'billetterie.html'), ('Location', 'location.html'), ('Diffusion', 'diffusion.html'), )