about summary refs log tree commit diff stats
path: root/src/main.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-07-30 20:23:34 +0200
committerbptato <nincsnevem662@gmail.com>2021-07-30 20:25:38 +0200
commit34b023515599bc746c10c597467ecb07f53c49fe (patch)
tree38e77bb205bf94c63387dae4f7d859cda7bb9ce6 /src/main.nim
parent94a10242dca6181ef8f15a37e7083069ead09559 (diff)
downloadchawan-34b023515599bc746c10c597467ecb07f53c49fe.tar.gz
CSS selectors and re-organization
Diffstat (limited to 'src/main.nim')
-rw-r--r--src/main.nim28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/main.nim b/src/main.nim
index 95f1f3cd..539527f1 100644
--- a/src/main.nim
+++ b/src/main.nim
@@ -3,14 +3,18 @@ import uri
 import os
 import streams
 
-import display
-import termattrs
+import css/style
+
+import utils/termattrs
+
+import html/dom
+import html/htmlparser
+
+import io/display
+import io/twtio
+
 import buffer
-import twtio
 import config
-import htmlparser
-import dom
-import style
 
 let clientInstance = newHttpClient()
 proc loadRemotePage*(url: string): string =
@@ -39,16 +43,17 @@ proc main*() =
   if paramCount() != 1:
     eprint "Invalid parameters. Usage:\ntwt <url>"
     quit(1)
-  if not readConfig("config"):
-    eprint "Failed to read keymap, falling back to default"
+  if not readConfig("res/config"):
+    eprint "Failed to read keymap, fallback to default"
   let attrs = getTermAttributes()
   let buffer = newBuffer(attrs)
   let uri = parseUri(paramStr(1))
   buffers.add(buffer)
   buffer.document = parseHtml(getPageUri(uri))
-  #discard buffer.document.querySelector("#hi.a[title=\"test\"]")
-  var box = CSSBox()
-  applyProperties(box, "color: #090; line-height: 1.2")
+  let s = buffer.document.querySelector(":not(:first-child)")
+  eprint s.len
+  for q in s:
+    eprint q
   buffer.setLocation(uri)
   buffer.renderHtml()
   var lastUri = uri
@@ -65,6 +70,5 @@ proc main*() =
         buffer.document = parseHtml(getPageUri(buffer.document.location))
       buffer.renderHtml()
     lastUri = newUri
-
 main()
 #parseCSS(newFileStream("default.css", fmRead))