From 07e22d156a664510f130134f521451a4b6746b8a Mon Sep 17 00:00:00 2001 From: tyru Date: Sat, 10 Jun 2017 12:32:56 +0900 Subject: [PATCH 1/4] Data.String: doc: add strchars() --- doc/vital/Data/String.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/vital/Data/String.txt b/doc/vital/Data/String.txt index d3b3bd31b..d411067b9 100644 --- a/doc/vital/Data/String.txt +++ b/doc/vital/Data/String.txt @@ -139,6 +139,10 @@ dstring({expr}) *Vital.Data.String.dstring()* lines({str}) *Vital.Data.String.lines()* Splits into list of strings of each lines of {str}. +strchars({str}) *Vital.Data.String.strchars()* + Returns the number of characters in String {str}. + This is a polyfill of |strchars()| when it was not provided. + contains_multibyte({str}) *Vital.Data.String.contains_multibyte()* Return Number 1 if String {str} contains a multi-byte character, otherwise zero. From 0931d5f24d915aa08fe40f82f4206aaf36e2e8bb Mon Sep 17 00:00:00 2001 From: tyru Date: Sat, 10 Jun 2017 12:33:41 +0900 Subject: [PATCH 2/4] Mapping: add missing doc --- doc/vital/Mapping.txt | 121 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 118 insertions(+), 3 deletions(-) diff --git a/doc/vital/Mapping.txt b/doc/vital/Mapping.txt index d451350f3..be7cee5fc 100644 --- a/doc/vital/Mapping.txt +++ b/doc/vital/Mapping.txt @@ -1,4 +1,4 @@ -*vital/Mapping.txt* Utilities for mapping. +*vital/Mapping.txt* Utilities for mapping / abbreviation. Maintainer: tyru @@ -12,14 +12,129 @@ INTERFACE |Vital.Mapping-interface| ============================================================================== INTRODUCTION *Vital.Mapping-introduction* -*Vital.Mapping* is TODO +*Vital.Mapping* is a utility functions related to |:map|, |:unmap|, +|:abbreviate|, |:unabbreviate| commands. ============================================================================== INTERFACE *Vital.Mapping-interface* ------------------------------------------------------------------------------ FUNCTIONS *Vital.Mapping-functions* -TODO + *Mapping.execute_abbr_command()* +execute_abbr_command({mode}, {dict}, {lhs}, {rhs}) + Execute `get_abbr_command(mode, dict, lhs, rhs)` result. + See |Mapping.get_abbr_command()|. + + *Mapping.execute_map_command()* +execute_map_command({mode}, {dict}, {lhs}, {rhs}) + Execute `get_map_command(mode, dict, lhs, rhs)` result. + See |Mapping.get_map_command()|. + + *Mapping.execute_unmap_command()* +execute_unmap_command({mode}, {dict}, {lhs}) + Execute `get_unmap_command(mode, dict, lhs)` result. + See |Mapping.get_unmap_command()|. + + *Mapping.get_all_modes()* +get_all_modes() + Returns string which represents all mode characters ("noiclxs"). + NOTE: "v" is not contained. Because "x" and "s" already mean "v". + + *Mapping.get_all_modes_list()* +get_all_modes_list() + Returns |List| which represents all mode characters. + Same as `split(get_all_modes(), '\zs')` . + See |Mapping.get_all_modes()|. + + *Mapping.get_abbr_command()* +get_abbr_command({mode}, {dict}, {lhs}, {rhs}) + Constructs |:abbreviate| command string. + {mode} is a character of mode. + {dict} is a |Dictionary| of options. + {lhs} and {rhs} are strings of lhs/rhs of |:map| command. + The options can be created by |Mapping.options_chars2dict()| or + |maparg()|'s return value when {dict} is non-zero. + + *Mapping.get_map_command()* +get_map_command({mode}, {dict}, {lhs}, {rhs}) + Constructs |:map| command string. + {mode} is a character of mode. + {dict} is a |Dictionary| of options. + {lhs} and {rhs} are strings of lhs/rhs of |:map| command. + The options can be created by |Mapping.options_chars2dict()| or + |maparg()|'s return value when {dict} is non-zero. + + *Mapping.get_unabbr_command()* +get_unabbr_command({mode}, {dict}, {lhs}) + Constructs |:unabbreviate| command string. + {mode} is a character of mode. + {dict} is a |Dictionary| of options. + {lhs} is a string of lhs of |:map| command. + The options can be created by |Mapping.options_chars2dict()| or + |maparg()|'s return value when {dict} is non-zero. + + *Mapping.get_unmap_command()* +get_unmap_command({mode}, {dict}, {lhs}) + Constructs |:unabbreviate| command string. + {mode} is a character of mode. + {dict} is a |Dictionary| of options. + {lhs} is a string of lhs of |:map| command. + The options can be created by |Mapping.options_chars2dict()| or + |maparg()|'s return value when {dict} is non-zero. + + *Mapping.options_chars2dict()* +options_chars2dict({chars}) + {chars} is a string which represents characters of options. + The return value is a |Dictionary| which is same as |maparg()|'s + return value when {dict} is non-zero. + + chars key ~ + "e" expr + "b" buffer + "s" silent + "S" script + "u" unique + "r" noremap (inverse) + "n" nowait + + Example: > + options_chars2dict("bs") = { + "expr": 0, + "buffer": 1, + "silent": 1, + "script": 0, + "unique": 0, + "noremap": 1, + "nowait": 0, + } +< + *Mapping.options_chars2raw()* +options_chars2raw({chars}) + Same as `options_dict2raw(options_chars2dict(chars))` . + See |Mapping.options_dict2raw()| and |Mapping.options_chars2dict()|. + + Example: > + options_dict2chars('eb') = '' +< + *Mapping.options_dict2chars()* +options_dict2chars({dict}) + Converts {dict} to characters of options. + + Example: > + options_dict2chars({'expr': 1, 'buffer': 1}) = 'eb' +< + *Mapping.options_dict2raw()* +options_dict2raw({dict}) + {dict} is a |Dictionary| which represents options. + See |Mapping.options_chars2dict()| for the options. + + Example: > + options_dict2raw({'expr': 1, 'buffer': 1}) = '' +< + *Mapping.is_mode_char()* +is_mode_char({char}) + Returns non-zero if {char} is a character one of + "v", "n", "o", "i", "c", "l", "x", "s". ============================================================================== vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl From 82185f2a21fef05adf0cefa271dfffb1546158bd Mon Sep 17 00:00:00 2001 From: tyru Date: Sat, 10 Jun 2017 12:34:29 +0900 Subject: [PATCH 3/4] Web.URI: add missing doc --- doc/vital/Web/URI.txt | 132 +++++++++++++++++++----------------- doc/vital/Web/URI/HTTP.txt | 43 ++++++++++++ doc/vital/Web/URI/HTTPS.txt | 31 +++++++++ 3 files changed, 142 insertions(+), 64 deletions(-) create mode 100644 doc/vital/Web/URI/HTTP.txt create mode 100644 doc/vital/Web/URI/HTTPS.txt diff --git a/doc/vital/Web/URI.txt b/doc/vital/Web/URI.txt index 538693a5f..7b018c4f9 100644 --- a/doc/vital/Web/URI.txt +++ b/doc/vital/Web/URI.txt @@ -68,7 +68,11 @@ like_uri({str}) *Vital.Web.URI.like_uri()* *Vital.Web.URI.new_default_pattern_set()* new_default_pattern_set() - Returns |Vital.Web.URI-PatternSet|. + Creates a new |Vital.Web.URI-PatternSet| object. + + *Vital.Web.URI.clone_pattern_set()* +clone_pattern_set({patternset}) + Clones a |Vital.Web.URI-PatternSet| object. encode({str} [, {char-enc}]) *Vital.Web.URI.encode()* Encodes {str} to Percent-encoding string. @@ -144,70 +148,70 @@ is_path({str}) is_query({str}) is_fragment({str}) - Returns non-zero value if {str} has right syntax - for each component. Returns zero otherwise. + Returns non-zero value if {str} has right syntax + for each component. Returns zero otherwise. *Vital.Web.URI-URI.clone()* clone() - This method clones a URI object itself. > - let s:URI = vital#{plugin-name}#new().import('Web.URI') - let uri = s:URI.new('http://example.com/') - let copyuri = uri.clone().relative('/a/b/c') - echo uri.to_string() - " => 'http://example.com/' - echo copyuri.to_string() - " => 'http://example.com/a/b/c' + This method clones a URI object itself. > + let s:URI = vital#{plugin-name}#new().import('Web.URI') + let uri = s:URI.new('http://example.com/') + let copyuri = uri.clone().relative('/a/b/c') + echo uri.to_string() + " => 'http://example.com/' + echo copyuri.to_string() + " => 'http://example.com/a/b/c' < *Vital.Web.URI-URI.relative()* relative({reluri}) - This method ... - * Calculates a URI from - base URI and relative URI({reluri}). - * Changes the URI object itself (destructive). - * Returns the URI object itself. - * Calls |Vital.Web.URI-URI.relative()| implicitly. - - Example: > - let s:URI = vital#{plugin-name}#new().import('Web.URI') - let BASE_URI = 'http://example.com/foo/bar' - let RELATIVE_URI = '../baz' - echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string() - " => 'http://example.com/baz' - - let BASE_URI = 'http://example.com/foo/bar/' - let RELATIVE_URI = '../baz' - echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string() - " => 'http://example.com/foo/baz' + This method ... + * Calculates a URI from + base URI and relative URI({reluri}). + * Changes the URI object itself (destructive). + * Returns the URI object itself. + * Calls |Vital.Web.URI-URI.relative()| implicitly. + + Example: > + let s:URI = vital#{plugin-name}#new().import('Web.URI') + let BASE_URI = 'http://example.com/foo/bar' + let RELATIVE_URI = '../baz' + echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string() + " => 'http://example.com/baz' + + let BASE_URI = 'http://example.com/foo/bar/' + let RELATIVE_URI = '../baz' + echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string() + " => 'http://example.com/foo/baz' < *Vital.Web.URI-URI.canonicalize()* canonicalize() - This method ... - * Canonicalizes the URI. - * Changes the URI object itself (destructive). - * Returns the URI object itself. - - See Web.URI.* modules for supported schemes. - For example, the following four URIs - becomes equivalent URI (http://example.com/). - * http://example.com - * http://example.com/ - * http://example.com:/ - * http://example.com:80/ - - Example: > - let s:URI = vital#{plugin-name}#new().import('Web.URI') - echo s:URI.new('http://example.com:80/').to_string() - " => 'http://example.com/' + This method ... + * Canonicalizes the URI. + * Changes the URI object itself (destructive). + * Returns the URI object itself. + + See Web.URI.* modules for supported schemes. + For example, the following four URIs + becomes equivalent URI (http://example.com/). + * http://example.com + * http://example.com/ + * http://example.com:/ + * http://example.com:80/ + + Example: > + let s:URI = vital#{plugin-name}#new().import('Web.URI') + echo s:URI.new('http://example.com:80/').to_string() + " => 'http://example.com/' < *Vital.Web.URI-URI.default_port()* default_port() - This method returns the default port for current scheme. - (e.g.: 80 for "http" scheme) - See Web.URI.* modules for supported schemes. + This method returns the default port for current scheme. + (e.g.: 80 for "http" scheme) + See Web.URI.* modules for supported schemes. ------------------------------------------------------------------------------ PATTERNSET OBJECT *Vital.Web.URI-PatternSet* @@ -232,28 +236,28 @@ According to RFC3986, URI allows but these characters often appears in ordinary text. This code lets the parser ignore these characters. > - let s:LoosePatternSet = s:URI.new_default_pattern_set() + let s:LoosePatternSet = s:URI.new_default_pattern_set() - " Remove "'", "(", ")" from default sub_delims(). - function! s:LoosePatternSet.sub_delims() abort - return '[!$&*+,;=]' - endfunction + " Remove "'", "(", ")" from default sub_delims(). + function! s:LoosePatternSet.sub_delims() abort + return '[!$&*+,;=]' + endfunction - " Ignore trailing string after URI. - let NONE = [] - let ret = URI.new_from_seq_string( - \ 'http://example.com)', NONE, s:LoosePatternSet) - if ret isnot NONE - ... - endif + " Ignore trailing string after URI. + let NONE = [] + let ret = URI.new_from_seq_string( + \ 'http://example.com)', NONE, s:LoosePatternSet) + if ret isnot NONE + ... + endif < get({component}) *Vital.Web.URI-PatternSet.get()* - Returns each component definition. + Returns each component definition. > - let s:PatternSet = s:URI.new_default_pattern_set() - echo s:PatternSet.get('scheme') + let s:PatternSet = s:URI.new_default_pattern_set() + echo s:PatternSet.get('scheme') < Listing all customizable components here (alphabetic order). NOTE: DON'T call these methods directly. diff --git a/doc/vital/Web/URI/HTTP.txt b/doc/vital/Web/URI/HTTP.txt new file mode 100644 index 000000000..a9ed0b51e --- /dev/null +++ b/doc/vital/Web/URI/HTTP.txt @@ -0,0 +1,43 @@ +*vital/Web/URI/HTTP.txt* http scheme handler for Web.URI + +Maintainer: tyru + +============================================================================== +CONTENTS *Vital.Web.URI.HTTP-contents* + +INTRODUCTION |Vital.Web.URI.HTTP-introduction| +INTERFACE |Vital.Web.URI.HTTP-interface| + Functions |Vital.Web.URI.HTTP-functions| + +============================================================================== +INTRODUCTION *Vital.Web.URI.HTTP-introduction* + +*Vital.Web.URI.HTTP* is a http scheme handler for |Vital.Web.URI|. + +============================================================================== +INTERFACE *Vital.Web.URI.HTTP-interface* +------------------------------------------------------------------------------ +FUNCTIONS *Vital.Web.URI.HTTP-functions* + +canonicalize({uri}) *Vital.Web.URI.HTTP.canonicalize()* + Canonicalizes {uri}. {uri} is a |Vital.Web.URI-URI| object. + + * Set '/' to its path if its path is empty + * If its port is the same as a default port of http scheme (80), + make the URI's port empty + + For example, the following four URIs are equivalent: + * http://example.com + * http://example.com/ + * http://example.com:/ + * http://example.com:80/ + This function canonicalizes them to http://example.com/ . + + ref. https://tools.ietf.org/html/rfc3986#section-6.2.3 + +default_port() + *Vital.Web.URI.HTTP.default_port()* + Returns a string of a default port of http scheme ("80"). + +============================================================================== +vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl diff --git a/doc/vital/Web/URI/HTTPS.txt b/doc/vital/Web/URI/HTTPS.txt new file mode 100644 index 000000000..83b4b1b49 --- /dev/null +++ b/doc/vital/Web/URI/HTTPS.txt @@ -0,0 +1,31 @@ +*vital/Web/URI/HTTPS.txt* https scheme handler for Web.URI + +Maintainer: tyru + +============================================================================== +CONTENTS *Vital.Web.URI.HTTPS-contents* + +INTRODUCTION |Vital.Web.URI.HTTPS-introduction| +INTERFACE |Vital.Web.URI.HTTPS-interface| + Functions |Vital.Web.URI.HTTPS-functions| + +============================================================================== +INTRODUCTION *Vital.Web.URI.HTTPS-introduction* + +*Vital.Web.URI.HTTPS* is a https scheme handler for |Vital.Web.URI|. + +============================================================================== +INTERFACE *Vital.Web.URI.HTTPS-interface* +------------------------------------------------------------------------------ +FUNCTIONS *Vital.Web.URI.HTTPS-functions* + +canonicalize({uri}) *Vital.Web.URI.HTTPS.canonicalize()* + This simply invokes |Vital.Web.URI.HTTP.canonicalize()| with a {uri} + argument. + +default_port() + *Vital.Web.URI.HTTPS.default_port()* + Returns a string of a default port of https scheme ("443"). + +============================================================================== +vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl From 38db89b5730bdafc26d18ee785a6a07bc419e32c Mon Sep 17 00:00:00 2001 From: tyru Date: Sat, 10 Jun 2017 12:56:29 +0900 Subject: [PATCH 4/4] Mapping: fix doc tags --- doc/vital/Mapping.txt | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/vital/Mapping.txt b/doc/vital/Mapping.txt index be7cee5fc..dcc6d780c 100644 --- a/doc/vital/Mapping.txt +++ b/doc/vital/Mapping.txt @@ -20,33 +20,33 @@ INTERFACE *Vital.Mapping-interface* ------------------------------------------------------------------------------ FUNCTIONS *Vital.Mapping-functions* - *Mapping.execute_abbr_command()* + *Vital.Mapping.execute_abbr_command()* execute_abbr_command({mode}, {dict}, {lhs}, {rhs}) Execute `get_abbr_command(mode, dict, lhs, rhs)` result. See |Mapping.get_abbr_command()|. - *Mapping.execute_map_command()* + *Vital.Mapping.execute_map_command()* execute_map_command({mode}, {dict}, {lhs}, {rhs}) Execute `get_map_command(mode, dict, lhs, rhs)` result. See |Mapping.get_map_command()|. - *Mapping.execute_unmap_command()* + *Vital.Mapping.execute_unmap_command()* execute_unmap_command({mode}, {dict}, {lhs}) Execute `get_unmap_command(mode, dict, lhs)` result. See |Mapping.get_unmap_command()|. - *Mapping.get_all_modes()* + *Vital.Mapping.get_all_modes()* get_all_modes() Returns string which represents all mode characters ("noiclxs"). NOTE: "v" is not contained. Because "x" and "s" already mean "v". - *Mapping.get_all_modes_list()* + *Vital.Mapping.get_all_modes_list()* get_all_modes_list() Returns |List| which represents all mode characters. Same as `split(get_all_modes(), '\zs')` . See |Mapping.get_all_modes()|. - *Mapping.get_abbr_command()* + *Vital.Mapping.get_abbr_command()* get_abbr_command({mode}, {dict}, {lhs}, {rhs}) Constructs |:abbreviate| command string. {mode} is a character of mode. @@ -55,7 +55,7 @@ get_abbr_command({mode}, {dict}, {lhs}, {rhs}) The options can be created by |Mapping.options_chars2dict()| or |maparg()|'s return value when {dict} is non-zero. - *Mapping.get_map_command()* + *Vital.Mapping.get_map_command()* get_map_command({mode}, {dict}, {lhs}, {rhs}) Constructs |:map| command string. {mode} is a character of mode. @@ -64,7 +64,7 @@ get_map_command({mode}, {dict}, {lhs}, {rhs}) The options can be created by |Mapping.options_chars2dict()| or |maparg()|'s return value when {dict} is non-zero. - *Mapping.get_unabbr_command()* + *Vital.Mapping.get_unabbr_command()* get_unabbr_command({mode}, {dict}, {lhs}) Constructs |:unabbreviate| command string. {mode} is a character of mode. @@ -73,7 +73,7 @@ get_unabbr_command({mode}, {dict}, {lhs}) The options can be created by |Mapping.options_chars2dict()| or |maparg()|'s return value when {dict} is non-zero. - *Mapping.get_unmap_command()* + *Vital.Mapping.get_unmap_command()* get_unmap_command({mode}, {dict}, {lhs}) Constructs |:unabbreviate| command string. {mode} is a character of mode. @@ -82,7 +82,7 @@ get_unmap_command({mode}, {dict}, {lhs}) The options can be created by |Mapping.options_chars2dict()| or |maparg()|'s return value when {dict} is non-zero. - *Mapping.options_chars2dict()* + *Vital.Mapping.options_chars2dict()* options_chars2dict({chars}) {chars} is a string which represents characters of options. The return value is a |Dictionary| which is same as |maparg()|'s @@ -108,7 +108,7 @@ options_chars2dict({chars}) "nowait": 0, } < - *Mapping.options_chars2raw()* + *Vital.Mapping.options_chars2raw()* options_chars2raw({chars}) Same as `options_dict2raw(options_chars2dict(chars))` . See |Mapping.options_dict2raw()| and |Mapping.options_chars2dict()|. @@ -116,14 +116,14 @@ options_chars2raw({chars}) Example: > options_dict2chars('eb') = '' < - *Mapping.options_dict2chars()* + *Vital.Mapping.options_dict2chars()* options_dict2chars({dict}) Converts {dict} to characters of options. Example: > options_dict2chars({'expr': 1, 'buffer': 1}) = 'eb' < - *Mapping.options_dict2raw()* + *Vital.Mapping.options_dict2raw()* options_dict2raw({dict}) {dict} is a |Dictionary| which represents options. See |Mapping.options_chars2dict()| for the options. @@ -131,7 +131,7 @@ options_dict2raw({dict}) Example: > options_dict2raw({'expr': 1, 'buffer': 1}) = '' < - *Mapping.is_mode_char()* + *Vital.Mapping.is_mode_char()* is_mode_char({char}) Returns non-zero if {char} is a character one of "v", "n", "o", "i", "c", "l", "x", "s".