pydocx icon indicating copy to clipboard operation
pydocx copied to clipboard

office Open xml: shared_math

Open IuryAlves opened this issue 8 years ago • 5 comments

Hi, I spent some time writing the tags that is used with equations. This is not complete yet, but maybe is a good start to create a docx to latex exporter.

I also noticed that there is a issue (#49) to enable equations, but it is stopped for a long time. I would like to continue contributing to make this possible.

IuryAlves avatar Apr 23 '16 03:04 IuryAlves

Hello iury,

Thanks for the PR! We would love to have support for equations.

Would you be willing to implement at least some of these models in an exporter (preferably HTML), or perhaps write a separate exporter that adds support for these? We'd also love to have some basic smoke tests covering a .docx file with a mix of math and normal content, along with some XML tests covering all of the added models. It doesn't need to cover all of the corner cases or achieve full coverage, but in order to maintain this going forward, we need at least "happy path" coverage.

Thanks again! -Wes

winhamwr avatar Sep 14 '16 16:09 winhamwr

@winhamwr sure. I will do it.

IuryAlves avatar Sep 15 '16 01:09 IuryAlves

@winhamwr Sorry for the delay. I've come to realize that there are many cyclic import issues in my pull request. For example:

<m:acc>
  <m:e>
    <m:acc/>
  </m:e>
</m:acc>

This becomes the following:

# accent.py
from pydocx.openxml.shared_math.element import Element
# element.py
from pydocx.openxml.shared_math.accent import Accent

I am wondering what is the best solution for this problem.

IuryAlves avatar Nov 13 '16 21:11 IuryAlves

@IuryAlves you can use a string to avoid the circular import, kind of like with Django's model syntax. here is an example.

winhamwr avatar Nov 14 '16 15:11 winhamwr

Thanks @winhamwr

IuryAlves avatar Nov 14 '16 20:11 IuryAlves