aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-26 19:46:06 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-26 19:46:30 +0100
commit9c78cc3ce8b3345f95cb37a2a9d2101f52ecaa41 (patch)
tree335d76935ee1b52448946abc9d4553fd8b6c0bf8
parent774aad55da0fc62f8de8c95dbbb3d2ad41010e3f (diff)
downloadchawan-9c78cc3ce8b3345f95cb37a2a9d2101f52ecaa41.tar.gz
Consistent naming of parseURL, non-public newURLParams
-rw-r--r--src/buffer/buffer.nim8
-rw-r--r--src/types/url.nim12
2 files changed, 10 insertions, 10 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index ad22df83..17b6e4b8 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -544,7 +544,7 @@ proc updateHover*(buffer: Buffer, cursorx, cursory: int): UpdateHoverResult {.pr
proc loadResource(buffer: Buffer, document: Document, elem: HTMLLinkElement) =
if elem.href == "": return
- let url = parseUrl(elem.href, document.url.some)
+ let url = parseURL(elem.href, document.url.some)
if url.isSome:
let url = url.get
if url.scheme == buffer.url.scheme:
@@ -912,8 +912,8 @@ proc readSuccess*(buffer: Buffer, s: string): ReadSuccessResult {.proxy.} =
result.repaint = true
result.open = buffer.implicitSubmit(input)
of INPUT_FILE:
- let cdir = parseUrl("file://" & getCurrentDir() & DirSep)
- let path = parseUrl(s, cdir)
+ let cdir = parseURL("file://" & getCurrentDir() & DirSep)
+ let path = parseURL(s, cdir)
if path.issome:
input.file = path
input.invalid = true
@@ -952,7 +952,7 @@ proc click*(buffer: Buffer, cursorx, cursory: int): ClickResult {.proxy.} =
result.repaint = buffer.setFocus(clickable)
of TAG_A:
result.repaint = buffer.restoreFocus()
- let url = parseUrl(HTMLAnchorElement(clickable).href, clickable.document.baseURL.some)
+ let url = parseURL(HTMLAnchorElement(clickable).href, clickable.document.baseURL.some)
if url.issome:
result.open = some(newRequest(url.get, HTTP_GET))
of TAG_OPTION:
diff --git a/src/types/url.nim b/src/types/url.nim
index 4dbe24c7..69df47c3 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -731,7 +731,7 @@ func anchor*(url: Url): string =
return url.fragment.get
return ""
-proc parseUrl*(input: string, base = none(Url), url: var Url, override = none(UrlState)): Option[Url] =
+proc parseURL*(input: string, base = none(Url), url: var Url, override = none(UrlState)): Option[Url] =
var url = basicParseUrl(input, base, url, override)
if url.isnone:
return url
@@ -740,7 +740,7 @@ proc parseUrl*(input: string, base = none(Url), url: var Url, override = none(Ur
url.get.blob = BlobUrlEntry().some
return url
-proc parseUrl*(input: string, base = none(Url), override = none(UrlState)): Option[Url] =
+proc parseURL*(input: string, base = none(Url), override = none(UrlState)): Option[Url] =
var url = Url().some
url = basicParseUrl(input, base, url.get, override)
if url.isnone:
@@ -901,7 +901,7 @@ proc serializeApplicationXWWWFormUrlEncoded*(kvs: seq[(string, string)]): string
proc initURLSearchParams(params: URLSearchParams, init: string) =
params.list = parseApplicationXWWWFormUrlEncoded(init)
-proc newURLSearchParams*[T: seq[(string, string)]|Table[string, string]|string](init: T = ""): URLSearchParams {.jsctor.} =
+proc newURLSearchParams[T: seq[(string, string)]|Table[string, string]|string](init: T = ""): URLSearchParams {.jsctor.} =
new(result)
when T is seq[(string, string)]:
result.list = init
@@ -965,14 +965,14 @@ proc newURL*(url: URL): URL =
#TODO add Option wrapper
proc newURL*(s: string, base: Option[string] = none(string)): URL {.jserr, jsctor.} =
if base.issome:
- let baseUrl = parseUrl(base.get)
+ let baseUrl = parseURL(base.get)
if baseUrl.isnone:
JS_ERR JS_TypeError, base.get & " is not a valid URL"
- let url = parseUrl(s, baseUrl)
+ let url = parseURL(s, baseUrl)
if url.isnone:
JS_ERR JS_TypeError, s & " is not a valid URL"
return url.get
- let url = parseUrl(s)
+ let url = parseURL(s)
if url.isnone:
JS_ERR JS_TypeError, s & " is not a valid URL"
url.get.searchParams = newURLSearchParams()