Skip to content

Commit 82185f2

Browse files
committed
Web.URI: add missing doc
1 parent 0931d5f commit 82185f2

File tree

3 files changed

+142
-64
lines changed

3 files changed

+142
-64
lines changed

doc/vital/Web/URI.txt

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ like_uri({str}) *Vital.Web.URI.like_uri()*
6868

6969
*Vital.Web.URI.new_default_pattern_set()*
7070
new_default_pattern_set()
71-
Returns |Vital.Web.URI-PatternSet|.
71+
Creates a new |Vital.Web.URI-PatternSet| object.
72+
73+
*Vital.Web.URI.clone_pattern_set()*
74+
clone_pattern_set({patternset})
75+
Clones a |Vital.Web.URI-PatternSet| object.
7276

7377
encode({str} [, {char-enc}]) *Vital.Web.URI.encode()*
7478
Encodes {str} to Percent-encoding string.
@@ -144,70 +148,70 @@ is_path({str})
144148
is_query({str})
145149
is_fragment({str})
146150

147-
Returns non-zero value if {str} has right syntax
148-
for each component. Returns zero otherwise.
151+
Returns non-zero value if {str} has right syntax
152+
for each component. Returns zero otherwise.
149153

150154
*Vital.Web.URI-URI.clone()*
151155
clone()
152156

153-
This method clones a URI object itself. >
154-
let s:URI = vital#{plugin-name}#new().import('Web.URI')
155-
let uri = s:URI.new('http://example.com/')
156-
let copyuri = uri.clone().relative('/a/b/c')
157-
echo uri.to_string()
158-
" => 'http://example.com/'
159-
echo copyuri.to_string()
160-
" => 'http://example.com/a/b/c'
157+
This method clones a URI object itself. >
158+
let s:URI = vital#{plugin-name}#new().import('Web.URI')
159+
let uri = s:URI.new('http://example.com/')
160+
let copyuri = uri.clone().relative('/a/b/c')
161+
echo uri.to_string()
162+
" => 'http://example.com/'
163+
echo copyuri.to_string()
164+
" => 'http://example.com/a/b/c'
161165
<
162166
*Vital.Web.URI-URI.relative()*
163167
relative({reluri})
164168

165-
This method ...
166-
* Calculates a URI from
167-
base URI and relative URI({reluri}).
168-
* Changes the URI object itself (destructive).
169-
* Returns the URI object itself.
170-
* Calls |Vital.Web.URI-URI.relative()| implicitly.
171-
172-
Example: >
173-
let s:URI = vital#{plugin-name}#new().import('Web.URI')
174-
let BASE_URI = 'http://example.com/foo/bar'
175-
let RELATIVE_URI = '../baz'
176-
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
177-
" => 'http://example.com/baz'
178-
179-
let BASE_URI = 'http://example.com/foo/bar/'
180-
let RELATIVE_URI = '../baz'
181-
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
182-
" => 'http://example.com/foo/baz'
169+
This method ...
170+
* Calculates a URI from
171+
base URI and relative URI({reluri}).
172+
* Changes the URI object itself (destructive).
173+
* Returns the URI object itself.
174+
* Calls |Vital.Web.URI-URI.relative()| implicitly.
175+
176+
Example: >
177+
let s:URI = vital#{plugin-name}#new().import('Web.URI')
178+
let BASE_URI = 'http://example.com/foo/bar'
179+
let RELATIVE_URI = '../baz'
180+
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
181+
" => 'http://example.com/baz'
182+
183+
let BASE_URI = 'http://example.com/foo/bar/'
184+
let RELATIVE_URI = '../baz'
185+
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
186+
" => 'http://example.com/foo/baz'
183187
<
184188
*Vital.Web.URI-URI.canonicalize()*
185189
canonicalize()
186190

