Skip to content

sync with upstream#66

Merged
aleksandarbos merged 91 commits intomasterfrom
aleksandarbos/sync-with-upstream
Dec 26, 2019
Merged

sync with upstream#66
aleksandarbos merged 91 commits intomasterfrom
aleksandarbos/sync-with-upstream

Conversation

@aleksandarbos
Copy link
Copy Markdown

Description (e.g. "Related to ...", "Closes ...", etc.)

Code review checklist

  • Private platform tests at core/tests/test_python-docx are updated and passing
  • If this change is going to be deployed on Cloudsmith after merge, python-docx version number should be increased

Steve Canny and others added 30 commits July 26, 2016 21:11
While this may not work in all cases, it is less ugly than arbitrarily
boosting the id value as suggested. A general-case fix will have to wait
for access to headers and footers. It definitely reduces the likelihood
of a collision.
* Also take care of a pesky warning from pytest when getting style by
  id.
Python 2.6 seems to be no longer supported on travis.ci so we're letting
it drop here. We're retaining testing on 2.6 in tox for now though.
In preparation for moving to Python Black for standardized code layout,
get the custom element mappings closer to Black style layout.
To access header and footer parts, Section will need the document part
and the source for that will be its Sections parent proxy. Add
document_part as construction parameter for Sections and modify tests to
suit.
* Modernize section unit test fixtures while in there.
scanny and others added 24 commits January 6, 2019 14:26
This is essentially migrated "up" from DocumentPart, which now
subclasses BaseStoryPart.
Also extract Package.get_or_add_image_part() to avoid BaseStoryPart and
others having to know about ImageParts.
Add some namespace-prefix mappings that arise for the first time in
headers.
Add scenarios for Section.different_first_page_header_footer.
In preparation for adding even-page and first-page header and footer
properties, pass the WD_HEADER_FOOTER_INDEX member identifying the
header or footer type (primary, first, even) to _Header and _Footer on
construction. This will allow each of these classes to serve for all
three header/footer types.
The implementation of `Document.add_section()` "clones" the previously
last `w:sectPr` element to produce the `w:sectPr` for the new section.
This has the effect of duplicating the header and footer references
along with the rIds used to link them to their header or footer part.

There have been no reports that this causes a problem, but in any case
the correct behavior is to add a new section without any header or
footer definitions, such that the new section "inherits" all
header/footer definitions (and header/footer parts are not "reused").

Add code to remove all `w:headerReference` and `w:footerReference`
elements from a "cloned" `w:sectPr` element when adding a section.
Maintaining the default document template as a directory allows its
individual parts (XML files) to be curated like code, with line-changes
tracked by Git.

Extract the default template to a directory and load that directory as
the default when no template document is specified to the `Document()`
constructor.

Also add Header and Footer styles.
Also some pending documentation updates and some Black changes.
@aleksandarbos aleksandarbos merged commit 08eff31 into master Dec 26, 2019
@aleksandarbos aleksandarbos deleted the aleksandarbos/sync-with-upstream branch December 26, 2019 18:00
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.

6 participants