remove id attribute from pages

really, use the one from branches instead
This commit is contained in:
liquidex 2024-11-29 22:55:01 +01:00
parent 600651ec16
commit f518d7a0ff
3 changed files with 2 additions and 30 deletions

View file

@ -97,7 +97,7 @@ impl SemaRoots {
let successfully_parsed = successfully_parsed;
if successfully_parsed {
let attribute_warning_span = roots
let _attribute_warning_span = roots
.attributes
.as_ref()
.map(|attributes| attributes.percent.clone())
@ -109,28 +109,6 @@ impl SemaRoots {
_ => panic!("parse_attributes called for a non-.tree file"),
}
}
if attributes.id.is_empty() {
attributes.id = format!("treehouse-missingno-{}", treehouse.next_missingno());
diagnostics.push(Diagnostic {
severity: Severity::Warning,
code: Some("attr".into()),
message: "page does not have an `id` attribute".into(),
labels: vec![Label {
style: LabelStyle::Primary,
file_id,
range: attribute_warning_span.clone(),
message: String::new(),
}],
notes: vec![
format!(
"note: a generated id `{}` will be used, but this id is unstable and will not persist across generations",
attributes.id
),
format!("help: run `treehouse fix {}` to add missing ids to pages", treehouse.path(file_id)),
],
});
}
}
if let Some(thumbnail) = &attributes.thumbnail {

View file

@ -7,10 +7,6 @@ use crate::{state::FileId, vfs::VPathBuf};
/// Top-level `%%` root attributes.
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct RootAttributes {
/// Permanent ID of this page.
#[serde(default)]
pub id: String,
/// Template to use for generating the page.
/// Defaults to `_tree.hbs`.
#[serde(default)]

View file

@ -1,6 +1,4 @@
use treehouse::vfs::{
entries, query, BufferedFile, Content, Dir, MemDir, ToDynDir, VPath, VPathBuf,
};
use treehouse::vfs::{entries, query, BufferedFile, Content, MemDir, ToDynDir, VPath, VPathBuf};
const HEWWO: &[u8] = b"hewwo :3";
const FWOOFEE: &[u8] = b"fwoofee -w-";