jekyll-text-theme 1.4.3 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -6
  3. data/_data/locale.yml +21 -3
  4. data/_data/variables.yml +31 -0
  5. data/_includes/{blog → components}/article-data.html +4 -2
  6. data/_includes/{info → components}/follow-me.html +1 -1
  7. data/_includes/{blog → components}/footer.html +1 -1
  8. data/_includes/components/header.html +42 -0
  9. data/_includes/{blog → components}/license.html +0 -0
  10. data/_includes/{blog → components}/tags.html +5 -6
  11. data/_includes/icon/clear.svg +3 -0
  12. data/_includes/icon/link.svg +1 -0
  13. data/_includes/icon/omit.svg +1 -0
  14. data/_includes/icon/search.svg +3 -0
  15. data/_includes/icon/{mail.svg → social/mail.svg} +0 -0
  16. data/_includes/scripts/all.html +244 -0
  17. data/_includes/scripts/common.html +30 -0
  18. data/_includes/scripts/data.html +27 -0
  19. data/_includes/scripts/home.html +26 -0
  20. data/_includes/scripts/page-post.html +32 -0
  21. data/_includes/scripts/post.html +183 -0
  22. data/_includes/scripts/utils.html +180 -0
  23. data/_includes/snippets/get-lang.html +2 -2
  24. data/_includes/snippets/get-sources.html +5 -0
  25. data/_includes/utils/chart.html +17 -0
  26. data/_includes/utils/comment-disqus.html +0 -3
  27. data/_includes/utils/comment-gitalk.html +15 -12
  28. data/_includes/utils/google-analytics.html +6 -8
  29. data/_includes/utils/mathjax.html +10 -4
  30. data/_includes/utils/mermaid.html +5 -4
  31. data/_layouts/all.html +10 -131
  32. data/_layouts/base.html +38 -0
  33. data/_layouts/error-404.html +1 -1
  34. data/_layouts/home.html +81 -68
  35. data/_layouts/page.html +3 -3
  36. data/_layouts/post.html +32 -172
  37. data/_sass/animate/_fade-in-down.scss +10 -0
  38. data/_sass/animate/_fade-in.scss +8 -0
  39. data/_sass/colors/{_colors.chocolate.scss → _chocolate.scss} +9 -3
  40. data/_sass/colors/{_colors.dark.scss → _dark.scss} +10 -3
  41. data/_sass/colors/{_colors.default.scss → _default.scss} +10 -4
  42. data/_sass/colors/{_colors.forest.scss → _forest.scss} +9 -3
  43. data/_sass/colors/{_colors.ocean.scss → _ocean.scss} +9 -3
  44. data/_sass/colors/{_colors.orange.scss → _orange.scss} +9 -3
  45. data/_sass/common/_classes.scss +15 -0
  46. data/_sass/{settings → common}/_highlighting.scss +0 -12
  47. data/_sass/common/_reset.scss +171 -0
  48. data/_sass/common/_variables.scss +64 -0
  49. data/_sass/common/classes/_animation.scss +4 -0
  50. data/_sass/common/classes/_clearfix.scss +7 -0
  51. data/_sass/{mixins → common/classes}/_flex.scss +0 -0
  52. data/_sass/common/classes/_link.scss +161 -0
  53. data/_sass/common/classes/_media.scss +18 -0
  54. data/_sass/common/classes/_shadow.scss +14 -0
  55. data/_sass/common/classes/_shape.scss +19 -0
  56. data/_sass/common/classes/_space.scss +40 -0
  57. data/_sass/common/classes/_split-line.scss +24 -0
  58. data/_sass/common/classes/_transform.scss +4 -0
  59. data/_sass/common/classes/_transition.scss +4 -0
  60. data/_sass/common/classes/_user-select.scss +6 -0
  61. data/_sass/common/components/_button.scss +72 -0
  62. data/_sass/components/_article.content.extra.scss +41 -0
  63. data/_sass/components/_article.content.scss +127 -69
  64. data/_sass/components/_article.data.scss +11 -11
  65. data/_sass/components/_follow-me.scss +27 -34
  66. data/_sass/components/_footer.scss +4 -4
  67. data/_sass/components/_header.scss +35 -22
  68. data/_sass/components/_license.scss +7 -7
  69. data/_sass/components/_main.scss +23 -0
  70. data/_sass/components/_pagination.scss +12 -0
  71. data/_sass/components/_tags.scss +30 -15
  72. data/_sass/components/_toc.scss +32 -19
  73. data/_sass/layout/_all.scss +82 -0
  74. data/_sass/layout/_default.scss +19 -0
  75. data/_sass/{blog/_page.error-404.scss → layout/_error-404.scss} +1 -1
  76. data/_sass/layout/_home.scss +61 -0
  77. data/_sass/layout/_post.scss +80 -0
  78. data/assets/css/blog.scss +29 -34
  79. data/assets/images/logo/logo.svg +1 -1
  80. metadata +56 -38
  81. data/_includes/blog/header.html +0 -56
  82. data/_layouts/blog-base.html +0 -36
  83. data/_layouts/blog-default.html +0 -7
  84. data/_sass/base/_animate.scss +0 -19
  85. data/_sass/base/_base.scss +0 -83
  86. data/_sass/base/_image&icon.scss +0 -23
  87. data/_sass/base/_links.scss +0 -73
  88. data/_sass/base/_text.scss +0 -56
  89. data/_sass/blog/_layout.base.scss +0 -3
  90. data/_sass/blog/_layout.default.scss +0 -21
  91. data/_sass/blog/_layout.post.scss +0 -68
  92. data/_sass/blog/_page.all.scss +0 -35
  93. data/_sass/blog/_page.index.scss +0 -50
  94. data/_sass/components/_wrapper.scss +0 -29
  95. data/_sass/mixins/_link.scss +0 -67
  96. data/_sass/mixins/_media.scss +0 -12
  97. data/_sass/mixins/_prefix.scss +0 -14
  98. data/_sass/mixins/_shape.scss +0 -19
  99. data/_sass/settings/_base.scss +0 -12
  100. data/_sass/settings/_colors.scss +0 -9
  101. data/_sass/settings/_font.scss +0 -32
