refactor: Improve parser_line.v code clarity

- Changed the conditional check in `next_start`, `next_start_lf`, and `ensure_last_is_paragraph` functions to improve readability.  The original `!is` check was slightly less clear.  This change uses the `!` operator more consistently and makes the intention clearer.
This commit is contained in:
Mahmoud Emad
2025-01-05 16:10:43 +02:00
parent b2adba48af
commit d5d5eab855

View File

@@ -120,21 +120,21 @@ fn (mut parser Parser) next() {
// move further and reset the state
fn (mut parser Parser) next_start() ! {
// means we need to add paragraph because we don't know what comes next
if parser.doc.last() !is elements.Paragraph {
if parser.doc.last()! !is elements.Paragraph {
parser.doc.paragraph_new(mut parser.doc, '')
}
parser.next()
}
fn (mut parser Parser) next_start_lf() ! {
if parser.doc.last() !is elements.Paragraph {
if parser.doc.last()! !is elements.Paragraph {
parser.doc.paragraph_new(mut parser.doc, '\n')
}
parser.next()
}
fn (mut parser Parser) ensure_last_is_paragraph() ! {
if parser.doc.last() !is elements.Paragraph {
if parser.doc.last()! !is elements.Paragraph {
parser.doc.paragraph_new(mut parser.doc, '')
}
}