jekyll-rtd-theme 1.1.2 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e823e3b01e51ae8671337a94314e736ab6227762eb7477bf0ae8fbb0d0ad1c3
4
- data.tar.gz: 222f110766405f9cd0a299dfccde339f04ac85ea82abf8258ca471a3d39353e5
3
+ metadata.gz: bfa6e7cffcb895b7a19f9f904415f281083b74a3578bb9e2679058895719c54a
4
+ data.tar.gz: 144a22891ac23e3fc30dbfc9b2ccfa11c595be2667f0d24de1c034f747086e05
5
5
  SHA512:
6
- metadata.gz: 9ded9e6c16623c617ea73684a082742b29bf850f4bf7dab8d99e3ee58cf2dfb6730c97f0a6863b5ad9cb9be71436b119947544f4d610e3e415c9a875792fd0b1
7
- data.tar.gz: acdbeaf0a2631fe40d1c08b2c2245ce18af876fcba2304b4b949368476a785629373f6241c419a8776293672531e790385277ad992f24f7e8879737e759d6ddf
6
+ metadata.gz: 53034a59f804c982e3c36dc863567050dbb8c45bd510c09e6244c9e839d0456df681dfb3e4deb2b1b9a8d3aedb87f7aa2db0f20692aa80fde22e471d21e6b201
7
+ data.tar.gz: fb7a032b4b6f85f82cd9078ba514970fce313cf2b6dbab52689c7de8979ce69da7aa38560ba63cad1c20885e67f6980d749ff776f4f8b51dd66be42a4d918f24
data/README.md CHANGED
@@ -7,28 +7,34 @@
7
7
  [![](https://img.shields.io/badge/featured%20on-JekyllThemes-red.svg)](https://jekyll-themes.com)
8
8
  [![](https://badges.gitter.im/rundocs/jekyll-rtd-theme.svg)][gitter]
9
9
 
10
- Just another documentation theme compatible with GitHub Pages, based on sphinx_rtd_theme
10
+ GitHub-flavored docs theme for Jekyll, based on sphinx_rtd_theme
11
11
 
12
- ![](https://user-images.githubusercontent.com/68011645/89026666-ad3a8680-d35b-11ea-9f4b-d3fe26ae12ed.png)
12
+ <img class="shadow-box" width="50%" alt="jekyll-rtd-theme" src="https://user-images.githubusercontent.com/68011645/89026666-ad3a8680-d35b-11ea-9f4b-d3fe26ae12ed.png">
13
+
14
+ ## Quick start
15
+ ```yml
16
+ remote_theme: rundocs/jekyll-rtd-theme
17
+ ```
18
+ You can [generate](https://github.com/rundocs/starter-slim/generate) with the same files and folders from [rundocs/starter-slim](https://github.com/rundocs/starter-slim/)
13
19
 
14
20
  ## Features
15
- - Automatically generate sidebar based on directory
16
- - Only need one file `_config.yml` to configure site
17
- - Search engine optimized
21
+ - Automatically generate nested sidebar based on directory
18
22
  - Multi-language supported
23
+ - Search engine optimized
19
24
  - Document search (RegExp supported)
20
25
  - Support third-party comments
21
26
  - Google, Baidu, CNZZ Analytics supported
22
-
23
- ## Roadmap
24
- See the [open issues](https://github.com/rundocs/jekyll-rtd-theme/issues) for a list of proposed features (and known issues)
27
+ - Just need one file `_config.yml` to configure site
25
28
 
26
29
  ## Documents
27
- You can view theme related [tests](https://rundocs.github.io/jekyll-rtd-theme), For full documentation, please refer to [https://rundocs.io](https://rundocs.io)
30
+ For full documentation, please refer to our website ([rundocs.io](https://rundocs.io/)) for details
28
31
 
29
- ## The License
30
- The theme is available as open source under the terms of the [MIT License](https://github.com/rundocs/jekyll-rtd-theme/blob/master/LICENSE).
32
+ ### test
33
+ - Latest test document: [rundocs.github.io/jekyll-rtd-theme](https://rundocs.github.io/jekyll-rtd-theme)
34
+ - Preview debug branch, please refer to [rundocs.github.io/debug](https://rundocs.github.io/debug)
31
35
 
36
+ ## The license
37
+ The theme is available as open source under the terms of the MIT License
32
38
 
33
39
  [repository]: https://github.com/rundocs/jekyll-rtd-theme
34
40
  [rubygem]: https://rubygems.org/gems/jekyll-rtd-theme
@@ -1,7 +1,7 @@
1
1
  <div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
2
2
  <span class="rst-current-version" data-toggle="rst-current-version">
3
3
  <span class="fa fa-book"> {{ site.title }}</span>
4
- {% if site.addons_branch and site.github_metadata != false %}v: {{ branch }}{% endif %}
4
+ {% if site.addons_branch and site.github_metadata != false %}{{ branch }}{% endif %}
5
5
  <span class="fa fa-caret-down"></span>
6
6
  </span>
7
7
  <div class="rst-other-versions">
@@ -9,6 +9,10 @@
9
9
  {% for item in items -%}
10
10
  {%- if addons contains item -%}
11
11
  {% include addons/{{ item }}.liquid %}
12
+ {%- else -%}
13
+ {%- if item.github -%}
14
+ {% include addons/github.liquid items=item.github %}
15
+ {%- endif -%}
12
16
  {%- endif -%}
13
17
  {% endfor -%}
14
18
  <hr>
@@ -6,3 +6,13 @@
6
6
  </a>
7
7
  </dd>
8
8
  </dl>
9
+
10
+ <script>
11
+ $(document).ready(function() {
12
+ let analytics = new URL("https://rundocs-analytics.glitch.me/collect?v={{ version }}&lang={{ lang }}");
13
+ analytics.searchParams.append("user_lang", navigator.language);
14
+ analytics.searchParams.append("host", location.host);
15
+ analytics.searchParams.append("platform", navigator.platform);
16
+ $.getJSON(analytics.toString(), (data) => $("#counter").html(data.count));
17
+ });
18
+ </script>
@@ -1,6 +1,20 @@
1
1
  <dl>
2
2
  <dt>{{ __github }}</dt>
3
- <dd><a href="{{ repository_url }}"><i class="fa fa-github"></i> {{ __homepage }}</a></dd>
4
- <dd><a href="{{ zip_url }}"><i class="fa fa-download"></i> {{ __download }}</a></dd>
5
- <dd><a href="{{ issues_url }}"><i class="fa fa-question-circle-o"></i> {{ __issues }}</a></dd>
3
+ {%- if include.items -%}
4
+ {% for item in include.items -%}
5
+ {% case item %}
6
+ {% when "homepage" %}
7
+ <dd><a href="{{ repository_url }}"><i class="fa fa-github"></i> {{ __homepage }}</a></dd>
8
+ {% when "issues" %}
9
+ <dd><a href="{{ issues_url }}"><i class="fa fa-question-circle-o"></i> {{ __issues }}</a></dd>
10
+ {% when "download" %}
11
+ <dd><a href="{{ zip_url }}"><i class="fa fa-download"></i> {{ __download }}</a></dd>
12
+ {% else %}
13
+ {% endcase %}
14
+ {% endfor -%}
15
+ {%- else -%}
16
+ <dd><a href="{{ repository_url }}"><i class="fa fa-github"></i> {{ __homepage }}</a></dd>
17
+ <dd><a href="{{ issues_url }}"><i class="fa fa-question-circle-o"></i> {{ __issues }}</a></dd>
18
+ <dd><a href="{{ zip_url }}"><i class="fa fa-download"></i> {{ __download }}</a></dd>
19
+ {%- endif -%}
6
20
  </dl>
@@ -1,9 +1,6 @@
1
1
  $(document).ready(function() {
2
- let analytics = new URL("https://rundocs-analytics.glitch.me/collect?v={{ version }}&lang={{ lang }}");
3
- let highlight = new URL(location.href).searchParams.get("highlight");
4
-
5
- SphinxRtdTheme.Navigation.reset = function() {
6
- const link = $(".wy-menu-vertical").find(`[href="${location.pathname}"]`);
2
+ function initialize(name) {
3
+ let link = $(".wy-menu-vertical").find(`[href="${decodeURI(name)}"]`);
7
4
  if (link.length > 0) {
8
5
  $(".wy-menu-vertical .current").removeClass("current");
9
6
  link.addClass("current");
@@ -14,34 +11,157 @@ $(document).ready(function() {
14
11
  link.closest("li.toctree-l4").addClass("current");
15
12
  link.closest("li.toctree-l5").addClass("current");
16
13
  }
17
- };
18
- SphinxRtdTheme.Navigation.enable(true);
19
-
20
- if (highlight) {
21
- $(".section").find("*").each(function() {
22
- try {
23
- if (this.outerHTML.match(new RegExp(highlight, "im"))) {
24
- $(this).addClass("highlighted-box");
14
+ }
15
+
16
+ function toggleCurrent(link) {
17
+ let closest = link.closest("li");
18
+ closest.siblings("li.current").removeClass("current");
19
+ closest.siblings().find("li.current").removeClass("current");
20
+ closest.find("> ul li.current").removeClass("current");
21
+ closest.toggleClass("current");
22
+ }
23
+
24
+ function toc() {
25
+ $(".wy-menu-vertical li.current").append('<ul class="content-toc"></ul>').html(function() {
26
+ let level = parseInt(this.dataset.level);
27
+ let temp = 0;
28
+ let stack = [$(this).find(".content-toc")];
29
+
30
+ $(".document").find("h2,h3,h4,h5,h6").each(function() {
31
+ let anchor = $("<a/>").addClass("reference internal").text($(this).text()).attr("href", `#${this.id}`);
32
+ let tagLevel = parseInt(this.tagName.slice(1)) - 1;
33
+
34
+ if (tagLevel > temp) {
35
+ let parent = stack[0].children("li:last")[0];
36
+ if (parent) {
37
+ stack.unshift($("<ul/>").appendTo(parent));
38
+ }
39
+ } else {
40
+ stack.splice(0, Math.min(temp - tagLevel, Math.max(stack.length - 1, 0)));
25
41
  }
26
- } catch (e) {
27
- feedback(["highlight", e.message]);
42
+ temp = tagLevel;
43
+
44
+ $("<li/>").addClass(`toctree-l${level + tagLevel}`).append(anchor).appendTo(stack[0]);
45
+ });
46
+ if (!stack[0].html()) {
47
+ stack[0].remove();
28
48
  }
29
49
  });
30
- $(".section").find(".highlighted-box").each(function() {
31
- if (($(this).find(".highlighted-box").length > 0)) {
32
- $(this).removeClass("highlighted-box");
50
+ }
51
+
52
+ function set(name, value) {
53
+ return localStorage.setItem(name, value);
54
+ }
55
+
56
+ function get(name) {
57
+ return localStorage.getItem(name) || false;
58
+ }
59
+
60
+ function restore() {
61
+ let scroll = get("scroll");
62
+ let scrollTime = get("scrollTime");
63
+ let scrollHost = get("scrollHost");
64
+
65
+ if (scroll && scrollTime && scrollHost) {
66
+ if (scrollHost == location.host && (Date.now() - scrollTime < 6e5)) {
67
+ $(".wy-side-scroll").scrollTop(scroll);
33
68
  }
69
+ }
70
+ $(".wy-side-scroll").scroll(function() {
71
+ set("scroll", this.scrollTop);
72
+ set("scrollTime", Date.now());
73
+ set("scrollHost", location.host);
34
74
  });
35
75
  }
36
- for (let item in ui.admonition) {
37
- $(".admonition-title").each(function() {
38
- $(this).html(ui.admonition[$(this).attr("ui")]);
39
- });
76
+
77
+ function highlight() {
78
+ let text = new URL(location.href).searchParams.get("highlight");
79
+ let box = ".highlighted-box";
80
+
81
+ if (text) {
82
+ $(".section").find("*").each(function() {
83
+ try {
84
+ if (this.outerHTML.match(new RegExp(text, "im"))) {
85
+ $(this).addClass("highlighted-box");
86
+ }
87
+ } catch (e) {
88
+ debug(e.message);
89
+ }
90
+ });
91
+ $(".section").find(box).each(function() {
92
+ if (($(this).find(box).length > 0)) {
93
+ $(this).removeClass(box);
94
+ }
95
+ });
96
+ }
40
97
  }
98
+
41
99
  anchors.add();
100
+ toc();
101
+ initialize(location.pathname);
102
+ restore();
103
+ highlight();
104
+
105
+ /* nested ul */
106
+ $(".wy-menu-vertical ul").siblings("a").each(function() {
107
+ let link = $(this);
108
+ let expand = $('<span class="toctree-expand"></span>');
42
109
 
43
- analytics.searchParams.append("user_lang", navigator.language);
44
- analytics.searchParams.append("host", location.host);
45
- analytics.searchParams.append("platform", navigator.platform);
46
- $.getJSON(analytics.toString(), (data) => $("#counter").html(data.count));
110
+ expand.on("click", function(e) {
111
+ e.stopPropagation();
112
+ toggleCurrent(link);
113
+ return false;
114
+ });
115
+ link.prepend(expand);
116
+ });
117
+
118
+ /* admonition */
119
+ $(".admonition-title").each(function() {
120
+ $(this).html(ui.admonition[$(this).attr("ui")]);
121
+ });
122
+
123
+ /* bind */
124
+ $(document).on("click", '[data-toggle="wy-nav-top"]', function() {
125
+ $('[data-toggle="wy-nav-shift"]').toggleClass("shift");
126
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
127
+ });
128
+ $(document).on("click", ".wy-menu-vertical .current ul li a", function() {
129
+ $('[data-toggle="wy-nav-shift"]').removeClass("shift");
130
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
131
+ toggleCurrent($(this));
132
+ });
133
+ $(document).on("scroll", function() {
134
+ let start = $(this).scrollTop() + 5;
135
+ let items = [];
136
+
137
+ $(".document").find("h1,h2,h3,h4,h5,h6").each(function() {
138
+ items.push({
139
+ offset: $(this).offset().top,
140
+ id: this.id,
141
+ level: parseInt(this.tagName.slice(1))
142
+ });
143
+ });
144
+ for (let i = 0; i < items.length; i++) {
145
+ if (start > items[i].offset) {
146
+ if (i < items.length - 1) {
147
+ if (start < items[i + 1].offset) {
148
+ if (items[i].level == 1) {
149
+ initialize(location.pathname);
150
+ } else {
151
+ initialize("#" + items[i].id);
152
+ }
153
+ }
154
+ } else {
155
+ initialize("#" + items[i].id);
156
+ }
157
+ }
158
+ }
159
+ });
160
+ $(document).on("click", '[data-toggle="rst-current-version"]', function() {
161
+ $('[data-toggle="rst-versions"]').toggleClass("shift-up");
162
+ });
163
+ $(window).bind("resize", function() {
164
+ requestAnimationFrame(function() {});
165
+ });
166
+ $(window).bind("hashchange", () => initialize(location.hash || location.pathname));
47
167
  });
@@ -13,7 +13,7 @@ function search(data) {
13
13
  $(".search").empty();
14
14
  $(".search-summary").html(i18n[lang].search_results_not_found);
15
15
  $("#search-results h2").html(i18n[lang].search_results);
16
- return feedback(["search", e.message]);
16
+ return debug(e.message);
17
17
  }
18
18
 
19
19
  function slice(content, min, max) {
@@ -32,7 +32,7 @@ function search(data) {
32
32
  }
33
33
  }
34
34
  } catch (e) {
35
- feedback(["search", e.message]);
35
+ debug(e.message);
36
36
  }
37
37
  try {
38
38
  if (page.content) {
@@ -40,7 +40,7 @@ function search(data) {
40
40
  content = page.content.match(regexp);
41
41
  }
42
42
  } catch (e) {
43
- feedback(["search", e.message]);
43
+ debug(e.message);
44
44
  }
45
45
  if (title || content) {
46
46
  let result = [`<a href="${ui.baseurl}${page.url}?highlight=${text}">${page.title}</a>`];
@@ -72,5 +72,5 @@ function search(data) {
72
72
  }
73
73
 
74
74
  $(document).ready(function() {
75
- $.ajax(`${ui.baseurl}/pages.json`).done(search).fail((xhr, message) => feedback(["search", message]));
75
+ $.ajax(`${ui.baseurl}/pages.json`).done(search).fail((xhr, message) => debug(message));
76
76
  });
@@ -0,0 +1,33 @@
1
+ self.addEventListener("activate", function(event) {
2
+ let cacheWhitelist = ["rundocs-{{ version }}"];
3
+
4
+ event.waitUntil(
5
+ caches.keys().then(function(keyList) {
6
+ return Promise.all(keyList.map(function(key) {
7
+ if (cacheWhitelist.indexOf(key) === -1) {
8
+ return caches.delete(key);
9
+ }
10
+ }));
11
+ })
12
+ );
13
+ });
14
+
15
+ self.addEventListener("fetch", function(e) {
16
+ if (/^https:\/\/cdn\.jsdelivr\.net\/gh\/rundocs\/jekyll-rtd-theme@.+/.exec(e.request.url)) {
17
+ e.respondWith(
18
+ caches.match(e.request).then(function(resp) {
19
+ if (resp !== undefined) {
20
+ return resp;
21
+ } else {
22
+ return fetch(e.request, { cache: "no-store" }).then(function(resp) {
23
+ let clone = resp.clone();
24
+ caches.open("rundocs-{{ version }}").then(function(cache) {
25
+ cache.put(e.request, clone);
26
+ });
27
+ return resp;
28
+ }).catch(console.log);
29
+ }
30
+ })
31
+ );
32
+ }
33
+ });
@@ -24,7 +24,7 @@
24
24
  {%- assign level = level | minus: 1 -%}
25
25
  {%- endif -%}
26
26
 
27
- <li class="toctree-l{{ level }} {{ current }}">
27
+ <li class="toctree-l{{ level }} {{ current }}" data-sort="{{ item.sort }}" data-level="{{ level }}">
28
28
  <a class="reference internal {{ current }}" href="{{ item.url | relative_url }}">
29
29
  {%- if item.sort and site.show_sorted != false -%}
30
30
  {{ item.sort }}. {{ item.title | default: item.url }}
File without changes
File without changes
@@ -1,17 +1,19 @@
1
1
  <footer>
2
- {%- if next or prev -%}
3
- <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
4
- {%- if next -%}
5
- <a href="{{ next.url | relative_url }}" class="btn btn-neutral float-right" title="{{ next.title }}" accesskey="n" rel="next">
6
- {{- __next }} <span class="fa fa-arrow-circle-right"></span>
7
- </a>
8
- {%- endif -%}
9
- {%- if prev -%}
10
- <a href="{{ prev.url | relative_url }}" class="btn btn-neutral float-left" title="{{ prev.title }}" accesskey="p" rel="prev">
11
- <span class="fa fa-arrow-circle-left"></span> {{ __previous -}}
12
- </a>
13
- {%- endif -%}
14
- </div>
2
+ {%- if page.url != "/search.html" and page.url != "/404.html" -%}
3
+ {%- if next or prev -%}
4
+ <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
5
+ {%- if next -%}
6
+ <a href="{{ next.url | relative_url }}" class="btn btn-neutral float-right" title="{{ next.title }}" accesskey="n" rel="next">
7
+ {{- __next }} <span class="fa fa-arrow-circle-right"></span>
8
+ </a>
9
+ {%- endif -%}
10
+ {%- if prev -%}
11
+ <a href="{{ prev.url | relative_url }}" class="btn btn-neutral float-left" title="{{ prev.title }}" accesskey="p" rel="prev">
12
+ <span class="fa fa-arrow-circle-left"></span> {{ __previous -}}
13
+ </a>
14
+ {%- endif -%}
15
+ </div>
16
+ {%- endif -%}
15
17
  {%- endif -%}
16
18
  <hr>
17
19
  {%- if site.copyright -%}
@@ -1,10 +1,10 @@
1
1
  {%- assign description = content | strip_html | split: " " | join: " " | escape | truncate: 150 -%}
2
- {%- assign version = "1.1.2" -%}
2
+ {%- assign version = "1.1.7" -%}
3
3
  {%- assign addons = "github, i18n, plugins, analytics" | split: ", " -%}
4
4
 
5
5
  {%- assign schema_date = page.date | default: site.time | date_to_xmlschema -%}
6
6
  {%- assign schema_modi = site.time | date_to_xmlschema -%}
7
- {%- assign schema_surl = page.url | absolute_url | replace: 'http://', 'https://' | xml_escape -%}
7
+ {%- assign schema_surl = page.url | absolute_url | xml_escape -%}
8
8
 
9
9
  {% comment %} scss {% endcomment %}
10
10
  {%- capture site_scss -%}
@@ -22,25 +22,15 @@
22
22
 
23
23
  {% comment %} github-metadata {% endcomment %}
24
24
  {%- if site.github_metadata != false -%}
25
- {%- if jekyll.environment == "production" -%}
26
- {%- assign author = site.author | default: site.github.owner_name -%}
27
- {%- assign branch = site.github.source.branch -%}
28
- {%- assign commit = site.github.build_revision | slice: 0, 7 -%}
29
- {%- assign repository_url = site.github.repository_url -%}
30
- {%- assign issues_url = site.github.issues_url -%}
31
- {%- assign zip_url = site.github.zip_url -%}
32
- {%- capture github_edit_link %}{% github_edit_link %}{% endcapture -%}
33
- {%- else -%}
34
- {%- assign author = site.author | default: "[author]" -%}
35
- {%- assign branch = "[branch]" -%}
36
- {%- assign commit = "[commit]" -%}
37
- {%- assign repository_url = "#" -%}
38
- {%- assign issues_url = "#" -%}
39
- {%- assign zip_url = "#" -%}
40
- {%- assign github_edit_link = "#" -%}
41
- {%- endif -%}
25
+ {%- assign author = site.author | default: site.github.owner_name -%}
26
+ {%- assign branch = site.github.source.branch -%}
27
+ {%- assign commit = site.github.build_revision | slice: 0, 7 -%}
28
+ {%- assign repository_url = site.github.repository_url -%}
29
+ {%- assign issues_url = site.github.issues_url -%}
30
+ {%- assign zip_url = site.github.zip_url -%}
31
+ {%- capture github_edit_link %}{% github_edit_link %}{% endcapture -%}
42
32
  {%- else -%}
43
- {%- assign author = site.author | default: "[author]" -%}
33
+ {%- assign author = site.author -%}
44
34
  {%- assign branch = "" -%}
45
35
  {%- assign commit = "" -%}
46
36
  {%- assign repository_url = "" -%}
@@ -68,11 +58,13 @@
68
58
  {% comment %} content {% endcomment %}
69
59
  {%- assign content = content
70
60
  | replace: '’', "'"
71
- | replace: '<pre class="highlight"><code>', "<pre>"
72
- | replace: '<pre><code class=', "<pre class="
61
+ | replace: '<pre class="highlight"><code>', '<pre class="notranslate">'
62
+ | replace: '<pre><code class="', '<pre class="notranslate '
73
63
  | replace: "</code></pre>", "</pre>"
74
64
  | replace: '<code class="language-plaintext highlighter-rouge">', '<code class="literal">'
75
- | replace: "<table>", '<table class="docutils align-default">' -%}
65
+ | replace: "<dl>", '<dl class="definition">'
66
+ | replace: "<table>", '<div class="wy-table-responsive"><table class="docutils">'
67
+ | replace: "</table>", '</table></div>' -%}
76
68
 
77
69
  {% comment %} prev and next {% endcomment %}
78
70
  {%- assign workdir_files = site_files | where_exp: "item", "item.dir == page.dir" -%}