1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vdoc: include the project root folder, when searching for readme of src/ (#19000)

This commit is contained in:
Turiiya 2023-07-29 23:00:18 +02:00 committed by GitHub
parent 1c2b4e76dc
commit e78e468d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1 @@
hello from readme

View File

@ -0,0 +1,3 @@
module foo
fn bar()

View File

@ -0,0 +1,4 @@
hello from readme
module foo
fn bar()

View File

@ -0,0 +1,3 @@
module foo
pub fn bar() {}

View File

@ -52,6 +52,11 @@ fn check_path(vexe string, dir string, tests []string) int {
cmd: '${os.quoted_path(vexe)} doc -comments ${os.quoted_path(program)}' cmd: '${os.quoted_path(vexe)} doc -comments ${os.quoted_path(program)}'
out_filename: 'main.comments.out' out_filename: 'main.comments.out'
) )
fails += check_output(
program: program
cmd: '${os.quoted_path(vexe)} doc -readme -comments ${os.quoted_path(program)}'
out_filename: 'main.readme.comments.out'
)
total_fails += fails total_fails += fails
if fails == 0 { if fails == 0 {
println(term.green('OK')) println(term.green('OK'))

View File

@ -233,6 +233,9 @@ fn (vd VDoc) get_readme(path string) string {
} }
} }
if fname == '' { if fname == '' {
if path.all_after_last(os.path_separator) == 'src' {
return vd.get_readme(path.all_before_last(os.path_separator))
}
return '' return ''
} }
readme_path := os.join_path(path, '${fname}.md') readme_path := os.join_path(path, '${fname}.md')