refactor ppt
This commit is contained in:
parent
bda5c933a3
commit
4bd44ec4b5
3 changed files with 3 additions and 12 deletions
|
|
@ -9,11 +9,10 @@ type exportExtension string
|
|||
const GIF exportExtension = ".gif"
|
||||
const PNG exportExtension = ".png"
|
||||
const PPTX exportExtension = ".pptx"
|
||||
const PPT exportExtension = ".ppt"
|
||||
const PDF exportExtension = ".pdf"
|
||||
const SVG exportExtension = ".svg"
|
||||
|
||||
var SUPPORTED_EXTENSIONS = []exportExtension{SVG, PNG, PDF, PPTX, GIF, PPT}
|
||||
var SUPPORTED_EXTENSIONS = []exportExtension{SVG, PNG, PDF, PPTX, GIF}
|
||||
|
||||
func getExportExtension(outputPath string) exportExtension {
|
||||
ext := filepath.Ext(outputPath)
|
||||
|
|
|
|||
|
|
@ -57,14 +57,6 @@ func TestOutputFormat(t *testing.T) {
|
|||
requiresAnimationInterval: false,
|
||||
requiresPngRender: true,
|
||||
},
|
||||
{
|
||||
outputPath: "/out.ppt",
|
||||
extension: PPT,
|
||||
supportsDarkTheme: false,
|
||||
supportsAnimation: false,
|
||||
requiresAnimationInterval: false,
|
||||
requiresPngRender: false,
|
||||
},
|
||||
{
|
||||
outputPath: "/out.pdf",
|
||||
extension: PDF,
|
||||
|
|
|
|||
|
|
@ -187,10 +187,10 @@ func Run(ctx context.Context, ms *xmain.State) (err error) {
|
|||
inputPath = filepath.Join(inputPath, "index.d2")
|
||||
}
|
||||
}
|
||||
outputFormat := getExportExtension(outputPath)
|
||||
if outputFormat == PPT {
|
||||
if filepath.Ext(outputPath) == ".ppt" {
|
||||
return xmain.UsageErrorf("D2 does not support ppt exports, did you mean \"pptx\"?")
|
||||
}
|
||||
outputFormat := getExportExtension(outputPath)
|
||||
if outputPath != "-" {
|
||||
outputPath = ms.AbsPath(outputPath)
|
||||
if *animateIntervalFlag > 0 && !outputFormat.supportsAnimation() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue