tools: print the offending markdown source line, for errors and warnings
parent
1f99d1e025
commit
b04b8d438b
|
@ -61,18 +61,23 @@ These are:
|
||||||
if line.len > too_long_line_length {
|
if line.len > too_long_line_length {
|
||||||
if mdfile.state == .vexample {
|
if mdfile.state == .vexample {
|
||||||
wprintln(wline(file_path, i, line.len, 'long V example line'))
|
wprintln(wline(file_path, i, line.len, 'long V example line'))
|
||||||
|
wprintln(line)
|
||||||
warnings++
|
warnings++
|
||||||
} else if mdfile.state == .codeblock {
|
} else if mdfile.state == .codeblock {
|
||||||
wprintln(wline(file_path, i, line.len, 'long code block line'))
|
wprintln(wline(file_path, i, line.len, 'long code block line'))
|
||||||
|
wprintln(line)
|
||||||
warnings++
|
warnings++
|
||||||
} else if line.starts_with('|') {
|
} else if line.starts_with('|') {
|
||||||
wprintln(wline(file_path, i, line.len, 'long table'))
|
wprintln(wline(file_path, i, line.len, 'long table'))
|
||||||
|
wprintln(line)
|
||||||
warnings++
|
warnings++
|
||||||
} else if line.contains('https') {
|
} else if line.contains('https') {
|
||||||
wprintln(wline(file_path, i, line.len, 'long link'))
|
wprintln(wline(file_path, i, line.len, 'long link'))
|
||||||
|
wprintln(line)
|
||||||
warnings++
|
warnings++
|
||||||
} else {
|
} else {
|
||||||
eprintln(eline(file_path, i, line.len, 'line too long'))
|
eprintln(eline(file_path, i, line.len, 'line too long'))
|
||||||
|
eprintln(line)
|
||||||
errors++
|
errors++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +134,8 @@ fn rtext(s string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wline(file_path string, lnumber int, column int, message string) string {
|
fn wline(file_path string, lnumber int, column int, message string) string {
|
||||||
return btext('$file_path:${lnumber + 1}:${column + 1}:') + btext(mtext(' warn:')) + rtext(' $message')
|
return btext('$file_path:${lnumber + 1}:${column + 1}:') + btext(mtext(' warn:')) +
|
||||||
|
rtext(' $message')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eline(file_path string, lnumber int, column int, message string) string {
|
fn eline(file_path string, lnumber int, column int, message string) string {
|
||||||
|
@ -155,7 +161,7 @@ enum MDFileParserState {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MDFile {
|
struct MDFile {
|
||||||
path string
|
path string
|
||||||
mut:
|
mut:
|
||||||
examples []VCodeExample
|
examples []VCodeExample
|
||||||
current VCodeExample
|
current VCodeExample
|
||||||
|
|
Loading…
Reference in New Issue