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:
parent
e38a221dc3
commit
e3c40f1df8
@ -260,6 +260,9 @@ body {
|
|||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
.doc-content p {
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
.doc-content a {
|
.doc-content a {
|
||||||
color: #2779bd;
|
color: #2779bd;
|
||||||
color: var(--link-color);
|
color: var(--link-color);
|
||||||
@ -267,6 +270,9 @@ body {
|
|||||||
.doc-content > .doc-node {
|
.doc-content > .doc-node {
|
||||||
padding: 5rem 0 2rem 0;
|
padding: 5rem 0 2rem 0;
|
||||||
margin-top: -4rem;
|
margin-top: -4rem;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all; /* IE11 */
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
.doc-content > .doc-node.const:not(:first-child) {
|
.doc-content > .doc-node.const:not(:first-child) {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
@ -408,6 +414,11 @@ pre, code, pre code {
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
text-shadow: none;
|
text-shadow: none;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
|
background-color: #edf2f7;
|
||||||
|
background-color: var(--code-background-color);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
pre code {
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
@ -421,15 +432,14 @@ pre, code, pre code {
|
|||||||
-moz-hyphens: none;
|
-moz-hyphens: none;
|
||||||
-ms-hyphens: none;
|
-ms-hyphens: none;
|
||||||
hyphens: none;
|
hyphens: none;
|
||||||
background-color: #edf2f7;
|
|
||||||
background-color: var(--code-background-color);
|
|
||||||
display: block;
|
display: block;
|
||||||
border-radius: 0.25rem;
|
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
|
||||||
code, pre code {
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
code {
|
||||||
|
padding: 0.2rem;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
pre {
|
pre {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
1
cmd/tools/vdoc-resources/normalize.css
vendored
1
cmd/tools/vdoc-resources/normalize.css
vendored
@ -39,7 +39,6 @@ strong {
|
|||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
code,
|
|
||||||
kbd,
|
kbd,
|
||||||
samp {
|
samp {
|
||||||
font-family: monospace, monospace;
|
font-family: monospace, monospace;
|
||||||
|
@ -573,7 +573,12 @@ fn (mut cfg DocConfig) generate_docs_from_file() {
|
|||||||
for dirpath in dirs {
|
for dirpath in dirs {
|
||||||
cfg.vprintln('Generating docs for ${dirpath}...')
|
cfg.vprintln('Generating docs for ${dirpath}...')
|
||||||
mut dcs := doc.generate(dirpath, cfg.pub_only, true) or {
|
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 dcs.contents.len == 0 { continue }
|
||||||
if cfg.is_multi {
|
if cfg.is_multi {
|
||||||
|
@ -244,11 +244,11 @@ pub fn (mut d Doc) generate() ?bool {
|
|||||||
// get all files
|
// 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)) }
|
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 {
|
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)
|
v_files := d.prefs.should_compile_filtered_files(base_path, project_files)
|
||||||
if v_files.len == 0 {
|
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
|
// parse files
|
||||||
mut file_asts := []ast.File{}
|
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.pub_only = pub_only
|
||||||
doc.with_comments = with_comments
|
doc.with_comments = with_comments
|
||||||
doc.generate() or {
|
doc.generate() or {
|
||||||
return error(err)
|
return error_with_code(err, errcode)
|
||||||
}
|
}
|
||||||
return doc
|
return doc
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user