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

fix #596: make layout_summary() layout order correspond to order in PPTX file #598

Merged

Conversation

markheckmann
Copy link
Contributor

@markheckmann markheckmann commented Sep 2, 2024

Fixes #596. All tests are passed. Coverage of new functions is 100%.

Changes

The layout order in layout_summary() now corresponds to the layout order in the PPTX file, also in case of multiple masters.

url <- "https://github.com/user-attachments/files/16825504/many_layouts.pptx"
file <- tempfile(fileext = ".pptx")
download.file(url, file)
x <- read_pptx(file)
layout_summary(x) 

              layout   master
1        Title Slide Master_1
2  Title and Content Master_1
3     Section Header Master_1
4        Two Content Master_1
5         Comparison Master_1
6         Title Only Master_1
7              Blank Master_1
8           layout_8 Master_1
9           layout_9 Master_1
10         layout_10 Master_1
11         layout_11 Master_1

Technical

In class dir_collection, the files are now added to a container in the order of their trailing numeric index. For example, slideLayout2.xml will now preceed slideLayout10.xml. Before, alphabetical sorting was used, where
slideLayout10.xml comes before slideLayout2.xml.

In class `dir_collection`, files are added to a container during
initialization using alphabetical sorting. This caused the slide
layout order to deviate from the one in the PPTX file, for example,
when calling layout_summary(). Files are now added to a container
in the order of their trailing numeric index. For example,
`slideLayout2.xml` will now preceed `slideLayout10.xml`. Before,
alphabetical sorting was used, where `slideLayout10.xml` comes before `slideLayout2.xml`.
@davidgohel
Copy link
Owner

thanks a lot for your work !

@davidgohel davidgohel merged commit 443b833 into davidgohel:master Sep 2, 2024
3 checks passed
@markheckmann markheckmann deleted the issue_596_layout_summary_sorting branch September 2, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

layout_summary() layout order deviates from layout order in PPTX file
2 participants