mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vdoc: highlight inline examples for -f html
(#13879)
This commit is contained in:
@ -690,7 +690,7 @@ pub fn (a array) filter(predicate fn (voidptr) bool) array
|
||||
// Example: array.any(it.name == 'Bob') // will yield `true` if any element has `.name == 'Bob'`
|
||||
pub fn (a array) any(predicate fn (voidptr) bool) bool
|
||||
|
||||
// all tests whether all elements in the array pass the test
|
||||
// all tests whether all elements in the array pass the test.
|
||||
// Ignore the function signature. `all` does not take an actual callback. Rather, it
|
||||
// takes an `it` expression.
|
||||
// It returns `false` if any element fails the test. Otherwise,
|
||||
|
@ -516,7 +516,7 @@ pub fn (b byte) str_escaped() string {
|
||||
|
||||
// is_capital returns `true`, if the byte is a Latin capital letter.
|
||||
// Example: assert `H`.is_capital() == true
|
||||
// Example: assert 'h`.is_capital() == false
|
||||
// Example: assert `h`.is_capital() == false
|
||||
[inline]
|
||||
pub fn (c byte) is_capital() bool {
|
||||
return c >= `A` && c <= `Z`
|
||||
|
@ -72,7 +72,7 @@ pub fn (c byte) is_alnum() bool {
|
||||
|
||||
// is_capital returns `true`, if the byte is a Latin capital letter.
|
||||
// Example: assert `H`.is_capital() == true
|
||||
// Example: assert 'h`.is_capital() == false
|
||||
// Example: assert `h`.is_capital() == false
|
||||
[inline]
|
||||
pub fn (c byte) is_capital() bool {
|
||||
return c >= `A` && c <= `Z`
|
||||
|
@ -85,7 +85,7 @@ fn trace_error(x string) {
|
||||
}
|
||||
|
||||
// error returns a default error instance containing the error given in `message`.
|
||||
// Example: `if ouch { return error('an error occurred') }`
|
||||
// Example: if ouch { return error('an error occurred') }
|
||||
[inline]
|
||||
pub fn error(message string) IError {
|
||||
trace_error(message)
|
||||
@ -95,7 +95,7 @@ pub fn error(message string) IError {
|
||||
}
|
||||
|
||||
// error_with_code returns a default error instance containing the given `message` and error `code`.
|
||||
// `if ouch { return error_with_code('an error occurred', 1) }`
|
||||
// Example: if ouch { return error_with_code('an error occurred', 1) }
|
||||
[inline]
|
||||
pub fn error_with_code(message string, code int) IError {
|
||||
trace_error('$message | code: $code')
|
||||
|
Reference in New Issue
Block a user