-
Couldn't load subscription status.
- Fork 10
Remove unzip and zip and use ZipArchives.jl instead
#31
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
==========================================
+ Coverage 94.62% 95.84% +1.21%
==========================================
Files 10 10
Lines 521 505 -16
==========================================
- Hits 493 484 -9
+ Misses 28 21 -7 ☔ View full report in Codecov by Sentry. |
|
I updated this PR to the latest version of main. @matthijscox-asml @jaakkor2 This PR also resolves the problems in #47. With this PR there is no need to mess with file permissions or directories because everything stays as zip files. |
That would be another good reason to go with your changes :) But you do not expect issues with editing the zip files, if the zip file is read-only from the Pkg.add ? |
|
In this PR the only thing I do with the template file is To avoid changing an existing zip file, I keep track of two separate zip file objects when writing the presentation. One is The other is
update_presentation_state!(p, template_reader)
write_relationships!(w, p)
write_presentation!(w, p)
write_slides!(w, p, template_reader)
write_shapes!(w, p)
update_table_style!(w, template_reader)
add_contenttypes!(w, template_reader)Then only after all of the files that needed to be edited were written, do I copy over all other files from the template that are not yet in # copy over any files from the template
# but don't overwrite any files in w
for i in zip_nentries(template_reader):-1:1
local name = zip_name(template_reader, i)
if !endswith(name,"/")
if !zip_name_collision(w, name)
local compress = zip_iscompressed(template_reader, i)
zip_data = zip_readentry(template_reader, i)
zip_newfile(w, name; compress)
write(w, zip_data)
zip_commitfile(w)
end
end
endIn this way no zip file entry needs to be edited or deleted, only read and append operations are needed. |
|
okay, i agree this looks good! hmm, I've decided to go with it. do you want to do a release 1.0 of ZipArchives.jl first before merging this? |
|
Sure, I'll make sure to do that. Thanks for reviewing this. |
I removed some functions from ZipArchives.jl in JuliaIO/ZipArchives.jl#43 that are not needed by PPTX.jl to reduce the complexity. No changes to PPTX.jl should be needed.
|
I was ill for a while so this took a bit longer than expected. I see that there's a silly error in the docs test that needs a fix (although I don't know why it suddenly needs If you want you can also update the Project.toml and bump it to v0.7.0, then I'll register a new version after merging this PR. |
Fixes #14 by using ZipArchives.jl
ZipArchives.jl is a new package I made to read Zarr data, and it works for PPTX as well.
Lastly, in this PR I removed the ability to use template directories, only files are allowed.