databook-theme 0.1.1

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 (113) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.MD +1 -0
  4. data/_includes/blog/blog.liquid +50 -0
  5. data/_includes/blog/features.liquid +36 -0
  6. data/_includes/blog/full.liquid +3 -0
  7. data/_includes/blog/list.liquid +41 -0
  8. data/_includes/blog/post.liquid +6 -0
  9. data/_includes/components/analytics.google.liquid +11 -0
  10. data/_includes/components/analytics.liquid +11 -0
  11. data/_includes/components/comments.disqus.liquid +17 -0
  12. data/_includes/components/comments.gitalk.liquid +22 -0
  13. data/_includes/components/comments.liquid +13 -0
  14. data/_includes/components/navmenu.items.liquid +51 -0
  15. data/_includes/components/navmenu.liquid +4 -0
  16. data/_includes/components/pagination.liquid +83 -0
  17. data/_includes/components/prevnext.liquid +1 -0
  18. data/_includes/components/search.baidu.liquid +7 -0
  19. data/_includes/components/search.bing.liquid +6 -0
  20. data/_includes/components/search.google.liquid +6 -0
  21. data/_includes/components/search.liquid +21 -0
  22. data/_includes/components/social_button.liquid +9 -0
  23. data/_includes/components/social_link.liquid +14 -0
  24. data/_includes/components/title.liquid +41 -0
  25. data/_includes/components/toc.liquid +28 -0
  26. data/_includes/custom/analytics.liquid +3 -0
  27. data/_includes/custom/blog.liquid +3 -0
  28. data/_includes/custom/body.liquid +3 -0
  29. data/_includes/custom/comments.liquid +3 -0
  30. data/_includes/custom/footer.liquid +3 -0
  31. data/_includes/custom/head.liquid +3 -0
  32. data/_includes/custom/katex.liquid +15 -0
  33. data/_includes/custom/mathjax.liquid +19 -0
  34. data/_includes/custom/search.liquid +3 -0
  35. data/_includes/extensions/toc.liquid +182 -0
  36. data/_includes/functions/get_config.liquid +11 -0
  37. data/_includes/functions/get_config_data.liquid +23 -0
  38. data/_includes/functions/get_icon.liquid +5 -0
  39. data/_includes/functions/get_page_meta.liquid +60 -0
  40. data/_includes/functions/get_page_thumbnail.liquid +23 -0
  41. data/_includes/functions/get_page_title.liquid +7 -0
  42. data/_includes/functions/get_recent_posts.liquid +17 -0
  43. data/_includes/functions/get_taxonomy_link.liquid +9 -0
  44. data/_includes/head/head.liquid +12 -0
  45. data/_includes/head/meta.liquid +41 -0
  46. data/_includes/head/opengraph.liquid +1 -0
  47. data/_includes/head/requirements.liquid +87 -0
  48. data/_includes/head/styles.liquid +10 -0
  49. data/_includes/js/codes.js +116 -0
  50. data/_includes/js/scrollspy.js +16 -0
  51. data/_includes/layout/article.liquid +71 -0
  52. data/_includes/layout/footer.liquid +53 -0
  53. data/_includes/layout/header.liquid +31 -0
  54. data/_includes/layout/hero.liquid +29 -0
  55. data/_includes/layout/page.liquid +33 -0
  56. data/_includes/layout/pagehead.liquid +17 -0
  57. data/_includes/layout/sidebar.liquid +178 -0
  58. data/_includes/localize +29 -0
  59. data/_includes/notice +6 -0
  60. data/_includes/version +1 -0
  61. data/_layouts/article.liquid +10 -0
  62. data/_layouts/default.liquid +131 -0
  63. data/_layouts/home.liquid +20 -0
  64. data/_layouts/page.liquid +9 -0
  65. data/_layouts/post.liquid +9 -0
  66. data/_layouts/system.liquid +35 -0
  67. data/_layouts/taxonomy.liquid +67 -0
  68. data/_sass/_custom.scss +0 -0
  69. data/_sass/_databook.scss +42 -0
  70. data/_sass/_debug.scss +7 -0
  71. data/_sass/_variables.scss +24 -0
  72. data/_sass/base/_misc.scss +0 -0
  73. data/_sass/base/_mixins.scss +32 -0
  74. data/_sass/base/_normalize.scss +45 -0
  75. data/_sass/base/_responsive.scss +28 -0
  76. data/_sass/components/_archive.scss +49 -0
  77. data/_sass/components/_blog.scss +249 -0
  78. data/_sass/components/_forms.scss +30 -0
  79. data/_sass/components/_hero.scss +70 -0
  80. data/_sass/components/_misc.scss +3 -0
  81. data/_sass/components/_notice.scss +27 -0
  82. data/_sass/components/_notification.scss +10 -0
  83. data/_sass/components/_post.scss +19 -0
  84. data/_sass/components/_sidebar.scss +303 -0
  85. data/_sass/components/_tabs.scss +67 -0
  86. data/_sass/components/_text.scss +27 -0
  87. data/_sass/components/_toc.scss +50 -0
  88. data/_sass/layout/_article.scss +211 -0
  89. data/_sass/layout/_body.scss +26 -0
  90. data/_sass/layout/_footer.scss +76 -0
  91. data/_sass/layout/_header.scss +124 -0
  92. data/_sass/layout/_main.scss +8 -0
  93. data/_sass/layout/_misc.scss +7 -0
  94. data/_sass/layout/_navbar.scss +323 -0
  95. data/_sass/layout/_sidebar.scss +115 -0
  96. data/_sass/layout/_wrapper.scss +7 -0
  97. data/_sass/theme/_scheme.scss +112 -0
  98. data/_sass/typography/_article.scss +49 -0
  99. data/_sass/typography/_doc.scss +104 -0
  100. data/_sass/typography/_highlight.scss +208 -0
  101. data/_sass/typography/_markdown.scss +18 -0
  102. data/_sass/typography/_table.scss +119 -0
  103. data/_sass/typography/_typography.scss +108 -0
  104. data/_sass/utilities/_thinscrollbar.scss +35 -0
  105. data/assets/databook/css/databook.scss +6 -0
  106. data/assets/databook/img/avatar.png +0 -0
  107. data/assets/databook/img/logo.png +0 -0
  108. data/assets/databook/js/databook.js +8 -0
  109. data/assets/databook/js/search.js +47 -0
  110. data/assets/databook/version.json +9 -0
  111. data/assets/favicon.ico +0 -0
  112. data/assets/search.json +30 -0
  113. metadata +224 -0