@@ -1,6 +1,6 @@
1
- {%- assign __return = '' -%}
1
+ {%- assign __return = site.data.variables.default.lang -%}
2
2
  {%- if page.lang -%}
3
3
  {%- assign __return = page.lang -%}
4
- {%- else -%}
4
+ {%- elsif site.lang -%}
5
5
  {%- assign __return = site.lang -%}
6
6
  {%- endif -%}
@@ -0,0 +1,5 @@
1
+ {%- assign _sources = site.data.variables.default.sources -%}
2
+ {%- if site.sources -%}
3
+ {%- assign _sources = site.sources -%}
4
+ {%- endif -%}
5
+ {%- assign __return = site.data.variables.sources[_sources] -%}
@@ -0,0 +1,17 @@
1
+ {%- if site.chart == true or page.chart == true -%}
2
+ {%- include snippets/get-sources.html -%}
3
+ {%- assign _sources = __return -%}
4
+ <script>
5
+ window.Lazyload.js(['{{ _sources.jquery }}', '{{ _sources.chart }}'], function() {
6
+ var $canvas = null, $this = null, _ctx = null, _text = '';
7
+ $('.language-chart').each(function(){
8
+ $this = $(this);
9
+ $canvas = $('<canvas></canvas>');
10
+ _text = $this.text();
11
+ $this.text('').append($canvas);
12
+ _ctx = $canvas.get(0).getContext('2d');
13
+ (_ctx && _text) && (new Chart(_ctx, JSON.parse(_text)) && $this.attr('data-processed', true));
14
+ });
15
+ });
16
+ </script>
17
+ {%- endif -%}
@@ -1,16 +1,13 @@
1
1
  {%- if site.disqus.shortname and page.key -%}
2
2
  <div id="disqus_thread"></div>
3
3
  <script>
