From b895bf3d75a36977b04925e25a13ef32d7339003 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 22 May 2018 22:15:42 +0100 Subject: [PATCH] Adds ability to specify `scripts` in config to be added to HTML. --- public/karax.html | 1 + src/forum.nim | 3 ++- src/utils.nim | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/karax.html b/public/karax.html index ec498ea..e43498e 100644 --- a/public/karax.html +++ b/public/karax.html @@ -17,5 +17,6 @@
+ $scripts diff --git a/src/forum.nim b/src/forum.nim index 57b14a2..2c5824f 100644 --- a/src/forum.nim +++ b/src/forum.nim @@ -266,7 +266,8 @@ proc initialise() = karaxHtml = readFile("public/karax.html") % { "title": config.title, - "timestamp": encodeUrl(CompileDate & CompileTime) + "timestamp": encodeUrl(CompileDate & CompileTime), + "scripts": config.scripts }.newStringTable() diff --git a/src/utils.nim b/src/utils.nim index f4884ca..dc50965 100644 --- a/src/utils.nim +++ b/src/utils.nim @@ -28,6 +28,7 @@ type dbPath*: string hostname*: string name*, title*: string + scripts*: string ForumError* = object of Exception data*: PostError @@ -64,6 +65,7 @@ proc loadConfig*(filename = getCurrentDir() / "forum.json"): Config = result.hostname = root["hostname"].getStr() result.name = root["name"].getStr() result.title = root["title"].getStr() + result.scripts = root{"scripts"}.getStr() proc processGT(n: XmlNode, tag: string): (int, XmlNode, string) = result = (0, newElement(tag), tag)