feat(keywords): add STOPPED keyword
Adds STOPPED alongside TODO/DONE/STARTED/FIXME/FIXED/XXX across the stack: lexer, AST Keyword enum, HTML renderer (class="stopped"), LSP keyword_str, and the Vim syntax red group (nuwikiKeywordAttn). Grouped with the attention/pending keywords (red) for both export and in-editor highlighting. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ pub enum Keyword {
|
||||
Fixme,
|
||||
Fixed,
|
||||
Xxx,
|
||||
Stopped,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
||||
@@ -502,6 +502,7 @@ impl HtmlRenderer {
|
||||
Keyword::Fixme => ("FIXME", "fixme"),
|
||||
Keyword::Fixed => ("FIXED", "fixed"),
|
||||
Keyword::Xxx => ("XXX", "xxx"),
|
||||
Keyword::Stopped => ("STOPPED", "stopped"),
|
||||
};
|
||||
write!(w, "<span class=\"{class}\">{label}</span>")
|
||||
}
|
||||
|
||||
@@ -1141,6 +1141,7 @@ const KEYWORDS: &[(&str, Keyword)] = &[
|
||||
("FIXME", Keyword::Fixme),
|
||||
("FIXED", Keyword::Fixed),
|
||||
("XXX", Keyword::Xxx),
|
||||
("STOPPED", Keyword::Stopped),
|
||||
];
|
||||
|
||||
fn match_keyword(rest: &str) -> Option<(usize, Keyword)> {
|
||||
|
||||
@@ -205,6 +205,7 @@ fn keyword_spans() {
|
||||
("FIXME x\n", "<span class=\"fixme\">FIXME</span>"),
|
||||
("FIXED x\n", "<span class=\"fixed\">FIXED</span>"),
|
||||
("XXX x\n", "<span class=\"xxx\">XXX</span>"),
|
||||
("STOPPED x\n", "<span class=\"stopped\">STOPPED</span>"),
|
||||
];
|
||||
for (src, expected) in cases {
|
||||
let out = render(src);
|
||||
|
||||
@@ -450,7 +450,7 @@ fn inline_math_captures_content() {
|
||||
// ===== Keywords =====
|
||||
|
||||
#[test]
|
||||
fn all_six_keywords() {
|
||||
fn all_keywords() {
|
||||
let cases: &[(&str, Keyword)] = &[
|
||||
("TODO", Keyword::Todo),
|
||||
("DONE", Keyword::Done),
|
||||
@@ -458,6 +458,7 @@ fn all_six_keywords() {
|
||||
("FIXME", Keyword::Fixme),
|
||||
("FIXED", Keyword::Fixed),
|
||||
("XXX", Keyword::Xxx),
|
||||
("STOPPED", Keyword::Stopped),
|
||||
];
|
||||
for (s, expected) in cases {
|
||||
let line = format!("{s} stuff\n");
|
||||
|
||||
@@ -377,6 +377,7 @@ fn keywords_become_keyword_nodes() {
|
||||
("FIXME", Keyword::Fixme),
|
||||
("FIXED", Keyword::Fixed),
|
||||
("XXX", Keyword::Xxx),
|
||||
("STOPPED", Keyword::Stopped),
|
||||
];
|
||||
for (src, expected) in cases {
|
||||
let doc = parse(&format!("{src} stuff\n"));
|
||||
|
||||
@@ -1311,6 +1311,7 @@ fn keyword_str(k: nuwiki_core::ast::Keyword) -> &'static str {
|
||||
nuwiki_core::ast::Keyword::Fixme => "FIXME",
|
||||
nuwiki_core::ast::Keyword::Fixed => "FIXED",
|
||||
nuwiki_core::ast::Keyword::Xxx => "XXX",
|
||||
nuwiki_core::ast::Keyword::Stopped => "STOPPED",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user