diff options
author | bptato <nincsnevem662@gmail.com> | 2023-08-13 17:42:34 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-08-13 17:54:05 +0200 |
commit | d526deb99e44f2a8d1a9c3eea60676703dd64302 (patch) | |
tree | f63689ff7654d14ad9bca182a837b3155b2471a0 /src/html | |
parent | f92e30232252deb194596e7c298cc7fcf56517cb (diff) | |
download | chawan-d526deb99e44f2a8d1a9c3eea60676703dd64302.tar.gz |
Add mailcap, mime.types & misc refactorings
* add mailcap: works with copiousoutput, needsterminal, etc. * add mime.types (only works with mailcap) * refactor pipeBuffer * remove "dispatcher" * fix bug in directory display where baseurl would not be used
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/dom.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 11254c56..c0dc066c 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -27,10 +27,10 @@ import js/timeout import types/blob import types/color import types/matrix -import types/mime import types/referer import types/url import types/vector +import utils/mimeguess import utils/twtstr type @@ -794,6 +794,7 @@ const ReflectTable0 = [ # Forward declarations func attrb*(element: Element, s: string): bool proc attr*(element: Element, name, value: string) +func baseURL*(document: Document): URL proc tostr(ftype: enum): string = return ($ftype).split('_')[1..^1].join("-").tolower() @@ -1802,8 +1803,8 @@ func target0*(element: Element): string = # HTMLHyperlinkElementUtils (for <a> and <area>) func href0[T: HTMLAnchorElement|HTMLAreaElement](element: T): string = if element.attrb("href"): - let url = parseUrl(element.attr("href"), some(element.document.url)) - if url.issome: + let url = parseURL(element.attr("href"), some(element.document.baseURL)) + if url.isSome: return $url.get # <base> @@ -2030,7 +2031,7 @@ func isHostIncludingInclusiveAncestor*(a, b: Node): bool = return true return false -func baseURL*(document: Document): Url = +func baseURL*(document: Document): URL = #TODO frozen base url... var href = "" for base in document.elements(TAG_BASE): |