mirror of
https://github.com/typst/typst
synced 2025-05-21 20:45:27 +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 {
|
impl CompileCommand {
|
||||||
/// The output path.
|
/// The output path.
|
||||||
pub fn output(&self) -> PathBuf {
|
pub fn output(&self) -> PathBuf {
|
||||||
self.output
|
self.output.clone().unwrap_or_else(|| {
|
||||||
.clone()
|
self.common.input.with_extension(
|
||||||
.unwrap_or_else(|| self.common.input.with_extension("pdf"))
|
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.
|
/// 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