code housekeeping

This commit is contained in:
りき萌 2025-08-26 12:46:50 +02:00
parent e1b6578b2a
commit d3c3ff8e4e
10 changed files with 108 additions and 100 deletions

View file

@ -3,6 +3,7 @@ use codespan_reporting::diagnostic::{Diagnostic, Label};
use serde::Deserialize;
use crate::{
config::Config,
state::{FileId, TomlError, Treehouse, toml_error_to_diagnostic},
tree::attributes::{Picture, timestamp_from_id},
};
@ -77,7 +78,11 @@ pub struct IncludeFeed {
}
impl Doc {
pub fn parse(treehouse: &mut Treehouse, file_id: FileId) -> (Doc, Vec<Diagnostic<FileId>>) {
pub fn parse(
treehouse: &mut Treehouse,
config: &Config,
file_id: FileId,
) -> (Doc, Vec<Diagnostic<FileId>>) {
let mut diagnostics = vec![];
let source = treehouse.source(file_id).input();
@ -125,6 +130,17 @@ impl Doc {
]),
);
}
for tag in &attributes.tags {
if !config.feed.tags.contains(tag) {
diagnostics.push(
Diagnostic::warning()
.with_code("attr")
.with_message(format!("doc has unregistered tag `{tag}`"))
.with_labels(vec![Label::primary(file_id, attributes_span.clone())]),
);
}
}
}
(