jekyll-rtd-theme 1.0.1 → 1.0.2

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: cb6951c99db8b05f676775f3d340a5ee35053b7f9a3eb4d475a8b5c60cf4b835
4
- data.tar.gz: 0cb3eabfc0e92c3d35e83538757b9c43d7c450a1343892bfecaac16bdf5f0553
3
+ metadata.gz: 282253f9da9722cd28af8e9c627f2db0c058aec9534c048cbd46debf2deaaa5f
4
+ data.tar.gz: 2f169bf76523fac4055f67af31744db424a616455bdb6d3ccb286158bae9c55a
5
5
  SHA512:
6
- metadata.gz: b0b4d12c7fb8a28302bf151a0767dfa73db9e280947a0deb5147b2a164ec6efa33c01b20108186f44914d7144c71827ac37e68cb2416ed56ac9833b7892db30d
7
- data.tar.gz: ade5cf7162131e9d927baf5f4381882f98ad586c7a8c9b0cf9fb8ad07eead5598215567596ba53e01cd7fc4771a20c754d7e443cd7c90ea29803f3461916ebc2
6
+ metadata.gz: 05b63adf3aa720a064975accecb0c92cde53ab4df1be6f1c900be3c41fa3e19084215051244acf30078563ccf235e61cc5b8c39bcea6fb51d7fd4608b7fb7a57
7
+ data.tar.gz: 16d6c0c5c9ab03b6acde4a16960d57d7214571bd9f65dad54ed2d3107c3b983657a27cb5f9c184aed4575aee8fab6f3c774a7172183966ffb8e8420c31f39ebe
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Jekyll-rtd-theme
1
+ # jekyll-rtd-theme
2
2
  [![](https://github.com/rundocs/jekyll-rtd-theme/workflows/CI/badge.svg)][repository]
3
3
  [![](https://img.shields.io/gem/v/jekyll-rtd-theme)][rubygem]
4
4
  [![](https://img.shields.io/gem/dt/jekyll-rtd-theme)][rubygem]
@@ -17,10 +17,10 @@ Just another documentation theme compatible with GitHub Pages, based on sphinx_r
17
17
  - Compatible with GitHub Pages.
18
18
  - Optimized for search engines with support for Open Graph data.
19
19
  - Optimized for search engines with `robots.txt` and `sitemap.xml`.
20
- - Search engine support
20
+ - Search engine (RegExp supported)
21
21
  - Commenting support
22
22
  - Google,Baidu,CNZZ Analytics support.
23
- - UI localized text in English(default), Chinese(中文)...
23
+ - Multi-language supported
24
24
  - And many features waiting for you to discover.
25
25
 
26
26
  ## Roadmap
@@ -13,7 +13,9 @@
13
13
  <div class="rst-other-versions">
14
14
  {%- assign items = site.addons | default: addons -%}
15
15
  {% for item in items -%}
16
- {% include addons/source/{{ item }}.liquid %}
16
+ {%- if addons contains item -%}
17
+ {% include addons/source/{{ item }}.liquid %}
18
+ {%- endif -%}
17
19
  {% endfor -%}
18
20
  <hr>
19
21
  <small>
@@ -7,4 +7,4 @@
7
7
  document.head.appendChild(script);
8
8
  })(document.createElement("script"));
9
9
  </script>
10
- {% endif %}
10
+ {% endif %}
@@ -4,4 +4,4 @@
4
4
  <meta property="og:url" content="{{ schema_url }}">
5
5
  <meta property="og:type" content="article">
6
6
  <meta property="article:author" content="{{ author }}">
7
- <meta property="article:modified_time" content="{{ schema_lastmod }}">
7
+ <meta property="article:modified_time" content="{{ schema_lastmod }}">
@@ -7,4 +7,4 @@
7
7
  "url": "{{ schema_url }}",
8
8
  "dateModified": "{{ schema_lastmod }}"
9
9
  }
10
- </script>
10
+ </script>
@@ -9,8 +9,6 @@
9
9
 
10
10
  <script>
11
11
  $(document).ready(function() {
12
- $.getJSON("https://rundocs-analytics.glitch.me/analytics?host=" + location.host, function(data) {
13
- $("#counter").html(data.count);
14
- });
12
+ $.getJSON("https://rundocs-analytics.glitch.me/analytics?host=" + location.host, (data) => $("#counter").html(data.count));
15
13
  });
16
14
  </script>
@@ -1,5 +1,5 @@
1
1
  <dl>
2
- <dt>{{ __gems }}</dt>
2
+ <dt>{{ __plugins }}</dt>
3
3
  {%- for item in site.plugins %}
4
4
  <dd><a href="https://rubygems.org/gems/{{ item }}"><i class="fa fa-cog"></i> {{ item }}</a></dd>
5
5
  {%- endfor %}
@@ -0,0 +1,40 @@
1
+ $(document).ready(function() {
2
+ let highlight = new URL(location.href).searchParams.get("highlight");
3
+
4
+ SphinxRtdTheme.Navigation.reset = function() {
5
+ const link = $(".wy-menu-vertical").find(`[href="${location.pathname}"]`);
6
+ if (link.length > 0) {
7
+ $(".wy-menu-vertical .current").removeClass("current");
8
+ link.addClass("current");
9
+ link.closest("li.toctree-l1").parent().addClass("current");
10
+ link.closest("li.toctree-l1").addClass("current");
11
+ link.closest("li.toctree-l2").addClass("current");
12
+ link.closest("li.toctree-l3").addClass("current");
13
+ link.closest("li.toctree-l4").addClass("current");
14
+ link.closest("li.toctree-l5").addClass("current");
15
+ }
16
+ };
17
+ SphinxRtdTheme.Navigation.enable(true);
18
+
19
+ if (highlight) {
20
+ $(".section").find("*").each(function() {
21
+ try {
22
+ if (this.outerHTML.match(new RegExp(highlight, "im"))) {
23
+ $(this).addClass("highlighted-box");
24
+ }
25
+ } catch (e) {
26
+ console.log(e.message);
27
+ }
28
+ });
29
+ $(".section").find(".highlighted-box").each(function() {
30
+ if (($(this).find(".highlighted-box").length > 0)) {
31
+ $(this).removeClass("highlighted-box");
32
+ }
33
+ });
34
+ }
35
+ for (let item in ui.admonition) {
36
+ let content = $(`.language-${item}`).html();
37
+ $(`.language-${item}`).replaceWith(`<div class="admonition ${item}"><p class="admonition-title">${ui.admonition[item]}</p><p>${content}</p></div>`);
38
+ }
39
+ anchors.add();
40
+ });
@@ -0,0 +1,80 @@
1
+ function feedback(type, message) {
2
+ console.log(`feedback: https://github.com/rundocs/jekyll-rtd-theme/issues?q=${type}+${message}`);
3
+ }
4
+
5
+ function search(data) {
6
+ let text = new URL(location.href).searchParams.get("q");
7
+ let lang = new URL(location.href).searchParams.get("lang") || ui.lang;
8
+
9
+ $("input[name='q']").val(text);
10
+ $("input[name='q']").attr("placeholder", i18n[lang].search_docs + "...");
11
+
12
+ let results = [];
13
+ let regexp = new RegExp();
14
+ try {
15
+ regexp = new RegExp(text, "im");
16
+ } catch (e) {
17
+ $(".search").empty();
18
+ $(".search-summary").html(i18n[lang].search_results_not_found);
19
+ $("#search-results h2").html(i18n[lang].search_results);
20
+ return;
21
+ }
22
+
23
+ function slice(content, min, max) {
24
+ return content.slice(min, max).replace(regexp, (match) => `<span class="highlighted">${match}</span>`);
25
+ }
26
+ for (page of data) {
27
+ let [title, content] = [null, null];
28
+ try {
29
+ if (page.title) {
30
+ title = page.title.match(regexp);
31
+ } else {
32
+ if (page.url == "/") {
33
+ page.title = ui.title;
34
+ } else {
35
+ page.title = page.url;
36
+ }
37
+ }
38
+ } catch (e) {
39
+ feedback("search", e.message);
40
+ }
41
+ try {
42
+ if (page.content) {
43
+ page.content = $("<div/>").html(page.content).text();
44
+ content = page.content.match(regexp);
45
+ }
46
+ } catch (e) {
47
+ feedback("search", e.message);
48
+ }
49
+ if (title || content) {
50
+ let result = [`<a href="${ui.baseurl}${page.url}?highlight=${text}">${page.title}</a>`];
51
+ if (content) {
52
+ let [min, max] = [content.index - 100, content.index + 100];
53
+ let [prefix, suffix] = ["...", "..."];
54
+
55
+ if (min < 0) {
56
+ prefix = "";
57
+ min = 0;
58
+ }
59
+ if (max > page.content.length) {
60
+ suffix = "";
61
+ max = page.content.length;
62
+ }
63
+ result.push(`<p class="context">${prefix}${slice(page.content ,min, max)}${suffix}</p>`);
64
+ }
65
+ results.push(`<li>${result.join("")}</li>`);
66
+ }
67
+ }
68
+ if (results.length > 0 && text.length > 0) {
69
+ $(".search").html(results.join(""));
70
+ $(".search-summary").html(i18n[lang].search_results_found.replace("#", results.length));
71
+ } else {
72
+ $(".search").empty();
73
+ $(".search-summary").html(i18n[lang].search_results_not_found);
74
+ }
75
+ $("#search-results h2").html(i18n[lang].search_results);
76
+ }
77
+
78
+ $(document).ready(function() {
79
+ $.ajax(`${ui.baseurl}/pages.json`).done(search).fail((xhr, message) => feedback("search", message));
80
+ });
@@ -1,8 +1,9 @@
1
+ {% comment %} English {% endcomment %}
1
2
  {%- assign __github = "GitHub" -%}
2
3
  {%- assign __homepage = "Homepage" -%}
3
4
  {%- assign __issues = "Issues" -%}
4
5
  {%- assign __download = "Download" -%}
5
- {%- assign __gems = "Gems" -%}
6
+ {%- assign __plugins = "Theme Plugins" -%}
6
7
  {%- assign __translations = "Translations" -%}
7
8
  {%- assign __statistics = "Statistics" -%}
8
9
  {%- assign __total_visits = "Total visits:" -%}
@@ -0,0 +1,29 @@
1
+ {% comment %} French {% endcomment %}
2
+ {%- assign __github = "Github" -%}
3
+ {%- assign __homepage = "Page d'accueil" -%}
4
+ {%- assign __issues = "Problèmes" -%}
5
+ {%- assign __download = "Télécharger" -%}
6
+ {%- assign __plugins = "Plugins de thème" -%}
7
+ {%- assign __translations = "Traductions" -%}
8
+ {%- assign __statistics = "Statistiques" -%}
9
+ {%- assign __total_visits = "Total des visites:" -%}
10
+
11
+ {%- assign __note = "Remarques" -%}
12
+ {%- assign __tip = "Conseils" -%}
13
+ {%- assign __warning = "avertissement" -%}
14
+ {%- assign __danger = "Danger" -%}
15
+
16
+ {%- assign __next = "Page suivante" -%}
17
+ {%- assign __previous = "Page précédente" -%}
18
+ {%- assign __copyright = "droits d'auteur" -%}
19
+ {%- assign __revision = "Révision" -%}
20
+
21
+ {%- assign __404 = "404" -%}
22
+ {%- assign __not_found = "Cette page n'existe pas encore!" -%}
23
+
24
+ {%- assign __searching = "Recherche" -%}
25
+ {%- assign __search = "Chercher" -%}
26
+ {%- assign __search_docs = "Rechercher des documents" -%}
27
+ {%- assign __search_results = "Résultats de recherche" -%}
28
+ {%- assign __search_results_found = "Recherche terminée, page (s) «#» trouvée (s) correspondant à la requête de recherche." -%}
29
+ {%- assign __search_results_not_found = "Votre recherche ne correspond à aucun document, veuillez vous assurer que tous les caractères sont correctement orthographiés!" -%}
@@ -0,0 +1,29 @@
1
+ {% comment %} Italian {% endcomment %}
2
+ {%- assign __github = "Github" -%}
3
+ {%- assign __homepage = "Homepage" -%}
4
+ {%- assign __issues = "Problemi" -%}
5
+ {%- assign __download = "Scarica" -%}
6
+ {%- assign __plugins = "Plugin del tema" -%}
7
+ {%- assign __translations = "Traduzioni" -%}
8
+ {%- assign __statistics = "statistica" -%}
9
+ {%- assign __total_visits = "Visite totali:" -%}
10
+
11
+ {%- assign __note = "Osservazioni" -%}
12
+ {%- assign __tip = "Suggerimenti" -%}
13
+ {%- assign __warning = "avvertimento" -%}
14
+ {%- assign __danger = "Pericolo" -%}
15
+
16
+ {%- assign __next = "Pagina successiva" -%}
17
+ {%- assign __previous = "Pagina precedente" -%}
18
+ {%- assign __copyright = "Diritto d'autore" -%}
19
+ {%- assign __revision = "Revisione" -%}
20
+
21
+ {%- assign __404 = "404" -%}
22
+ {%- assign __not_found = "Questa pagina non esiste ancora!" -%}
23
+
24
+ {%- assign __searching = "ricerca" -%}
25
+ {%- assign __search = "Ricerca" -%}
26
+ {%- assign __search_docs = "Cerca documenti" -%}
27
+ {%- assign __search_results = "risultati di ricerca" -%}
28
+ {%- assign __search_results_found = "Ricerca terminata, sono state trovate pagine # corrispondenti alla query di ricerca." -%}
29
+ {%- assign __search_results_not_found = "La tua ricerca non ha prodotto risultati in nessun documento, assicurati che tutti i caratteri siano scritti correttamente!" -%}
@@ -0,0 +1,29 @@
1
+ {% comment %} Japanese {% endcomment %}
2
+ {%- assign __github = "Github" -%}
3
+ {%- assign __homepage = "ホームページ" -%}
4
+ {%- assign __issues = "問題" -%}
5
+ {%- assign __download = "ダウンロード" -%}
6
+ {%- assign __plugins = "テーマプラグイン" -%}
7
+ {%- assign __translations = "翻訳" -%}
8
+ {%- assign __statistics = "統計学" -%}
9
+ {%- assign __total_visits = "総訪問数:" -%}
10
+
11
+ {%- assign __note = "備考" -%}
12
+ {%- assign __tip = "チップ" -%}
13
+ {%- assign __warning = "警告" -%}
14
+ {%- assign __danger = "危険" -%}
15
+
16
+ {%- assign __next = "次のページ" -%}
17
+ {%- assign __previous = "前のページ" -%}
18
+ {%- assign __copyright = "著作権" -%}
19
+ {%- assign __revision = "リビジョン" -%}
20
+
21
+ {%- assign __404 = "404" -%}
22
+ {%- assign __not_found = "このページはまだ存在しません!" -%}
23
+
24
+ {%- assign __searching = "探す" -%}
25
+ {%- assign __search = "探す" -%}
26
+ {%- assign __search_docs = "ドキュメントを検索" -%}
27
+ {%- assign __search_results = "の検索結果" -%}
28
+ {%- assign __search_results_found = "検索が終了し、検索クエリに一致する「#」ページが見つかりました。" -%}
29
+ {%- assign __search_results_not_found = "検索はどのドキュメントにも一致しませんでした。すべての文字のスペルが正しいことを確認してください!" -%}
@@ -0,0 +1,29 @@
1
+ {% comment %} Korean {% endcomment %}
2
+ {%- assign __github = "Github" -%}
3
+ {%- assign __homepage = "홈페이지" -%}
4
+ {%- assign __issues = "이슈" -%}
5
+ {%- assign __download = "다운로드" -%}
6
+ {%- assign __plugins = "테마 플러그인" -%}
7
+ {%- assign __translations = "번역" -%}
8
+ {%- assign __statistics = "통계" -%}
9
+ {%- assign __total_visits = "총 방문수 :" -%}
10
+
11
+ {%- assign __note = "비고" -%}
12
+ {%- assign __tip = "팁" -%}
13
+ {%- assign __warning = "경고" -%}
14
+ {%- assign __danger = "위험" -%}
15
+
16
+ {%- assign __next = "다음 페이지" -%}
17
+ {%- assign __previous = "이전 페이지" -%}
18
+ {%- assign __copyright = "저작권" -%}
19
+ {%- assign __revision = "개정" -%}
20
+
21
+ {%- assign __404 = "404" -%}
22
+ {%- assign __not_found = "이 페이지는 아직 존재하지 않습니다!" -%}
23
+
24
+ {%- assign __searching = "수색" -%}
25
+ {%- assign __search = "검색" -%}
26
+ {%- assign __search_docs = "문서 검색" -%}
27
+ {%- assign __search_results = "검색 결과" -%}
28
+ {%- assign __search_results_found = "검색이 완료되었습니다. 검색어와 일치하는 # 페이지를 찾았습니다." -%}
29
+ {%- assign __search_results_not_found = "검색어와 일치하는 문서가 없습니다. 모든 문자의 철자가 올바른지 확인하십시오!" -%}
@@ -1,8 +1,9 @@
1
+ {% comment %} Chinese Simplified {% endcomment %}
1
2
  {%- assign __github = "开源文档" -%}
2
3
  {%- assign __homepage = "仓库" -%}
3
4
  {%- assign __issues = "反馈" -%}
4
5
  {%- assign __download = "下载" -%}
5
- {%- assign __gems = "主题插件" -%}
6
+ {%- assign __plugins = "主题插件" -%}
6
7
  {%- assign __translations = "文档翻译" -%}
7
8
  {%- assign __statistics = "访问统计" -%}
8
9
  {%- assign __total_visits = "累计浏览次数:" -%}
@@ -1,6 +1,6 @@
1
1
  {%- assign description = content | strip_html | split: " " | join: " " | escape | truncate: 150 -%}
2
- {%- assign version = "1.0.1" -%}
3
- {%- assign addons = "github, i18n, gems, analytics" | split: ", " -%}
2
+ {%- assign version = "1.0.2" -%}
3
+ {%- assign addons = "github, i18n, plugins, analytics" | split: ", " -%}
4
4
 
5
5
  {%- include reset/site_pages.liquid %}
6
6
  {%- include reset/i18n.liquid -%}
@@ -35,7 +35,7 @@
35
35
  {%- endcapture -%}
36
36
 
37
37
  {%- capture site_script %}
38
- {% include assets/site.js %}
38
+ {% include assets/common.js %}
39
39
  {% include assets/custom.js %} {{ site.script }}
40
40
  {%- endcapture -%}
41
41
 
@@ -1,21 +1,29 @@
1
- {%- assign site_lang = site.lang | default: "en-US" -%}
1
+ {%- include reset/languages.liquid -%}
2
2
 
3
+ {% comment %} Set default lang {% endcomment %}
4
+ {%- assign site_lang = "en" -%}
5
+ {%- if languages contains site.lang -%}
6
+ {%- assign site_lang = site.lang -%}
7
+ {%- endif -%}
8
+
9
+ {% comment %} Get docs all avaiable langs {% endcomment %}
3
10
  {%- capture langs -%}
4
11
  {{ site_lang }}|
5
12
  {%- for item in site_dirs -%}
6
13
  {%- assign chapter = item.dir | remove_first: "/" | split: "/" | first -%}
7
- {%- if chapter contains "-" -%}
14
+ {%- if languages contains chapter -%}
8
15
  {{ chapter }}|
9
16
  {%- endif -%}
10
17
  {%- endfor -%}
11
18
  {%- endcapture -%}
12
19
  {%- assign site_langs = langs | split: "|" | uniq -%}
13
20
 
21
+ {% comment %} include language by the root subdirectory {% endcomment %}
14
22
  {%- assign lang = site_lang -%}
15
23
 
16
24
  {%- if page.dir != "/" -%}
17
25
  {%- assign chapter = page.dir | remove_first: "/" | split: "/" | first -%}
18
- {%- if chapter contains "-" -%}
26
+ {%- if languages contains chapter -%}
19
27
  {%- assign lang = chapter -%}
20
28
  {%- endif -%}
21
29
  {%- endif -%}
@@ -0,0 +1,110 @@
1
+ {% comment %} https://cloud.google.com/translate/docs/languages ISO-639-1 {% endcomment %}
2
+ {% comment %} https://github.com/matheuss/google-translate-api/blob/master/languages.js {% endcomment %}
3
+ {%- capture iso_codes -%}
4
+ af
5
+ sq
6
+ am
7
+ ar
8
+ hy
9
+ az
10
+ eu
11
+ be
12
+ bn
13
+ bs
14
+ bg
15
+ ca
16
+ ceb
17
+ ny
18
+ zh-cn
19
+ zh-tw
20
+ co
21
+ hr
22
+ cs
23
+ da
24
+ nl
25
+ en
26
+ eo
27
+ et
28
+ tl
29
+ fi
30
+ fr
31
+ fy
32
+ gl
33
+ ka
34
+ de
35
+ el
36
+ gu
37
+ ht
38
+ ha
39
+ haw
40
+ iw
41
+ hi
42
+ hmn
43
+ hu
44
+ is
45
+ ig
46
+ id
47
+ ga
48
+ it
49
+ ja
50
+ jw
51
+ kn
52
+ kk
53
+ km
54
+ ko
55
+ ku
56
+ ky
57
+ lo
58
+ la
59
+ lv
60
+ lt
61
+ lb
62
+ mk
63
+ mg
64
+ ms
65
+ ml
66
+ mt
67
+ mi
68
+ mr
69
+ mn
70
+ my
71
+ ne
72
+ no
73
+ ps
74
+ fa
75
+ pl
76
+ pt
77
+ ma
78
+ ro
79
+ ru
80
+ sm
81
+ gd
82
+ sr
83
+ st
84
+ sn
85
+ sd
86
+ si
87
+ sk
88
+ sl
89
+ so
90
+ es
91
+ su
92
+ sw
93
+ sv
94
+ tg
95
+ ta
96
+ te
97
+ th
98
+ tr
99
+ uk
100
+ ur
101
+ uz
102
+ vi
103
+ cy
104
+ xh
105
+ yi
106
+ yo
107
+ zu
108
+ {%- endcapture -%}
109
+
110
+ {%- assign languages = iso_codes | split: " " -%}
@@ -1,9 +1,9 @@
1
- {% comment %} Start from the language chapter(eg: en-US) or root(/) {% endcomment %}
1
+ {% comment %} Start from the language chapter(eg: en-us) or root(/) {% endcomment %}
2
2
  {%- assign workdir = include.workdir | default: "/" -%}
3
3
 
4
4
  {%- if page.dir != "/" -%}
5
5
  {%- assign chapter = page.dir | remove_first: "/" | split: "/" | first -%}
6
- {%- if chapter contains "-" -%}
6
+ {%- if languages contains chapter -%}
7
7
  {%- capture workdir %}/{{ chapter }}/{% endcapture -%}
8
8
  {%- endif -%}
9
9
  {%- endif -%}
@@ -21,7 +21,8 @@
21
21
  {%- if workdir == dir -%}
22
22
  {% comment %} Root directory does not display other languages {% endcomment %}
23
23
  {%- if workdir == "/" -%}
24
- {%- unless item.dir contains "-" %}{{ item.dir }}|{% endunless -%}
24
+ {%- assign language = item.dir | replace: "/", "" -%}
25
+ {%- unless languages contains language %}{{ item.dir }}|{% endunless -%}
25
26
  {%- else -%}
26
27
  {{ item.dir }}|
27
28
  {%- endif -%}
@@ -1,5 +1,132 @@
1
1
  ---
2
- layout: basic
2
+ layout: plugins/compress
3
3
  ---
4
4
 
5
- <div class="section">{{ content }}</div>
5
+ {%- include reset/defaults.liquid -%}
6
+
7
+ <!DOCTYPE html>
8
+
9
+ <!--
10
+ {% if site.remote_theme -%}
11
+ rundocs.io, remote_theme: {{ site.remote_theme }}, based on v{{ version }}
12
+ {%- else -%}
13
+ rundocs.io, theme: {{ site.theme | default: "jekyll-rtd-theme, based on" }} v{{ version }}
14
+ {%- endif %}
15
+ -->
16
+
17
+ <html class="writer-html5" lang="{{ lang }}">
18
+
19
+ <head>
20
+ <meta charset="utf-8">
21
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
22
+ <title>{{ title }}</title>
23
+ <!-- meta -->
24
+ <meta name="description" content="{{ description }}">
25
+ <meta name="author" content="{{ author }}">
26
+ <meta name="revised" content="{{ commit }}">
27
+ <meta name="generator" content="jekyll-rtd-theme v{{ version }}">
28
+ <!-- custom meta -->
29
+ {% for meta in site.meta -%}
30
+ <meta name="{{ meta.first }}" content="{{ meta.last }}">
31
+ {% endfor -%}
32
+ <!-- og -->
33
+ {% include addons/seo/og.liquid %}
34
+ <!-- schema -->
35
+ {% include addons/seo/schema.liquid %}
36
+ <!-- link -->
37
+ {% if prev -%}
38
+ <link rel="prev" href="{{ prev.url | absolute_url | xml_escape }}">
39
+ {%- endif -%}
40
+ {%- if next -%}
41
+ <link rel="next" href="{{ next.url | absolute_url | xml_escape }}">
42
+ {%- endif -%}
43
+ <link rel="canonical" href="{{ schema_url }}">
44
+ <!-- theme -->
45
+ <link rel="stylesheet" href="{{ cdn }}/assets/css/theme.css">
46
+ <link rel="stylesheet" href="{{ cdn }}/assets/css/rougify/{{ site.rougify | default: 'github' }}.css">
47
+ <style>{{ site_scss | scssify }}</style>
48
+ <!-- icon -->
49
+ <link rel="icon" type="image/svg+xml" href="{{ site.baseurl }}/assets/favicon.svg">
50
+ <!-- script -->
51
+ <script src="{{ cdn }}/assets/js/jquery.min.js"></script>
52
+ <script>
53
+ const ui = {
54
+ baseurl: "{{ site.baseurl }}",
55
+ title: "{{ site.title }}",
56
+ lang: "{{ lang }}",
57
+ admonition: {
58
+ note: "{{ __note }}",
59
+ tip: "{{ __tip }}",
60
+ warning: "{{ __warning }}",
61
+ danger: "{{ __danger }}"
62
+ }
63
+ };
64
+ </script>
65
+ </head>
66
+
67
+ <body class="wy-body-for-nav">
68
+ <div class="wy-grid-for-nav">
69
+ <!-- SIDE NAV, TOGGLES ON MOBILE -->
70
+ <nav data-toggle="wy-nav-shift" class="wy-nav-side">
71
+ <div class="wy-side-scroll">
72
+ <div class="wy-side-nav-search">
73
+ {% if site.logo %}
74
+ <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}">
75
+ <img src="{{ site.baseurl }}/{{ site.logo }}" class="logo" alt="{{ site.title }}">
76
+ </a>
77
+ {% else %}
78
+ <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}" class="icon icon-home"> {{ site.title }}</a>
79
+ {% endif %}
80
+ <div role="search">
81
+ <form id="rtd-search-form" class="wy-form" action="{{ site.baseurl }}/search.html" method="get" autocomplete="off">
82
+ <input type="text" name="q" placeholder="{{ __search_docs }}...">
83
+ <input type="hidden" name="lang" value="{{ lang }}">
84
+ </form>
85
+ </div>
86
+ </div>
87
+ <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
88
+ {% include toctree.liquid %}
89
+ </div>
90
+ {%- if site.embed -%}
91
+ <div class="wy-embed-wrap">
92
+ <div class="wy-embed">{{ site.embed }}</div>
93
+ </div>
94
+ {%- endif -%}
95
+ </div>
96
+ </nav>
97
+ <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
98
+ <!-- MOBILE NAV -->
99
+ <nav class="wy-nav-top" aria-label="top navigation">
100
+ <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
101
+ <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}">{{ site.title }}</a>
102
+ </nav>
103
+ <div class="wy-nav-content">
104
+ <div class="rst-content">
105
+ {% include breadcrumbs.liquid %}
106
+ <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
107
+ <div itemprop="articleBody">
108
+ {%- if page.url == "/search.html" -%}
109
+ {{ content }}
110
+ {%- else -%}
111
+ <div class="section">{{ content }}</div>
112
+ {%- endif -%}
113
+ </div>
114
+ {% include addons/comments/disqus.liquid %}
115
+ </div>
116
+ {% include footer.liquid %}
117
+ </div>
118
+ </div>
119
+ </section>
120
+ </div>
121
+ {%- if site.addons %}{% include addons.liquid %}{% endif %}
122
+ <!-- script -->
123
+ <script src="{{ cdn }}/assets/js/theme.js"></script>
124
+ <script src="{{ cdn }}/assets/js/anchor.min.js"></script>
125
+ <script>{{ site_script }}</script>
126
+ <!-- analytics -->
127
+ {%- include addons/analytics/baidu.liquid -%}
128
+ {%- include addons/analytics/cnzz.liquid -%}
129
+ {%- include addons/analytics/google.liquid -%}
130
+ </body>
131
+
132
+ </html>
@@ -22,4 +22,4 @@
22
22
  width: 100%;
