Add a bodyxml->content-tree converter#49
Conversation
|
API looks okay to me so far. the ones are gonna be interesting, I reckon there are ones that behave differently depending the attributes (e.g. flourish i think has type I guess that can still work though, we can return different things inside the transformer function depending on what the attribute is. |
| } else if ("children" in xmlnode) { | ||
| return { | ||
| ...ctnode, | ||
| // this is a flatmap because of <experimental/> |
i kept making the API more powerful and then stripping it away when none of the nodes i was working with needed the power. but it's possible that the transformer function needs to take a second arg of |
another option is to make the code more about mutating the existing tree than generating a new one. that's probably how we'd do this if we weren't javascript programmers. that code would look more like using unist-util-visit, with the return value being used to decide how or if to recurse. |
|
i should add some more tests. hopefully i can get a hold of some specialist content soon to use as a source of tests |
|
for more complicated transforms like the ones in cp we might need to provide the parent node to the transformer function as a second arg |
|
once this is merged i'll go ahead and enact the filesystem changes described in a comment on eli's PR because we've confirmed we can make that work using a then we can start working towards a world where this repo can publish packages. |
This is only made to deal with very simple articles so far that contain basic html content.
I need to do a little more research to understand what
<content type=contentand<content type=articleare.It passes the simple-post test but not the kitchen-snippet test.
The transformer API is fine, i guess. you write something like this:
if you return a children value, it'll recurse into the children of the xmlnode to make the children. if you return a
childrenvalue, it won't. if you returnchildren: nullit won't go to the children but also the children will be deleted from the node.hope u like it!