import base64, strutils, json, htmlgen, dom, algorithm
type
TData = object
content {.importc.}: cstring
proc decodeContent(content: string): string =
result = ""
for line in content.splitLines:
if line != "":
result.add decode(line)
proc contains(x: seq[PJSonNode], s: string): bool =
for i in x:
assert i.kind == JString
if i.str == s: return true
proc processContent(content: string) =
var jsonDoc = parseJson(content)
assert jsonDoc.kind == JArray
var jsonArr = jsonDoc.elems
jsonArr.sort do (x, y: PJsonNode) -> int:
system.cmp(x["name"].str, y["name"].str)
var
officialList = ""
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
desc = pkg["description"].str
# Review array index access when #1291 is solved.
dot = if desc.high > 0 and desc[