@@ -0,0 +1,182 @@
1
+ {% capture tocWorkspace %}
2
+ {% comment %}
3
+ Copyright (c) 2017 Vladimir "allejo" Jimenez
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
25
+ {% endcomment %}
26
+ {% comment %}
27
+ Version 1.1.0
28
+ https://github.com/allejo/jekyll-toc
29
+
30
+ "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
31
+
32
+ Usage:
33
+ {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
34
+
35
+ Parameters:
36
+ * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
37
+
38
+ Optional Parameters:
39
+ * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
40
+ * class (string) : '' - a CSS class assigned to the TOC
41
+ * id (string) : '' - an ID to assigned to the TOC
42
+ * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
43
+ * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
44
+ * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
45
+ * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
46
+ * submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level
47
+ * base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
48
+ * anchor_class (string) : '' - add custom class(es) for each anchor element
49
+ * skip_no_ids (bool) : false - skip headers that do not have an `id` attribute
50
+
51
+ Output:
52
+ An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
53
+ generate the table of contents and will NOT output the markdown given to it
54
+ {% endcomment %}
55
+
56
+ {% capture newline %}
57
+ {% endcapture %}
58
+ {% assign newline = newline | rstrip %} <!-- Remove the extra spacing but preserve the newline -->
59
+
60
+ {% capture deprecation_warnings %}{% endcapture %}
61
+
62
+ {% if include.baseurl %}
63
+ {% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "baseurl" has been deprecated, use "base_url" instead -->{{ newline }}{% endcapture %}
64
+ {% endif %}
65
+
66
+ {% if include.skipNoIDs %}
67
+ {% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "skipNoIDs" has been deprecated, use "skip_no_ids" instead -->{{ newline }}{% endcapture %}
68
+ {% endif %}
69
+
70
+ {% capture jekyll_toc %}{% endcapture %}
71
+ {% assign orderedList = include.ordered | default: false %}
72
+ {% assign baseURL = include.base_url | default: include.baseurl | default: '' %}
73
+ {% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %}
74
+ {% assign minHeader = include.h_min | default: 1 %}
75
+ {% assign maxHeader = include.h_max | default: 6 %}
76
+ {% assign nodes = include.html | strip | split: '<h' %}
77
+
78
+ {% assign firstHeader = true %}
79
+ {% assign currLevel = 0 %}
80
+ {% assign lastLevel = 0 %}
81
+
82
+ {% capture listModifier %}{% if orderedList %}ol{% else %}ul{% endif %}{% endcapture %}
83
+
84
+ {% for node in nodes %}
85
+ {% if node == "" %}
86
+ {% continue %}
87
+ {% endif %}
88
+
89
+ {% assign currLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
90
+
91
+ {% if currLevel < minHeader or currLevel > maxHeader %}
92
+ {% continue %}
93
+ {% endif %}
94
+
95
+ {% assign _workspace = node | split: '</h' %}
96
+
97
+ {% assign _idWorkspace = _workspace[0] | split: 'id="' %}
98
+ {% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
99
+ {% assign htmlID = _idWorkspace[0] %}
100
+
101
+ {% assign _classWorkspace = _workspace[0] | split: 'class="' %}
102
+ {% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
103
+ {% assign htmlClass = _classWorkspace[0] %}
104
+
105
+ {% if htmlClass contains "no_toc" %}
106
+ {% continue %}
107
+ {% endif %}
108
+
109
+ {% if firstHeader %}
110
+ {% assign minHeader = currLevel %}
111
+ {% endif %}
112
+
113
+ {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
114
+ {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
115
+
116
+ {% if include.item_class and include.item_class != blank %}
117
+ {% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %}
118
+ {% endif %}
119
+
120
+ {% if include.submenu_class and include.submenu_class != blank %}
121
+ {% assign subMenuLevel = currLevel | minus: 1 %}
122
+ {% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %}
123
+ {% endif %}
124
+
125
+ {% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
126
+
127
+ {% if htmlID %}
128
+ {% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %}
129
+
130
+ {% if include.anchor_class %}
131
+ {% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %}
132
+ {% endif %}
133
+
134
+ {% capture listItem %}<a{{ anchorAttributes }}>{{ anchorBody }}</a>{% endcapture %}
135
+ {% elsif skipNoIDs == true %}
136
+ {% continue %}
137
+ {% else %}
138
+ {% capture listItem %}{{ anchorBody }}{% endcapture %}
139
+ {% endif %}
140
+
141
+ {% if currLevel > lastLevel %}
142
+ {% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %}
143
+ {% elsif currLevel < lastLevel %}
144
+ {% assign repeatCount = lastLevel | minus: currLevel %}
145
+
146
+ {% for i in (1..repeatCount) %}
147
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
148
+ {% endfor %}
149
+
150
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
151
+ {% else %}
152
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
153
+ {% endif %}
154
+
155
+ {% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}
156
+
157
+ {% assign lastLevel = currLevel %}
158
+ {% assign firstHeader = false %}
159
+ {% endfor %}
160
+
161
+ {% assign repeatCount = minHeader | minus: 1 %}
162
+ {% assign repeatCount = lastLevel | minus: repeatCount %}
163
+ {% for i in (1..repeatCount) %}
164
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
165
+ {% endfor %}
166
+
167
+ {% if jekyll_toc != '' %}
168
+ {% assign rootAttributes = '' %}
169
+ {% if include.class and include.class != blank %}
170
+ {% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %}
171
+ {% endif %}
172
+
173
+ {% if include.id and include.id != blank %}
174
+ {% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %}
175
+ {% endif %}
176
+
177
+ {% if rootAttributes %}
178
+ {% assign nodes = jekyll_toc | split: '>' %}
179
+ {% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %}
180
+ {% endif %}
181
+ {% endif %}
182
+ {% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc }}
@@ -0,0 +1,11 @@
1
+ {%- assign return = include.default -%}
2
+
3
+ {%- assign key = include.key -%}
4
+
5
+ {%- if page[key] != nil -%}
6
+ {%- assign return = page[key] -%}
7
+ {%- elsif layout[key] != nil -%}
8
+ {%- assign return = layout[key] -%}
9
+ {%- elsif site[key] != nil -%}
10
+ {%- assign return = site[key] -%}
11
+ {%- endif -%}
@@ -0,0 +1,23 @@
1
+ {%- assign return = nil -%}
2
+ {%- assign key = include.key -%}
3
+ {%- assign key_id = key | append: "_id" -%}
4
+
5
+ {%- if page[key].first -%}
6
+ {%- assign return = page[key] -%}
7
+ {%- elsif page[key] == false -%}
8
+ {%- elsif page[key_id] != nil -%}
9
+ {%- assign id = page[key_id] -%}
10
+ {%- assign return = site.data[id] -%}
11
+ {%- elsif layout[key].first -%}
12
+ {%- assign return = layout[key] -%}
13
+ {%- elsif layout[key] == false -%}
14
+ {%- elsif layout[key_id] != nil -%}
15
+ {%- assign id = layout[key_id] -%}
16
+ {%- assign return = site.data[id] -%}
17
+ {%- elsif site[key].first -%}
18
+ {%- assign return = site.sidebar -%}
19
+ {%- elsif site[key] == false -%}
20
+ {%- elsif site[key_id] != nil -%}
21
+ {%- assign id = site[key_id] -%}
22
+ {%- assign return = site.data[id] -%}
23
+ {%- endif -%}
@@ -0,0 +1,5 @@
1
+ {%- if include.icon contains "<" -%}
2
+ {{- include.icon | markdownify -}}
3
+ {%- else -%}
4
+ <i class="{{- include.icon -}}"></i>
5
+ {%- endif -%}
@@ -0,0 +1,60 @@
1
+ {%- assign pageitem = include.page | default: page -%}
2
+
3
+ {%- if pageitem.date -%}
4
+ {%- assign year1 = site.time | date: "%Y" -%}
5
+ {%- assign year2 = pageitem.date | date: "%Y" -%}
6
+ {%- if year1 == year2 or include.short_date -%}
7
+ {%- capture date_format -%}{%- include localize key="date_format_short" default="%b %d %H:%M" -%}{%- endcapture -%}
8
+ {%- else -%}
9
+ {%- capture date_format -%}{%- include localize key="date_format_long" default="%b %d, %Y %H:%M" -%}{%- endcapture -%}
10
+ {%- endif -%}
11
+ {%- endif -%}
12
+
13
+ <div class="c-meta">
14
+ {%- if pageitem.date -%}
15
+ <time class="c-meta__item c-meta__item--time" datetime="{{- pageitem.date | date_to_xmlschema -}}">
16
+ {{- pageitem.date | date: date_format -}}
17
+ </time>
18
+ {%- endif -%}
19
+
20
+ {%- if include.authors and pageitem.author -%}
21
+ <span class="c-meta__item c-meta__item--author">{{- pageitem.author -}}</span>
22
+ {%- endif -%}
23
+
24
+ {%- if include.categories and pageitem.categories and pageitem.categories.size > 0 -%}
25
+ <span class="c-meta__item c-meta__item--categories">
26
+ {%- for category in pageitem.categories -%}
27
+ <a href="{%- include functions/get_taxonomy_link.liquid category=category -%}">{{- category -}}</a>
28
+ {%- endfor -%}
29
+ </span>
30
+ {%- endif -%}
31
+
32
+ {%- if include.tags and pageitem.tags and pageitem.tags.size > 0 -%}
33
+ <span class="c-meta__item c-meta__item--tags">
34
+ {%- for tag in pageitem.tags -%}
35
+ <a href="{%- include functions/get_taxonomy_link.liquid tag=tag -%}">{{- tag -}}</a>
36
+ {%- endfor -%}
37
+ </span>
38
+ {%- endif -%}
39
+
40
+ {%- if include.details -%}
41
+ {%- if site.source_link and site.github -%}
42
+ <span class="c-meta__item c-meta__item--source">
43
+ <a href="{{- site.github.repository_url -}}/blob/{{- site.github.source.branch -}}/{{- pageitem.path -}}" target="_blank">Source</a>
44
+ </span>
45
+ {%- endif -%}
46
+
47
+ {%- if pageitem.sticky -%}
48
+ <span class="c-meta__item c-meta__item--sticky">
49
+ {%- include localize key="tag_sticky" default="Sticky" -%}
50
+ </span>
51
+ {%- endif -%}
52
+
53
+ {%- if pageitem.featured -%}
54
+ <span class="c-meta__item c-meta__item--featured">
55
+ {%- include localize key="tag_featured" default="Featured" -%}
56
+ </span>
57
+ {%- endif -%}
58
+ {%- endif -%}
59
+
60
+ </div>
@@ -0,0 +1,23 @@
1
+ {%- assign pageitem = include.page | default: page -%}
2
+ {%- assign thumbnail_src = pageitem.thumbnail -%}
3
+
4
+ {%- if thumbnail_src == nil and include.autodetect -%}
5
+ {%- assign html = include.html -%}
6
+ {%- unless html -%}
7
+ {%- assign html = pageitem.content | markdownify -%}
8
+ {%- endunless -%}
9
+
10
+ {%- assign slices = html | split:"<img " -%}
11
+ {%- if slices.size > 1 -%}
12
+ {%- assign attrs = slices[1] | split: ">" | first | replace: "'", '"' -%}
13
+ {%- assign slices = attrs | split: 'src="' -%}
14
+ {%- assign thumbnail_src = slices[1] | split: '"' | first -%}
15
+ {%- endif -%}
16
+
17
+ {%- if thumbnail_src.size == 0 and site.thumbnail_placeholder -%}
18
+ {%- assign thumbnail_src = site.thumbnail_placeholder -%}
19
+ {%- endif -%}
20
+
21
+ {%- endif -%}
22
+
23
+ {{- thumbnail_src -}}
@@ -0,0 +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 -%}
@@ -0,0 +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 -%}
@@ -0,0 +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 -%}
@@ -0,0 +1,12 @@
1
+ <head>
2
+ {% include head/meta.liquid %}
3
+ {% include head/opengraph.liquid %}
4
+ {% include head/requirements.liquid %}
5
+ {% include head/styles.liquid %}
6
+
7
+ {%- if jekyll.environment == "production" -%}
8
+ {%- include components/analytics.liquid -%}
9
+ {%- endif %}
10
+
11
+ {% include custom/head.liquid %}
12
+ </head>
@@ -0,0 +1,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
+ {%- capture page_title -%}{%- include functions/get_page_title.liquid -%}{%- endcapture -%}
8
+ {%- assign html_title = page_title -%}
9
+ {%- if page.title -%}
10
+ {%- assign html_title = html_title | append: " " | append: title_separator | append: " " -%}
11
+ {%- endif -%}
12
+ {%- assign html_title = html_title | append: site.title -%}
13
+
14
+
15
+ <meta charset="{{- site.encoding | default: 'utf-8' -}}">
16
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
17
+ <meta name="viewport" content="width=device-width, initial-scale=1">
18
+ <meta name="robots" content="{{- robots -}}">
19
+ {%- if site.keywords -%}<meta name="keywords" content="{{- site.keywords -}}">{%- endif -%}
20
+ {%- if site.baseurl -%}<base href="{{- site.baseurl -}}">{%- endif -%}
21
+ <link rel="icon" type="image/x-icon" href="{{- site.favicon | default:'/assets/favicon.ico' -}}">
22
+
23
+ <title>{{- html_title -}}</title>
24
+
25
+ <script type="text/javascript" >
26
+ window.databookConfig = {
27
+ siteTitle: "{{- site.title -}}",
28
+ siteBaseurl: "{{- site.baseurl -}}",
29
+ siteUrl: "{{- site.url -}}",
30
+ titleSeparater: "{{- site.title_separator -}}",
31
+ generatedDate: "{{- site.time | date_to_xmlschema -}}",
32
+ pageTitle: "{{- page_title -}}",
33
+ pageLayout: "{{- page.layout -}}",
34
+ {%- if page.scrollspy or layout.scrollspy or site.scrollspy -%}scrollspy: true,{%- endif -%}
35
+ {%- if page.chartjs or layout.chartjs or site.chartjs -%}chartjs: true,{%- endif -%}
36
+ {%- if page.mathjax or layout.mathjax or site.mathjax -%}mathjax: true,{%- endif -%}
37
+ {%- if page.mermaid or layout.mermaid or site.mermaid -%}mermaid: true,{%- endif -%}
38
+ {% if jekyll.environment == "development" %}debug: true,{% endif %}
39
+ };
40
+ document.querySelector('.js-disabled').classList.remove('js-disabled');
41
+ </script>
@@ -0,0 +1 @@
1
+ {%- comment -%}todo{%- endcomment -%}
@@ -0,0 +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 -%}
@@ -0,0 +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 -%}
@@ -0,0 +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
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ if (!!window.databookConfig?.scrollspy) {
3
+ window.addEventListener('load', () => {
4
+ let links = Array.from(document.querySelectorAll('.c-toc__link'));
5
+ let headers = links.map(x => decodeURI(x.href).split('#', 2)[1]).map(x => document.getElementById(x));
6
+ if (links.length <= 1) return;
7
+ window.onscroll = () => {
8
+ let scrollPosition = document.documentElement.scrollTop;
9
+ let offsets = headers.map(x => x.offsetTop);
10
+ offsets = offsets.map((x, i) => x - (x - ((i == 0) ? 0 : offsets[i - 1])) * .33);
11
+ let target = offsets.findIndex(x => x > scrollPosition);
12
+ links.forEach((link, i) => link.classList.toggle('is-active', i == target - 1));
13
+ };
14
+ });
15
+ }
16
+ }