From 08f406c44c861a914c8b63fab454250f8a4c4b36 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Wed, 20 Sep 2023 00:25:21 -0700 Subject: refactor nav, blocks, macros, templates. fix image shortcodes --- templates/partials/head_js.html | 165 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 templates/partials/head_js.html (limited to 'templates/partials/head_js.html') diff --git a/templates/partials/head_js.html b/templates/partials/head_js.html new file mode 100644 index 0000000..9a5604a --- /dev/null +++ b/templates/partials/head_js.html @@ -0,0 +1,165 @@ +{#- JAVASCRIPT #} + {%- set integrity = config.extra.integrity | default(value=true) -%} + {%- if config.extra.offline %}{% set integrity = false %}{% endif %} + {%- set search_library=config.extra.search_library | default(value="elasticlunr") -%} + + {%- set preStyle = false %} + + {%- if config.extra.fonts %}{%- for i in config.extra.fonts %} + {%- if i.url is matching("^http[s]?://") %} + {%- set preStyle = true %} + {%- endif %} + {%- endfor %}{%- endif %} + + {%- if config.extra.fontawesome %} + {%- set preStyle = true %} + {%- endif %} + + {%- if config.extra.math or page.extra.math %} + {%- set katex_css=config.extra.katex_css | default(value="katex.min.css") -%} + {%- if katex_css %} + {%- set preStyle = true %} + {%- endif %} + {%- endif %} + + +{%- if config.extra.js_bundle %} + {%- if config.build_search_index %} + {%- if config.extra.pwa | default(value=false) %} + + {%- else %} + + {%- endif %} + + {%- else %} + {%- if config.extra.pwa | default(value=false) %} + + {%- else %} + + {%- endif %} + {%- endif %} + + {%- if config.build_search_index %} + {%- if search_library == "elasticlunr" %} + {%- if lang != "en" %} + + + {%- endif %} + {%- endif %} + {%- endif %} + +{%- else %}{#- Not js_bundle #} + + {%- if preStyle == true %} + {%- if config.extra.js_prestyle | default(value=true) %} + + {%- endif %} + {%- endif %} + + {%- if config.extra.js_switcher | default(value=true) %} + + {%- endif %} + + {%- if config.extra.js_email_encode | default(value=true) %} + + {%- endif %} + + {%- if config.extra.js_copycode | default(value=true) %} + + {%- endif %} + + {%- if config.extra.pwa | default(value=false) %} + + {%- endif %} + + {%- if search_library == "tinysearch" %} + + {%- elif search_library == "stork" %} + + {%- elif config.build_search_index %} + + {%- set search_index_format="elasticlunr_json" -%} + {%- if config.search.index_format %} + {%- if config.search.index_format == "elasticlunr_javascript" %} + {%- set search_index_format="elasticlunr_javascript" -%} + {%- endif %} + {%- endif %} + + {%- set uglyurls = config.extra.uglyurls | default(value=false) -%} + {%- if config.extra.offline %}{% set uglyurls = true %}{% endif %} + {%- if search_index_format == "elasticlunr_javascript" %}{#- Javascript index format #} + + + + {%- if uglyurls %} + + {%- else %} + + {%- endif %} + + {%- else %} + + {%- endif %} + + {%- if lang != "en" %} + + + {%- endif %} + + {%- endif %} + +{%- endif %} + + + + + +{#- Katex #} +{#- https://katex.org/docs/autorender.html #} +{#- https://github.com/KaTeX/KaTeX/ #} +{#- https://github.com/KaTeX/KaTeX/tree/main/contrib/mathtex-script-type/ #} +{%- if config.extra.math or page.extra.math %} + +{%- set katex_bundle=config.extra.katex_bundle | default(value="js/katexbundle.min.js") -%} +{%- if katex_bundle %} + +{%- else %} + + {%- set katex_js=config.extra.katex_js | default(value="js/katex.min.js") -%} + {%- if katex_js %}{%- if katex_js is matching("^http[s]?://") %} + + {%- else %} + + {%- endif %}{%- endif %} + + {%- set mathtex_js=config.extra.mathtex_js | default(value="js/mathtex-script-type.min.js") -%} + {%- if mathtex_js %}{%- if mathtex_js is matching("^http[s]?://") %} + + {%- else %} + + {%- endif %}{%- endif %} + + {%- if config.extra.math_auto_render or page.extra.math_auto_render %} + {%- set katex_autorender_js=config.extra.katex_autorender_js | default(value="js/katex-auto-render.min.js") -%} + {%- if katex_autorender_js %} + {%- if katex_autorender_js is matching("^http[s]?://") %} + + {%- else %} + + {%- endif %} + {%- endif %} + {%- set katex_options=config.extra.katex_options | default(value="js/katexoptions.js") -%} + {%- if katex_options %} + + {%- endif %} + {%- endif %} +{%- endif %} + +{%- endif %} + + + + + + +{#- End of head_js partial -#} -- cgit v1.3.1