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

Word2007 Writer : Fixed first footnote appearing as separator #2635

Merged
merged 5 commits into from
Aug 14, 2024

Conversation

jacksleight
Copy link
Contributor

@jacksleight jacksleight commented Jul 24, 2024

Description

Fixes #2634

This issue is caused by conflicting w:ids in the footnote data:

<w:footnote w:id="0" w:type="continuationSeparator">
  <w:p>
    <w:r>
      <w:continuationSeparator/>
    </w:r>
  </w:p>
</w:footnote>
<w:footnote w:id="0">
  ...
</w:footnote>

The continuation separator and the first footnote have the same w:id.

I tested how Word saves these and the footnotes start with a w:id of 1 not 0, so I just added that offset. I don't know if that's necessarily the best way to fix it (this is my first PHPWord PR), can make any changes if needed.

I also added new assertions to the footnotes test, to check that a footnote with w:id 0 does not exist and 1 does, but again, not sure if this is the best way to do that check.

Checklist:

  • My CI is 🟢
  • I have covered by unit tests my new code (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes
  • I have updated the changelog

@coveralls
Copy link

coveralls commented Jul 24, 2024

Coverage Status

coverage: 97.01%. remained the same
when pulling 965f688 on jacksleight:fix/footnote-seperator
into 1691301 on PHPOffice:master.

@Progi1984 Progi1984 added this to the 1.3.0 milestone Aug 13, 2024
@Progi1984
Copy link
Member

@jacksleight Hi, thank you for your contribution.

Could you update the 2.0.0.md changelog, please ?

@jacksleight
Copy link
Contributor Author

@Progi1984 Ah yeah, that's done.

Copy link
Member

@Progi1984 Progi1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A last comment

docs/changes/2.x/2.0.0.md Outdated Show resolved Hide resolved
@Progi1984 Progi1984 changed the title Fix first footnote appearing as separator Word2007 Writer : Fixed first footnote appearing as separator Aug 13, 2024
@Progi1984 Progi1984 merged commit dbf0a3e into PHPOffice:master Aug 14, 2024
13 checks passed
@Progi1984
Copy link
Member

Thank you @jacksleight for your contribution

@jacksleight jacksleight deleted the fix/footnote-seperator branch August 14, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

First footnote displays as a black line with no number
3 participants