on master help sign in
@include takes one file

Glob includes are gone; globbing stays in @data, where a directory of records is common.

commit72fcaf04e9ae51fc981adee2b74073a6a800c24e authoriko <mail@iko.soy> dateSat 26 Sep 2026, 04:04 (2 weeks ago) parent65dec96
1 file changed−68
crates/htmlang-core/src/parser.rs−68
crates/htmlang-core/src/parser.rs−68
@@ -463,74 +463,6 @@ impl Evaluator {
463463 .unwrap_or(rest);
464464 let filename = substitute_vars(filename, &ctx.variables);
465465
466− // Glob support: if filename contains *, expand to multiple imports
467− if filename.contains('*') {
468− let base_dir = match &ctx.base_path {
469− Some(base) => base.clone(),
470− None => PathBuf::from("."),
471− };
472− let pattern_path = Path::new(&filename);
473− let (glob_dir, glob_pattern) = match pattern_path.parent() {
474− Some(dir) if !dir.as_os_str().is_empty() => (
475− base_dir.join(dir),
476− pattern_path
477− .file_name()
478− .unwrap_or_default()
479− .to_string_lossy()
480− .to_string(),
481− ),
482− _ => (base_dir.clone(), filename.clone()),
483− };
484− let matched_files = match std::fs::read_dir(&glob_dir) {
485− Ok(entries) => {
486− let mut files: Vec<PathBuf> = entries
487− .flatten()
488− .filter(|e| {
489− let name = e.file_name().to_string_lossy().to_string();
490− glob_match(&glob_pattern, &name)
491− })
492− .map(|e| e.path())
493− .collect();
494− files.sort();
495− files
496− }
497− Err(e) => {
498− ctx.diagnostics.push(Diagnostic {
499− line: line_num,
500− column: None,
501− message: format!(
502− "cannot read directory for glob '{}': {}",
503− filename, e
504− ),
505− severity: Severity::Error,
506− source_line: Some(content.clone()),
507− });
508− return Ok(None);
509− }
510− };
511− if matched_files.is_empty() {
512− ctx.diagnostics.push(Diagnostic {
513− line: line_num,
514− column: None,
515− message: format!("no files matched glob pattern '{}'", filename),
516− severity: Severity::Warning,
517− source_line: Some(content.clone()),
518− });
519− return Ok(None);
520− }
521− let mut matched_nodes = Vec::new();
522− for file_path in matched_files {
523− let rel_name = file_path
524− .strip_prefix(&base_dir)
525− .unwrap_or(&file_path)
526− .to_string_lossy()
527− .to_string();
528− let import_line = format!("@include \"{}\"", rel_name);
529− matched_nodes.extend(self.eval_block(&syntax::parse(&import_line), ctx));
530− }
531− return Ok(Some(matched_nodes));
532− }
533−
534466 let resolved = match &ctx.base_path {
535467 Some(base) => base.join(&filename),
536468 None => PathBuf::from(&filename),