187-
This method ...
188-
* Canonicalizes the URI.
189-
* Changes the URI object itself (destructive).
190-
* Returns the URI object itself.
191-
192-
See Web.URI.* modules for supported schemes.
193-
For example, the following four URIs
194-
becomes equivalent URI (http://example.com/).
195-
* http://example.com
196-
* http://example.com/
197-
* http://example.com:/
198-
* http://example.com:80/
199-
200-
Example: >
201-
let s:URI = vital#{plugin-name}#new().import('Web.URI')
202-
echo s:URI.new('http://example.com:80/').to_string()
203-
" => 'http://example.com/'
191+
This method ...
192+
* Canonicalizes the URI.
193+
* Changes the URI object itself (destructive).
194+
* Returns the URI object itself.
195+
196+
See Web.URI.* modules for supported schemes.
197+
For example, the following four URIs
198+
becomes equivalent URI (http://example.com/).
199+
* http://example.com
200+
* http://example.com/
201+
* http://example.com:/
202+
* http://example.com:80/
203+
204+
Example: >
205+
let s:URI = vital#{plugin-name}#new().import('Web.URI')
206+
echo s:URI.new('http://example.com:80/').to_string()
207+
" => 'http://example.com/'
204208
<
205209
*Vital.Web.URI-URI.default_port()*
206210
default_port()
207211

208-
This method returns the default port for current scheme.
209-
(e.g.: 80 for "http" scheme)
210-
See Web.URI.* modules for supported schemes.
212+
This method returns the default port for current scheme.
213+
(e.g.: 80 for "http" scheme)
214+
See Web.URI.* modules for supported schemes.
211215

212216
------------------------------------------------------------------------------
213217
PATTERNSET OBJECT *Vital.Web.URI-PatternSet*
@@ -232,28 +236,28 @@ According to RFC3986, URI allows
232236
but these characters often appears in ordinary text.
233237
This code lets the parser ignore these characters. >
234238
235-
let s:LoosePatternSet = s:URI.new_default_pattern_set()
239+
let s:LoosePatternSet = s:URI.new_default_pattern_set()
236240
237-
" Remove "'", "(", ")" from default sub_delims().
238-
function! s:LoosePatternSet.sub_delims() abort
239-
return '[!$&*+,;=]'
240-
endfunction
241+
" Remove "'", "(", ")" from default sub_delims().
242+
function! s:LoosePatternSet.sub_delims() abort
243+
return '[!$&*+,;=]'
244+
endfunction
241245
242-
" Ignore trailing string after URI.
243-
let NONE = []
244-
let ret = URI.new_from_seq_string(
245-
\ 'http://example.com)', NONE, s:LoosePatternSet)
246-
if ret isnot NONE
247-
...
248-
endif
246+
" Ignore trailing string after URI.
247+
let NONE = []
248+
let ret = URI.new_from_seq_string(
249+
\ 'http://example.com)', NONE, s:LoosePatternSet)
250+
if ret isnot NONE
251+
...
252+
endif
249253
<
250254

251255
get({component}) *Vital.Web.URI-PatternSet.get()*
252256

253-
Returns each component definition.
257+
Returns each component definition.
254258
>
255-
let s:PatternSet = s:URI.new_default_pattern_set()
256-
echo s:PatternSet.get('scheme')
259+
let s:PatternSet = s:URI.new_default_pattern_set()
260+
echo s:PatternSet.get('scheme')
257261
<
258262
Listing all customizable components here (alphabetic order).
259263
NOTE: DON'T call these methods directly.

doc/vital/Web/URI/HTTP.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
*vital/Web/URI/HTTP.txt* http scheme handler for Web.URI
2+
3+
Maintainer: tyru <[email protected]>
4+
5+
==============================================================================
6+
CONTENTS *Vital.Web.URI.HTTP-contents*
7+
8+
INTRODUCTION |Vital.Web.URI.HTTP-introduction|
9+
INTERFACE |Vital.Web.URI.HTTP-interface|
10+
Functions |Vital.Web.URI.HTTP-functions|
11+
12+
==============================================================================
13+
INTRODUCTION *Vital.Web.URI.HTTP-introduction*
14+
15+
*Vital.Web.URI.HTTP* is a http scheme handler for |Vital.Web.URI|.
16+
17+
==============================================================================
18+
INTERFACE *Vital.Web.URI.HTTP-interface*
19+
------------------------------------------------------------------------------
20+
FUNCTIONS *Vital.Web.URI.HTTP-functions*
21+
22+
canonicalize({uri}) *Vital.Web.URI.HTTP.canonicalize()*
23+
Canonicalizes {uri}. {uri} is a |Vital.Web.URI-URI| object.
24+
25+
* Set '/' to its path if its path is empty
26+
* If its port is the same as a default port of http scheme (80),
27+
make the URI's port empty
28+
29+
For example, the following four URIs are equivalent:
30+
* http://example.com
31+
* http://example.com/
32+
* http://example.com:/
33+
* http://example.com:80/
34+
This function canonicalizes them to http://example.com/ .
35+
36+
ref. https://tools.ietf.org/html/rfc3986#section-6.2.3
37+
38+
default_port()
39+
*Vital.Web.URI.HTTP.default_port()*
40+
Returns a string of a default port of http scheme ("80").
41+
42+
==============================================================================
43+
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

doc/vital/Web/URI/HTTPS.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
*vital/Web/URI/HTTPS.txt* https scheme handler for Web.URI
2+
3+
Maintainer: tyru <[email protected]>
4+
5+
==============================================================================
6+
CONTENTS *Vital.Web.URI.HTTPS-contents*
7+
8+
INTRODUCTION |Vital.Web.URI.HTTPS-introduction|
9+
INTERFACE |Vital.Web.URI.HTTPS-interface|
10+
Functions |Vital.Web.URI.HTTPS-functions|
11+
12+
==============================================================================
13+
INTRODUCTION *Vital.Web.URI.HTTPS-introduction*
14+
15+
*Vital.Web.URI.HTTPS* is a https scheme handler for |Vital.Web.URI|.
16+
17+
==============================================================================
18+
INTERFACE *Vital.Web.URI.HTTPS-interface*
19+
------------------------------------------------------------------------------
20+
FUNCTIONS *Vital.Web.URI.HTTPS-functions*
21+
22+
canonicalize({uri}) *Vital.Web.URI.HTTPS.canonicalize()*
23+
This simply invokes |Vital.Web.URI.HTTP.canonicalize()| with a {uri}
24+
argument.
25+
26+
default_port()
27+
*Vital.Web.URI.HTTPS.default_port()*
28+
Returns a string of a default port of https scheme ("443").
29+
30+
==============================================================================
31+
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

0 commit comments

Comments
 (0)