rename and docs
This commit is contained in:
parent
f0adecf1dc
commit
eb2518c0e4
4 changed files with 14 additions and 10 deletions
|
|
@ -35,7 +35,7 @@ import (
|
||||||
"oss.terrastruct.com/d2/lib/pdf"
|
"oss.terrastruct.com/d2/lib/pdf"
|
||||||
pdflib "oss.terrastruct.com/d2/lib/pdf"
|
pdflib "oss.terrastruct.com/d2/lib/pdf"
|
||||||
"oss.terrastruct.com/d2/lib/png"
|
"oss.terrastruct.com/d2/lib/png"
|
||||||
"oss.terrastruct.com/d2/lib/ppt"
|
"oss.terrastruct.com/d2/lib/pptx"
|
||||||
"oss.terrastruct.com/d2/lib/textmeasure"
|
"oss.terrastruct.com/d2/lib/textmeasure"
|
||||||
"oss.terrastruct.com/d2/lib/version"
|
"oss.terrastruct.com/d2/lib/version"
|
||||||
|
|
||||||
|
|
@ -368,7 +368,7 @@ func compile(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, rende
|
||||||
if user, err := user.Current(); err != nil {
|
if user, err := user.Current(); err != nil {
|
||||||
username = user.Username
|
username = user.Username
|
||||||
}
|
}
|
||||||
p := ppt.NewPresentation(rootName, rootName, rootName, username, version.Version)
|
p := pptx.NewPresentation(rootName, rootName, rootName, username, version.Version)
|
||||||
err := renderPPTX(ctx, ms, p, plugin, renderOpts, outputPath, page, diagram, nil)
|
err := renderPPTX(ctx, ms, p, plugin, renderOpts, outputPath, page, diagram, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
|
|
@ -759,7 +759,7 @@ func renderPDF(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, opt
|
||||||
return svg, nil
|
return svg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderPPTX(ctx context.Context, ms *xmain.State, presentation *ppt.Presentation, plugin d2plugin.Plugin, opts d2svg.RenderOpts, outputPath string, page playwright.Page, diagram *d2target.Diagram, boardPath []string) error {
|
func renderPPTX(ctx context.Context, ms *xmain.State, presentation *pptx.Presentation, plugin d2plugin.Plugin, opts d2svg.RenderOpts, outputPath string, page playwright.Page, diagram *d2target.Diagram, boardPath []string) error {
|
||||||
var currBoardPath []string
|
var currBoardPath []string
|
||||||
// Root board doesn't have a name, so we use the output filename
|
// Root board doesn't have a name, so we use the output filename
|
||||||
if diagram.Name == "" {
|
if diagram.Name == "" {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package ppt
|
package pptx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
|
|
@ -1,4 +1,13 @@
|
||||||
package ppt
|
// pptx is a package to create slide presentations in pptx (Microsoft Power Point) format.
|
||||||
|
// A `.pptx` file is just a bunch of zip compressed `.xml` files following the Office Open XML (OOXML) format.
|
||||||
|
// To see its content, you can just `unzip <path/to/file>.pptx -d <folder>`.
|
||||||
|
// With this package, it is possible to create a `Presentation` and add `Slide`s to it.
|
||||||
|
// Then, when saving the presentation, it will generate the required `.xml` files, compress them and write to the disk.
|
||||||
|
// Note that this isn't a full implementation of the OOXML format, but a wrapper around it.
|
||||||
|
// There's a base template with common files to the presentation and then when saving, the package generate only the slides and relationships.
|
||||||
|
// The base template and slide templates were generated using https://python-pptx.readthedocs.io/en/latest/
|
||||||
|
// For more information about OOXML, check http://officeopenxml.com/index.php
|
||||||
|
package pptx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
|
|
@ -9,11 +18,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: comments / references / assumptions
|
|
||||||
// TODO: update core files with metadata
|
|
||||||
// TODO: links?
|
|
||||||
// TODO: appendix?
|
|
||||||
|
|
||||||
type Presentation struct {
|
type Presentation struct {
|
||||||
Title string
|
Title string
|
||||||
Description string
|
Description string
|
||||||
Loading…
Reference in a new issue