databook-theme 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -21
- data/README.MD +1 -1
- data/_includes/blog/blog.liquid +50 -50
- data/_includes/blog/features.liquid +36 -36
- data/_includes/blog/full.liquid +3 -3
- data/_includes/blog/list.liquid +41 -41
- data/_includes/blog/post.liquid +6 -6
- data/_includes/components/analytics.google.liquid +11 -11
- data/_includes/components/analytics.liquid +11 -11
- data/_includes/components/comments.disqus.liquid +17 -17
- data/_includes/components/comments.gitalk.liquid +22 -22
- data/_includes/components/comments.liquid +13 -13
- data/_includes/components/navmenu.items.liquid +51 -51
- data/_includes/components/navmenu.liquid +4 -4
- data/_includes/components/pagination.liquid +83 -83
- data/_includes/components/prevnext.liquid +1 -1
- data/_includes/components/search.baidu.liquid +7 -7
- data/_includes/components/search.bing.liquid +6 -6
- data/_includes/components/search.google.liquid +6 -6
- data/_includes/components/search.liquid +21 -21
- data/_includes/components/social_button.liquid +9 -9
- data/_includes/components/social_link.liquid +14 -14
- data/_includes/components/title.liquid +41 -41
- data/_includes/components/toc.liquid +28 -28
- data/_includes/custom/analytics.liquid +3 -3
- data/_includes/custom/blog.liquid +3 -3
- data/_includes/custom/body.liquid +3 -3
- data/_includes/custom/comments.liquid +3 -3
- data/_includes/custom/favicon.liquid +11 -0
- data/_includes/custom/footer.liquid +3 -3
- data/_includes/custom/head.liquid +3 -3
- data/_includes/custom/katex.liquid +15 -15
- data/_includes/custom/mathjax.liquid +19 -19
- data/_includes/custom/search.liquid +3 -3
- data/_includes/extensions/toc.liquid +182 -182
- data/_includes/functions/get_config.liquid +11 -11
- data/_includes/functions/get_config_data.liquid +23 -23
- data/_includes/functions/get_icon.liquid +5 -5
- data/_includes/functions/get_page_meta.liquid +74 -60
- data/_includes/functions/get_page_thumbnail.liquid +22 -23
- data/_includes/functions/get_page_title.liquid +7 -7
- data/_includes/functions/get_recent_posts.liquid +17 -17
- data/_includes/functions/get_taxonomy_link.liquid +9 -9
- data/_includes/head/head.liquid +11 -12
- data/_includes/head/meta.liquid +50 -41
- data/_includes/head/requirements.liquid +87 -87
- data/_includes/head/styles.liquid +10 -10
- data/_includes/js/codes.js +116 -116
- data/_includes/js/scrollspy.js +16 -16
- data/_includes/layout/article.liquid +74 -71
- data/_includes/layout/footer.liquid +53 -53
- data/_includes/layout/header.liquid +31 -31
- data/_includes/layout/hero.liquid +29 -29
- data/_includes/layout/page.liquid +33 -33
- data/_includes/layout/pagehead.liquid +17 -17
- data/_includes/layout/sidebar.liquid +178 -178
- data/_includes/localize +29 -29
- data/_includes/notice +6 -6
- data/_includes/version +1 -1
- data/_layouts/article.liquid +10 -10
- data/_layouts/default.liquid +132 -131
- data/_layouts/home.liquid +20 -20
- data/_layouts/page.liquid +9 -9
- data/_layouts/post.liquid +9 -9
- data/_layouts/system.liquid +35 -35
- data/_layouts/taxonomy.liquid +67 -67
- data/_sass/_databook.scss +42 -42
- data/_sass/_debug.scss +7 -7
- data/_sass/_variables.scss +24 -24
- data/_sass/base/_mixins.scss +32 -32
- data/_sass/base/_normalize.scss +45 -45
- data/_sass/base/_responsive.scss +28 -28
- data/_sass/components/_archive.scss +49 -49
- data/_sass/components/_blog.scss +249 -249
- data/_sass/components/_forms.scss +30 -30
- data/_sass/components/_hero.scss +70 -70
- data/_sass/components/_misc.scss +3 -3
- data/_sass/components/_notice.scss +27 -27
- data/_sass/components/_notification.scss +10 -10
- data/_sass/components/_post.scss +19 -19
- data/_sass/components/_sidebar.scss +303 -303
- data/_sass/components/_tabs.scss +67 -67
- data/_sass/components/_text.scss +27 -27
- data/_sass/components/_toc.scss +50 -50
- data/_sass/layout/_article.scss +211 -211
- data/_sass/layout/_body.scss +26 -26
- data/_sass/layout/_footer.scss +75 -75
- data/_sass/layout/_header.scss +124 -124
- data/_sass/layout/_main.scss +8 -8
- data/_sass/layout/_misc.scss +7 -7
- data/_sass/layout/_navbar.scss +323 -323
- data/_sass/layout/_sidebar.scss +115 -115
- data/_sass/layout/_wrapper.scss +7 -7
- data/_sass/theme/_scheme.scss +112 -112
- data/_sass/typography/_article.scss +49 -49
- data/_sass/typography/_doc.scss +104 -104
- data/_sass/typography/_highlight.scss +208 -208
- data/_sass/typography/_markdown.scss +18 -18
- data/_sass/typography/_table.scss +119 -119
- data/_sass/typography/_typography.scss +103 -108
- data/_sass/utilities/_thinscrollbar.scss +35 -35
- data/assets/databook/css/databook.scss +6 -6
- data/assets/databook/js/databook.js +8 -8
- data/assets/databook/js/search.js +47 -47
- data/assets/databook/version.json +9 -9
- data/assets/search.json +30 -30
- metadata +8 -8
- data/_includes/head/opengraph.liquid +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{%- assign pageitem = include.page | default: page -%}
|
|
2
|
-
|
|
3
|
-
{%- if pageitem.title_key -%}
|
|
4
|
-
{%- include localize key=pageitem.title_key default=pageitem.title -%}
|
|
5
|
-
{%- else -%}
|
|
6
|
-
{{- pageitem.title -}}
|
|
7
|
-
{%- endif -%}
|
|
1
|
+
{%- assign pageitem = include.page | default: page -%}
|
|
2
|
+
|
|
3
|
+
{%- if pageitem.title_key -%}
|
|
4
|
+
{%- include localize key=pageitem.title_key default=pageitem.title -%}
|
|
5
|
+
{%- else -%}
|
|
6
|
+
{{- pageitem.title -}}
|
|
7
|
+
{%- endif -%}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{%- assign posts = site.posts | sort: "date" -%}
|
|
2
|
-
|
|
3
|
-
{%- if include.sticky -%}
|
|
4
|
-
{%- assign sticky_posts = posts | where_exp: "item", "item.sticky == true" -%}
|
|
5
|
-
{%- assign normal_posts = posts | where_exp: "item", "item.sticky != true" -%}
|
|
6
|
-
{%- assign posts = sticky_posts | concat: normal_posts -%}
|
|
7
|
-
{%- elsif include.featured -%}
|
|
8
|
-
{%- assign featured_posts = posts | where_exp: "item", "item.featured == true" -%}
|
|
9
|
-
{%- assign normal_posts = posts | where_exp: "item", "item.featured != true" -%}
|
|
10
|
-
{%- assign posts = featured_posts | concat: normal_posts -%}
|
|
11
|
-
{%- endif -%}
|
|
12
|
-
|
|
13
|
-
{%- if include.count -%}
|
|
14
|
-
{%- assign posts = posts | slice: 0, include.count -%}
|
|
15
|
-
{%- endif -%}
|
|
16
|
-
|
|
17
|
-
{%- assign return = posts -%}
|
|
1
|
+
{%- assign posts = site.posts | sort: "date" -%}
|
|
2
|
+
|
|
3
|
+
{%- if include.sticky -%}
|
|
4
|
+
{%- assign sticky_posts = posts | where_exp: "item", "item.sticky == true" -%}
|
|
5
|
+
{%- assign normal_posts = posts | where_exp: "item", "item.sticky != true" -%}
|
|
6
|
+
{%- assign posts = sticky_posts | concat: normal_posts -%}
|
|
7
|
+
{%- elsif include.featured -%}
|
|
8
|
+
{%- assign featured_posts = posts | where_exp: "item", "item.featured == true" -%}
|
|
9
|
+
{%- assign normal_posts = posts | where_exp: "item", "item.featured != true" -%}
|
|
10
|
+
{%- assign posts = featured_posts | concat: normal_posts -%}
|
|
11
|
+
{%- endif -%}
|
|
12
|
+
|
|
13
|
+
{%- if include.count -%}
|
|
14
|
+
{%- assign posts = posts | slice: 0, include.count -%}
|
|
15
|
+
{%- endif -%}
|
|
16
|
+
|
|
17
|
+
{%- assign return = posts -%}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{%- if include.tag -%}
|
|
2
|
-
/tags/#!/{{- include.tag | url_encode -}}
|
|
3
|
-
{%- elsif include.category -%}
|
|
4
|
-
/categories/#!/{{- include.category | url_encode -}}
|
|
5
|
-
{%- elsif include.archive -%}
|
|
6
|
-
/archive/#!/{{- include.archive | url_encode -}}
|
|
7
|
-
{%- elsif include.author -%}
|
|
8
|
-
/authors/#!/{{- include.author | url_encode -}}
|
|
9
|
-
{%- endif -%}
|
|
1
|
+
{%- if include.tag -%}
|
|
2
|
+
/tags/#!/{{- include.tag | url_encode -}}
|
|
3
|
+
{%- elsif include.category -%}
|
|
4
|
+
/categories/#!/{{- include.category | url_encode -}}
|
|
5
|
+
{%- elsif include.archive -%}
|
|
6
|
+
/archive/#!/{{- include.archive | url_encode -}}
|
|
7
|
+
{%- elsif include.author -%}
|
|
8
|
+
/authors/#!/{{- include.author | url_encode -}}
|
|
9
|
+
{%- endif -%}
|
data/_includes/head/head.liquid
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
<head>
|
|
2
|
-
{% include head/meta.liquid %}
|
|
3
|
-
{% include head/
|
|
4
|
-
{% include head/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</head>
|
|
1
|
+
<head>
|
|
2
|
+
{% include head/meta.liquid %}
|
|
3
|
+
{% include head/requirements.liquid %}
|
|
4
|
+
{% include head/styles.liquid %}
|
|
5
|
+
|
|
6
|
+
{%- if jekyll.environment == "production" -%}
|
|
7
|
+
{%- include components/analytics.liquid -%}
|
|
8
|
+
{%- endif %}
|
|
9
|
+
|
|
10
|
+
{% include custom/head.liquid %}
|
|
11
|
+
</head>
|
data/_includes/head/meta.liquid
CHANGED
|
@@ -1,41 +1,50 @@
|
|
|
1
|
-
{%- assign robots = "index,follow" -%}
|
|
2
|
-
{%- if site.disallow_robots -%}
|
|
3
|
-
{%- assign robots = "noindex,nofollow" -%}
|
|
4
|
-
{%- endif -%}
|
|
5
|
-
|
|
6
|
-
{%- assign title_separator = site.title_separator | default: "
|
|
7
|
-
{%-
|
|
8
|
-
{%- assign
|
|
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
|
-
|
|
1
|
+
{%- assign robots = "index,follow" -%}
|
|
2
|
+
{%- if site.disallow_robots -%}
|
|
3
|
+
{%- assign robots = "noindex,nofollow" -%}
|
|
4
|
+
{%- endif -%}
|
|
5
|
+
|
|
6
|
+
{%- assign title_separator = site.title_separator | default: "|" -%}
|
|
7
|
+
{%- assign site_title = site.title | default: site.name -%}
|
|
8
|
+
{%- assign site_description = site.tagline | default: site.description -%}
|
|
9
|
+
{%- capture page_title -%}{%- include functions/get_page_title.liquid -%}{%- endcapture -%}
|
|
10
|
+
|
|
11
|
+
{%- assign html_title = "" -%}
|
|
12
|
+
{%- if page_title.size > 0 -%}
|
|
13
|
+
{%- assign html_title = page_title | append: " " | append: title_separator | append: " " | append: site.title -%}
|
|
14
|
+
{%- else -%}
|
|
15
|
+
{%- assign html_title = site_title | append: " " | append: title_separator | append: " " | append: site_description -%}
|
|
16
|
+
{%- endif -%}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<meta charset="{{- site.encoding | default: 'utf-8' -}}">
|
|
20
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
21
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
22
|
+
<meta name="robots" content="{{- robots -}}">
|
|
23
|
+
{%- if site.keywords -%}<meta name="keywords" content="{{- site.keywords -}}">{%- endif -%}
|
|
24
|
+
{%- if site.baseurl -%}<base href="{{- site.baseurl -}}">{%- endif -%}
|
|
25
|
+
|
|
26
|
+
<link rel="alternate" type="application/atom+xml" href="{{- '/feed.xml' | relative_url -}}" title="Atom Feed">
|
|
27
|
+
|
|
28
|
+
<title>{{- html_title -}}</title>
|
|
29
|
+
|
|
30
|
+
{% include custom/favicon.liquid %}
|
|
31
|
+
|
|
32
|
+
{%- seo title=false -%}
|
|
33
|
+
|
|
34
|
+
<script type="text/javascript" >
|
|
35
|
+
window.databookConfig = {
|
|
36
|
+
siteTitle: "{{- site_title -}}",
|
|
37
|
+
siteBaseurl: "{{- site.baseurl -}}",
|
|
38
|
+
siteUrl: "{{- site.url -}}",
|
|
39
|
+
titleSeparater: "{{- site.title_separator -}}",
|
|
40
|
+
generatedDate: "{{- site.time | date_to_xmlschema -}}",
|
|
41
|
+
pageTitle: "{{- page_title -}}",
|
|
42
|
+
pageLayout: "{{- page.layout -}}",
|
|
43
|
+
{%- if page.scrollspy or layout.scrollspy or site.scrollspy -%}scrollspy: true,{%- endif -%}
|
|
44
|
+
{%- if page.chartjs or layout.chartjs or site.chartjs -%}chartjs: true,{%- endif -%}
|
|
45
|
+
{%- if page.mathjax or layout.mathjax or site.mathjax -%}mathjax: true,{%- endif -%}
|
|
46
|
+
{%- if page.mermaid or layout.mermaid or site.mermaid -%}mermaid: true,{%- endif -%}
|
|
47
|
+
{% if jekyll.environment == "development" %}debug: true,{% endif %}
|
|
48
|
+
};
|
|
49
|
+
document.querySelector('.js-disabled').classList.remove('js-disabled');
|
|
50
|
+
</script>
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
{%- assign npm_cdn_key = ":npm_cdn/" -%}
|
|
2
|
-
{%- assign npm_cdn = site.npm_cdn | default: "https://cdn.jsdelivr.net/npm/"-%}
|
|
3
|
-
{%- assign last_char = npm_cdn | split: "" | last -%}
|
|
4
|
-
{%- if last_char != "/" -%}{%- assign npc_cdn = npm_cdn | append: "/" -%}{%- endif -%}
|
|
5
|
-
|
|
6
|
-
{%- assign github_cdn_key = ":github_cdn/" -%}
|
|
7
|
-
{%- assign github_cdn = site.github_cdn | default: "https://cdn.jsdelivr.net/gh/" -%}
|
|
8
|
-
{%- assign last_char = github_cdn | split: "" | last -%}
|
|
9
|
-
{%- if last_char != "/" -%}{%- assign github_cdn = github_cdn | append: "/" -%}{%- endif -%}
|
|
10
|
-
|
|
11
|
-
{%- assign js_list = "" | split: "" -%}
|
|
12
|
-
{%- assign mjs_list = "" | split: "" -%}
|
|
13
|
-
{%- assign css_list = "" | split: "" -%}
|
|
14
|
-
|
|
15
|
-
{%- assign js_list = js_list
|
|
16
|
-
| push: "/assets/databook/js/databook.js"
|
|
17
|
-
-%}
|
|
18
|
-
|
|
19
|
-
{%- assign mjs_list = mjs_list
|
|
20
|
-
-%}
|
|
21
|
-
|
|
22
|
-
{%- assign css_list = css_list
|
|
23
|
-
| push: "/assets/databook/css/databook.css"
|
|
24
|
-
| push: ":npm_cdn/@fortawesome/fontawesome-free/css/all.min.css"
|
|
25
|
-
-%}
|
|
26
|
-
|
|
27
|
-
{%- if page.chartjs or layout.chartjs or site.chartjs -%}
|
|
28
|
-
{%- assign js_list = js_list | push: ":npm_cdn/chart.js/dist/chart.min.js" -%}
|
|
29
|
-
{%- endif -%}
|
|
30
|
-
|
|
31
|
-
{%- if page.flowchart or layout.flowchart or site.flowchart -%}
|
|
32
|
-
{%- assign js_list = js_list | push: ":npm_cdn/raphael@2.3.0/raphael.min.js" -%}
|
|
33
|
-
{%- assign js_list = js_list | push: ":npm_cdn/flowchart.js@1.8.0/release/flowchart.min.js" -%}
|
|
34
|
-
{%- endif -%}
|
|
35
|
-
|
|
36
|
-
{%- if page.katex or layout.katex or site.katex -%}
|
|
37
|
-
{%- assign css_list = css_list | push: ":npm_cdn/katex/dist/katex.min.css" -%}
|
|
38
|
-
{%- assign js_list = js_list | push: ":npm_cdn/katex/dist/katex.min.js" -%}
|
|
39
|
-
{%- assign js_list = js_list | push: ":npm_cdn/katex/dist/contrib/auto-render.min.js" -%}
|
|
40
|
-
{%- include custom/katex.liquid -%}
|
|
41
|
-
{%- endif -%}
|
|
42
|
-
|
|
43
|
-
{%- if page.mathjax or layout.mathjax or site.mathjax -%}
|
|
44
|
-
{%- assign js_list = js_list | push: ":npm_cdn/mathjax/es5/tex-mml-chtml.js" -%}
|
|
45
|
-
{%- include custom/mathjax.liquid -%}
|
|
46
|
-
{%- endif -%}
|
|
47
|
-
|
|
48
|
-
{%- if page.mermaid or layout.mermaid or site.mermaid -%}
|
|
49
|
-
{%- assign js_list = js_list | push: ":npm_cdn/mermaid/dist/mermaid.min.js" -%}
|
|
50
|
-
{%- endif -%}
|
|
51
|
-
|
|
52
|
-
{%- if site.data.requirements.js -%}{%- assign js_list = js_list | concat: site.data.requirements.js -%}{%- endif -%}
|
|
53
|
-
{%- if site.data.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: site.data.requirements.modules -%}{%- endif -%}
|
|
54
|
-
{%- if site.data.requirements.css -%}{%- assign css_list = css_list | concat: site.data.requirements.css -%}{%- endif -%}
|
|
55
|
-
|
|
56
|
-
{%- if site.requirements.js -%}{%- assign js_list = js_list | concat: site.requirements.js -%}{%- endif -%}
|
|
57
|
-
{%- if site.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: site.requirements.modules -%}{%- endif -%}
|
|
58
|
-
{%- if site.requirements.css -%}{%- assign css_list = css_list | concat: site.requirements.css -%}{%- endif -%}
|
|
59
|
-
|
|
60
|
-
{%- if layout.requirements.js -%}{%- assign js_list = js_list | concat: layout.requirements.js -%}{%- endif -%}
|
|
61
|
-
{%- if layout.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: layout.requirements.modules -%}{%- endif -%}
|
|
62
|
-
{%- if layout.requirements.css -%}{%- assign css_list = css_list | concat: layout.requirements.css -%}{%- endif -%}
|
|
63
|
-
|
|
64
|
-
{%- if page.requirements.js -%}{%- assign js_list = js_list | concat: page.requirements.js -%}{%- endif -%}
|
|
65
|
-
{%- if page.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: page.requirements.modules -%}{%- endif -%}
|
|
66
|
-
{%- if page.requirements.css -%}{%- assign css_list = css_list | concat: page.requirements.css -%}{%- endif -%}
|
|
67
|
-
|
|
68
|
-
{%- if page.js -%}{%- assign js_list = js_list | concat: page.js -%}{%- endif -%}
|
|
69
|
-
{%- if page.modules -%}{%- assign mjs_list = mjs_list | concat: page.modules -%}{%- endif -%}
|
|
70
|
-
{%- if page.css -%}{%- assign css_list = css_list | concat: page.css -%}{%- endif -%}
|
|
71
|
-
|
|
72
|
-
{%- assign js_list = js_list | uniq -%}
|
|
73
|
-
{%- assign mjs_list = mjs_list | uniq -%}
|
|
74
|
-
{%- assign css_list = css_list | uniq -%}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{%- for url in css_list -%}
|
|
78
|
-
<link href="{{- url | replace: npm_cdn_key, npm_cdn | replace: github_cdn_key, github_cdn | relative_url -}}" type="text/css" rel="stylesheet">
|
|
79
|
-
{%- endfor -%}
|
|
80
|
-
|
|
81
|
-
{%- for url in js_list -%}
|
|
82
|
-
<script src="{{- url | replace: npm_cdn_key, npm_cdn | replace: github_cdn_key, github_cdn | relative_url -}}" type="text/javascript" defer></script>
|
|
83
|
-
{%- endfor -%}
|
|
84
|
-
|
|
85
|
-
{%- for url in mjs_list -%}
|
|
86
|
-
<script src="{{- url | replace: npm_cdn_key, npm_cdn | replace: github_cdn_key, github_cdn | relative_url -}}" type="module" ></script>
|
|
87
|
-
{%- endfor -%}
|
|
1
|
+
{%- assign npm_cdn_key = ":npm_cdn/" -%}
|
|
2
|
+
{%- assign npm_cdn = site.npm_cdn | default: "https://cdn.jsdelivr.net/npm/"-%}
|
|
3
|
+
{%- assign last_char = npm_cdn | split: "" | last -%}
|
|
4
|
+
{%- if last_char != "/" -%}{%- assign npc_cdn = npm_cdn | append: "/" -%}{%- endif -%}
|
|
5
|
+
|
|
6
|
+
{%- assign github_cdn_key = ":github_cdn/" -%}
|
|
7
|
+
{%- assign github_cdn = site.github_cdn | default: "https://cdn.jsdelivr.net/gh/" -%}
|
|
8
|
+
{%- assign last_char = github_cdn | split: "" | last -%}
|
|
9
|
+
{%- if last_char != "/" -%}{%- assign github_cdn = github_cdn | append: "/" -%}{%- endif -%}
|
|
10
|
+
|
|
11
|
+
{%- assign js_list = "" | split: "" -%}
|
|
12
|
+
{%- assign mjs_list = "" | split: "" -%}
|
|
13
|
+
{%- assign css_list = "" | split: "" -%}
|
|
14
|
+
|
|
15
|
+
{%- assign js_list = js_list
|
|
16
|
+
| push: "/assets/databook/js/databook.js"
|
|
17
|
+
-%}
|
|
18
|
+
|
|
19
|
+
{%- assign mjs_list = mjs_list
|
|
20
|
+
-%}
|
|
21
|
+
|
|
22
|
+
{%- assign css_list = css_list
|
|
23
|
+
| push: "/assets/databook/css/databook.css"
|
|
24
|
+
| push: ":npm_cdn/@fortawesome/fontawesome-free/css/all.min.css"
|
|
25
|
+
-%}
|
|
26
|
+
|
|
27
|
+
{%- if page.chartjs or layout.chartjs or site.chartjs -%}
|
|
28
|
+
{%- assign js_list = js_list | push: ":npm_cdn/chart.js/dist/chart.min.js" -%}
|
|
29
|
+
{%- endif -%}
|
|
30
|
+
|
|
31
|
+
{%- if page.flowchart or layout.flowchart or site.flowchart -%}
|
|
32
|
+
{%- assign js_list = js_list | push: ":npm_cdn/raphael@2.3.0/raphael.min.js" -%}
|
|
33
|
+
{%- assign js_list = js_list | push: ":npm_cdn/flowchart.js@1.8.0/release/flowchart.min.js" -%}
|
|
34
|
+
{%- endif -%}
|
|
35
|
+
|
|
36
|
+
{%- if page.katex or layout.katex or site.katex -%}
|
|
37
|
+
{%- assign css_list = css_list | push: ":npm_cdn/katex/dist/katex.min.css" -%}
|
|
38
|
+
{%- assign js_list = js_list | push: ":npm_cdn/katex/dist/katex.min.js" -%}
|
|
39
|
+
{%- assign js_list = js_list | push: ":npm_cdn/katex/dist/contrib/auto-render.min.js" -%}
|
|
40
|
+
{%- include custom/katex.liquid -%}
|
|
41
|
+
{%- endif -%}
|
|
42
|
+
|
|
43
|
+
{%- if page.mathjax or layout.mathjax or site.mathjax -%}
|
|
44
|
+
{%- assign js_list = js_list | push: ":npm_cdn/mathjax/es5/tex-mml-chtml.js" -%}
|
|
45
|
+
{%- include custom/mathjax.liquid -%}
|
|
46
|
+
{%- endif -%}
|
|
47
|
+
|
|
48
|
+
{%- if page.mermaid or layout.mermaid or site.mermaid -%}
|
|
49
|
+
{%- assign js_list = js_list | push: ":npm_cdn/mermaid/dist/mermaid.min.js" -%}
|
|
50
|
+
{%- endif -%}
|
|
51
|
+
|
|
52
|
+
{%- if site.data.requirements.js -%}{%- assign js_list = js_list | concat: site.data.requirements.js -%}{%- endif -%}
|
|
53
|
+
{%- if site.data.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: site.data.requirements.modules -%}{%- endif -%}
|
|
54
|
+
{%- if site.data.requirements.css -%}{%- assign css_list = css_list | concat: site.data.requirements.css -%}{%- endif -%}
|
|
55
|
+
|
|
56
|
+
{%- if site.requirements.js -%}{%- assign js_list = js_list | concat: site.requirements.js -%}{%- endif -%}
|
|
57
|
+
{%- if site.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: site.requirements.modules -%}{%- endif -%}
|
|
58
|
+
{%- if site.requirements.css -%}{%- assign css_list = css_list | concat: site.requirements.css -%}{%- endif -%}
|
|
59
|
+
|
|
60
|
+
{%- if layout.requirements.js -%}{%- assign js_list = js_list | concat: layout.requirements.js -%}{%- endif -%}
|
|
61
|
+
{%- if layout.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: layout.requirements.modules -%}{%- endif -%}
|
|
62
|
+
{%- if layout.requirements.css -%}{%- assign css_list = css_list | concat: layout.requirements.css -%}{%- endif -%}
|
|
63
|
+
|
|
64
|
+
{%- if page.requirements.js -%}{%- assign js_list = js_list | concat: page.requirements.js -%}{%- endif -%}
|
|
65
|
+
{%- if page.requirements.modules -%}{%- assign mjs_list = mjs_list | concat: page.requirements.modules -%}{%- endif -%}
|
|
66
|
+
{%- if page.requirements.css -%}{%- assign css_list = css_list | concat: page.requirements.css -%}{%- endif -%}
|
|
67
|
+
|
|
68
|
+
{%- if page.js -%}{%- assign js_list = js_list | concat: page.js -%}{%- endif -%}
|
|
69
|
+
{%- if page.modules -%}{%- assign mjs_list = mjs_list | concat: page.modules -%}{%- endif -%}
|
|
70
|
+
{%- if page.css -%}{%- assign css_list = css_list | concat: page.css -%}{%- endif -%}
|
|
71
|
+
|
|
72
|
+
{%- assign js_list = js_list | uniq -%}
|
|
73
|
+
{%- assign mjs_list = mjs_list | uniq -%}
|
|
74
|
+
{%- assign css_list = css_list | uniq -%}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
{%- for url in css_list -%}
|
|
78
|
+
<link href="{{- url | replace: npm_cdn_key, npm_cdn | replace: github_cdn_key, github_cdn | relative_url -}}" type="text/css" rel="stylesheet">
|
|
79
|
+
{%- endfor -%}
|
|
80
|
+
|
|
81
|
+
{%- for url in js_list -%}
|
|
82
|
+
<script src="{{- url | replace: npm_cdn_key, npm_cdn | replace: github_cdn_key, github_cdn | relative_url -}}" type="text/javascript" defer></script>
|
|
83
|
+
{%- endfor -%}
|
|
84
|
+
|
|
85
|
+
{%- for url in mjs_list -%}
|
|
86
|
+
<script src="{{- url | replace: npm_cdn_key, npm_cdn | replace: github_cdn_key, github_cdn | relative_url -}}" type="module" ></script>
|
|
87
|
+
{%- endfor -%}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{%- assign accent_color_hue = page.accent_color_hue | default: layout.accent_color_hue | default: site.accent_color_hue | default: false -%}
|
|
2
|
-
{%- assign accent_color_saturation = page.accent_color_saturation | default: layout.accent_color_saturation | default: site.accent_color_saturation | default: false -%}
|
|
3
|
-
{%- if accent_color_hue or accent_color_saturation -%}
|
|
4
|
-
<style>
|
|
5
|
-
:root[data-accent-color="custom"] {
|
|
6
|
-
--db-accent-color-h: {{accent_color_hue|default:"220"}};
|
|
7
|
-
--db-accent-color-s: {{accent_color_saturation|default:"50%"}};
|
|
8
|
-
}
|
|
9
|
-
</style>
|
|
10
|
-
{%- endif -%}
|
|
1
|
+
{%- assign accent_color_hue = page.accent_color_hue | default: layout.accent_color_hue | default: site.accent_color_hue | default: false -%}
|
|
2
|
+
{%- assign accent_color_saturation = page.accent_color_saturation | default: layout.accent_color_saturation | default: site.accent_color_saturation | default: false -%}
|
|
3
|
+
{%- if accent_color_hue or accent_color_saturation -%}
|
|
4
|
+
<style>
|
|
5
|
+
:root[data-accent-color="custom"] {
|
|
6
|
+
--db-accent-color-h: {{accent_color_hue|default:"220"}};
|
|
7
|
+
--db-accent-color-s: {{accent_color_saturation|default:"50%"}};
|
|
8
|
+
}
|
|
9
|
+
</style>
|
|
10
|
+
{%- endif -%}
|
data/_includes/js/codes.js
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
{
|
|
2
|
-
function init() {
|
|
3
|
-
let items = [...document.querySelectorAll('pre')]
|
|
4
|
-
.filter(pre => {
|
|
5
|
-
return pre.childElementCount == 1
|
|
6
|
-
&& pre.children[0].tagName == 'CODE'
|
|
7
|
-
&& pre.children[0].childElementCount == 0;
|
|
8
|
-
})
|
|
9
|
-
.map((pre, index) => {
|
|
10
|
-
let name = pre.children[0].className.replace('language-', '');
|
|
11
|
-
let text = pre.children[0].textContent;
|
|
12
|
-
let newNode = document.createElement('div');
|
|
13
|
-
newNode.className = `js-code js-code--${name}`;
|
|
14
|
-
newNode.setAttribute('style', pre.getAttribute('style') || "");
|
|
15
|
-
pre.after(newNode);
|
|
16
|
-
return {
|
|
17
|
-
node: pre,
|
|
18
|
-
name,
|
|
19
|
-
text,
|
|
20
|
-
output: newNode,
|
|
21
|
-
id: `js-pre${index}`,
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
items.forEach(render);
|
|
26
|
-
|
|
27
|
-
if (items.some(x => x.success && x.name == 'mathjax')) {
|
|
28
|
-
MathJax.startup.document.clear();
|
|
29
|
-
MathJax.startup.document.updateDocument();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function render(item) {
|
|
34
|
-
if (item.name == 'chart' && typeof Chart !== 'undefined') {
|
|
35
|
-
renderChart(item);
|
|
36
|
-
} else if (item.name == 'flowchart' && typeof flowchart !== 'undefined') {
|
|
37
|
-
renderFlowchart(item);
|
|
38
|
-
} else if ((item.name == 'katex' || item.name == 'math') && typeof katex !== 'undefined') {
|
|
39
|
-
renderKatex(item);
|
|
40
|
-
} else if ((item.name == 'mathjax' || item.name == 'math') && typeof MathJax !== 'undefined') {
|
|
41
|
-
renderMathjax(item);
|
|
42
|
-
} else if (item.name == 'mermaid' && typeof mermaid !== 'undefined') {
|
|
43
|
-
renderMermaid(item);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (item.error) {
|
|
47
|
-
item.output.innerHTML = `<p style="color:red;">Error: ${item.error}</p>`;
|
|
48
|
-
} else if (item.success) {
|
|
49
|
-
item.node.style.display = 'none';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
function renderChart(item) {
|
|
55
|
-
let json;
|
|
56
|
-
try {
|
|
57
|
-
json = JSON.parse(item.text);
|
|
58
|
-
} catch (error) {
|
|
59
|
-
item.error = 'Invalid JSON syntax.';
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let canvas = document.createElement('canvas');
|
|
64
|
-
item.output.append(canvas);
|
|
65
|
-
try {
|
|
66
|
-
new Chart(canvas, json);
|
|
67
|
-
item.success = true;
|
|
68
|
-
} catch (error) {
|
|
69
|
-
item.error = 'Invalid Chart syntax.';
|
|
70
|
-
console.error(error);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function renderFlowchart(item) {
|
|
75
|
-
try {
|
|
76
|
-
let diagram = flowchart.parse(item.text);
|
|
77
|
-
diagram.drawSVG(item.output);
|
|
78
|
-
item.success = true;
|
|
79
|
-
} catch (error) {
|
|
80
|
-
item.error = 'Invalid flowchart syntax.';
|
|
81
|
-
console.error(error);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function renderKatex(item) {
|
|
86
|
-
try {
|
|
87
|
-
katex.render(item.text, item.output, { displayMode: true });
|
|
88
|
-
item.success = true;
|
|
89
|
-
} catch (error) {
|
|
90
|
-
item.error = 'Invalid Katex syntax.';
|
|
91
|
-
console.error(error);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function renderMathjax(item) {
|
|
96
|
-
try {
|
|
97
|
-
item.output.append(MathJax.tex2chtml(item.text));
|
|
98
|
-
item.success = true;
|
|
99
|
-
} catch (error) {
|
|
100
|
-
item.error = 'Invalid Mathjax syntax.';
|
|
101
|
-
console.error(error);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function renderMermaid(item) {
|
|
106
|
-
try {
|
|
107
|
-
item.output.innerHTML = mermaid.render(item.id, item.text);
|
|
108
|
-
item.success = true;
|
|
109
|
-
} catch (error) {
|
|
110
|
-
item.error = 'Invalid mermaid syntax.';
|
|
111
|
-
console.error(error);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
window.addEventListener('load', init);
|
|
116
|
-
}
|
|
1
|
+
{
|
|
2
|
+
function init() {
|
|
3
|
+
let items = [...document.querySelectorAll('pre')]
|
|
4
|
+
.filter(pre => {
|
|
5
|
+
return pre.childElementCount == 1
|
|
6
|
+
&& pre.children[0].tagName == 'CODE'
|
|
7
|
+
&& pre.children[0].childElementCount == 0;
|
|
8
|
+
})
|
|
9
|
+
.map((pre, index) => {
|
|
10
|
+
let name = pre.children[0].className.replace('language-', '');
|
|
11
|
+
let text = pre.children[0].textContent;
|
|
12
|
+
let newNode = document.createElement('div');
|
|
13
|
+
newNode.className = `js-code js-code--${name}`;
|
|
14
|
+
newNode.setAttribute('style', pre.getAttribute('style') || "");
|
|
15
|
+
pre.after(newNode);
|
|
16
|
+
return {
|
|
17
|
+
node: pre,
|
|
18
|
+
name,
|
|
19
|
+
text,
|
|
20
|
+
output: newNode,
|
|
21
|
+
id: `js-pre${index}`,
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
items.forEach(render);
|
|
26
|
+
|
|
27
|
+
if (items.some(x => x.success && x.name == 'mathjax')) {
|
|
28
|
+
MathJax.startup.document.clear();
|
|
29
|
+
MathJax.startup.document.updateDocument();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function render(item) {
|
|
34
|
+
if (item.name == 'chart' && typeof Chart !== 'undefined') {
|
|
35
|
+
renderChart(item);
|
|
36
|
+
} else if (item.name == 'flowchart' && typeof flowchart !== 'undefined') {
|
|
37
|
+
renderFlowchart(item);
|
|
38
|
+
} else if ((item.name == 'katex' || item.name == 'math') && typeof katex !== 'undefined') {
|
|
39
|
+
renderKatex(item);
|
|
40
|
+
} else if ((item.name == 'mathjax' || item.name == 'math') && typeof MathJax !== 'undefined') {
|
|
41
|
+
renderMathjax(item);
|
|
42
|
+
} else if (item.name == 'mermaid' && typeof mermaid !== 'undefined') {
|
|
43
|
+
renderMermaid(item);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (item.error) {
|
|
47
|
+
item.output.innerHTML = `<p style="color:red;">Error: ${item.error}</p>`;
|
|
48
|
+
} else if (item.success) {
|
|
49
|
+
item.node.style.display = 'none';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
function renderChart(item) {
|
|
55
|
+
let json;
|
|
56
|
+
try {
|
|
57
|
+
json = JSON.parse(item.text);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
item.error = 'Invalid JSON syntax.';
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let canvas = document.createElement('canvas');
|
|
64
|
+
item.output.append(canvas);
|
|
65
|
+
try {
|
|
66
|
+
new Chart(canvas, json);
|
|
67
|
+
item.success = true;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
item.error = 'Invalid Chart syntax.';
|
|
70
|
+
console.error(error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function renderFlowchart(item) {
|
|
75
|
+
try {
|
|
76
|
+
let diagram = flowchart.parse(item.text);
|
|
77
|
+
diagram.drawSVG(item.output);
|
|
78
|
+
item.success = true;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
item.error = 'Invalid flowchart syntax.';
|
|
81
|
+
console.error(error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function renderKatex(item) {
|
|
86
|
+
try {
|
|
87
|
+
katex.render(item.text, item.output, { displayMode: true });
|
|
88
|
+
item.success = true;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
item.error = 'Invalid Katex syntax.';
|
|
91
|
+
console.error(error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function renderMathjax(item) {
|
|
96
|
+
try {
|
|
97
|
+
item.output.append(MathJax.tex2chtml(item.text));
|
|
98
|
+
item.success = true;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
item.error = 'Invalid Mathjax syntax.';
|
|
101
|
+
console.error(error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function renderMermaid(item) {
|
|
106
|
+
try {
|
|
107
|
+
item.output.innerHTML = mermaid.render(item.id, item.text);
|
|
108
|
+
item.success = true;
|
|
109
|
+
} catch (error) {
|
|
110
|
+
item.error = 'Invalid mermaid syntax.';
|
|
111
|
+
console.error(error);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
window.addEventListener('load', init);
|
|
116
|
+
}
|