summaryrefslogtreecommitdiff
path: root/crates/typst-cli/src/compile.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-03-09 12:55:03 +0100
committerGitHub <noreply@github.com>2024-03-09 11:55:03 +0000
commit82617a6a3cb4d1d7b8b4ed52f2adb31a3a148114 (patch)
treed9242fac2c8c17ad3feaedae41c19d91ecabe902 /crates/typst-cli/src/compile.rs
parent204c4ecfcb5b0dfc4d34e5622af603c2c190af69 (diff)
Generate PDF ID automatically unless we really have a stable ID (#3591)
Diffstat (limited to 'crates/typst-cli/src/compile.rs')
-rw-r--r--crates/typst-cli/src/compile.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/crates/typst-cli/src/compile.rs b/crates/typst-cli/src/compile.rs
index 8e628b4e..9a252a53 100644
--- a/crates/typst-cli/src/compile.rs
+++ b/crates/typst-cli/src/compile.rs
@@ -9,7 +9,7 @@ use parking_lot::RwLock;
use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator};
use typst::diag::{bail, At, Severity, SourceDiagnostic, StrResult};
use typst::eval::Tracer;
-use typst::foundations::Datetime;
+use typst::foundations::{Datetime, Smart};
use typst::layout::Frame;
use typst::model::Document;
use typst::syntax::{FileId, Source, Span};
@@ -157,18 +157,13 @@ fn export(
OutputFormat::Svg => {
export_image(world, document, command, watching, ImageExportFormat::Svg)
}
- OutputFormat::Pdf => export_pdf(document, command, world),
+ OutputFormat::Pdf => export_pdf(document, command),
}
}
/// Export to a PDF.
-fn export_pdf(
- document: &Document,
- command: &CompileCommand,
- world: &SystemWorld,
-) -> StrResult<()> {
- let ident = world.input().map(|i| i.to_string_lossy());
- let buffer = typst_pdf::pdf(document, ident.as_deref(), now());
+fn export_pdf(document: &Document, command: &CompileCommand) -> StrResult<()> {
+ let buffer = typst_pdf::pdf(document, Smart::Auto, now());
let output = command.output();
fs::write(output, buffer)
.map_err(|err| eco_format!("failed to write PDF file ({err})"))?;