-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfixNext.sh
46 lines (39 loc) · 1.87 KB
/
fixNext.sh
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
#!/bin/bash
# ./fixNext.sh next_theme_dir
# for example put FixNext in hexo_dir and use: `FixNext/fixNext.sh themes/next`
# pull the lastest Next theme
# git clone https://github.com/theme-next/hexo-theme-next $1
rm -rf $1
git clone git@github.com:theme-next/hexo-theme-next.git $1
# git clone git@github.com:sli1989/hexo-theme-next.git themes/next
# auto install 3rd libs locally, use CDN verdor instead
# git clone https://github.com/theme-next/theme-next-pace $1/source/lib/pace
# fix Categories meta
# replace
sed "s/__('post.in')/__('post.in') + __('symbol.colon')/" -i $1/layout/_macro/post.swig
# add behind the matching row
sed '/symbol.comma/a \ <span> > <\/span>' -i $1/layout/_macro/post.swig
# delete the matching row
sed -i '/symbol.comma/d' $1/layout/_macro/post.swig
# Click on the site-author-image to return to the homepage
# add in front of the matching row
sed '/<img class="site-author-image"/i <a href="/" class="site-author-image" rel="start" style="border:none">' -i $1/layout/_partials/sidebar/site-overview.swig
# add behind the matching row
sed '/alt="{{ theme.author }}" \/>/a </a>' -i $1/layout/_partials/sidebar/site-overview.swig
# H5 music player
# add in front of the matching row
# Turn the command line into double quotes when you have single quotes
sed "/<\/body>/i {% include '_my/audio.swig' %}" -i $1/layout/_layout.swig
cp -a FixNext/QPlayer/_my $1/layout
# display Footnotes
# add in front of the matching row
cp FixNext/custom.js $1/source/js
sed '/<\/body>/i <script type="text/javascript" src="/js/custom.js"></script>' -i $1/layout/_layout.swig
# add new indexpage
# add behind the matching row
sed '/commonweal/a \ hits: 热文\n navi: 导航\n comments: 留言板' -i $1/languages/zh-CN.yml
# fix Categories meta
# replace
sed "s/分类于/分类/" -i $1/languages/zh-CN.yml
# replace the zh-CN
# cp FixNext/zh-CN.yml $1/languages/zh-CN.yml