-
Notifications
You must be signed in to change notification settings - Fork 1
/
pelicanconf.py
141 lines (118 loc) · 4.81 KB
/
pelicanconf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Siong-Ui Te'
SITENAME = u'Pāli Chanting'
# leave SITEURL blank when developing
SITEURL = ''
PATH = 'content'
# avoid processing .html files
READERS = {'html': None}
# mix articles and static files in the same place
# @see https://github.com/getpelican/pelican/issues/1587
ARTICLE_PATHS = ['articles']
STATIC_PATHS = ['articles', 'extra', 'code']
EXTRA_PATH_METADATA = {'extra/robots.txt': {'path': 'robots.txt'},
'extra/yezi.png': {'path': 'favicon.ico'},}
# https://github.com/spatialaudio/nbsphinx/issues/549
# https://docs.getpelican.com/en/stable/settings.html
# https://docutils.sourceforge.io/docs/user/config.html#line-length-limit
DOCUTILS_SETTINGS = {'line_length_limit': 1000000}
# modify TIMEZONE to your timezone
TIMEZONE = 'Asia/Taipei'
DEFAULT_LANG = u'en'
LOCALE = 'en_US.UTF-8'
# @see http://docs.getpelican.com/en/latest/settings.html#basic-settings
# @see http://docs.getpelican.com/en/latest/settings.html#path-metadata
PATH_METADATA = 'articles/(?P<slug>[-a-zA-Z0-9.]*)%(?P<lang>[_a-zA-Z]{2,5})\.rst'
# @see http://docs.getpelican.com/en/latest/settings.html#url-settings
ARTICLE_URL = '{slug}/'
ARTICLE_SAVE_AS = '{slug}/index.html'
# other possible PATH and URL config
#PATH_METADATA = 'articles[-a-zA-Z0-9/]*/(?P<slug>[-a-zA-Z0-9]*)%(?P<lang>[_a-zA-Z]{2,5})\.rst'
#PATH_METADATA = 'articles/(?P<urlpath>[-a-zA-Z0-9/]*)/(?P<slug>[-a-zA-Z0-9]*)%(?P<lang>[_a-zA-Z]{2,5})\.rst'
#ARTICLE_URL = '{urlpath}/{slug}/'
#ARTICLE_SAVE_AS = '{urlpath}/{slug}/index.html'
# 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
DEFAULT_PAGINATION = False
# https://github.com/getpelican/pelican/issues/1513
# {tag}tagName syntax not working now
# Update: 3.6.3 looks working now
THEME = 'theme'
PLUGIN_PATHS = ['plugins']
PLUGINS = ['i18n_subsites',
'edit_on_github',
'embed_github_repository_file',
'embed_picasaweb_image']
# custom setting for HTML meta info
META_KEYWORDS = 'Pāli, Chanting'
META_DESCRIPTION = 'Pāli Chanting'
# mapping: language_code -> settings_overrides_dict
I18N_SUBSITES = {
'zh': {
'SITENAME': '巴利唸誦',
'AUTHOR': '戴上為',
'LOCALE': 'zh_TW.UTF-8',
'META_KEYWORDS': '巴利, 唸誦',
'META_DESCRIPTION': '巴利唸誦',
},
'th': {
'SITENAME': 'บาลีสวดมนต์',
'AUTHOR': 'ฉ่ง-หวี',
'LOCALE': 'th_TH.UTF-8',
'META_KEYWORDS': 'บาลี, สวดมนต์',
'META_DESCRIPTION': 'บาลีสวดมนต์',
},
}
I18N_UNTRANSLATED_ARTICLES = 'remove'
# generate only index.html and pages and articles. (no archives, tags, categories)
#DIRECT_TEMPLATES = ['index']
# use metadata attribute 'order' in page files for ordering
# @see http://docs.getpelican.com/en/latest/settings.html#url-settings
PAGE_ORDER_BY = 'order'
# CONTENT_DIR_URL is the setting for edit_on_github plugin
CONTENT_DIR_URL = u'https://github.com/siongui/pali-chanting/tree/master/content'
# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
# custom Jinja2 filter
def hidden_pages_get_page_with_slug_index(hidden_pages):
for page in hidden_pages:
if page.slug == "index":
return page
# custom Jinja2 filter for localizing theme
def gettext(string, lang):
if lang == "en":
return string
elif lang == "zh":
if string == "Archives": return "歸檔"
elif string == "Categories": return "分類"
elif string == "Category": return "分類"
elif string == "Authors": return "作者"
elif string == "Author": return "作者"
elif string == "Tags": return "標籤"
elif string == "Updated": return "更新"
elif string == "Translation(s)": return "翻譯"
elif string == "Edit on Github": return "在Github上編輯"
else: return string
elif lang == "th":
if string == "Archives": return "สารบรรณ"
elif string == "Categories": return "ประเภท"
elif string == "Category": return "ประเภท"
elif string == "Authors": return "ผู้เขียน"
elif string == "Author": return "ผู้เขียน"
elif string == "Tags": return "แท็ก"
elif string == "Updated": return "การปรับปรุง"
elif string == "Translation(s)": return "การแปล"
elif string == "Edit on Github": return "แก้ไขที่ Github"
else: return string
else:
return string
JINJA_FILTERS = {
"hidden_pages_get_page_with_slug_index": hidden_pages_get_page_with_slug_index,
"gettext": gettext,
}