Comments (8)
Yes you are right with clearVariables(). Could you find a class with has an implementation in clearVariables()?
Yes I think deprecating XmlUnit; and combining it into one class is a good idea.
Wow yes, I like the idea of using XmlComponent<Properties>
will be much cleaner.
Regarding the JSON.parse thing, At the time it was quick and understandable to me. Will the new implantation of the formatter be easy to read? I don't mind sacrificing some efficiency for readability. Don't want to overengineer the problem.
from docx.
Almost there with the first part, but yes, I think it will be much easier to understand actually. Something like:
formatComponent(comp) {
const ret = {};
ret[comp.rootKey] = comp.root.map.forEach(subComp => {
if (subComp instanceof XmlComponent)
return formatComponent(comp);
else // Must be a string
return comp
});
return ret;
}
(Or something like that -- I just wrote that quickly in the ocmment box)
from docx.
is it possible to have the format like the clearVariables() kind of style? I say this because then the format logic for each component can be inside the component itself, which could make it very clean. Just a thought.
Also, we should use native for-of rather than lodashes version (foreach)
from docx.
I like that idea! How about giving elements a .toXml
method? We'd only have to implement it for XmlComponent
and XmlAttributeComponent
from docx.
Yeah a .toXml() method is perfect. Nice and descriptive
from docx.
I am looking into the tests now, there is the jsonify()
method which does JSON.parse/JSON.stringify
I am moving that out into a Utility class because its copied and pasted everywhere.
This got me thinking, surely we would need JSON.parse/JSON.stringify
in the formatter as well then?
from docx.
Wow, I just saw you did this:
expect(tree).to.deep.equal({
"w:spacing": [{_attr: {"w:before": 100}}],
});
which eliminates the need for the jsonify()
method? Epic stuff
from docx.
Closed with #14
from docx.
Related Issues (20)
- Repeat header in row HOT 1
- Attempted import error: 'Packer' is not exported from 'docx' (imported as 'Packer'). HOT 7
- Packer.toBuffer error in browser: nodebuffer not supported by this platform HOT 1
- Lists - instance not working with level greater than 0
- ExternalHyperlink renders empty line HOT 3
- tableHeader repeats row only if declared on the first row in a table
- el.elements not iterable when patching comments
- can not set indent by chars HOT 2
- Adding different numbering within the same line of paragraph HOT 12
- Field Codes in SimpleField Formulas HOT 1
- Corrupt Word document from patching with an XML attribute with an ampersand HOT 3
- After Patching, Following Text is Wrong Font Family HOT 1
- Possibility of adding hanging without affecting left indent of the paragraph.
- `PageNumber.TOTAL_PAGES_IN_SECTION` not documented and not functional, but within TS enum HOT 2
- Colors are not showing properly HOT 2
- When I open a document using WPS office, the width of the table cannot fill the entire page HOT 2
- Add accent characters
- The MathIntergral limLoc seems to be wrong
- Doesn't work with bg-black HOT 1
- Couple issues with embedded fonts HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docx.