summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMyriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com>2024-07-14 21:14:21 +0800
committerGitHub <noreply@github.com>2024-07-14 13:14:21 +0000
commita3f3a1a83330e3fe9a686fbe4c0eda9f1e9e99b2 (patch)
tree0c6b10649101d75573e453498901907bdec5a8b3 /docs
parent4d8976b619fbb2ab19c1e46fccbca4294c0c2d0b (diff)
Change the signature of `World::main` (#4531)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/src/html.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/src/html.rs b/docs/src/html.rs
index ab140a90..58c8e54c 100644
--- a/docs/src/html.rs
+++ b/docs/src/html.rs
@@ -6,7 +6,7 @@ use heck::{ToKebabCase, ToTitleCase};
use pulldown_cmark as md;
use serde::{Deserialize, Serialize};
use typed_arena::Arena;
-use typst::diag::{FileResult, StrResult};
+use typst::diag::{FileError, FileResult, StrResult};
use typst::foundations::{Bytes, Datetime};
use typst::layout::{Abs, Point, Size};
use typst::syntax::{FileId, Source, VirtualPath};
@@ -463,12 +463,16 @@ impl World for DocWorld {
&FONTS.0
}
- fn main(&self) -> Source {
- self.0.clone()
+ fn main(&self) -> FileId {
+ self.0.id()
}
- fn source(&self, _: FileId) -> FileResult<Source> {
- Ok(self.0.clone())
+ fn source(&self, id: FileId) -> FileResult<Source> {
+ if id == self.0.id() {
+ Ok(self.0.clone())
+ } else {
+ Err(FileError::NotFound(id.vpath().as_rootless_path().into()))
+ }
}
fn file(&self, id: FileId) -> FileResult<Bytes> {