5959 opaque* : bool
6060 isIpv6: bool # not expose it for compatibility.
6161
62- proc encodeUrl * (s: string , usePlus = true ): string =
62+ func encodeUrl * (s: string , usePlus = true ): string =
6363 # # Encodes a URL according to RFC3986.
6464 # #
6565 # # This means that characters in the set
@@ -72,7 +72,7 @@ proc encodeUrl*(s: string, usePlus = true): string =
7272 # # spaces are encoded as ``+`` instead of ``%20``.
7373 # #
7474 # # **See also:**
75- # # * `decodeUrl proc <#decodeUrl,string>`_
75+ # # * `decodeUrl func <#decodeUrl,string>`_
7676 runnableExamples:
7777 assert encodeUrl (" https://nim-lang.org" ) == " https%3A%2F%2Fnim-lang.org"
7878 assert encodeUrl (" https://nim-lang.org/this is a test" ) == " https%3A%2F%2Fnim-lang.org%2Fthis+is+a+test"
@@ -88,7 +88,7 @@ proc encodeUrl*(s: string, usePlus = true): string =
8888 add (result , '%' )
8989 add (result , toHex (ord (c), 2 ))
9090
91- proc decodeUrl * (s: string , decodePlus = true ): string =
91+ func decodeUrl * (s: string , decodePlus = true ): string =
9292 # # Decodes a URL according to RFC3986.
9393 # #
9494 # # This means that any ``%xx`` (where ``xx`` denotes a hexadecimal
@@ -100,7 +100,7 @@ proc decodeUrl*(s: string, decodePlus = true): string =
100100 # # characters are converted to a space.
101101 # #
102102 # # **See also:**
103- # # * `encodeUrl proc <#encodeUrl,string>`_
103+ # # * `encodeUrl func <#encodeUrl,string>`_
104104 runnableExamples:
105105 assert decodeUrl (" https%3A%2F%2Fnim-lang.org" ) == " https://nim-lang.org"
106106 assert decodeUrl (" https%3A%2F%2Fnim-lang.org%2Fthis+is+a+test" ) == " https://nim-lang.org/this is a test"
@@ -125,7 +125,7 @@ proc decodeUrl*(s: string, decodePlus = true): string =
125125 inc (j)
126126 setLen (result , j)
127127
128- proc encodeQuery * (query: openArray [(string , string )], usePlus = true ,
128+ func encodeQuery * (query: openArray [(string , string )], usePlus = true ,
129129 omitEq = true ): string =
130130 # # Encodes a set of (key, value) parameters into a URL query string.
131131 # #
@@ -138,7 +138,7 @@ proc encodeQuery*(query: openArray[(string, string)], usePlus = true,
138138 # # is used for the URL encoding of the string values.
139139 # #
140140 # # **See also:**
141- # # * `encodeUrl proc <#encodeUrl,string>`_
141+ # # * `encodeUrl func <#encodeUrl,string>`_
142142 runnableExamples:
143143 assert encodeQuery ({: }) == " "
144144 assert encodeQuery ({" a" : " 1" , " b" : " 2" }) == " a=1&b=2"
@@ -153,7 +153,7 @@ proc encodeQuery*(query: openArray[(string, string)], usePlus = true,
153153 result .add ('=' )
154154 result .add (encodeUrl (val, usePlus))
155155
156- proc parseAuthority (authority: string , result: var Uri ) =
156+ func parseAuthority (authority: string , result: var Uri ) =
157157 var i = 0
158158 var inPort = false
159159 var inIPv6 = false
@@ -182,7 +182,7 @@ proc parseAuthority(authority: string, result: var Uri) =
182182 result .hostname.add (authority[i])
183183 i.inc
184184
185- proc parsePath (uri: string , i: var int , result: var Uri ) =
185+ func parsePath (uri: string , i: var int , result: var Uri ) =
186186
187187 i.inc parseUntil (uri, result .path, {'?' , '#' }, i)
188188
@@ -199,7 +199,7 @@ proc parsePath(uri: string, i: var int, result: var Uri) =
199199 i.inc # Skip '#'
200200 i.inc parseUntil (uri, result .anchor, {}, i)
201201
202- proc initUri * (): Uri =
202+ func initUri * (): Uri =
203203 # # Initializes a URI with ``scheme``, ``username``, ``password``,
204204 # # ``hostname``, ``port``, ``path``, ``query`` and ``anchor``.
205205 # #
@@ -211,7 +211,7 @@ proc initUri*(): Uri =
211211 result = Uri (scheme: " " , username: " " , password: " " , hostname: " " , port: " " ,
212212 path: " " , query: " " , anchor: " " )
213213
214- proc initUri * (isIpv6: bool ): Uri {.since : (1 , 3 , 5 ).} =
214+ func initUri * (isIpv6: bool ): Uri {.since : (1 , 3 , 5 ).} =
215215 # # Initializes a URI with ``scheme``, ``username``, ``password``,
216216 # # ``hostname``, ``port``, ``path``, ``query``, ``anchor`` and ``isIpv6``.
217217 # #
@@ -226,19 +226,19 @@ proc initUri*(isIpv6: bool): Uri {.since: (1, 3, 5).} =
226226 result = Uri (scheme: " " , username: " " , password: " " , hostname: " " , port: " " ,
227227 path: " " , query: " " , anchor: " " , isIpv6: isIpv6)
228228
229- proc resetUri (uri: var Uri ) =
229+ func resetUri (uri: var Uri ) =
230230 for f in uri.fields:
231231 when f is string :
232232 f.setLen (0 )
233233 else :
234234 f = false
235235
236- proc parseUri * (uri: string , result: var Uri ) =
236+ func parseUri * (uri: string , result: var Uri ) =
237237 # # Parses a URI. The `result` variable will be cleared before.
238238 # #
239239 # # **See also:**
240240 # # * `Uri type <#Uri>`_ for available fields in the URI type
241- # # * `initUri proc <#initUri>`_ for initializing a URI
241+ # # * `initUri func <#initUri>`_ for initializing a URI
242242 runnableExamples:
243243 var res = initUri ()
244244 parseUri (" https://nim-lang.org/docs/manual.html" , res)
@@ -281,7 +281,7 @@ proc parseUri*(uri: string, result: var Uri) =
281281 # Path
282282 parsePath (uri, i, result )
283283
284- proc parseUri * (uri: string ): Uri =
284+ func parseUri * (uri: string ): Uri =
285285 # # Parses a URI and returns it.
286286 # #
287287 # # **See also:**
@@ -294,7 +294,7 @@ proc parseUri*(uri: string): Uri =
294294 result = initUri ()
295295 parseUri (uri, result )
296296
297- proc removeDotSegments (path: string ): string =
297+ func removeDotSegments (path: string ): string =
298298 if path.len == 0 : return " "
299299 var collection: seq [string ] = @ []
300300 let endsWithSlash = path[path.len- 1 ] == '/'
@@ -324,7 +324,7 @@ proc removeDotSegments(path: string): string =
324324 result = collection.join (" /" )
325325 if endsWithSlash: result .add '/'
326326
327- proc merge (base, reference: Uri ): string =
327+ func merge (base, reference: Uri ): string =
328328 # http://tools.ietf.org/html/rfc3986#section-5.2.3
329329 if base.hostname != " " and base.path == " " :
330330 '/' & reference.path
@@ -335,7 +335,7 @@ proc merge(base, reference: Uri): string =
335335 else :
336336 base.path[0 .. lastSegment] & reference.path
337337
338- proc combine * (base: Uri , reference: Uri ): Uri =
338+ func combine * (base: Uri , reference: Uri ): Uri =
339339 # # Combines a base URI with a reference URI.
340340 # #
341341 # # This uses the algorithm specified in
@@ -345,7 +345,7 @@ proc combine*(base: Uri, reference: Uri): Uri =
345345 # # URIs path affect the resulting URI.
346346 # #
347347 # # **See also:**
348- # # * `/ proc <#/,Uri,string>`_ for building URIs
348+ # # * `/ func <#/,Uri,string>`_ for building URIs
349349 runnableExamples:
350350 let foo = combine (parseUri (" https://nim-lang.org/foo/bar" ), parseUri (" /baz" ))
351351 assert foo.path == " /baz"
@@ -386,11 +386,11 @@ proc combine*(base: Uri, reference: Uri): Uri =
386386 result .scheme = base.scheme
387387 result .anchor = reference.anchor
388388
389- proc combine * (uris: varargs [Uri ]): Uri =
389+ func combine * (uris: varargs [Uri ]): Uri =
390390 # # Combines multiple URIs together.
391391 # #
392392 # # **See also:**
393- # # * `/ proc <#/,Uri,string>`_ for building URIs
393+ # # * `/ func <#/,Uri,string>`_ for building URIs
394394 runnableExamples:
395395 let foo = combine (parseUri (" https://nim-lang.org/" ), parseUri (" docs/" ),
396396 parseUri (" manual.html" ))
@@ -400,7 +400,7 @@ proc combine*(uris: varargs[Uri]): Uri =
400400 for i in 1 ..< uris.len:
401401 result = combine (result , uris[i])
402402
403- proc isAbsolute * (uri: Uri ): bool =
403+ func isAbsolute * (uri: Uri ): bool =
404404 # # Returns true if URI is absolute, false otherwise.
405405 runnableExamples:
406406 let foo = parseUri (" https://nim-lang.org" )
@@ -409,15 +409,15 @@ proc isAbsolute*(uri: Uri): bool =
409409 assert isAbsolute (bar) == false
410410 return uri.scheme != " " and (uri.hostname != " " or uri.path != " " )
411411
412- proc `/` * (x: Uri , path: string ): Uri =
412+ func `/` * (x: Uri , path: string ): Uri =
413413 # # Concatenates the path specified to the specified URIs path.
414414 # #
415- # # Contrary to the `combine proc <#combine,Uri,Uri>`_ you do not have to worry about
415+ # # Contrary to the `combine func <#combine,Uri,Uri>`_ you do not have to worry about
416416 # # the slashes at the beginning and end of the path and URIs path
417417 # # respectively.
418418 # #
419419 # # **See also:**
420- # # * `combine proc <#combine,Uri,Uri>`_
420+ # # * `combine func <#combine,Uri,Uri>`_
421421 runnableExamples:
422422 let foo = parseUri (" https://nim-lang.org/foo/bar" ) / " /baz"
423423 assert foo.path == " /foo/bar/baz"
@@ -443,15 +443,15 @@ proc `/`*(x: Uri, path: string): Uri =
443443 result .path.add '/'
444444 result .path.add (path)
445445
446- proc `?` * (u: Uri , query: openArray [(string , string )]): Uri =
446+ func `?` * (u: Uri , query: openArray [(string , string )]): Uri =
447447 # # Concatenates the query parameters to the specified URI object.
448448 runnableExamples:
449449 let foo = parseUri (" https://example.com" ) / " foo" ? {" bar" : " qux" }
450450 assert $ foo == " https://example.com/foo?bar=qux"
451451 result = u
452452 result .query = encodeQuery (query)
453453
454- proc `$` * (u: Uri ): string =
454+ func `$` * (u: Uri ): string =
455455 # # Returns the string representation of the specified URI object.
456456 runnableExamples:
457457 let foo = parseUri (" https://nim-lang.org" )
0 commit comments