149 lines
3.8 KiB
Python
149 lines
3.8 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*- #
|
|
from __future__ import unicode_literals
|
|
|
|
class i18n(object):
|
|
# looks for translations in
|
|
# {LOCALE_DIR}/{LANGUAGE}/LC_MESSAGES/{DOMAIN}.mo
|
|
# if not present, falls back to default
|
|
|
|
DOMAIN = 'messages'
|
|
LOCALE_DIR = '{THEME}/translations'
|
|
LANGUAGES = ['ru']
|
|
NEWSTYLE = True
|
|
|
|
__name__ = 'i18n'
|
|
|
|
def register(self):
|
|
from pelican.signals import generator_init
|
|
generator_init.connect(self.install_translator)
|
|
|
|
def install_translator(self, generator):
|
|
import gettext
|
|
try:
|
|
translator = gettext.translation(
|
|
self.DOMAIN,
|
|
self.LOCALE_DIR.format(THEME=THEME),
|
|
self.LANGUAGES)
|
|
except (OSError, IOError):
|
|
translator = gettext.NullTranslations()
|
|
generator.env.install_gettext_translations(translator, self.NEWSTYLE)
|
|
|
|
# ABOUT_ME = ' '
|
|
AUTHOR = 'Андрей Астафьев'
|
|
SITENAME = 'ДСП'
|
|
SITEURL = 'https://dsp.246060.ru'
|
|
|
|
PATH = 'wiki'
|
|
|
|
TIMEZONE = 'Europe/Moscow'
|
|
|
|
DEFAULT_LANG = 'ru'
|
|
|
|
# Generation time
|
|
CACHE_CONTENT = True
|
|
LOAD_CONTENT_CACHE = True
|
|
|
|
# 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
|
|
USE_FOLDER_AS_CATEGORY = True
|
|
DEFAULT_DATE = 'fs'
|
|
STATIC_PATHS = [ 'images', 'files' ]
|
|
|
|
MARKDOWN = {
|
|
'extension_configs': {
|
|
'markdown.extensions.codehilite': {'css_class': 'highlight'},
|
|
'markdown.extensions.extra': {},
|
|
'markdown.extensions.meta': {},
|
|
'markdown.extensions.toc': {
|
|
'title': 'Содержание'
|
|
},
|
|
} ,
|
|
'output_format': 'html5',
|
|
}
|
|
|
|
DISPLAY_CATEGORIES_ON_MENU = False
|
|
DISPLAY_CATEGORIES_ON_SIDEBAR = True
|
|
DISPLAY_TAGS_ON_SIDEBAR = True
|
|
|
|
THEME = 'themes/bootstrap4'
|
|
BOOTSTRAP_THEME = 'litera'
|
|
|
|
I18N_TEMPLATES_LANG = 'ru'
|
|
I18N_GETTEXT_NEWSTYLE = True
|
|
I18N_GETTEXT_LOCALEDIR = 'themes/bootstrap4/translations'
|
|
I18N_GETTEXT_DOMAIN = 'messages'
|
|
JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n']}
|
|
|
|
PLUGIN_PATHS = ["plugins/official", "plugins/thirdparty"]
|
|
PLUGINS = [i18n(), "pandoc_reader", "pelican-css", "pelidoc", "series", "subcategory", "tag_cloud", "tipue_search", "plantuml"]
|
|
#, "render_math", "md-metayaml"
|
|
#PLUGINS = ["better_tables", "just_table"]
|
|
|
|
PANDOC_ARGS = [
|
|
"--variable=documentclass:extarticle",
|
|
"--variable=toc-title:Содержание",
|
|
"--filter=skip-toc-tag",
|
|
"--filter=pandoc_plantuml_filter.py",
|
|
"--highlight-style=tango",
|
|
"--template=wiki",
|
|
"--resource-path=wiki"
|
|
]
|
|
|
|
PDF_PROCESSOR = True
|
|
|
|
PANDOC_OUTPUTS = {
|
|
'pdf': 'pdf',
|
|
}
|
|
|
|
PANDOC_EXTRA_OPTIONS = [
|
|
"--variable=documentclass:extarticle",
|
|
"--variable=toc-title:Содержание",
|
|
"--filter=skip-toc-tag",
|
|
"--filter=pandoc_plantuml_filter.py",
|
|
"--highlight-style=tango",
|
|
"--resource-path=wiki",
|
|
"--template=wiki",
|
|
"--pdf-engine=xelatex"
|
|
]
|
|
|
|
PANDOC_MARKDOWN_EXTENSIONS = [
|
|
"+smart",
|
|
"+backtick_code_blocks",
|
|
"+fenced_code_blocks",
|
|
"+fenced_code_attributes"
|
|
"+fenced_divs"
|
|
"+native_divs"
|
|
"+native_spans"
|
|
]
|
|
|
|
YUICOMPRESSOR_EXECUTABLE = "yui-compressor"
|
|
YUICOMPRESSOR_EXTRA_OPTIONS = ["--nomunge"]
|
|
PLUGINS += ["yuicompressor-opt"]
|
|
|
|
DIRECT_TEMPLATES = ('index', 'categories', 'authors', 'archives', 'search')
|
|
|
|
# Blogroll
|
|
LINKS = ()
|
|
# LINKS = (('Pelican', 'http://getpelican.com/'),
|
|
# ('Python.org', 'http://python.org/'),
|
|
# ('Jinja2', 'http://jinja.pocoo.org/'),
|
|
# ('You can modify those links in your config file', '#'),)
|
|
|
|
# Social widget
|
|
SOCIAL = ()
|
|
# SOCIAL = (('You can add links in your config file', '#'),
|
|
# ('Another social link', '#'),)
|
|
|
|
PYGMENTS_STYLE='pastie'
|
|
|
|
DEFAULT_PAGINATION = 20
|
|
|
|
# Uncomment following line if you want document-relative URLs when developing
|
|
RELATIVE_URLS = True
|
|
|