Created a plugin to tackle #1181. Currently have an issue with tikzjax since it imports some wasm file from its javascript. The rest should work as expected. --------- Signed-off-by: George Araujo <george.gcac@gmail.com>
This commit is contained in:
parent
876d287cc8
commit
08d562a104
|
|
@ -7,5 +7,6 @@ _site
|
||||||
.ruby-version
|
.ruby-version
|
||||||
.tweet-cache
|
.tweet-cache
|
||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
|
assets/libs/
|
||||||
node_modules/
|
node_modules/
|
||||||
vendor
|
vendor
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
**/*.map
|
||||||
**/*.min.css
|
**/*.min.css
|
||||||
**/*.min.js
|
**/*.min.js
|
||||||
assets/css/main.scss
|
assets/css/main.scss
|
||||||
|
assets/js/distillpub/template.v2.js
|
||||||
assets/plotly/demo.html
|
assets/plotly/demo.html
|
||||||
lighthouse_results/**
|
lighthouse_results/**
|
||||||
_posts/2015-10-20-math.md
|
_posts/2015-10-20-math.md
|
||||||
|
|
|
||||||
1
Gemfile
1
Gemfile
|
|
@ -21,6 +21,7 @@ group :jekyll_plugins do
|
||||||
gem 'webrick'
|
gem 'webrick'
|
||||||
end
|
end
|
||||||
group :other_plugins do
|
group :other_plugins do
|
||||||
|
gem 'css_parser'
|
||||||
gem 'feedjira'
|
gem 'feedjira'
|
||||||
gem 'httparty'
|
gem 'httparty'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
224
_config.yml
224
_config.yml
|
|
@ -395,72 +395,164 @@ enable_progressbar: true # enables a horizontal progress bar linked to the verti
|
||||||
# Library versions
|
# Library versions
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
bootstrap-table:
|
# Add the url, version and integrity hash of the libraries you use in your site.
|
||||||
version: "1.22.1"
|
third_party_libraries:
|
||||||
chartjs:
|
download: false # if true, download the versions of the libraries specified below and use the downloaded files
|
||||||
version: "4.4.1"
|
bootstrap-table:
|
||||||
d3:
|
integrity:
|
||||||
version: "7.8.5"
|
css: "sha256-uRX+PiRTR4ysKFRCykT8HLuRCub26LgXJZym3Yeom1c="
|
||||||
integrity: "sha256-1rA678n2xEx7x4cTZ5x4wpUCj6kUMZEZ5cxLSVSFWxw="
|
js: "sha256-4rppopQE9POKfukn2kEvhJ9Um25Cf6+IDVkARD0xh78="
|
||||||
diff2html:
|
url:
|
||||||
version: "3.4.47"
|
css: "https://cdn.jsdelivr.net/npm/bootstrap-table@{{version}}/dist/bootstrap-table.min.css"
|
||||||
integrity:
|
js: "https://cdn.jsdelivr.net/npm/bootstrap-table@{{version}}/dist/bootstrap-table.min.js"
|
||||||
css: "sha256-IMBK4VNZp0ivwefSn51bswdsrhk0HoMTLc2GqFHFBXg="
|
version: "1.22.4"
|
||||||
js: "sha256-eU2TVHX633T1o/bTQp6iIJByYJEtZThhF9bKz/DcbbY="
|
chartjs:
|
||||||
echarts:
|
url:
|
||||||
version: "5.4.3"
|
js: "https://cdn.jsdelivr.net/npm/chart.js@{{version}}/dist/chart.umd.min.js"
|
||||||
integrity:
|
version: "4.4.1"
|
||||||
library: "sha256-EVZCmhajjLhgTcxlGMGUBtQiYULZCPjt0uNTFEPFTRk="
|
d3:
|
||||||
dark_theme: "sha256-UmFIP/4VvOqBDIl2QWl1HBuAJ1XWs/iFZxT5yJRZOKo="
|
integrity:
|
||||||
highlightjs:
|
js: "sha256-1rA678n2xEx7x4cTZ5x4wpUCj6kUMZEZ5cxLSVSFWxw="
|
||||||
version: "11.9.0"
|
url:
|
||||||
integrity:
|
js: "https://cdn.jsdelivr.net/npm/d3@{{version}}/dist/d3.min.js"
|
||||||
css:
|
version: "7.8.5"
|
||||||
light: "sha256-Oppd74ucMR5a5Dq96FxjEzGF7tTw2fZ/6ksAqDCM8GY="
|
diff2html:
|
||||||
dark: "sha256-nyCNAiECsdDHrr/s2OQsp5l9XeY2ZJ0rMepjCT2AkBk="
|
integrity:
|
||||||
imagesloaded:
|
css: "sha256-IMBK4VNZp0ivwefSn51bswdsrhk0HoMTLc2GqFHFBXg="
|
||||||
version: "5.0.0"
|
js: "sha256-eU2TVHX633T1o/bTQp6iIJByYJEtZThhF9bKz/DcbbY="
|
||||||
integrity: "sha256-htrLFfZJ6v5udOG+3kNLINIKh2gvoKqwEhHYfTTMICc="
|
url:
|
||||||
img-comparison-slider:
|
css: "https://cdn.jsdelivr.net/npm/diff2html@{{version}}/bundles/css/diff2html.min.css"
|
||||||
version: "8.0.6"
|
js: "https://cdn.jsdelivr.net/npm/diff2html@{{version}}/bundles/js/diff2html-ui.min.js"
|
||||||
jquery:
|
version: "3.4.47"
|
||||||
version: "3.6.0"
|
echarts:
|
||||||
integrity: "sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
|
integrity:
|
||||||
leaflet:
|
js:
|
||||||
version: "1.9.4"
|
library: "sha256-QvgynZibb2U53SsVu98NggJXYqwRL7tg3FeyfXvPOUY="
|
||||||
integrity:
|
dark_theme: "sha256-sm6Ui9w41++ZCWmIWDLC18a6ki72FQpWDiYTDxEPXwU="
|
||||||
css: "sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
url:
|
||||||
js: "sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
js:
|
||||||
mathjax:
|
library: "https://cdn.jsdelivr.net/npm/echarts@{{version}}/dist/echarts.min.js"
|
||||||
version: "3.2.0"
|
dark_theme: "https://cdn.jsdelivr.net/npm/echarts@{{version}}/theme/dark-fresh-cut.js"
|
||||||
masonry:
|
version: "5.5.0"
|
||||||
version: "4.2.2"
|
google_fonts:
|
||||||
integrity: "sha256-Nn1q/fx0H7SNLZMQ5Hw5JLaTRZp0yILA/FRexe19VdI="
|
url:
|
||||||
mdb:
|
fonts: "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:100,300,400,500,700|Material+Icons&display=swap"
|
||||||
version: "4.20.0"
|
highlightjs:
|
||||||
integrity:
|
integrity:
|
||||||
css: "sha256-jpjYvU3G3N6nrrBwXJoVEYI/0zw8htfFnhT9ljN3JJw="
|
css:
|
||||||
js: "sha256-NdbiivsvWt7VYCt6hYNT3h/th9vSTL4EDWeGs5SN3DA="
|
light: "sha256-Oppd74ucMR5a5Dq96FxjEzGF7tTw2fZ/6ksAqDCM8GY="
|
||||||
medium_zoom:
|
dark: "sha256-nyCNAiECsdDHrr/s2OQsp5l9XeY2ZJ0rMepjCT2AkBk="
|
||||||
version: "1.1.0"
|
url:
|
||||||
integrity: "sha256-ZgMyDAIYDYGxbcpJcfUnYwNevG/xi9OHKaR/8GK+jWc="
|
css:
|
||||||
mermaid:
|
light: "https://cdn.jsdelivr.net/npm/highlight.js@{{version}}/styles/github.min.css"
|
||||||
version: "10.7.0"
|
dark: "https://cdn.jsdelivr.net/npm/highlight.js@{{version}}/styles/github-dark.min.css"
|
||||||
integrity: "sha256-TtLOdUA8mstPoO6sGvHIGx2ceXrrX4KgIItO06XOn8A="
|
version: "11.9.0"
|
||||||
swiper:
|
imagesloaded:
|
||||||
version: "11.0.5"
|
integrity:
|
||||||
integrity:
|
js: "sha256-htrLFfZJ6v5udOG+3kNLINIKh2gvoKqwEhHYfTTMICc="
|
||||||
css: "sha256-yUoNxsvX+Vo8Trj3lZ/Y5ZBf8HlBFsB6Xwm7rH75/9E="
|
url:
|
||||||
js: "sha256-BPrwikijIybg9OQC5SYFFqhBjERYOn97tCureFgYH1E="
|
js: https://cdn.jsdelivr.net/npm/imagesloaded@{{version}}/imagesloaded.pkgd.min.js
|
||||||
vega:
|
version: "5.0.0"
|
||||||
version: "5.27.0"
|
img-comparison-slider:
|
||||||
integrity: "sha256-Yot/cfgMMMpFwkp/5azR20Tfkt24PFqQ6IQS+80HIZs="
|
url:
|
||||||
vega-embed:
|
css: "https://cdn.jsdelivr.net/npm/img-comparison-slider@{{version}}/dist/styles.min.css"
|
||||||
version: "6.24.0"
|
js: "https://cdn.jsdelivr.net/npm/img-comparison-slider@{{version}}/dist/index.min.js"
|
||||||
integrity: "sha256-FPCJ9JYCC9AZSpvC/t/wHBX7ybueZhIqOMjpWqfl3DU="
|
version: "8.0.6"
|
||||||
vega-lite:
|
jquery:
|
||||||
version: "5.16.3"
|
integrity:
|
||||||
integrity: "sha256-TvBvIS5jUN4BSy009usRjNzjI1qRrHPYv7xVLJyjUyw="
|
js: "sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/jquery@{{version}}/dist/jquery.min.js"
|
||||||
|
version: "3.6.0"
|
||||||
|
leaflet:
|
||||||
|
integrity:
|
||||||
|
css: "sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
||||||
|
js: "sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
||||||
|
js_map: "sha256-YAoQ3FzREN4GmVENMir8vgHHypC0xfSK3CAxTHCqx1M="
|
||||||
|
url:
|
||||||
|
css: "https://cdn.jsdelivr.net/npm/leaflet@{{version}}/dist/leaflet.css"
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/leaflet@{{version}}/dist/leaflet.js"
|
||||||
|
js_map: "https://cdn.jsdelivr.net/npm/leaflet@{{version}}/dist/leaflet.js.map"
|
||||||
|
version: "1.9.4"
|
||||||
|
mathjax:
|
||||||
|
local:
|
||||||
|
fonts: "output/chtml/fonts/woff-v2/"
|
||||||
|
url:
|
||||||
|
fonts: "https://cdn.jsdelivr.net/npm/mathjax@{{version}}/es5/output/chtml/fonts/woff-v2/"
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/mathjax@{{version}}/es5/tex-mml-chtml.js"
|
||||||
|
version: "3.2.0"
|
||||||
|
masonry:
|
||||||
|
integrity:
|
||||||
|
js: "sha256-Nn1q/fx0H7SNLZMQ5Hw5JLaTRZp0yILA/FRexe19VdI="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/masonry-layout@{{version}}/dist/masonry.pkgd.min.js"
|
||||||
|
version: "4.2.2"
|
||||||
|
mdb:
|
||||||
|
integrity:
|
||||||
|
css: "sha256-jpjYvU3G3N6nrrBwXJoVEYI/0zw8htfFnhT9ljN3JJw="
|
||||||
|
css_map: "sha256-iYYMNfsJdVZjvsebJulg09miBXM4/GMTJgv1u5EZFFM="
|
||||||
|
js: "sha256-NdbiivsvWt7VYCt6hYNT3h/th9vSTL4EDWeGs5SN3DA="
|
||||||
|
js_map: "sha256-UPgyn4YNsT0khkBK5553QwhnlbTlU0aa+igyc6qP1bE="
|
||||||
|
url:
|
||||||
|
css: "https://cdn.jsdelivr.net/npm/mdbootstrap@{{version}}/css/mdb.min.css"
|
||||||
|
css_map: "https://cdn.jsdelivr.net/npm/mdbootstrap@{{version}}/css/mdb.min.css.map"
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/mdbootstrap@{{version}}/js/mdb.min.js"
|
||||||
|
js_map: "https://cdn.jsdelivr.net/npm/mdbootstrap@{{version}}/js/mdb.min.js.map"
|
||||||
|
version: "4.20.0"
|
||||||
|
medium_zoom:
|
||||||
|
integrity:
|
||||||
|
js: "sha256-ZgMyDAIYDYGxbcpJcfUnYwNevG/xi9OHKaR/8GK+jWc="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/medium-zoom@{{version}}/dist/medium-zoom.min.js"
|
||||||
|
version: "1.1.0"
|
||||||
|
mermaid:
|
||||||
|
integrity:
|
||||||
|
js: "sha256-TtLOdUA8mstPoO6sGvHIGx2ceXrrX4KgIItO06XOn8A="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/mermaid@{{version}}/dist/mermaid.min.js"
|
||||||
|
version: "10.7.0"
|
||||||
|
polyfill:
|
||||||
|
url:
|
||||||
|
js: "https://cdnjs.cloudflare.com/polyfill/v{{version}}/polyfill.min.js?features=es6"
|
||||||
|
version: "3"
|
||||||
|
swiper:
|
||||||
|
integrity:
|
||||||
|
css: "sha256-yUoNxsvX+Vo8Trj3lZ/Y5ZBf8HlBFsB6Xwm7rH75/9E="
|
||||||
|
js: "sha256-BPrwikijIybg9OQC5SYFFqhBjERYOn97tCureFgYH1E="
|
||||||
|
url:
|
||||||
|
css: "https://cdn.jsdelivr.net/npm/swiper@{{version}}/swiper-bundle.min.css"
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/swiper@{{version}}/swiper-element-bundle.min.js"
|
||||||
|
version: "11.0.5"
|
||||||
|
swiper-map:
|
||||||
|
integrity:
|
||||||
|
js: "sha256-hlZaH8ySXX97bZaetnrtYlKuhx3oEXFz/s2IXchu6vk="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/swiper@11.1.0/swiper-element-bundle.min.js.map"
|
||||||
|
version: "11.0.5"
|
||||||
|
vega:
|
||||||
|
integrity:
|
||||||
|
js: "sha256-Yot/cfgMMMpFwkp/5azR20Tfkt24PFqQ6IQS+80HIZs="
|
||||||
|
js_map: "sha256-z0x9ICA65dPkZ0JVa9wTImfF6n7AJsKc6WlFE96/wNA="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/vega@{{version}}/build/vega.min.js"
|
||||||
|
js_map: "https://cdn.jsdelivr.net/npm/vega@{{version}}/build/vega.min.js.map"
|
||||||
|
version: "5.27.0"
|
||||||
|
vega-embed:
|
||||||
|
integrity:
|
||||||
|
js: "sha256-FPCJ9JYCC9AZSpvC/t/wHBX7ybueZhIqOMjpWqfl3DU="
|
||||||
|
js_map: "sha256-VBbfSEFYSMdX/rTdGrONEHNP6BprCB7H/LpMMNt/cPA="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/vega-embed@{{version}}/build/vega-embed.min.js"
|
||||||
|
js_map: "https://cdn.jsdelivr.net/npm/vega-embed@{{version}}/build/vega-embed.min.js.map"
|
||||||
|
version: "6.24.0"
|
||||||
|
vega-lite:
|
||||||
|
integrity:
|
||||||
|
js: "sha256-TvBvIS5jUN4BSy009usRjNzjI1qRrHPYv7xVLJyjUyw="
|
||||||
|
js_map: "sha256-l2I4D5JC23Ulsu6e3sKVe5AJ+r+DFkzkKnZS8nUGz28="
|
||||||
|
url:
|
||||||
|
js: "https://cdn.jsdelivr.net/npm/vega-lite@{{version}}/build/vega-lite.min.js"
|
||||||
|
js_map: "https://cdn.jsdelivr.net/npm/vega-lite@{{version}}/build/vega-lite.min.js.map"
|
||||||
|
version: "5.16.3"
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Get external JSON data
|
# Get external JSON data
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,22 @@
|
||||||
|
|
||||||
<!-- Bootstrap & MDB -->
|
<!-- Bootstrap & MDB -->
|
||||||
<link rel="stylesheet" href="{{ '/assets/css/bootstrap.min.css' | relative_url | bust_file_cache }}">
|
<link rel="stylesheet" href="{{ '/assets/css/bootstrap.min.css' | relative_url | bust_file_cache }}">
|
||||||
<!-- <link rel="stylesheet" href="{{ '/assets/css/mdb.min.css' | relative_url | bust_file_cache }}"> -->
|
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/mdbootstrap@{{ site.mdb.version }}/css/mdb.min.css"
|
href="{{ site.third_party_libraries.mdb.url.css }}"
|
||||||
integrity="{{ site.mdb.integrity.css }}"
|
integrity="{{ site.third_party_libraries.mdb.integrity.css }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- Bootstrap Table -->
|
<!-- Bootstrap Table -->
|
||||||
{% if page.pretty_table %}
|
{% if page.pretty_table %}
|
||||||
<link defer rel="stylesheet" href="https://unpkg.com/bootstrap-table@{{ site.bootstrap-table.version }}/dist/bootstrap-table.min.css">
|
<link
|
||||||
|
defer
|
||||||
|
rel="stylesheet"
|
||||||
|
href="{{ site.third_party_libraries.bootstrap-table.url.css }}"
|
||||||
|
integrity="{{ site.third_party_libraries.bootstrap-table.integrity.css }}"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Fonts & Icons -->
|
<!-- Fonts & Icons -->
|
||||||
|
|
@ -22,7 +27,7 @@
|
||||||
defer
|
defer
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
type="text/css"
|
type="text/css"
|
||||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:100,300,400,500,700|Material+Icons&display=swap"
|
href="{{ site.third_party_libraries.google_fonts.url.fonts }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- Code Syntax Highlighting -->
|
<!-- Code Syntax Highlighting -->
|
||||||
|
|
@ -71,9 +76,9 @@
|
||||||
<link
|
<link
|
||||||
defer
|
defer
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://unpkg.com/leaflet@{{ site.leaflet.version }}/dist/leaflet.css"
|
href="{{ site.third_party_libraries.leaflet.url.css }}"
|
||||||
integrity="{{ site.leaflet.integrity.css }}"
|
integrity="{{ site.third_party_libraries.leaflet.integrity.css }}"
|
||||||
crossorigin=""
|
crossorigin="anonymous"
|
||||||
>
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
@ -82,24 +87,24 @@
|
||||||
<link
|
<link
|
||||||
defer
|
defer
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/highlight.js@{{ site.highlightjs.version }}/styles/github.min.css"
|
href="{{ site.third_party_libraries.highlightjs.url.css.light }}"
|
||||||
integrity="{{ site.highlightjs.integrity.css.light }}"
|
integrity="{{ site.third_party_libraries.highlightjs.integrity.css.light }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
media="screen and (prefers-color-scheme: light)"
|
media="screen and (prefers-color-scheme: light)"
|
||||||
>
|
>
|
||||||
<link
|
<link
|
||||||
defer
|
defer
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/highlight.js@{{ site.highlightjs.version }}/styles/github-dark.min.css"
|
href="{{ site.third_party_libraries.highlightjs.url.css.dark }}"
|
||||||
integrity="{{ site.highlightjs.integrity.css.dark }}"
|
integrity="{{ site.third_party_libraries.highlightjs.integrity.css.dark }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
media="screen and (prefers-color-scheme: dark)"
|
media="screen and (prefers-color-scheme: dark)"
|
||||||
>
|
>
|
||||||
<link
|
<link
|
||||||
defer
|
defer
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/diff2html@{{ site.diff2html.version }}/bundles/css/diff2html.min.css"
|
href="{{ site.third_party_libraries.diff2html.url.css }}"
|
||||||
integrity="{{ site.diff2html.integrity.css }}"
|
integrity="{{ site.third_party_libraries.diff2html.integrity.css }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
>
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -110,7 +115,7 @@
|
||||||
<link
|
<link
|
||||||
defer
|
defer
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/img-comparison-slider@{{ site.img-comparison-slider.version }}/dist/styles.min.css"
|
href="{{ site.third_party_libraries.img-comparison-slider.url.css }}"
|
||||||
>
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<!-- Image slider -->
|
<!-- Image slider -->
|
||||||
|
|
@ -118,8 +123,8 @@
|
||||||
<link
|
<link
|
||||||
defer
|
defer
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://cdn.jsdelivr.net/npm/swiper@{{ site.swiper.version }}/swiper-bundle.min.css"
|
href="{{ site.third_party_libraries.swiper.url.css }}"
|
||||||
integrity="{{ site.swiper.integrity.css }}"
|
integrity="{{ site.third_party_libraries.swiper.integrity.css }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
>
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<script src="{{ '/assets/js/bootstrap.bundle.min.js' | relative_url }}"></script>
|
<script src="{{ '/assets/js/bootstrap.bundle.min.js' | relative_url }}"></script>
|
||||||
<!-- <script src="{{ '/assets/js/mdb.min.js' | relative_url }}"></script> -->
|
<!-- <script src="{{ '/assets/js/mdb.min.js' | relative_url }}"></script> -->
|
||||||
<script
|
<script
|
||||||
src="https://cdn.jsdelivr.net/npm/mdbootstrap@{{ site.mdb.version }}/js/mdb.min.js"
|
src="{{ site.third_party_libraries.mdb.url.js }}"
|
||||||
integrity="{{ site.mdb.integrity.js }}"
|
integrity="{{ site.third_party_libraries.mdb.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{% if page.chart and page.chart.chartjs %}
|
{% if page.chart and page.chart.chartjs %}
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/chart.js@{{ site.chartjs.version }}/dist/chart.umd.min.js"></script>
|
<script defer src="{{ site.third_party_libraries.chartjs.url.js }}"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var $canvas = null,
|
var $canvas = null,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
{% if page.code_diff %}
|
{% if page.code_diff %}
|
||||||
<!-- diff2html doesn't go well with Bootstrap Table -->
|
<!-- diff2html doesn't go well with Bootstrap Table -->
|
||||||
<script
|
<script
|
||||||
defer
|
src="{{ site.third_party_libraries.diff2html.url.js }}"
|
||||||
src="https://cdn.jsdelivr.net/npm/diff2html@{{ site.diff2html.version }}/bundles/js/diff2html-ui.min.js"
|
integrity="{{ site.third_party_libraries.diff2html.integrity.js }}"
|
||||||
integrity="{{ site.diff2html.integrity.js }}"
|
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
{% if page.chart and page.chart.echarts %}
|
{% if page.chart and page.chart.echarts %}
|
||||||
<script
|
<script
|
||||||
defer
|
src="{{ site.third_party_libraries.echarts.url.js.library }}"
|
||||||
src="https://cdn.jsdelivr.net/npm/echarts@{{ site.echarts.version }}/dist/echarts.min.js"
|
integrity="{{ site.third_party_libraries.echarts.integrity.js.library }}"
|
||||||
integrity="{{ site.echarts.integrity.library }}"
|
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
{% if site.enable_darkmode %}
|
{% if site.enable_darkmode %}
|
||||||
<script
|
<script
|
||||||
defer
|
src="{{ site.third_party_libraries.echarts.url.js.dark_theme }}"
|
||||||
src="https://cdn.jsdelivr.net/npm/echarts@{{ site.echarts.version }}/theme/dark-fresh-cut.js"
|
integrity="{{ site.third_party_libraries.echarts.integrity.js.dark_theme }}"
|
||||||
integrity="{{ site.echarts.integrity.dark_theme }}"
|
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{% if page.images %}
|
{% if page.images %}
|
||||||
{% if page.images.compare %}
|
{% if page.images.compare %}
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/img-comparison-slider@{{ site.img-comparison-slider.version }}/dist/index.min.js"></script>
|
<script defer src="{{ site.third_party_libraries.img-comparison-slider.url.js }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.images.slider %}
|
{% if page.images.slider %}
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/swiper@{{ site.swiper.version }}/swiper-element-bundle.min.js"
|
src="{{ site.third_party_libraries.swiper.url.js }}"
|
||||||
integrity="{{ site.swiper.integrity.js }}"
|
integrity="{{ site.third_party_libraries.swiper.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<!-- jQuery -->
|
<!-- jQuery -->
|
||||||
<script
|
<script
|
||||||
src="https://cdn.jsdelivr.net/npm/jquery@{{ site.jquery.version }}/dist/jquery.min.js"
|
src="{{ site.third_party_libraries.jquery.url.js }}"
|
||||||
integrity="{{ site.jquery.integrity }}"
|
integrity="{{ site.third_party_libraries.jquery.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
{% if page.map %}
|
{% if page.map %}
|
||||||
<script
|
<script
|
||||||
defer
|
src="{{ site.third_party_libraries.leaflet.url.js }}"
|
||||||
src="https://unpkg.com/leaflet@{{ site.leaflet.version }}/dist/leaflet.js"
|
integrity="{{ site.third_party_libraries.leaflet.integrity.js }}"
|
||||||
integrity="{{ site.leaflet.integrity.js }}"
|
|
||||||
crossorigin=""
|
crossorigin=""
|
||||||
></script>
|
></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
<!-- Masonry & imagesLoaded -->
|
<!-- Masonry & imagesLoaded -->
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/masonry-layout@{{ site.masonry.version }}/dist/masonry.pkgd.min.js"
|
src="{{ site.third_party_libraries.masonry.url.js }}"
|
||||||
integrity="{{ site.masonry.integrity }}"
|
integrity="{{ site.third_party_libraries.masonry.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/imagesloaded@{{ site.imagesloaded.version }}/imagesloaded.pkgd.min.js"
|
src="{{ site.third_party_libraries.imagesloaded.url.js }}"
|
||||||
integrity="{{ site.imagesloaded.integrity }}"
|
integrity="{{ site.third_party_libraries.imagesloaded.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script defer src="{{ '/assets/js/masonry.js' | relative_url }}" type="text/javascript"></script>
|
<script defer src="{{ '/assets/js/masonry.js' | relative_url }}" type="text/javascript"></script>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
defer
|
defer
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
id="MathJax-script"
|
id="MathJax-script"
|
||||||
src="https://cdn.jsdelivr.net/npm/mathjax@{{ site.mathjax.version }}/es5/tex-mml-chtml.js"
|
src="{{ site.third_party_libraries.mathjax.url.js }}"
|
||||||
></script>
|
></script>
|
||||||
<script defer src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
|
<script defer src="{{ site.third_party_libraries.polyfill.url.js }}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
{% if page.mermaid and page.mermaid.enabled %}
|
{% if page.mermaid and page.mermaid.enabled %}
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/mermaid@{{ site.mermaid.version }}/dist/mermaid.min.js"
|
src="{{ site.third_party_libraries.mermaid.url.js }}"
|
||||||
integrity="{{ site.mermaid.integrity }}"
|
integrity="{{ site.third_party_libraries.mermaid.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
{% if page.mermaid.zoomable %}
|
{% if page.mermaid.zoomable %}
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/d3@{{ site.d3.version }}/dist/d3.min.js"
|
src="{{ site.third_party_libraries.d3.url.js }}"
|
||||||
integrity="{{ site.d3.integrity }}"
|
integrity="{{ site.third_party_libraries.d3.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
<!-- Medium Zoom JS -->
|
<!-- Medium Zoom JS -->
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/medium-zoom@{{ site.medium_zoom.version }}/dist/medium-zoom.min.js"
|
src="{{ site.third_party_libraries.medium_zoom.url.js }}"
|
||||||
integrity="{{ site.medium_zoom.integrity }}"
|
integrity="{{ site.third_party_libraries.medium_zoom.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
||||||
|
|
@ -24,7 +24,12 @@
|
||||||
<!-- Bootstrap Table -->
|
<!-- Bootstrap Table -->
|
||||||
{% if page.pretty_table %}
|
{% if page.pretty_table %}
|
||||||
<!-- Bootstrap Table doesn't go well with diff2html -->
|
<!-- Bootstrap Table doesn't go well with diff2html -->
|
||||||
<script defer src="https://unpkg.com/bootstrap-table@{{ site.bootstrap-table.version }}/dist/bootstrap-table.min.js"></script>
|
<script
|
||||||
|
defer
|
||||||
|
src="{{ site.third_party_libraries.bootstrap-table.url.js }}"
|
||||||
|
integrity="{{ site.third_party_libraries.bootstrap-table.integrity.js }}"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Load Common JS -->
|
<!-- Load Common JS -->
|
||||||
|
|
@ -34,3 +39,5 @@
|
||||||
|
|
||||||
<!-- Jupyter Open External Links New Tab -->
|
<!-- Jupyter Open External Links New Tab -->
|
||||||
<script defer src="{{ '/assets/js/jupyter_new_tab.js' | relative_url | bust_file_cache }}"></script>
|
<script defer src="{{ '/assets/js/jupyter_new_tab.js' | relative_url | bust_file_cache }}"></script>
|
||||||
|
|
||||||
|
{% assign site.test-library.url = site.test-library.url | append: 'teste' %}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
{% if page.chart and page.chart.vega_lite %}
|
{% if page.chart and page.chart.vega_lite %}
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/vega@{{ site.vega.version }}/build/vega.min.js"
|
src="{{ site.third_party_libraries.vega.url.js }}"
|
||||||
integrity="{{ site.vega.integrity }}"
|
integrity="{{ site.third_party_libraries.vega.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/vega-lite@{{ site.vega-lite.version }}/build/vega-lite.min.js"
|
src="{{ site.third_party_libraries.vega-lite.url.js }}"
|
||||||
integrity="{{ site.vega-lite.integrity }}"
|
integrity="{{ site.third_party_libraries.vega-lite.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/vega-embed@{{ site.vega-embed.version }}/build/vega-embed.min.js"
|
src="{{ site.third_party_libraries.vega-embed.url.js }}"
|
||||||
integrity="{{ site.vega-embed.integrity }}"
|
integrity="{{ site.third_party_libraries.vega-embed.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<!-- Medium Zoom JS -->
|
<!-- Medium Zoom JS -->
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/npm/medium-zoom@{{ site.medium_zoom.version }}/dist/medium-zoom.min.js"
|
src="{{ site.third_party_libraries.medium_zoom.url.js }}"
|
||||||
integrity="{{ site.medium_zoom.integrity }}"
|
integrity="{{ site.third_party_libraries.medium_zoom.integrity.js }}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
></script>
|
></script>
|
||||||
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,51 @@
|
||||||
# based on https://distresssignal.org/busting-css-cache-with-jekyll-md5-hash
|
# based on https://distresssignal.org/busting-css-cache-with-jekyll-md5-hash
|
||||||
# https://gist.github.com/BryanSchuetz/2ee8c115096d7dd98f294362f6a667db
|
# https://gist.github.com/BryanSchuetz/2ee8c115096d7dd98f294362f6a667db
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module CacheBust
|
module CacheBust
|
||||||
class CacheDigester
|
class CacheDigester
|
||||||
require 'digest/md5'
|
require 'digest/md5'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
|
||||||
attr_accessor :file_name, :directory
|
attr_accessor :file_name, :directory
|
||||||
|
|
||||||
def initialize(file_name:, directory: nil)
|
def initialize(file_name:, directory: nil)
|
||||||
self.file_name = file_name
|
self.file_name = file_name
|
||||||
self.directory = directory
|
self.directory = directory
|
||||||
end
|
end
|
||||||
|
|
||||||
def digest!
|
def digest!
|
||||||
[file_name, '?', Digest::MD5.hexdigest(file_contents)].join
|
[file_name, '?', Digest::MD5.hexdigest(file_contents)].join
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def directory_files_content
|
def directory_files_content
|
||||||
target_path = File.join(directory, '**', '*')
|
target_path = File.join(directory, '**', '*')
|
||||||
Dir[target_path].map{|f| File.read(f) unless File.directory?(f) }.join
|
Dir[target_path].map{|f| File.read(f) unless File.directory?(f) }.join
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_content
|
def file_content
|
||||||
local_file_name = file_name.slice((file_name.index('assets/')..-1))
|
local_file_name = file_name.slice((file_name.index('assets/')..-1))
|
||||||
File.read(local_file_name)
|
File.read(local_file_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_contents
|
def file_contents
|
||||||
is_directory? ? file_content : directory_files_content
|
is_directory? ? file_content : directory_files_content
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_directory?
|
def is_directory?
|
||||||
directory.nil?
|
directory.nil?
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def bust_file_cache(file_name)
|
|
||||||
CacheDigester.new(file_name: file_name, directory: nil).digest!
|
|
||||||
end
|
|
||||||
|
|
||||||
def bust_css_cache(file_name)
|
|
||||||
CacheDigester.new(file_name: file_name, directory: 'assets/_sass').digest!
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bust_file_cache(file_name)
|
||||||
|
CacheDigester.new(file_name: file_name, directory: nil).digest!
|
||||||
|
end
|
||||||
|
|
||||||
|
def bust_css_cache(file_name)
|
||||||
|
CacheDigester.new(file_name: file_name, directory: 'assets/_sass').digest!
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_filter(Jekyll::CacheBust)
|
Liquid::Template.register_filter(Jekyll::CacheBust)
|
||||||
|
|
@ -1,24 +1,23 @@
|
||||||
# Code from http://movb.de/jekyll-details-support.html
|
# Code from http://movb.de/jekyll-details-support.html
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Tags
|
module Tags
|
||||||
class DetailsTag < Liquid::Block
|
class DetailsTag < Liquid::Block
|
||||||
|
def initialize(tag_name, markup, tokens)
|
||||||
def initialize(tag_name, markup, tokens)
|
super
|
||||||
super
|
@caption = markup
|
||||||
@caption = markup
|
|
||||||
end
|
|
||||||
|
|
||||||
def render(context)
|
|
||||||
site = context.registers[:site]
|
|
||||||
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
|
|
||||||
caption = converter.convert(@caption).gsub(/<\/?p[^>]*>/, '').chomp
|
|
||||||
body = converter.convert(super(context))
|
|
||||||
"<details><summary>#{caption}</summary>#{body}</details>"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render(context)
|
||||||
|
site = context.registers[:site]
|
||||||
|
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
|
||||||
|
caption = converter.convert(@caption).gsub(/<\/?p[^>]*>/, '').chomp
|
||||||
|
body = converter.convert(super(context))
|
||||||
|
"<details><summary>#{caption}</summary>#{body}</details>"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
Liquid::Template.register_tag('details', Jekyll::Tags::DetailsTag)
|
|
||||||
|
Liquid::Template.register_tag('details', Jekyll::Tags::DetailsTag)
|
||||||
|
|
@ -0,0 +1,199 @@
|
||||||
|
Jekyll::Hooks.register :site, :after_init do |site|
|
||||||
|
require 'css_parser'
|
||||||
|
require 'digest'
|
||||||
|
require 'fileutils'
|
||||||
|
require 'nokogiri'
|
||||||
|
require 'open-uri'
|
||||||
|
require 'uri'
|
||||||
|
|
||||||
|
def download_file(url, dest)
|
||||||
|
# create the directory if it doesn't exist
|
||||||
|
dir = File.dirname(dest)
|
||||||
|
unless File.directory?(dir)
|
||||||
|
FileUtils.mkdir_p(dir)
|
||||||
|
end
|
||||||
|
|
||||||
|
# download the file if it doesn't exist
|
||||||
|
unless File.file?(dest)
|
||||||
|
puts "Downloading #{url} to #{dest}"
|
||||||
|
File.open(dest, "wb") do |saved_file|
|
||||||
|
URI.open(url, "rb") do |read_file|
|
||||||
|
saved_file.write(read_file.read)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# check if the file was downloaded successfully
|
||||||
|
unless File.file?(dest)
|
||||||
|
raise "Failed to download #{url} to #{dest}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def download_fonts(url, dest)
|
||||||
|
# only download fonts if the directory doesn't exist or is empty
|
||||||
|
unless File.directory?(dest) && !Dir.empty?(dest)
|
||||||
|
puts "Downloading fonts from #{url} to #{dest}"
|
||||||
|
# get available fonts from the url
|
||||||
|
doc = Nokogiri::HTML(URI.open(url, "User-Agent" => "Ruby/#{RUBY_VERSION}"))
|
||||||
|
doc.css('a').each do |link|
|
||||||
|
# get the file name from the url
|
||||||
|
file_name = link['href'].split('/').last.split('?').first
|
||||||
|
|
||||||
|
# verify if the file is a font file
|
||||||
|
if file_name.end_with?('.woff', '.woff2', '.ttf', '.otf')
|
||||||
|
# download the file and change the url to the local file
|
||||||
|
download_file(URI.join(url, link['href']).to_s, File.join(dest, file_name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def download_fonts_from_css(config, url, dest)
|
||||||
|
# get the file name from the url
|
||||||
|
file_name = url.split('/').last.split('?').first
|
||||||
|
|
||||||
|
if file_name == 'css'
|
||||||
|
file_name = 'google-fonts.css'
|
||||||
|
end
|
||||||
|
|
||||||
|
# only download the css file if it doesn't exist
|
||||||
|
unless File.file?(File.join(dest, file_name))
|
||||||
|
puts "Downloading fonts from #{url} to #{dest}"
|
||||||
|
# download the css file with a fake user agent to force downloading woff2 fonts instead of ttf
|
||||||
|
# user agent from https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome
|
||||||
|
doc = Nokogiri::HTML(URI.open(url, "User-Agent" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"))
|
||||||
|
css = CssParser::Parser.new
|
||||||
|
css.load_string! doc.document.text
|
||||||
|
|
||||||
|
# get the font-face rules
|
||||||
|
css.each_rule_set do |rule_set|
|
||||||
|
# check if the rule set has a url
|
||||||
|
if rule_set['src'].include?('url(')
|
||||||
|
# get the font file url
|
||||||
|
font_url = rule_set['src'].split('url(').last.split(')').first
|
||||||
|
|
||||||
|
# remove quotes from the url
|
||||||
|
if font_url.start_with?('"') || font_url.start_with?("'")
|
||||||
|
font_url = font_url[1..-2]
|
||||||
|
end
|
||||||
|
|
||||||
|
font_file_name = font_url.split('/').last.split('?').first
|
||||||
|
|
||||||
|
# verify if the file is a font file
|
||||||
|
if font_file_name.end_with?('.woff', '.woff2', '.ttf', '.otf')
|
||||||
|
# fix the font url if it is not an absolute url
|
||||||
|
unless font_url.start_with?('https://')
|
||||||
|
font_url = URI.join(url, font_url).to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
# download the file
|
||||||
|
download_file(font_url, File.join(dest, 'fonts', font_file_name))
|
||||||
|
|
||||||
|
# change the font url to the local file, considering baseurl
|
||||||
|
if config['baseurl']
|
||||||
|
# add rest of the src attribute if it exists
|
||||||
|
if rule_set['src'].split(' ').length > 1
|
||||||
|
rule_set['src'] = "url(#{File.join(config['baseurl'], 'assets', 'libs', 'fonts', font_file_name)}) #{rule_set['src'].split(' ').last}"
|
||||||
|
else
|
||||||
|
rule_set['src'] = "url(#{File.join(config['baseurl'], 'assets', 'libs', 'fonts', font_file_name)})"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# add rest of the src attribute if it exists
|
||||||
|
if rule_set['src'].split(' ').length > 1
|
||||||
|
rule_set['src'] = "url(#{File.join('/assets', 'libs', 'fonts', font_file_name)}) #{rule_set['src'].split(' ').last}"
|
||||||
|
else
|
||||||
|
rule_set['src'] = "url(#{File.join('/assets', 'libs', 'fonts', font_file_name)})"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# save the modified css file
|
||||||
|
File.write(File.join(dest, file_name), css.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
|
return file_name
|
||||||
|
end
|
||||||
|
|
||||||
|
# replace {{version}} with the version number in all 3rd party libraries urls
|
||||||
|
site.config['third_party_libraries'].each do |key, value|
|
||||||
|
if key != 'download'
|
||||||
|
value['url'].each do |type, url|
|
||||||
|
# check if url is a dictionary
|
||||||
|
if url.is_a?(Hash)
|
||||||
|
url.each do |type2, url2|
|
||||||
|
# replace {{version}} with the version number if it exists
|
||||||
|
if url2.include?('{{version}}')
|
||||||
|
site.config['third_party_libraries'][key]['url'][type][type2] = url2.gsub('{{version}}', site.config['third_party_libraries'][key]['version'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# replace {{version}} with the version number if it exists
|
||||||
|
if url.include?('{{version}}')
|
||||||
|
site.config['third_party_libraries'][key]['url'][type] = url.gsub('{{version}}', site.config['third_party_libraries'][key]['version'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# download 3rd party libraries if required
|
||||||
|
if site.config['third_party_libraries']['download']
|
||||||
|
site.config['third_party_libraries'].each do |key, value|
|
||||||
|
if key != 'download'
|
||||||
|
value['url'].each do |type, url|
|
||||||
|
# check if url is a dictionary
|
||||||
|
if url.is_a?(Hash)
|
||||||
|
url.each do |type2, url2|
|
||||||
|
# get the file name from the url
|
||||||
|
file_name = url2.split('/').last.split('?').first
|
||||||
|
# download the file and change the url to the local file
|
||||||
|
dest = File.join(site.source, 'assets', 'libs', file_name)
|
||||||
|
download_file(url2, dest)
|
||||||
|
# change the url to the local file, considering baseurl
|
||||||
|
if site.config['baseurl']
|
||||||
|
site.config['third_party_libraries'][key]['url'][type][type2] = File.join(site.config['baseurl'], 'assets', 'libs', file_name)
|
||||||
|
else
|
||||||
|
site.config['third_party_libraries'][key]['url'][type][type2] = File.join('/assets', 'libs', file_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
if type == 'fonts'
|
||||||
|
# get the file name from the url
|
||||||
|
file_name = url.split('/').last.split('?').first
|
||||||
|
|
||||||
|
if file_name.end_with?('css')
|
||||||
|
# if the file is a css file, download the css file, the fonts from it, and change information on the css file
|
||||||
|
file_name = download_fonts_from_css(site.config, url, File.join(site.source, 'assets', 'libs'))
|
||||||
|
# change the url to the local file, considering baseurl
|
||||||
|
if site.config['baseurl']
|
||||||
|
site.config['third_party_libraries'][key]['url'][type] = File.join(site.config['baseurl'], 'assets', 'libs', file_name)
|
||||||
|
else
|
||||||
|
site.config['third_party_libraries'][key]['url'][type] = File.join('/assets', 'libs', file_name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# download the font files and change the url to the local file
|
||||||
|
download_fonts(url, File.join(site.source, 'assets', 'libs', site.config['third_party_libraries'][key]['local']['fonts']))
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
# get the file name from the url
|
||||||
|
file_name = url.split('/').last.split('?').first
|
||||||
|
# download the file and change the url to the local file
|
||||||
|
dest = File.join(site.source, 'assets', 'libs', file_name)
|
||||||
|
download_file(url, dest)
|
||||||
|
# change the url to the local file, considering baseurl
|
||||||
|
if site.config['baseurl']
|
||||||
|
site.config['third_party_libraries'][key]['url'][type] = File.join(site.config['baseurl'], 'assets', 'libs', file_name)
|
||||||
|
else
|
||||||
|
site.config['third_party_libraries'][key]['url'][type] = File.join('/assets', 'libs', file_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -32,5 +32,4 @@ module ExternalPosts
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,22 @@
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class FileExistsTag < Liquid::Tag
|
class FileExistsTag < Liquid::Tag
|
||||||
|
def initialize(tag_name, path, tokens)
|
||||||
def initialize(tag_name, path, tokens)
|
super
|
||||||
super
|
@path = path
|
||||||
@path = path
|
|
||||||
end
|
|
||||||
|
|
||||||
def render(context)
|
|
||||||
# Pipe parameter through Liquid to make additional replacements possible
|
|
||||||
url = Liquid::Template.parse(@path).render context
|
|
||||||
|
|
||||||
# Adds the site source, so that it also works with a custom one
|
|
||||||
site_source = context.registers[:site].config['source']
|
|
||||||
file_path = site_source + '/' + url
|
|
||||||
|
|
||||||
# Check if file exists (returns true or false)
|
|
||||||
"#{File.exist?(file_path.strip!)}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render(context)
|
||||||
|
# Pipe parameter through Liquid to make additional replacements possible
|
||||||
|
url = Liquid::Template.parse(@path).render context
|
||||||
|
|
||||||
|
# Adds the site source, so that it also works with a custom one
|
||||||
|
site_source = context.registers[:site].config['source']
|
||||||
|
file_path = site_source + '/' + url
|
||||||
|
|
||||||
|
# Check if file exists (returns true or false)
|
||||||
|
"#{File.exist?(file_path.strip!)}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_tag('file_exists', Jekyll::FileExistsTag)
|
Liquid::Template.register_tag('file_exists', Jekyll::FileExistsTag)
|
||||||
|
|
@ -3,76 +3,76 @@ require 'nokogiri'
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
|
|
||||||
module Helpers
|
module Helpers
|
||||||
extend ActiveSupport::NumberHelper
|
extend ActiveSupport::NumberHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class GoogleScholarCitationsTag < Liquid::Tag
|
class GoogleScholarCitationsTag < Liquid::Tag
|
||||||
Citations = { }
|
Citations = { }
|
||||||
|
|
||||||
def initialize(tag_name, params, tokens)
|
def initialize(tag_name, params, tokens)
|
||||||
super
|
super
|
||||||
splitted = params.split(" ").map(&:strip)
|
splitted = params.split(" ").map(&:strip)
|
||||||
@scholar_id = splitted[0]
|
@scholar_id = splitted[0]
|
||||||
@article_id = splitted[1]
|
@article_id = splitted[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
article_id = context[@article_id.strip]
|
article_id = context[@article_id.strip]
|
||||||
scholar_id = context[@scholar_id.strip]
|
scholar_id = context[@scholar_id.strip]
|
||||||
article_url = "https://scholar.google.com/citations?view_op=view_citation&hl=en&user=#{scholar_id}&citation_for_view=#{scholar_id}:#{article_id}"
|
article_url = "https://scholar.google.com/citations?view_op=view_citation&hl=en&user=#{scholar_id}&citation_for_view=#{scholar_id}:#{article_id}"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
# If the citation count has already been fetched, return it
|
# If the citation count has already been fetched, return it
|
||||||
if GoogleScholarCitationsTag::Citations[article_id]
|
if GoogleScholarCitationsTag::Citations[article_id]
|
||||||
return GoogleScholarCitationsTag::Citations[article_id]
|
return GoogleScholarCitationsTag::Citations[article_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sleep for a random amount of time to avoid being blocked
|
# Sleep for a random amount of time to avoid being blocked
|
||||||
sleep(rand(1.5..3.5))
|
sleep(rand(1.5..3.5))
|
||||||
|
|
||||||
# Fetch the article page
|
# Fetch the article page
|
||||||
doc = Nokogiri::HTML(URI.open(article_url, "User-Agent" => "Ruby/#{RUBY_VERSION}"))
|
doc = Nokogiri::HTML(URI.open(article_url, "User-Agent" => "Ruby/#{RUBY_VERSION}"))
|
||||||
|
|
||||||
# Attempt to extract the "Cited by n" string from the meta tags
|
# Attempt to extract the "Cited by n" string from the meta tags
|
||||||
citation_count = 0
|
citation_count = 0
|
||||||
|
|
||||||
# Look for meta tags with "name" attribute set to "description"
|
# Look for meta tags with "name" attribute set to "description"
|
||||||
description_meta = doc.css('meta[name="description"]')
|
description_meta = doc.css('meta[name="description"]')
|
||||||
og_description_meta = doc.css('meta[property="og:description"]')
|
og_description_meta = doc.css('meta[property="og:description"]')
|
||||||
|
|
||||||
if !description_meta.empty?
|
if !description_meta.empty?
|
||||||
cited_by_text = description_meta[0]['content']
|
cited_by_text = description_meta[0]['content']
|
||||||
matches = cited_by_text.match(/Cited by (\d+[,\d]*)/)
|
matches = cited_by_text.match(/Cited by (\d+[,\d]*)/)
|
||||||
|
|
||||||
if matches
|
if matches
|
||||||
citation_count = matches[1].sub(",", "").to_i
|
citation_count = matches[1].sub(",", "").to_i
|
||||||
end
|
|
||||||
|
|
||||||
elsif !og_description_meta.empty?
|
|
||||||
cited_by_text = og_description_meta[0]['content']
|
|
||||||
matches = cited_by_text.match(/Cited by (\d+[,\d]*)/)
|
|
||||||
|
|
||||||
if matches
|
|
||||||
citation_count = matches[1].sub(",", "").to_i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
citation_count = Helpers.number_to_human(citation_count, :format => '%n%u', :precision => 2, :units => { :thousand => 'K', :million => 'M', :billion => 'B' })
|
|
||||||
|
|
||||||
rescue Exception => e
|
|
||||||
# Handle any errors that may occur during fetching
|
|
||||||
citation_count = "N/A"
|
|
||||||
|
|
||||||
# Print the error message including the exception class and message
|
|
||||||
puts "Error fetching citation count for #{article_id}: #{e.class} - #{e.message}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elsif !og_description_meta.empty?
|
||||||
|
cited_by_text = og_description_meta[0]['content']
|
||||||
|
matches = cited_by_text.match(/Cited by (\d+[,\d]*)/)
|
||||||
|
|
||||||
GoogleScholarCitationsTag::Citations[article_id] = citation_count
|
if matches
|
||||||
return "#{citation_count}"
|
citation_count = matches[1].sub(",", "").to_i
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
citation_count = Helpers.number_to_human(citation_count, :format => '%n%u', :precision => 2, :units => { :thousand => 'K', :million => 'M', :billion => 'B' })
|
||||||
|
|
||||||
|
rescue Exception => e
|
||||||
|
# Handle any errors that may occur during fetching
|
||||||
|
citation_count = "N/A"
|
||||||
|
|
||||||
|
# Print the error message including the exception class and message
|
||||||
|
puts "Error fetching citation count for #{article_id}: #{e.class} - #{e.message}"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
GoogleScholarCitationsTag::Citations[article_id] = citation_count
|
||||||
|
return "#{citation_count}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_tag('google_scholar_citations', Jekyll::GoogleScholarCitationsTag)
|
Liquid::Template.register_tag('google_scholar_citations', Jekyll::GoogleScholarCitationsTag)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
module Jekyll
|
||||||
|
module HideCustomBibtex
|
||||||
|
def hideCustomBibtex(input)
|
||||||
|
keywords = @context.registers[:site].config['filtered_bibtex_keywords']
|
||||||
|
|
||||||
|
keywords.each do |keyword|
|
||||||
|
input = input.gsub(/^.*\b#{keyword}\b *= *\{.*$\n/, '')
|
||||||
|
end
|
||||||
|
|
||||||
|
return input
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Liquid::Template.register_filter(Jekyll::HideCustomBibtex)
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
module Jekyll
|
|
||||||
module HideCustomBibtex
|
|
||||||
def hideCustomBibtex(input)
|
|
||||||
keywords = @context.registers[:site].config['filtered_bibtex_keywords']
|
|
||||||
|
|
||||||
keywords.each do |keyword|
|
|
||||||
input = input.gsub(/^.*\b#{keyword}\b *= *\{.*$\n/, '')
|
|
||||||
end
|
|
||||||
|
|
||||||
return input
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Liquid::Template.register_filter(Jekyll::HideCustomBibtex)
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
# based on https://distresssignal.org/busting-css-cache-with-jekyll-md5-hash
|
# based on https://distresssignal.org/busting-css-cache-with-jekyll-md5-hash
|
||||||
# https://gist.github.com/BryanSchuetz/2ee8c115096d7dd98f294362f6a667db
|
# https://gist.github.com/BryanSchuetz/2ee8c115096d7dd98f294362f6a667db
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module CleanString
|
module CleanString
|
||||||
class RemoveAccents
|
class RemoveAccents
|
||||||
require 'i18n'
|
require 'i18n'
|
||||||
I18n.config.available_locales = :en
|
I18n.config.available_locales = :en
|
||||||
|
|
||||||
attr_accessor :string
|
attr_accessor :string
|
||||||
|
|
||||||
def initialize(string:)
|
def initialize(string:)
|
||||||
self.string = string
|
self.string = string
|
||||||
end
|
end
|
||||||
|
|
||||||
def digest!
|
def digest!
|
||||||
remove_accents
|
remove_accents
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def remove_accents
|
def remove_accents
|
||||||
I18n.transliterate(string)
|
I18n.transliterate(string)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def remove_accents(string)
|
|
||||||
RemoveAccents.new(string: string).digest!
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_accents(string)
|
||||||
|
RemoveAccents.new(string: string).digest!
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_filter(Jekyll::CleanString)
|
Liquid::Template.register_filter(Jekyll::CleanString)
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue