-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpelicanconf.py
266 lines (206 loc) · 8.22 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import re
import os
import shutil
AUTHOR = 'ERIC KIM'
AUTHOR_LOWER = 'Eric Kim'
AUTHOR_SHORTENED = 'Eric'
AUTHOR_SUBTITLE = 'Data Scientist, Petroleum Engineer'
SITENAME = 'Pythonic Excursions'
SITESUBTITLE = u'Stories about Python and Data Science'
SITE_DESCRIPTION = 'Pythonic Excursions | Stories about Python and Data Science'
SITEURL = ''
# Regional Settings
TIMEZONE = 'America/Los_Angeles'
DATE_FORMATS = {'en': '%b %d, %Y'}
DEFAULT_LANG = u'en'
# Plugins and extensions
MARKDOWN = {
'extension_configs': {
'markdown.extensions.codehilite': {
'css_class': 'highlight'
},
'markdown.extensions.extra': {},
'markdown.extensions.toc': {
'permalink': 'true'
},
'markdown.extensions.meta': {},
'markdown.extensions.admonition': {},
}
}
MARKUP = ['md']
PLUGIN_PATHS = ['plugins/']
PLUGINS = ['sitemap',
'extract_toc',
'neighbors',
'render_math',
'related_posts',
'share_post',
'series',
'tipue_search',
'summary', # auto-summarizing articles
'feed_summary', # use summaries for RSS, not full articles
'ipynb.liquid', # for embedding notebooks
'liquid_tags.img', # embedding images
'liquid_tags.video', # embedding videos
'liquid_tags.include_code', # including code blocks
'liquid_tags.literal',
'tag_cloud',
]
IGNORE_FILES = ['.ipynb_checkpoints']
SITEMAP = {
'format': 'xml',
'priorities': {
'articles': 0.5,
'indexes': 0.5,
'pages': 0.5
},
'changefreqs': {
'articles': 'hourly',
'indexes': 'daily',
'pages': 'monthly'
}
}
# Appearance
THEME = 'pelican-aegis-jupyter-theme'
DEFAULT_PAGINATION = False
# Defaults
DEFAULT_CATEGORY = 'Miscellaneous'
USE_FOLDER_AS_CATEGORY = True
ARTICLE_URL = u'{slug}'
PAGE_URL = u'{slug}'
PAGE_SAVE_AS = u'{slug}.html'
# Feeds
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
CATEGORY_FEED_ATOM = None
CATEGORY_FEED_RSS = None
CLAIM_GOOGLE = "ZsWFnpirKDgtbmwb1YRymDnSfvnUrpzCbf6LD1F_4TY"
CLAIM_BING = "8FF1B025212A47B5B27CC47163A042F0"
STATIC_PATHS = ['images', 'downloads']
DIRECT_TEMPLATES = (('index', 'archives', 'search', '404', 'about'))
AUTHOR_SAVE_AS = ''
USE_SHORTCUT_ICONS = True
# Labels
RELATED_POSTS_LABEL = 'Related Posts' # articles that share common tags
SHARE_POST_INTRO = 'Share This Post :'
CARD_TEXT = 'MOST POPULAR'
CARD_POSTS = {
'Parse PDF Files While Retaining Structure with Tabula-py': 'parse-pdf-files-while-retaining-structure-with-tabula-py',
'Comprehensive Confidence Intervals for Python Developers': 'comprehensive_confidence_intervals_for_python_developers',
'Multiple Linear Regression and Visualization in Python': 'mutiple_linear_regression_and_visualization_in_python',
}
# SMO
FEATURED_IMAGE = SITEURL + '/theme/img/logo_icon_background.png'
ENABLE_MATHJAX = True
# files are actually saved in /aegis-jupyter/static/img/, but its copied to /output/theme/img/.
# just store any meta files in /aegis-jupyter/static/, and you are good.
PROFILE_PHOTO_FOOTER = "theme/img/profile_photo_footer.jpg"
PROFILE_PHOTO_ABOUT = "theme/img/profile_photo_about.jpg"
INDEX_BANNER_IMAGE = "theme/img/index_banner_image.jpg"
LOGO_WITH_SUBTITLE = "theme/img/logo_with_subtitle.svg" # logo created at "https://vectr.com/"
# actually located in 'content/downloads/misc/'. Files in 'content/downloads' will be copied into 'output/downloads' to
# auto-generate html href link.
RESUME_PDF_LINK = 'downloads/misc/Resume_Fall_2019.pdf'
RESUME_BUTTON_TEXT = 'Download CV'
GITHUB_LINK = 'https://github.com/aegis4048'
LINKEDIN_LINK = 'https://www.linkedin.com/in/eric-kim-34318811b/'
ABOUT_PAGE = 'about.html'
ARCHIVE_PAGE = 'archives.html'
# when developing offline, set it as False.
USE_CDN = False
########################### Jupyter Notebook related ########################
# for liquid tags
CODE_DIR = 'downloads/code'
NOTEBOOK_DIR = 'downloads/notebooks'
MISC_DIR = 'downloads/misc'
# copies files that are used when writing jupyter notebook to output directory
JUPYTER_IMAGES_DIR = 'content/downloads/notebooks/jupyter_images'
def copy_jupyter_images_to_output(dir):
jupyter_image_dir = re.split('\\\\|\\/|\\/\\/', dir)[-1]
if not os.path.exists(os.path.join('output', jupyter_image_dir)):
os.makedirs(os.path.join('output', jupyter_image_dir))
for file in os.listdir(dir):
shutil.copy2(os.path.join(dir, file), os.path.join('output', jupyter_image_dir))
copy_jupyter_images_to_output(JUPYTER_IMAGES_DIR)
############################ Social Media Shares ############################
# About Page
ABOUT_PAGE_TITLE = 'About Eric'
ABOUT_PAGE_DESCRIPTION = 'Pythonic Thinker & Solver, Petroleum Engineer'
# Archive Page
ARCHIVE_PAGE_TITLE = 'Archive'
ARCHIVE_PAGE_DESCRIPTION = 'Full Archives of Pythonic Excursions'
# landing(index) page description
INDEX_PAGE_TITLE = 'Pythonic Excursions'
INDEX_PAGE_DESCRIPTION = u'Stories About Python and Data Science | by Eric Kim'
### social media share debugger
# Twitter: https://cards-dev.twitter.com/validator
# Facebook: https://developers.facebook.com/tools/debug/
##############################################################################
FOOTER_TITLE = 'ABOUT ERIC'
TEXT_FOOTER = 'Petroleum engineering analyst at <a href="https://flogistix.com/" target="blank">Flogistix</a>. I am a self-taught Python developer with ' \
'strong engineering & statistical background. I am good at creating clean, easy-to-read codes for data ' \
'analysis. I enjoy assisting my fellow engineers by developing accessible and reproducible codes.'
EMAIL = 'aegis4048@gmail.com'
LOCATION = 'Oklahoma, USA'
COPYRIGHT_NOTICE = 'Handcrafted by me @2018'
INCLUDE_PROGRESSBAR = True
PROGRESSBAR_COLOR = '#24292e'
# turn off typografy. otherwise the codes in Jupyter won't properly be highlighted
##############################################################################
# code snippet for processing variables for auto-generation of Tech Stacks
NUM_MAX_STAR = 5
TECH_STACKS = {'Python': 5,
'Bootstrap': 4,
'HTML': 4,
'Django': 4,
'jQuery': 4,
'CSS': 4,
}
def process_techstacks(tech_dict, num_max_star):
num_stacks = len(tech_dict)
tech_stacks_list = [{key: {'filled_star': value, 'empty_star': num_max_star - value }} for key, value in tech_dict.items()]
tech_stacks_left = tech_stacks_list[:num_stacks // 2 + num_stacks % 2]
tech_stacks_right = tech_stacks_list[num_stacks // 2 + num_stacks % 2:]
return tech_stacks_left, tech_stacks_right
TECH_STACKS_LEFT, TECH_STACKS_RIGHT = process_techstacks(TECH_STACKS, NUM_MAX_STAR)
##################################################################################################################
PORT = 8090
# rmdir pelican-aegis-jupyter-theme
# git rm --cached pelican-aegis-jupyter-theme -r
# git submodule add https://github.com/aegis4048/pelican-aegis-jupyter-theme.git pelican-aegis-jupyter-theme
# rmdir output
# git rm --cached output -r
# git submodule add https://github.com/aegis4048/aegis4048.github.io.git output
# git submodule add https://github.com/aegis4048/aegis4048.github.io.git output
# git rm --cached pelican-aegis-jupyter-theme -r
# rm -rf .git/modules/pelican-aegis-jupyter-theme
# git remote show origin * remote origin --- check the connected repo
# git submodule update --init --recursive
# git submodule update --init
# pelican content -s publishconf.py
# Javascript function for estimating reading time. Run this on an article, and set the 'readingTime' variable in .md files.
"""
var count_p = 0
$('article').find('p').each(function(){
count_p += 1
});
var count_word = 0
for (i = 0; i < count_p; i++) {
Countable.count($('article p')[i], function(counter) {
count_word += counter.words;
});
}
var wpm = 200,
estimatedTimeMin = Math.round(count_word / wpm)
console.log(estimatedTimeMin)
"""
"""
$('.disqus-comment').each(function(){
var numCommentText = $(this).text(),
num = numCommentText.match(/\d+/g)
$(this).text(num)
});
"""