mirror of
https://github.com/typst/typst
synced 2025-05-21 04:25:28 +08:00
Use inferred format extension for the output path (#2166)
This commit is contained in:
parent
6378bb1754
commit
8b465222b2
@ -22,9 +22,15 @@ type CodespanError = codespan_reporting::files::Error;
|
||||
impl CompileCommand {
|
||||
/// The output path.
|
||||
pub fn output(&self) -> PathBuf {
|
||||
self.output
|
||||
.clone()
|
||||
.unwrap_or_else(|| self.common.input.with_extension("pdf"))
|
||||
self.output.clone().unwrap_or_else(|| {
|
||||
self.common.input.with_extension(
|
||||
match self.output_format().unwrap_or(OutputFormat::Pdf) {
|
||||
OutputFormat::Pdf => "pdf",
|
||||
OutputFormat::Png => "png",
|
||||
OutputFormat::Svg => "svg",
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// The format to use for generated output, either specified by the user or inferred from the extension.
|
||||
|
Loading…
x
Reference in New Issue
Block a user