23
23
  }
24
24
  }
25
- }
25
+ }
@@ -20,4 +20,4 @@
20
20
  max-width: 100%;
21
21
  }
22
22
  }
23
- }
23
+ }
@@ -4,4 +4,4 @@
4
4
  .wy-nav-content {
5
5
  max-width: none;
6
6
  }
7
- }
7
+ }
@@ -1,6 +1,6 @@
1
1
  @import "_album.scss";
2
2
  @import "_embed.scss";
3
-
3
+ /* custom */
4
4
  p {
5
5
  font-size: 15px;
6
6
  }
@@ -11,21 +11,21 @@ footer {
11
11
  text-align: center;
12
12
  }
13
13
  }
14
-
14
+ /* breadcrumbs icon */
15
15
  .fa-angle-double-right {
16
16
  font-size: 13px;
17
17
  }
18
-
18
+ /* fixed the addon overflow */
19
19
  .rst-versions {
20
20
  &.shift-up {
21
21
  overflow-y: auto;
22
22
  }
23
23
  }
24
-
24
+ /* fixed the toctree padding */
25
25
  .wy-nav-side {
26
26
  padding-bottom: 3em;
27
27
  }
28
-
28
+ /* mobile title margin, not the best method, flex should be better */
29
29
  .wy-nav-top {
30
30
  a {
31
31
  margin-left: -30px;
@@ -33,31 +33,32 @@ footer {
33
33
  }
34
34
 
35
35
  .rst-content {
36
+ /* fixed the long list */
36
37
  ol,
37
38
  ul {
38
39
  overflow-x: auto;
39
40
  }
40
-
41
+ /* fixed link>code */
41
42
  a code.literal {
42
43
  color: #2980b9;
43
44
  }
44
-
45
+ /* custom */
45
46
  code,
46
47
  div[class^=highlight] pre,
47
48
  pre {
48
49
  font-family: monospace;
49
50
  font-size: 12px;
50
51
  }
51
-
52
+ /* theme copyright */
52
53
  .copyright-rtd {
53
54
  display: none;
54
55
  }
55
-
56
+ /* view box of search results */
56
57
  .highlighted-box {
57
58
  border: 1px solid #f1c40f;
58
59
  }
59
60
  }
60
-
61
+ /* fixed the last of search results display */
61
62
  #search-results {
62
63
  li:last-child {
63
64
  border-bottom: 0;
@@ -66,12 +67,14 @@ footer {
66
67
  }
67
68
  @media screen and (max-width: 768px) {
68
69
  .wy-nav-content-wrap {
70
+ /* custom */
69
71
  .wy-nav-content {
70
72
  padding: 1em;
71
73
  }
72
74
  }
73
75
  }
74
76
  @media screen and (max-width: 480px) {
77
+ /* show edit on mobile */
75
78
  .wy-breadcrumbs li.wy-breadcrumbs-aside {
76
79
  display: initial;
77
80
  }
@@ -2,4 +2,4 @@
2
2
  <path d="M0 0h24v24H0z" fill="none"/>
3
3
  <path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"/>
4
4
  </svg>
5
- <!-- material-design-icons article -->
5
+ <!-- material-design-icons article -->
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  permalink: /search.html
3
- layout: basic
3
+ layout: default
4
4
  ---
5
5
 
6
+ {%- include reset/site_pages.liquid -%}
6
7
  {%- include reset/i18n.liquid -%}
7
8
 
8
9
  <div id="search-results">
@@ -10,3 +11,18 @@ layout: basic
10
11
  <p class="search-summary"></p>
11
12
  <ul class="search"></ul>
12
13
  </div>
14
+
15
+ <script>
16
+ const i18n = {
17
+ {%- for lang in site_langs -%}
18
+ {%- include i18n/{{ lang }}.liquid %}
19
+ "{{ lang }}": {
20
+ search_docs: "{{ __search_docs }}",
21
+ search_results: "{{ __search_results }}",
22
+ search_results_found: "{{ __search_results_found }}",
23
+ search_results_not_found: "{{ __search_results_not_found }}"
24
+ }{% unless forloop.last %},{% endunless %}
25
+ {%- endfor -%}
26
+ };
27
+ </script>
28
+ <script>{% include assets/search.js %}</script>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-rtd-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - saowang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-pages
@@ -41,29 +41,33 @@ files:
41
41
  - _includes/addons/seo/og.liquid
42
42
  - _includes/addons/seo/schema.liquid
43
43
  - _includes/addons/source/analytics.liquid
44
- - _includes/addons/source/gems.liquid
45
44
  - _includes/addons/source/github.liquid
46
45
  - _includes/addons/source/i18n.liquid
46
+ - _includes/addons/source/plugins.liquid
47
47
  - _includes/album.liquid
48
+ - _includes/assets/common.js
48
49
  - _includes/assets/custom.js
49
50
  - _includes/assets/custom.scss
50
- - _includes/assets/site.js
51
+ - _includes/assets/search.js
51
52
  - _includes/breadcrumbs.liquid
52
53
  - _includes/extend/list.liquid
53
54
  - _includes/extend/tabs.liquid
54
55
  - _includes/extend/toctree.liquid
55
56
  - _includes/footer.liquid
56
- - _includes/i18n/en-US.liquid
57
- - _includes/i18n/zh-CN.liquid
57
+ - _includes/i18n/en.liquid
58
+ - _includes/i18n/fr.liquid
59
+ - _includes/i18n/it.liquid
60
+ - _includes/i18n/ja.liquid
61
+ - _includes/i18n/ko.liquid
62
+ - _includes/i18n/zh-cn.liquid
58
63
  - _includes/list.liquid
59
64
  - _includes/reset/defaults.liquid
60
65
  - _includes/reset/i18n.liquid
66
+ - _includes/reset/languages.liquid
61
67
  - _includes/reset/schema.liquid
62
68
  - _includes/reset/site_pages.liquid
63
69
  - _includes/reset/workdir.liquid
64
- - _includes/searchbox.liquid
65
70
  - _includes/toctree.liquid
66
- - _layouts/basic.liquid
67
71
  - _layouts/default.liquid
68
72
  - _layouts/plugins/compress.liquid
69
73
  - _sass/_album.scss
@@ -1,125 +0,0 @@
1
- function feedback(type, message) {
2
- console.log(`feedback: https://github.com/rundocs/jekyll-rtd-theme/issues?q=${type}+${message}`);
3
- }
4
-
5
- function highlight() {
6
- let text = new URL(location.href).searchParams.get("highlight");
7
- let regexp = new RegExp(text, "im");
8
-
9
- if (text) {
10
- $(".section").find("*").each(function() {
11
- if (this.outerHTML.match(regexp)) {
12
- $(this).addClass("highlighted-box");
13
- }
14
- });
15
- $(".section").find(".highlighted-box").each(function() {
16
- if (($(this).find(".highlighted-box").length > 0)) {
17
- $(this).removeClass("highlighted-box");
18
- }
19
- });
20
- }
21
- }
22
-
23
- function search(data) {
24
- let text = new URL(location.href).searchParams.get("q");
25
- let results = [];
26
- let regexp = new RegExp(text, "im");
27
-
28
- function slice(content, min, max) {
29
- return content.slice(min, max).replace(regexp, (match) => `<span class="highlighted">${match}</span>`);
30
- }
31
- for (page of data) {
32
- let [title, content] = [null, null];
33
- try {
34
- if (page.title) {
35
- title = page.title.match(regexp);
36
- } else {
37
- if (page.url == "/") {
38
- page.title = "{{ site.title }}";
39
- } else {
40
- page.title = page.url;
41
- }
42
- }
43
- } catch (e) {
44
- feedback("search", e.message);
45
- }
46
- try {
47
- if (page.content) {
48
- page.content = $("<div/>").html(page.content).text();
49
- content = page.content.match(regexp);
50
- }
51
- } catch (e) {
52
- feedback("search", e.message);
53
- }
54
- if (title || content) {
55
- let result = [`<a href="{{ site.baseurl }}${page.url}?highlight=${text}">${page.title}</a>`];
56
- if (content) {
57
- let [min, max] = [content.index - 100, content.index + 100];
58
- let [prefix, suffix] = ["...", "..."];
59
-
60
- if (min < 0) {
61
- prefix = "";
62
- min = 0;
63
- }
64
- if (max > page.content.length) {
65
- suffix = "";
66
- max = page.content.length;
67
- }
68
- result.push(`<p class="context">${prefix}${slice(page.content ,min, max)}${suffix}</p>`);
69
- }
70
- results.push(`<li>${result.join("")}</li>`);
71
- }
72
- }
73
- if (results.length > 0 && text.length > 0) {
74
- $("#search-results ul.search").html(results.join(""));
75
- $("#search-results p.search-summary").html("{{ __search_results_found }}".replace("#", results.length));
76
- } else {
77
- $("#search-results ul.search").empty();
78
- $("#search-results p.search-summary").html("{{ __search_results_not_found }}");
79
- }
80
- $("#rtd-search-form [name='q']").val(text);
81
- $("#search-results h2").html("{{ __search_results }}");
82
- }
83
-
84
- function reset() {
85
- const link = $(".wy-menu-vertical").find(`[href="${location.pathname}"]`);
86
- if (link.length > 0) {
87
- $(".wy-menu-vertical .current").removeClass("current");
88
- link.addClass("current");
89
- link.closest("li.toctree-l1").parent().addClass("current");
90
- link.closest("li.toctree-l1").addClass("current");
91
- link.closest("li.toctree-l2").addClass("current");
92
- link.closest("li.toctree-l3").addClass("current");
93
- link.closest("li.toctree-l4").addClass("current");
94
- link.closest("li.toctree-l5").addClass("current");
95
- }
96
- }
97
-
98
- function admonition() {
99
- const items = {
100
- note: "{{ __note }}",
101
- tip: "{{ __tip }}",
102
- warning: "{{ __warning }}",
103
- danger: "{{ __danger }}"
104
- };
105
- for (let item in items) {
106
- let content = $(`.language-${item}`).html();
107
- $(`.language-${item}`).replaceWith(`<div class="admonition ${item}"><p class="admonition-title">${items[item]}</p><p>${content}</p></div>`);
108
- }
109
- }
110
-
111
- $(document).ready(function() {
112
- if (location.pathname == "{{ site.baseurl }}/search.html") {
113
- $.ajax({
114
- dataType: "json",
115
- url: "{{ site.baseurl }}/pages.json"
116
- })
117
- .done(search)
118
- .fail((xhr, message) => feedback("search", message));
119
- }
120
- admonition();
121
- anchors.add();
122
- highlight();
123
- SphinxRtdTheme.Navigation.reset = reset;
124
- SphinxRtdTheme.Navigation.enable(true);
125
- });
@@ -1,5 +0,0 @@
1
- <div role="search">
2
- <form id="rtd-search-form" class="wy-form" action="{{ site.baseurl }}/search.html" method="get" autocomplete="off">
3
- <input type="text" name="q" placeholder="{{ __search_docs }}...">
4
- </form>
5
- </div>
@@ -1,108 +0,0 @@
1
- ---
2
- layout: plugins/compress
3
- ---
4
-
5
- {%- include reset/defaults.liquid -%}
6
-
7
- <!DOCTYPE html>
8
-
9
- <!--
10
- {% if site.remote_theme -%}
11
- rundocs.io, remote_theme: {{ site.remote_theme }}, based on v{{ version }}
12
- {%- else -%}
13
- rundocs.io, theme: {{ site.theme | default: "jekyll-rtd-theme, based on" }} v{{ version }}
14
- {%- endif %}
15
- -->
16
-
17
- <html class="writer-html5" lang="{{ lang }}">
18
-
19
- <head>
20
- <meta charset="utf-8">
21
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
22
- <title>{{ title }}</title>
23
- <!-- meta -->
24
- <meta name="description" content="{{ description }}">
25
- <meta name="author" content="{{ author }}">
26
- <meta name="revised" content="{{ commit }}">
27
- <meta name="generator" content="jekyll-rtd-theme v{{ version }}">
28
- <!-- custom meta -->
29
- {% for meta in site.meta -%}
30
- <meta name="{{ meta.first }}" content="{{ meta.last }}">
31
- {% endfor -%}
32
- <!-- og -->
33
- {% include addons/seo/og.liquid %}
34
- <!-- schema -->
35
- {% include addons/seo/schema.liquid %}
36
- <!-- link -->
37
- {% if prev -%}
38
- <link rel="prev" href="{{ prev.url | absolute_url | xml_escape }}">
39
- {%- endif -%}
40
- {%- if next -%}
41
- <link rel="next" href="{{ next.url | absolute_url | xml_escape }}">
42
- {%- endif -%}
43
- <link rel="canonical" href="{{ schema_url }}">
44
- <!-- theme -->
45
- <link rel="stylesheet" href="{{ cdn }}/assets/css/theme.css">
46
- <link rel="stylesheet" href="{{ cdn }}/assets/css/rougify/{{ site.rougify | default: 'github' }}.css">
47
- <style>{{ site_scss | scssify }}</style>
48
- <!-- icon -->
49
- <link rel="icon" type="image/svg+xml" href="{{ site.baseurl }}/assets/favicon.svg">
50
- <!-- script -->
51
- <script src="{{ cdn }}/assets/js/jquery.min.js"></script>
52
- </head>
53
-
54
- <body class="wy-body-for-nav">
55
- <div class="wy-grid-for-nav">
56
- <!-- SIDE NAV, TOGGLES ON MOBILE -->
57
- <nav data-toggle="wy-nav-shift" class="wy-nav-side">
58
- <div class="wy-side-scroll">
59
- <div class="wy-side-nav-search">
60
- {% if site.logo %}
61
- <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}">
62
- <img src="{{ site.baseurl }}/{{ site.logo }}" class="logo" alt="{{ site.title }}">
63
- </a>
64
- {% else %}
65
- <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}" class="icon icon-home"> {{ site.title }}</a>
66
- {% endif %}
67
- {% include searchbox.liquid %}
68
- </div>
69
- <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
70
- {% include toctree.liquid %}
71
- </div>
72
- {%- if site.embed -%}
73
- <div class="wy-embed-wrap">
74
- <div class="wy-embed">{{ site.embed }}</div>
75
- </div>
76
- {%- endif -%}
77
- </div>
78
- </nav>
79
- <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
80
- <!-- MOBILE NAV -->
81
- <nav class="wy-nav-top" aria-label="top navigation">
82
- <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
83
- <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}">{{ site.title }}</a>
84
- </nav>
85
- <div class="wy-nav-content">
86
- <div class="rst-content">
87
- {% include breadcrumbs.liquid %}
88
- <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
89
- <div itemprop="articleBody">{{ content }}</div>
90
- {% include addons/comments/disqus.liquid %}
91
- </div>
92
- {% include footer.liquid %}
93
- </div>
94
- </div>
95
- </section>
96
- </div>
97
- {%- if site.addons %}{% include addons.liquid %}{% endif %}
98
- <!-- script -->
99
- <script src="{{ cdn }}/assets/js/theme.js"></script>
100
- <script src="{{ cdn }}/assets/js/anchor.min.js"></script>
101
- <script>{{ site_script }}</script>
102
- <!-- analytics -->
103
- {%- include addons/analytics/baidu.liquid -%}
104
- {%- include addons/analytics/cnzz.liquid -%}
105
- {%- include addons/analytics/google.liquid -%}
106
- </body>
107
-
108
- </html>