Skip to content

Commit a87cd96

Browse files
authored
vdoc: highlight inline examples for -f html (#13879)
1 parent 5c43493 commit a87cd96

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

cmd/tools/vdoc/html.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
430430
example_title := if examples.len > 1 { 'Examples' } else { 'Example' }
431431
dnw.writeln('<section class="doc-node examples"><h4>$example_title</h4>')
432432
for example in examples {
433-
// hl_example := html_highlight(example, tb)
434-
dnw.writeln('<pre><code class="language-v">$example</code></pre>')
433+
hl_example := html_highlight(example, tb)
434+
dnw.writeln('<pre><code class="language-v">$hl_example</code></pre>')
435435
}
436436
dnw.writeln('</section>')
437437
}

vlib/builtin/array.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ pub fn (a array) filter(predicate fn (voidptr) bool) array
690690
// Example: array.any(it.name == 'Bob') // will yield `true` if any element has `.name == 'Bob'`
691691
pub fn (a array) any(predicate fn (voidptr) bool) bool
692692

693-
// all tests whether all elements in the array pass the test
693+
// all tests whether all elements in the array pass the test.
694694
// Ignore the function signature. `all` does not take an actual callback. Rather, it
695695
// takes an `it` expression.
696696
// It returns `false` if any element fails the test. Otherwise,

vlib/builtin/int.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ pub fn (b byte) str_escaped() string {
516516

517517
// is_capital returns `true`, if the byte is a Latin capital letter.
518518
// Example: assert `H`.is_capital() == true
519-
// Example: assert 'h`.is_capital() == false
519+
// Example: assert `h`.is_capital() == false
520520
[inline]
521521
pub fn (c byte) is_capital() bool {
522522
return c >= `A` && c <= `Z`

vlib/builtin/js/byte.js.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn (c byte) is_alnum() bool {
7272

7373
// is_capital returns `true`, if the byte is a Latin capital letter.
7474
// Example: assert `H`.is_capital() == true
75-
// Example: assert 'h`.is_capital() == false
75+
// Example: assert `h`.is_capital() == false
7676
[inline]
7777
pub fn (c byte) is_capital() bool {
7878
return c >= `A` && c <= `Z`

vlib/builtin/option.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn trace_error(x string) {
8585
}
8686

8787
// error returns a default error instance containing the error given in `message`.
88-
// Example: `if ouch { return error('an error occurred') }`
88+
// Example: if ouch { return error('an error occurred') }
8989
[inline]
9090
pub fn error(message string) IError {
9191
trace_error(message)
@@ -95,7 +95,7 @@ pub fn error(message string) IError {
9595
}
9696

9797
// error_with_code returns a default error instance containing the given `message` and error `code`.
98-
// `if ouch { return error_with_code('an error occurred', 1) }`
98+
// Example: if ouch { return error_with_code('an error occurred', 1) }
9999
[inline]
100100
pub fn error_with_code(message string, code int) IError {
101101
trace_error('$message | code: $code')

vlib/vweb/vweb.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub mut:
157157
static_files map[string]string
158158
static_mime_types map[string]string
159159
// Map containing query params for the route.
160-
// Example: `http://localhost:3000/index?q=vpm&order_by=desc => { 'q': 'vpm', 'order_by': 'desc' }
160+
// http://localhost:3000/index?q=vpm&order_by=desc => { 'q': 'vpm', 'order_by': 'desc' }
161161
query map[string]string
162162
// Multipart-form fields.
163163
form map[string]string
@@ -389,7 +389,7 @@ pub struct RunParams {
389389
}
390390

391391
// run_at - start a new VWeb server, listening only on a specific address `host`, at the specified `port`
392-
// Example: `vweb.run_at(app, 'localhost', 8099)`
392+
// Example: vweb.run_at(app, 'localhost', 8099)
393393
[manualfree]
394394
pub fn run_at<T>(global_app &T, params RunParams) ? {
395395
mut l := net.listen_tcp(params.family, '$params.host:$params.port') or {

0 commit comments

Comments
 (0)