#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

from pelican import __version__ as PELICAN_VERSION


# Basic settings (http://docs.getpelican.com/en/stable/settings.html#basic-settings)
DEFAULT_CATEGORY = 'Sin categoría'
DELETE_OUTPUT_DIRECTORY = False
DISPLAY_CATEGORIES_ON_MENU = True
DISPLAY_PAGES_ON_MENU = True
MARKDOWN = {
    'extension_configs': {
        'markdown.extensions.codehilite': {'css_class': 'highlight'},
        'markdown.extensions.extra': {},
        'markdown.extensions.footnotes': {'BACKLINK_TITLE': 'Volver a la nota %d en el texto'},
        'markdown.extensions.meta': {},
    },
    'output_format': 'html5',
}
PATH = 'content'
PLUGIN_PATHS = ['plugins']
PLUGINS = ['another_read_more_link', 'i18n_subsites', 'neighbors', 'pelican-css', 'pelican-js', 'sitemap', 'tag-cloud', 'tipue-search']
SITENAME = 'Conocimientos Libres'
SITENAME_SINGLE = 'CL'
SITEURL = 'https://conocimientoslibres.tuxfamily.org'

# URL settings (http://docs.getpelican.com/en/stable/settings.html#url-settings)
RELATIVE_URLS = True
ARTICLE_URL = '{slug}/'
ARTICLE_SAVE_AS = '{slug}/index.html'
CATEGORY_URL = 'category/{slug}/'
CATEGORY_SAVE_AS = 'category/{slug}/index.html'
CATEGORIES_URL = 'categories/'
CATEGORIES_SAVE_AS = 'categories/index.html'
TAG_URL      = 'tag/{slug}/'
TAG_SAVE_AS  = 'tag/{slug}/index.html'
TAGS_URL     = 'tags/'
TAGS_SAVE_AS = 'tags/index.html'
AUTHOR_URL      = 'author/{slug}/'
AUTHOR_SAVE_AS  = 'author/{slug}/index.html'
YEAR_ARCHIVE_SAVE_AS = 'archives/{date:%Y}/index.html'
MONTH_ARCHIVE_SAVE_AS = 'archives/{date:%Y}/{date:%m}/index.html'
AUTHORS_URL     = 'pages/créditos/'
AUTHORS_SAVE_AS = 'pages/créditos/index.html'
ARCHIVES_URL     = 'archives/'
ARCHIVES_SAVE_AS = 'archives/index.html'
STATIC_PATHS = ['asciicasts', 'heckyel_pub.asc', 'wp-content', 'vendor']
PAGE_EXCLUDES = ['asciicasts', 'wp-content', 'vendor']
ARTICLE_EXCLUDES = ['asciicasts', 'wp-content', 'vendor']

# Time and date (http://docs.getpelican.com/en/stable/settings.html#time-and-date)
TIMEZONE = 'Europe/Madrid'
LOCALE = ('es_ES.UTF-8')

# Feed settings (http://docs.getpelican.com/en/stable/settings.html#feed-settings)
# feed generation is usually not desired when developing, set to true in publishconf.py
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

# Pagination (http://docs.getpelican.com/en/stable/settings.html#pagination)
DEFAULT_PAGINATION = 3
PAGINATION_PATTERNS = (
    (1, '{base_name}/', '{base_name}/index.html'),
    (2, '{base_name}/page/{number}/', '{base_name}/page/{number}/index.html'),
)
PAGINATOR_LIMIT = 4

# Translations (http://docs.getpelican.com/en/stable/settings.html#translations)
DEFAULT_LANG = 'es'
TRANSLATION_FEED_ATOM = None

# Themes (http://docs.getpelican.com/en/stable/settings.html#themes)
THEME = 'cl-theme/'
SITESUBTITLE = 'Sitio de información sobre Software Libre'
SHOW_RECENT_POSTS = 3  # the number of recent posts to show


# Plugins' configuration (not from Pelican core)
TAG_CLOUD_STEPS = 5
TAG_CLOUD_MAX_ITEMS = 53
TAG_CLOUD_SORTING = 'random'
TAG_CLOUD_BADGE = True

SITEMAP = {
    'format': 'xml',
    'priorities': {
        'articles': 0.5,
        'indexes': 0.5,
        'pages': 0.5
    },
    'changefreqs': {
        'articles': 'yearly',
        'indexes': 'weekly',
        'pages': 'yearly'
    }
}

ANOTHER_READ_MORE_LINK = 'Continúa leyendo <span class="screen-reader-text">{title}</span>'
ANOTHER_READ_MORE_LINK_FORMAT = ' <a class="more-link" href="{url}#read_more_link">{text}</a>'

I18N_UNTRANSLATED_ARTICLES = 'remove'
I18N_UNTRANSLATED_PAGES = 'remove'
I18N_SUBSITES = {
    'de': {
        'ANOTHER_READ_MORE_LINK': 'Weiter lesen <span class="screen-reader-text">{title}</span>',
        'LOCALE': ('de_DE.UTF-8'),
    },
    'en': {
        'ANOTHER_READ_MORE_LINK': 'Keep reading <span class="screen-reader-text">{title}</span>',
        'LOCALE': ('en_US.UTF-8'),
        'MARKDOWN': {
            'extension_configs': {
                'markdown.extensions.codehilite': {'css_class': 'highlight'},
                'markdown.extensions.extra': {},
                'markdown.extensions.footnotes': {'BACKLINK_TITLE': 'Jump back to footnote %d in the text'},
                'markdown.extensions.meta': {},
            },
            'output_format': 'html5',
        }
    },
    'eo': {
        'ANOTHER_READ_MORE_LINK': 'Legu plu <span class="screen-reader-text">el {title}</span>',
        'LOCALE': ('eo.UTF-8'),
    },
    'fr': {
        'LOCALE': ('fr_FR.UTF-8'),
    },
}
JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n']}
