summary refs log tree commit diff stats
path: root/web
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2014-06-30 22:43:13 +0200
committerAndreas Rumpf <rumpf_a@web.de>2014-06-30 22:43:13 +0200
commit1b78bdd982b34c217973bfca6a50dab25465041a (patch)
tree63b8808749393b822ae004b15558d4f1c6f5466f /web
parentb89495ef0f6bb60a3296fbaa7c4397dcd269f73d (diff)
parente21999c2c684eba39c399b8a775d07167035587e (diff)
downloadNim-1b78bdd982b34c217973bfca6a50dab25465041a.tar.gz
Merge pull request #1292 from gradha/pr_terminates_sentences_with_dot
Forces babel package descriptions to end with a dot.
Diffstat (limited to 'web')
-rw-r--r--web/babelpkglist.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/web/babelpkglist.nim b/web/babelpkglist.nim
index 378d4ce30..8745c9f99 100644
--- a/web/babelpkglist.nim
+++ b/web/babelpkglist.nim
@@ -28,13 +28,19 @@ proc processContent(content: string) =
     officialCount = 0
     unofficialList = ""
     unofficialCount = 0
+  let
+    endings = {'.', '!'}
 
   for pkg in jsonArr:
     assert pkg.kind == JObject
     let pkgWeb =
       if pkg.hasKey("web"): pkg["web"].str
       else: pkg["url"].str
-    let listItem = li(a(href=pkgWeb, pkg["name"].str), " ", pkg["description"].str)
+    let
+      desc = pkg["description"].str
+      # Review array index access when #1291 is solved.
+      dot = if desc.high > 0 and desc[<desc.high] in endings: "" else: "."
+      listItem = li(a(href=pkgWeb, pkg["name"].str), " ", desc & dot)
     if pkg["url"].str.startsWith("git://github.com/nimrod-code") or
        "official" in pkg["tags"].elems:
       officialCount.inc