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

vdoc: minor css fix + add error message

This commit is contained in:
Ned Palacios 2020-06-10 17:13:42 +08:00 committed by GitHub
parent e38a221dc3
commit e3c40f1df8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 10 deletions

View File

@ -260,6 +260,9 @@ body {
padding: 1rem;
overflow: hidden;
}
.doc-content p {
line-height: 1.4;
}
.doc-content a {
color: #2779bd;
color: var(--link-color);
@ -267,6 +270,9 @@ body {
.doc-content > .doc-node {
padding: 5rem 0 2rem 0;
margin-top: -4rem;
overflow: hidden;
word-break: break-all; /* IE11 */
word-break: break-word;
}
.doc-content > .doc-node.const:not(:first-child) {
padding-top: 0;
@ -408,6 +414,11 @@ pre, code, pre code {
font-size: 0.9rem;
text-shadow: none;
font-family: monospace;
background-color: #edf2f7;
background-color: var(--code-background-color);
border-radius: 0.25rem;
}
pre code {
direction: ltr;
text-align: left;
white-space: pre;
@ -421,14 +432,13 @@ pre, code, pre code {
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
background-color: #edf2f7;
background-color: var(--code-background-color);
display: block;
border-radius: 0.25rem;
overflow-x: auto;
padding: 1rem;
}
code, pre code {
padding: 1rem;
code {
padding: 0.2rem;
vertical-align: middle;
}
pre {
overflow: auto;

View File

@ -39,7 +39,6 @@ strong {
font-weight: bolder;
}
code,
kbd,
samp {
font-family: monospace, monospace;

View File

@ -573,7 +573,12 @@ fn (mut cfg DocConfig) generate_docs_from_file() {
for dirpath in dirs {
cfg.vprintln('Generating docs for ${dirpath}...')
mut dcs := doc.generate(dirpath, cfg.pub_only, true) or {
panic(err)
mut err_msg := err
if errcode == 1 {
err_msg += ' Use the `-m` flag if you are generating docs of a directory with multiple modules inside.'
}
eprintln(err_msg)
exit(1)
}
if dcs.contents.len == 0 { continue }
if cfg.is_multi {

View File

@ -244,11 +244,11 @@ pub fn (mut d Doc) generate() ?bool {
// get all files
base_path := if os.is_dir(d.input_path) { d.input_path } else { os.real_path(os.base_dir(d.input_path)) }
project_files := os.ls(base_path) or {
panic(err)
return error_with_code(err, 0)
}
v_files := d.prefs.should_compile_filtered_files(base_path, project_files)
if v_files.len == 0 {
return error('vdoc: No valid V files were found.')
return error_with_code('vdoc: No valid V files were found.', 1)
}
// parse files
mut file_asts := []ast.File{}
@ -383,7 +383,7 @@ pub fn generate(input_path string, pub_only, with_comments bool) ?Doc {
doc.pub_only = pub_only
doc.with_comments = with_comments
doc.generate() or {
return error(err)
return error_with_code(err, errcode)
}
return doc
}