From 0018f122a5d5b331b7c992dcf14f4a47641b3c6b Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 25 Dec 2021 20:17:43 +0100 Subject: [PATCH] Remove Gemini test This lives as an external program. --- tests/gemsvg.nim | 58 ------------------------------------------------ 1 file changed, 58 deletions(-) delete mode 100644 tests/gemsvg.nim diff --git a/tests/gemsvg.nim b/tests/gemsvg.nim deleted file mode 100644 index 4098cda..0000000 --- a/tests/gemsvg.nim +++ /dev/null @@ -1,58 +0,0 @@ -# SPDX-FileCopyrightText: ☭ 2021 Emery Hemingway -# SPDX-License-Identifier: Unlicense - -import std/[asyncdispatch, os, parseopt, strutils, tables, xmltree] -import preserves, preserves/xmlhooks -import syndicate, syndicate/[actors, capabilities, relay] -import parsegemini -import gemclient -import nimsvg -import svui -import eris - -type Svui = svui.Svui[Ref] - -proc main() = - proc quitHook() {.noconv.} = quit() - setControlCHook(quitHook) - - waitFor runActor("client") do (turn: var Turn): - - let cap = mint() - - connectUnix(turn, "/run/syndicate/ds", cap) do (turn: var Turn; a: Assertion) -> TurnAction: - let ds = unembed a - let client = newGeminiClient() - - for kind, arg, _ in getopt(): - if kind == cmdArgument and arg.startsWith"gemini": - var - nodes: seq[Nodes] - p: GeminiParser - let resp = client.fetch(arg) - open(p, resp.bodyStream) - # TODO: append to a text block until running into verbatim text, - # then push the current text and open a new block - while true: - p.next() - case p.kind - of gmiEof: break - else: - let n = buildSvg: - t: xmltree.escape p.text - nodes.add n - close(p) - let doc = buildSvg: - svg(viewBox="0 0 600 800", `font-family` = "Gentium Plus", `font-size`="20"): - g(fill="white"): - text(fill="black"): - for n in nodes: embed n - let - buf = render doc - bs = if buf.len < (16 shl 10): bs1k else: bs32k - capPr = toPreserve($erisCap(buf, bs), Ref) - discard publish(turn, ds, Svui(attrs: toTable {"urn": capPr}, svg: buf)) - - stderr.writeLine "done" - -main()