Move files handler back to main

This commit is contained in:
Aoran Zeng
2025-07-16 03:12:05 +08:00
parent 66e5c1f7e0
commit 902a40bed7
2 changed files with 31 additions and 29 deletions

View File

@@ -161,22 +161,9 @@ class Parser {
#| sections
has Section @!sections;
#| $path
method new($path) {
my $markdown-file;
if $path.IO.d {
$markdown-file = $path.IO.add("rawstr4c.md");
unless $markdown-file.e {
die "Error: No 'rawstr4c.md' file found in directory '$path'\n";
}
}
elsif $path.IO.f {
$markdown-file = $path.IO;
} else {
die "Error: '$path' is neither a file nor a directory\n";
}
self.bless(:input-file($markdown-file.Str));
#| $markdown-file markdown
method new($markdown-file) {
self.bless(:input-file($markdown-file));
}
# 获取根sectionlevel 0