4
-
5
4
  /**
6
5
  * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
7
6
  * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
8
-
9
7
  var disqus_config = function () {
10
8
  this.page.url = '{%- include snippets/page-url.html -%}';
11
9
  this.page.identifier = '{{ page.key }}';
12
10
  };
13
-
14
11
  (function() { // DON'T EDIT BELOW THIS LINE
15
12
  var d = document, s = d.createElement('script');
16
13
  s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
@@ -1,22 +1,25 @@
1
1
  {%- if site.disqus.shortname == nil and site.gitalk.clientID and site.gitalk.clientSecret and site.gitalk.repository and site.gitalk.owner and site.gitalk.admin and page.key -%}
2
- <link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
3
- <div id="js-gitalk-container"></div>
4
- {%- assign admin = '' -%}
5
- {%- for adminId in site.gitalk.admin -%}
6
- {%- assign admin = admin | append: ", '" | append: adminId | append: "'" -%}
7
- {%- endfor -%}
8
- {%- assign last = admin | size | minus: 1 -%}
9
- {%- assign admin = admin | slice: 2, last -%}
10
- <script src="//unpkg.com/gitalk/dist/gitalk.min.js"></script>
11
- <script>
2
+ {%- include snippets/get-sources.html -%}
3
+ {%- assign _sources = __return -%}
4
+ <div id="js-gitalk-container"></div>
5
+ {%- assign admin = '' -%}
6
+ {%- for adminId in site.gitalk.admin -%}
7
+ {%- assign admin = admin | append: ", '" | append: adminId | append: "'" -%}
8
+ {%- endfor -%}
9
+ {%- assign last = admin | size | minus: 1 -%}
10
+ {%- assign admin = admin | slice: 2, last -%}
11
+ <script>
12
+ window.Lazyload.css('{{ _sources.gitalk.css }}');
13
+ window.Lazyload.js('{{ _sources.gitalk.js }}', function() {
12
14
  var gitalk = new Gitalk({
13
15
  clientID: '{{ site.gitalk.clientID }}',
14
16
  clientSecret: '{{ site.gitalk.clientSecret }}',
15
17
  repo: '{{ site.gitalk.repository }}',
16
18
  owner: '{{ site.gitalk.owner }}',
17
19
  admin: [{{ admin }}],
18
- id: '{{ page.key }}'
20
+ id: '{{ page.key }}'
19
21
  });
20
22
  gitalk.render('js-gitalk-container');
21
- </script>
23
+ });
24
+ </script>
22
25
  {%- endif -%}
@@ -1,13 +1,11 @@
1
1
  {%- if site.ga_tracking_id -%}
2
- <!-- Google Analytics -->
3
2
  <script>
4
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
5
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
6
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
7
- })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
3
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
5
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
8
7
 
9
- ga('create', '{{ site.ga_tracking_id }}', 'auto');
10
- ga('send', 'pageview');
8
+ ga('create', '{{ site.ga_tracking_id }}', 'auto');
9
+ ga('send', 'pageview');
11
10
  </script>
12
- <!-- End Google Analytics -->
13
11
  {%- endif -%}
@@ -1,8 +1,14 @@
1
1
  {%- if site.mathjax == true or page.mathjax == true -%}
2
+ {%- include snippets/get-sources.html -%}
3
+ {%- assign _sources = __return -%}
2
4
  <script type="text/x-mathjax-config">
3
- MathJax.Hub.Config({
4
- tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
5
- });
5
+ var _config = { tex2jax: {
6
+ inlineMath: [['$','$'], ['\\(','\\)']]
7
+ }};
8
+ {%- if site.mathjax_autoNumber == true or page.mathjax_autoNumber == true -%}
9
+ _config.TeX = { equationNumbers: { autoNumber: "all" } };
10
+ {%- endif -%}
11
+ MathJax.Hub.Config(_config);
6
12
  </script>
7
- <script type="text/javascript" async src="//cdn.bootcss.com/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
13
+ <script type="text/javascript" src="{{ _sources.mathjax }}" async></script>
8
14
  {%- endif -%}
@@ -1,9 +1,10 @@
1
1
  {%- if site.mermaid == true or page.mermaid == true -%}
2
- <script src="//cdn.bootcss.com/mermaid/7.1.2/mermaid.min.js"></script>
2
+ {%- include snippets/get-sources.html -%}
3
+ {%- assign _sources = __return -%}
3
4
  <script>
4
- mermaid.init(undefined, '.language-mermaid');
5
- $(function() {
6
- mermaid.initialize({ startOnLoad: true });
5
+ window.Lazyload.js('{{ _sources.mermaid }}', function() {
6
+ mermaid.init(undefined, '.language-mermaid');
7
+ mermaid.initialize({ startOnLoad: true });
7
8
  });
8
9
  </script>
9
10
  {%- endif -%}
data/_layouts/all.html CHANGED
@@ -1,141 +1,20 @@
1
1
  ---
2
- layout: blog-default
2
+ layout: base
3
3
  titles:
4
4
  en: All Posts
5
5
  zh: 归档
6
6
  zh-Hans: 归档
7
7
  zh-Hant: 歸檔
8
8
  ---
9
- <div class="m-all">
9
+ <div class="m-all js-all">
10
10
  <div class="main">
11
- {%- include snippets/page-title.html -%}
12
- <h1 class="js-page-heading">{{ __return }}</h1>
13
- {%- include blog/tags.html -%}
11
+ <div class="m-search-box js-search-box">
12
+ <div class="icon-search">{%- include icon/search.svg -%}</div>
13
+ <input type="text" />
14
+ <div class="icon-clear">{%- include icon/clear.svg -%}</div>
15
+ </div>
16
+ {%- include components/tags.html -%}
14
17
  <!--group by year: http://stackoverflow.com/questions/19086284/jekyll-liquid-templating-how-to-group-blog-posts-by-year-->
15
- <section class="js-year-wrapper">
16
- {%- for post in site.posts -%}
17
- {%- assign currentdate = post.date | date: '%Y' -%}
18
- {%- if currentdate != date -%}
19
- {%- unless forloop.first -%}</ul></section>{%- endunless -%}
20
- <section id="{{ post.date | date: "%Y" }}">
21
- <h2 class="year-title" id="year-{{ post.date | date: "%Y" }}">{{ currentdate }}</h2>
22
- <ul class="year-list">
23
- {%- assign date = currentdate -%}
24
- {%- endif -%}
25
- {%- assign _tags = '' -%}
26
- {%- for tag in post.tags -%}
27
- {%- assign _tag = tag | strip | url_encode -%}
28
- {%- assign _tags = _tags | append: ',' | append: _tag -%}
29
- {%- endfor -%}
30
- {%- assign last = _tags | size | minus: 1 -%}
31
- {%- assign _tags = _tags | slice: 1, last -%}
32
- {%- assign __path = post.url -%}
33
- {%- include snippets/prepend-baseurl.html -%}
34
- {%- assign href = __return -%}
35
- {%- assign __locale = site.data.locale.ARTICLE_LIST_DATE_FORMAT -%}
36
- {%- include snippets/locale-to-string.html -%}
37
- <li class="js-post-block" data-tag="{{ _tags }}">
38
- <span class="post-date">{{ post.date | date: __return }}</span>
39
- <a class="post-link" href="{{ href }}">{{ post.title }}</a>
40
- </li>
41
- {%- if forloop.last -%}</ul></section>{%- endif -%}
42
- {%- endfor -%}
43
- </section>
18
+ <div class="js-result m-result"></div>
44
19
  </div>
45
- </div>
46
- {%- include snippets/page-title.html -%}
47
- <script type="text/javascript">
48
- // function queryString is copied from
49
- // http://stackoverflow.com/questions/979975/how-to-get-the-value-from-url-parameter#answer-979995
50
- function queryString() {
51
- // This function is anonymous, is executed immediately and
52
- // the return value is assigned to QueryString!
53
- var i = 0,
54
- queryObj = {},
55
- pair;
56
- var queryStr = window.location.search.substring(1);
57
- var queryArr = queryStr.split('&');
58
- for (i = 0; i < queryArr.length; i++) {
59
- pair = queryArr[i].split('=');
60
- // If first entry with this name
61
- if (typeof queryObj[pair[0]] === 'undefined') {
62
- queryObj[pair[0]] = pair[1];
63
- // If second entry with this name
64
- } else if (typeof queryObj[pair[0]] === 'string') {
65
- queryObj[pair[0]] = [queryObj[pair[0]], pair[1]];
66
- // If third or later entry with this name
67
- } else {
68
- queryObj[pair[0]].push(pair[1]);
69
- }
70
- }
71
- return queryObj;
72
- }
73
-
74
- $(function() {
75
- var $pageHeading = $('.js-page-heading');
76
- var $articleTag = $('.js-article-tag');
77
- var $tagShowAll = $('.js-tag-show-all');
78
- var $postBlock = $('.js-post-block');
79
- var $yearSection = $('.js-year-wrapper section');
80
-
81
- window.tagSelect = function(tag) {
82
- var i = 0,
83
- flag = false,
84
- cur, tagStr = '',
85
- tags = [],
86
- _tag = '',
87
- lis = [];
88
- if (tag === undefined || tag === '') {
89
- $pageHeading.text('{{ __return }}');
90
- $tagShowAll.focus();
91
- $postBlock.show();
92
- } else {
93
- tag = tag.trim();
94
- // $articleTag.filter('.tag-' + tag).focus();
95
- for (i = 0; i < $articleTag.length; i++) {
96
- cur = $articleTag.eq(i);
97
- _tag = cur.data('tag');
98
- if (typeof _tag === 'string' && _tag.trim() === tag) {
99
- cur.focus();
100
- tagStr = cur.children('span').text();
101
- (typeof tagStr === 'string') && (tagStr = tagStr.trim());
102
- $pageHeading.text('Tag: ' + tagStr);
103
- break;
104
- }
105
- }
106
- $postBlock.each(function() {
107
- flag = false;
108
- cur = $(this);
109
- tags = cur.data('tag').split(',');
110
- for (i = 0; i < tags.length; i++) {
111
- _tag = tags[i].trim();
112
- if (_tag === tag) {
113
- flag = true;
114
- cur.show();
115
- break;
116
- }
117
- }
118
- flag || (cur.hide());
119
- });
120
- }
121
- $yearSection.each(function() {
122
- flag = false;
123
- cur = $(this);
124
- lis = cur.find('li');
125
- for (i = 0; i < lis.length; i++) {
126
- if (lis.eq(i).css('display') !== 'none') {
127
- flag = true;
128
- break;
129
- }
130
- }
131
- flag ? cur.show() : cur.hide();
132
- });
133
- tag === undefined || window.history.replaceState(null, '', window.location.href.split('?')[0] + '?tag=' + tag);
134
- }
135
-
136
- var query = queryString(),
137
- tag = undefined;
138
- query.tag === undefined || (tag = query.tag);
139
- tagSelect(tag);
140
- });
141
- </script>
20
+ </div>
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ {%- include snippets/get-lang.html -%}
3
+ <html lang="{{ __return }}">
4
+ <head>
5
+ {%- include common-head.html -%}
6
+ {%- include head-icons-rel.html -%}
7
+ {%- assign __path = '/assets/css/blog.css' -%}
8
+ {%- include snippets/prepend-baseurl.html -%}
9
+ <link rel="stylesheet" href="{{ __return }}">
10
+ {%- include scripts/utils.html -%}
11
+ </head>
12
+ <body>
13
+ <div class="m-page-stage js-page-stage">
14
+ <div class="m-page-content">
15
+ {%- include components/header.html -%}
16
+ <div class="m-page-main">{{ content }}</div>
17
+ </div>
18
+ </div>
19
+ {%- include components/footer.html -%}
20
+ {%- include scripts/common.html -%}
21
+ {%- if page.layout == "home" -%}
22
+ {%- include scripts/home.html -%}
23
+ {%- elsif page.layout == "page" -%}
24
+ {%- include scripts/page-post.html -%}
25
+ {%- elsif page.layout == "post" -%}
26
+ {%- include scripts/page-post.html -%}
27
+ {%- include scripts/post.html -%}
28
+ {%- elsif page.layout == "all" -%}
29
+ {%- include scripts/all.html -%}
30
+ {%- endif -%}
31
+ {%- include utils/mathjax.html -%}
32
+ {%- include utils/mermaid.html -%}
33
+ {%- include utils/chart.html -%}
34
+ {%- if jekyll.environment != "development" -%}
35
+ {%- include utils/google-analytics.html -%}
36
+ {%- endif -%}
37
+ </body>
38
+ </html>
@@ -1,5 +1,5 @@
1
1
  ---
2
- layout: blog-default
2
+ layout: base
3
3
  title: 404
4
4
  ---
5
5
  <div class="m-error-404">
data/_layouts/home.html CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- layout: blog-default
2
+ layout: base
3
3
  titles:
4
4
  en: Blog
5
5
  zh: 博客
@@ -27,7 +27,7 @@ titles:
27
27
  {%- assign __locale = site.data.locale.READMORE -%}
28
28
  {%- include snippets/locale-to-string.html -%}
29
29
  <a href="{{ href }}">{{ __return }}</a>
30
- {%- include blog/article-data.html -%}
30
+ {%- include components/article-data.html -%}
31
31
  </article>
32
32
  {%- endfor -%}
33
33
  </div>
@@ -38,85 +38,98 @@ titles:
38
38
  {%- assign post_count = site.posts | size -%}
39
39
  {%- assign page_count = paginator.total_pages -%}
40
40
  <p>{{ __return | replace: '[POST_COUNT]', post_count | replace: '[PAGE_COUNT]', page_count }}</p>
41
- <ul class="inline-list">
42
- {%- if paginator.previous_page -%}
43
- {%- assign __path = paginator.previous_page_path -%}
44
- {%- include snippets/prepend-baseurl.html -%}
45
- {%- assign href = __return -%}
46
- <li><a class="round-button" href="{{ href }}">
47
- <div class="icon icon--previous">{%- include icon/previous.svg -%}</div></a>
48
- </li>
49
- {%- else -%}
50
- <li><div class="round-button inactive">
51
- <div class="icon icon--prrevious">{%- include icon/previous.svg -%}</div></div>
52
- </li>
53
- {%- endif -%}
54
- {%- for page in (1..paginator.total_pages) -%}
55
- {%- if page == paginator.page -%}
56
- <li>
57
- <div class="round-button cur"><span>{{ page }}</span></div>
58
- </li>
59
- {%- elsif page == 1 -%}
60
- {%- if site.paths.base -%}
61
- {%- assign __path = site.paths.base -%}
41
+ <ul>
42
+ {%- assign _max_show = 5 -%}
43
+ {%- assign _max_show_modulo_two = _max_show | modulo: 2 -%}
44
+ {%- assign _length = paginator.total_pages -%}
45
+ {%- assign _length_mimus_one = _length | minus: 1 -%}
46
+ {%- assign _cur = paginator.page -%}
47
+ {%- assign _extra = _max_show | minus: 3 -%}
48
+ {%- assign _extra_half = _extra | divided_by: 2 -%}
49
+ {%- if _max_show > 4 and _max_show_modulo_two == 1 and paginator.total_pages > _max_show -%}
50
+ {%- assign _condition0 = _extra | divided_by: 2 | plus: 1 -%}
51
+ {%- assign _condition1 = _length | minus: _extra_half -%}
52
+ {%- if _cur <= _condition0 -%}
53
+ {%- assign _n0 = 2 -%}
54
+ {%- assign _n1 = _extra | plus: 2 -%}
55
+ {%- elsif _cur >= _condition1 -%}
56
+ {%- assign _n0 = _length | minus: _extra | minus: 1 -%}
57
+ {%- assign _n1 = _length | minus: 1 -%}
62
58
  {%- else -%}
63
- {%- assign __path = '/' -%}
59
+ {%- assign _n0 = _cur | minus: _extra_half -%}
60
+ {%- assign _n1 = _cur | plus: _extra_half -%}
64
61
  {%- endif -%}
62
+ {%- endif -%}
63
+ {%- if paginator.previous_page -%}
64
+ {%- assign __path = paginator.previous_page_path -%}
65
65
  {%- include snippets/prepend-baseurl.html -%}
66
66
  {%- assign href = __return -%}
67
- <li>
68
- <a class="round-button" href="{{ href }}"><span>{{ page }}</span></a>
67
+ <li><a class="round-button" href="{{ href }}">
68
+ <div class="icon icon--previous">{%- include icon/previous.svg -%}</div></a>
69
69
  </li>
70
70
  {%- else -%}
71
- {%- assign __path = site.paginate_path -%}
71
+ <li><div class="round-button inactive">
72
+ <div class="icon icon--prrevious">{%- include icon/previous.svg -%}</div></div>
73
+ </li>
74
+ {%- endif -%}
75
+
76
+ {%- for page in (1.._length) -%}
77
+ {%- if page == _cur -%}
78
+ <li>
79
+ <div class="round-button cur"><span>{{ page }}</span></div>
80
+ </li>
81
+ {%- elsif page == 1 -%}
82
+ {%- if site.paths.base -%}
83
+ {%- assign __path = site.paths.base -%}
84
+ {%- else -%}
85
+ {%- assign __path = '/' -%}
86
+ {%- endif -%}
87
+ {%- include snippets/prepend-baseurl.html -%}
88
+ {%- assign href = __return -%}
89
+ <li>
90
+ <a class="round-button" href="{{ href }}"><span>{{ page }}</span></a>
91
+ </li>
92
+ {%- else -%}
93
+ {%- if _n0 and _n1 -%}
94
+ {%- if page > 1 and page < _n0 -%}
95
+ {%- if page == 2 -%}<li><span class="omit">{%- include icon/omit.svg -%}</span></li>{%- endif -%}
96
+ {%- elsif page > _n1 and page < _length -%}
97
+ {%- if page == _length_mimus_one -%}<li><span class="omit">{%- include icon/omit.svg -%}</span></li>{%- endif -%}
98
+ {%- else -%}
99
+ {%- assign __path = site.paginate_path -%}
100
+ {%- include snippets/prepend-baseurl.html -%}
101
+ {%- assign href = __return -%}
102
+ <li>
103
+ <a class="round-button" href="{{ href | replace: ':num', page }}"><span>{{ page }}</span></a>
104
+ </li>
105
+ {%- endif -%}
106
+ {%- else -%}
107
+ {%- assign __path = site.paginate_path -%}
108
+ {%- include snippets/prepend-baseurl.html -%}
109
+ {%- assign href = __return -%}
110
+ <li>
111
+ <a class="round-button" href="{{ href | replace: ':num', page }}"><span>{{ page }}</span></a>
112
+ </li>
113
+ {%- endif -%}
114
+ {%- endif -%}
115
+ {%- endfor -%}
116
+ {%- if paginator.next_page -%}
117
+ {%- assign __path = paginator.next_page_path -%}
72
118
  {%- include snippets/prepend-baseurl.html -%}
73
119
  {%- assign href = __return -%}
74
120
  <li>
75
- <a class="round-button" href="{{ href | replace: ':num', page }}"><span>{{ page }}</span></a>
121
+ <a class="round-button" href="{{ href }}">
122
+ <div class="icon icon--next">{%- include icon/next.svg -%}</div>
123
+ </a>
76
124
  </li>
125
+ {%- else -%}
126
+ <li><div class="round-button inactive">
127
+ <div class="icon icon--next">{%- include icon/next.svg -%}</div>
128
+ </div>
129
+ </li>
77
130
  {%- endif -%}
78
- {%- endfor -%}
79
- {%- if paginator.next_page -%}
80
- {%- assign __path = paginator.next_page_path -%}
81
- {%- include snippets/prepend-baseurl.html -%}
82
- {%- assign href = __return -%}
83
- <li>
84
- <a class="round-button" href="{{ href }}">
85
- <div class="icon icon--next">{%- include icon/next.svg -%}</div>
86
- </a>
87
- </li>
88
- {%- else -%}
89
- <li><div class="round-button inactive">
90
- <div class="icon icon--next">{%- include icon/next.svg -%}</div>
91
- </div></li>
92
- {%- endif -%}
93
131
  </ul>
94
132
  </nav>
95
133
  {%- endif -%}
96
134
  </div>
97
135
  </div>
98
- {%- if site.leancloud.app_id and site.leancloud.app_key and site.leancloud.app_class and site.isdebug == false -%}
99
- <script src="//cdn1.lncld.net/static/js/3.4.1/av-min.js"></script>
100
- <script>
101
- $(function() {
102
- AV.init({
103
- appId: '{{ site.leancloud.app_id }}',
104
- appKey: '{{ site.leancloud.app_key }}'
105
- });
106
- $(".article-view").each(function() {
107
- var curId = this.id;
108
- var query = new AV.Query('{{ site.leancloud.app_class }}');
109
- query.equalTo('key', curId.substr(9));
110
- query.first().then(function(result) {
111
- if (result) {
112
- $('#' + curId).text(result.attributes.views);
113
- }
114
- }, function(error) {
115
- if (error) {
116
- throw error;
117
- }
118
- });
119
- });
120
- });
121
- </script>
122
- {%- endif -%}