From 52f1e9c3651e02ce57098770884c2a128d8e73b5 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 14 May 2018 12:28:45 +0100 Subject: [PATCH] Implements syntax highlighting and
style. --- redesign/nimforum.scss | 11 ++++++++++- utils.nim | 9 +++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/redesign/nimforum.scss b/redesign/nimforum.scss index a511334..5e87f3e 100644 --- a/redesign/nimforum.scss +++ b/redesign/nimforum.scss @@ -427,4 +427,13 @@ code { tt { @extend code; -} \ No newline at end of file +} + +hr { + background: $border-color; + height: $border-width; + margin: $unit-2 0; + border: 0; +} + +@import "syntax.scss"; \ No newline at end of file diff --git a/utils.nim b/utils.nim index 11f51af..b1c7552 100644 --- a/utils.nim +++ b/utils.nim @@ -38,8 +38,8 @@ type var docConfig: StringTableRef docConfig = rstgen.defaultConfig() -docConfig["doc.listing_start"] = "
"
-docConfig["doc.smiley_format"] = "/images/smilieys/$1.png"
+docConfig["doc.listing_start"] = "
"
+docConfig["doc.listing_end"] = "
" proc loadConfig*(filename = getCurrentDir() / "forum.json"): Config = result = Config(smtpAddress: "", smtpPort: 25, smtpUser: "", @@ -81,7 +81,7 @@ proc blockquoteFinish(currentBlockquote, newNode: var XmlNode, n: XmlNode) = newNode.add(n) proc rstToHtml*(content: string): string = - result = rstgen.rstToHtml(content, {roSupportSmilies, roSupportMarkdown}, + result = rstgen.rstToHtml(content, {roSupportMarkdown}, docConfig) # Bolt on quotes. # TODO: Yes, this is ugly. I wrote it quickly. PRs welcome ;) @@ -116,7 +116,8 @@ proc rstToHtml*(content: string): string = blockquoteFinish(currentBlockquote, newNode, n) else: blockquoteFinish(currentBlockquote, newNode, n) - result = $newNode + result = "" + add(result, newNode, indWidth=0, addNewLines=false) except: echo("[WARNING] Could not parse rst html.")