Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bake in default tableStyles.xml to improve PackageCompiler.jl support #51

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/constants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ const TESTDATA_DIR = abspath(joinpath(@__DIR__, "..", "test/testdata"))

# we use layoutSlide1 for the first title slide, and layoutSlide2 for all other slides
const TITLE_SLIDE_LAYOUT = 1
const DEFAULT_SLIDE_LAYOUT = 2
const DEFAULT_SLIDE_LAYOUT = 2

include_dependency(joinpath(TEMPLATE_DIR, "tableStyles.xml"))
const DEFAULT_TABLE_STYLE_DATA = read(joinpath(TEMPLATE_DIR, "tableStyles.xml"))
10 changes: 3 additions & 7 deletions src/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,9 @@ function update_table_style!(w::ZipWriter, template::ZipBufferReader)
table_style_path = "ppt/tableStyles.xml"
table_style_doc = EzXML.parsexml(zip_readentry(template, table_style_path))
if has_empty_table_list(table_style_doc)
table_style_filename = "tableStyles.xml"
default_table_style_file = joinpath(TEMPLATE_DIR, table_style_filename)
open(default_table_style_file) do io
zip_newfile(w, table_style_path; compress=true)
write(w, io)
zip_commitfile(w)
end
zip_newfile(w, table_style_path; compress=true)
write(w, DEFAULT_TABLE_STYLE_DATA)
zip_commitfile(w)
end
nothing
end
Expand Down
3 changes: 3 additions & 0 deletions test/testWriting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ end
# the dark theme contains this node, which is named "<a:clrScheme name=\"Office\">" in the original theme
str = zip_readentry(output_zip, theme_file, String)
@test contains(str, "<a:clrScheme name=\"Office Theme\">")

# make sure table styles are not empty
@test PPTX.DEFAULT_TABLE_STYLE_DATA == zip_readentry(output_zip, "ppt/tableStyles.xml")
end
end

Expand Down
Loading