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

Conversion of OOXML to CiceroMark and vice versa #251

Closed

Conversation

algomaster99
Copy link
Member

Issue #247

Add package for converting OOXML <-> CiceroMark

Changes

  • initialize package
  • add function for converting OOXML to CiceroMark with proper tests
  • add function for converting CiceroMark to OOXML with proper tests

Copy link
Member

@jeromesimeon jeromesimeon left a comment

Choose a reason for hiding this comment

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

Why is this a different package from docx ?

@algomaster99
Copy link
Member Author

Oh, I just thought it was supposed to be a different package. One reason I can think of is that markdown-docx uses a path to a DOCX file which I think will install dependencies which might only work on Node and not on the browser. Mammoth works on the web too though.

@jeromesimeon
Copy link
Member

Oh, I just thought it was supposed to be a different package. One reason I can think of is that markdown-docx uses a path to a DOCX file which I think will install dependencies which might only work on Node and not on the browser. Mammoth works on the web too though.

I think it would make sense for all transforms to work on input data in memory and not depend on the file system? Maybe I'm missing something there.

Also, it would help to figure out if there are any differences between ooxml or docx before creating a whole new package.

@DianaLease @irmerk @dselman help here please?

@dselman
Copy link
Contributor

dselman commented Jul 9, 2020

Why is this a different package from docx ?

I think making this OOXML is more descriptive - as technically that is the (open) data format, vs docx which is the Microsoft proprietary file wrapper.

@algomaster99
Copy link
Member Author

@dselman But we will only be able to transform OOXML from Word Documents to CiceroMark. Other OOXML (for eg. from PowerPoint, Excel, etc.) will fail as it makes no sense.

@jeromesimeon
Copy link
Member

Why is this a different package from docx ?

I think making this OOXML is more descriptive - as technically that is the (open) data format, vs docx which is the Microsoft proprietary file wrapper.

Sounds like an argument for renaming the current package, not creating a new one?

Also, maybe I'm wrong but isn't a docx containing several xml files? (some of which may or may not be ooxml?).

@algomaster99
Copy link
Member Author

Also, maybe I'm wrong but isn't a docx containing several xml files?

@jeromesimeon OOXML file is just a zipped collection of all the XML files the Word contains as written here.

@jolanglinais
Copy link
Member

After discussing on a call, I think it would likely make the most sense to keep the code in markdown-docx instead of making a new package. In the future we can change the name if that makes sense... But based on @algomaster99's findings it seems like docx is the most descriptive at the moment.

This will get rid of mammoth and replace the current functionality with the implementation Aman creates.

@jolanglinais
Copy link
Member

@algomaster99 I think we wanted to keep it markdown-docx instead of markdown-ooxml

@algomaster99
Copy link
Member Author

@irmerk cool, I will try to integrate it there. Once I will do that, I will close this PR.

Copy link
Member

@jolanglinais jolanglinais left a comment

Choose a reason for hiding this comment

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

One thought I had going through the code:

Comment on lines +31 to +38
getId(elements) {
const variableProperties = elements[0]
for (const property of variableProperties.elements) {
if (property.name === 'w:tag') {
return property.attributes['w:val'];
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a case where getId() will not return anything, and you'd want to have a base case after the for loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

@irmerk I think every variable will have a corresponding ID so it ought to return something. And I am only calling this function when I parse w:sdt which are node types for content controls.

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.

4 participants