Skip to content

Improving test and bug fixing in TextElement.get_text()

Devillez Louis requested to merge ldevillez/extensions:fix_get_text into master

What does the merge request do?

@olafur found that my previous MR (!584 (merged)) about the get_text() function did some problems to Gcodetools (#inkscape#4779). He wrote some tests (!619 (closed)) which were incorporated and adapted in this MR.

closes #inkscape#4779 closes !619 (closed)

Implementation notes

  • Removing the tail of the main text element and removing the strip from the tests
  • The tags title and desc were completely ignored as they are not displayed in inkscape. The problem was that their tail were also ignored. Now we iterate over all the children of the text element, get only the text from text and tspan tags and get the tail from every child
  • Tests from @olafur were incorporated but adapted to not get the text of textand `tspan

Summary for release notes

Fixing get_text for text elements

Checklist

  • Add unit tests (if applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history

Merge request reports