From 426930159a19b4b83bf30b9b475ed53d5b643665 Mon Sep 17 00:00:00 2001
From: Jake <j.vondoemming@stud.uni-goettingen.de>
Date: Thu, 4 Aug 2022 16:22:54 +0200
Subject: [PATCH] use self-hosted mathjax

---
 .gitmodules               |  3 +++
 Makefile                  | 14 +++++++++-----
 fgs/Makefile              |  2 +-
 mathjax                   |  1 +
 theme/templates/base.html |  3 +--
 5 files changed, 15 insertions(+), 8 deletions(-)
 create mode 100644 .gitmodules
 create mode 160000 mathjax

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..522acb3
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "mathjax"]
+	path = mathjax
+	url = https://github.com/mathjax/MathJax.git
diff --git a/Makefile b/Makefile
index a1849d3..dc784c6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,16 @@
 .PHONY: html
-html: run
+html: build
 
 .PHONY: publish
-publish: run
+publish: build
 
-.PHONY: run
-run:
-	make -C fgs
+.PHONY: build
+build: mathjax
+	cd fgs && python3 __main__.py
+
+.PHONY: mathjax
+mathjax:
+	[ ! -d output/mathjax ] && cp -vr mathjax/es5 output/mathjax || true
 
 .PHONY: devserver
 devserver:
diff --git a/fgs/Makefile b/fgs/Makefile
index 6cfa260..61357d6 100644
--- a/fgs/Makefile
+++ b/fgs/Makefile
@@ -1,4 +1,4 @@
 
 .PHONY: run
 run:
-	python3 __main__.py
+	make -C ..
diff --git a/mathjax b/mathjax
new file mode 160000
index 0000000..600692a
--- /dev/null
+++ b/mathjax
@@ -0,0 +1 @@
+Subproject commit 600692ad9d3552cc25f85510d5797bc942ecc9f7
diff --git a/theme/templates/base.html b/theme/templates/base.html
index f260d11..b798077 100644
--- a/theme/templates/base.html
+++ b/theme/templates/base.html
@@ -15,6 +15,7 @@
 	<!-- <meta HTTP-EQUIV="REFRESH" content="500; url=#"> -->
 	<link rel="preload" href="{{ siteurl }}/{{ theme.static_dir }}/css/{{ theme.css_file }}" as="style" />
 	<link rel="stylesheet" type="text/css" href="{{ siteurl }}/{{ theme.static_dir }}/css/{{ theme.css_file }}" />
+	<script src="{{ siteurl }}/mathjax/tex-chtml.js" id="MathJax-script" async></script>
 	{#- TODO load javascript? -#}
 	{#- TODO og: meta tags -#}
 	{#- TODO favicon -#}
@@ -26,8 +27,6 @@
 	{% endif -%}#}
 	{% block extra_head %}{% endblock extra_head %}
 	{% endblock head %}
-	<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
-<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
 </head>
 <body>
 	<header>
-- 
GitLab