提交 261604bb 编写于 作者: C codecalm

charts code in footer, capture_global tag

上级 6ff80452
...@@ -91,7 +91,8 @@ ...@@ -91,7 +91,8 @@
"dependencies": { "dependencies": {
"apexcharts": "3.10.0", "apexcharts": "3.10.0",
"autosize": "4.0.2", "autosize": "4.0.2",
"bootstrap": "twbs/bootstrap#8d56c19", "bootstrap": "twbs/bootstrap#9ee9b8a",
"chart.js": "^2.8.0",
"imask": "5.2.1", "imask": "5.2.1",
"jquery": "3.4.1", "jquery": "3.4.1",
"jqvmap": "1.5.1", "jqvmap": "1.5.1",
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"selectize/dist/js/standalone/selectize.min.js", "selectize/dist/js/standalone/selectize.min.js",
"apexcharts/dist/apexcharts.min.js", "apexcharts/dist/apexcharts.min.js",
"chart.js/dist/Chart.min.js",
"jqvmap/dist/jquery.vmap.min.js", "jqvmap/dist/jquery.vmap.min.js",
"jqvmap/dist/maps/jquery.vmap.world.js", "jqvmap/dist/maps/jquery.vmap.world.js",
"jqvmap/dist/maps/jquery.vmap.usa.js", "jqvmap/dist/maps/jquery.vmap.usa.js",
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
], ],
"css": [ "css": [
"jqvmap/dist/jqvmap.min.css", "jqvmap/dist/jqvmap.min.css",
"selectize/dist/css/selectize.css" "selectize/dist/css/selectize.css",
"chart.js/dist/Chart.min.css"
] ]
} }
{% capture_global scripts %}
{% removeemptylines %} {% removeemptylines %}
{% assign data = site.data.charts[include.chart-id] %} {% assign data = site.data.charts[include.chart-id] %}
...@@ -127,3 +128,4 @@ document.addEventListener("DOMContentLoaded", function(event) { ...@@ -127,3 +128,4 @@ document.addEventListener("DOMContentLoaded", function(event) {
</script> </script>
{% endif %} {% endif %}
{% endremoveemptylines %} {% endremoveemptylines %}
{% endcapture_global %}
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
{% assign link = include.link | default: false %} {% assign link = include.link | default: false %}
{% assign el = 'span' %} {% assign el = 'span' %}
{% if link %}{% assign el = 'a' %}{% endif %} {% if link %}{% assign el = 'a' %}{% endif %}
<{{ el }} class="avatar{% if include['size'] %} avatar-{{ include['size'] }}{% endif %}{% if include.thumb %} avatar-thumb{% endif %}{% if include.class %} {{ include.class }}{% endif %}{% if include.shape %} {{ include.shape }}{% endif %}{% if include.color %} bg-{{ include.color }}-lt{% endif %}"{% if src %} style="background-image: url({{ site.base }}{{ src }})"{% endif %}>{% if include.status %} <{{ el }} class="avatar{% if include['size'] %} avatar-{{ include['size'] }}{% endif %}{% if include.thumb %} avatar-thumb{% endif %}{% if include.class %} {{ include.class }}{% endif %}{% if include.shape %} {{ include.shape }}{% endif %}{% if include.color %} bg-{{ include.color }}-lt{% endif %}"{% if src %} style="background-image: url({{ site.base }}/{{ src }})"{% endif %}>{% if include.status %}
<span class="badge bg-{{ include.status }}">{% if include.status-text %}{{ include.status-text }}{% elsif include.status-icon %}{% include ui/icon.html icon=include.status-icon class="avatar-status-icon" %}{% endif %}</span> <span class="badge bg-{{ include.status }}">{% if include.status-text %}{{ include.status-text }}{% elsif include.status-icon %}{% include ui/icon.html icon=include.status-icon class="avatar-status-icon" %}{% endif %}</span>
{% endif %}{% if placeholder %}{{ placeholder }}{% elsif include.icon %} {% include ui/icon.html icon=include.icon class="avatar-icon" %}{% endif %}</{{ el }}> {% endif %}{% if placeholder %}{{ placeholder }}{% elsif include.icon %} {% include ui/icon.html icon=include.icon class="avatar-icon" %}{% endif %}</{{ el }}>
{% endremoveemptylines %} {% endremoveemptylines %}
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{{ site.capture_global.scripts }}
<script>document.body.style.display = 'block';</script> <script>document.body.style.display = 'block';</script>
</body> </body>
</html> </html>
...@@ -22,5 +22,4 @@ module Jekyll ...@@ -22,5 +22,4 @@ module Jekyll
Jekyll::Hooks.register :documents, :pre_render do |doc, jekyll| Jekyll::Hooks.register :documents, :pre_render do |doc, jekyll|
jekyll.site['base'] = get_dir(doc.relative_path) jekyll.site['base'] = get_dir(doc.relative_path)
end end
end end
module Jekyll
module Tags
class CaptureGlobal < Liquid::Block
def initialize(tag_name, text, tokens)
super
@text = text.strip
end
def render(context)
if $capture_global[@text] === nil
$capture_global[@text] = '';
end
$capture_global[@text] += super.strip + "\n\n"
''
end
end
end
Jekyll::Hooks.register :site, :after_init do |page, jekyll|
$capture_global = {}
end
Jekyll::Hooks.register :pages, :pre_render do |page, jekyll|
jekyll.site['capture_global'] = $capture_global
end
Jekyll::Hooks.register :pages, :post_render do |page, jekyll|
$capture_global = {}
end
end
Liquid::Template.register_tag('capture_global', Jekyll::Tags::CaptureGlobal)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册