occulens

ENML to HTML converter

19 posts in this topic

I am working on an ENML to HTML converter that will take non-html tags and try to convert them to HTML. I am in the process of writing this in python. If anyone knows of a tool that already does this, I'd like to know about it. Thanks!

2 people like this

Share this post


Link to post

Good luck with this: What's in the CDATA is most of what you need. If you're sensible about the kinds of content you include (probably excluding sound) it shouldn't be too hard to do. When I've parsed ENML with Python I've used normal string processing to find the CDATA and extract it. THAT can then be put through whatever XML parsing package you want and tree-walked to do the conversion.

(And the reason I didn't complete is because my personal use cases are more about creating notes. And in any case restrictions on Intellectual Capital at my employer would've made it difficult to share the results.)

Martin

Share this post


Link to post

If you have already written a ENML parser in Python, then I would like to port it to JS (npm module). Let's get in sync.

Share this post


Link to post

If the ENML parser is available, I would also like to port it, to Java. Please let me know. Thanks!

Share this post


Link to post

I would love a converter from HTML to ENML :) Not just ENML to HTML. Just my two cents. I might see if I can make it myself using the converter you posted, but will see what I can do.

1 person likes this

Share this post


Link to post

I'm not sure if Alex referring the the Objective-C mentioned by Mustafa or the Java one I posted on GitHub.

Anyway I'm currently improving the Java one to convert from valid XHTML to ENML. It should be ready in a week or so.

 

Does the possibility to create Notes directly in HTML works also with the Java SDK ? If not is a planned feature ?

2 people like this

Share this post


Link to post

I was meaning the objective-c SDK. I'm writing my own right now.

Share this post


Link to post

I'm not sure if Alex referring the the Objective-C mentioned by Mustafa or the Java one I posted on GitHub.

Anyway I'm currently improving the Java one to convert from valid XHTML to ENML. It should be ready in a week or so.

 

Does the possibility to create Notes directly in HTML works also with the Java SDK ? If not is a planned feature ?

 

This is an iOS only feature as of now.

Share this post


Link to post

Pierre, did you ever finish that XHTML to ENML convertor in Java?  I forked your ENML to XHTML convertor so I could remove the evernote SDK dependency and simplify the API.  You can see it here: https://github.com/jlaws/enml4j

 

Let me know if you have finished/started the XHTML to ENML convertor and/or if you want some help finishing it.

 

-Joe

Share this post


Link to post

Pierre, did you ever finish that XHTML to ENML convertor in Java?  I forked your ENML to XHTML convertor so I could remove the evernote SDK dependency and simplify the API.  You can see it here: https://github.com/jlaws/enml4j

 

Let me know if you have finished/started the XHTML to ENML convertor and/or if you want some help finishing it.

 

-Joe

 

Hi,

 

I saw your fork on GitHub. Thanks for the bug fixes ! I'll merge them into my code.

I'll keep the dependency on the Evernote API though as it's more convenient for my usage.

 

I didn't started the XHTML to ENML convertor as I don't really need it for my project so far.

But I can do it if you are interested in using it.

I won't be able to that quickly though as I'm currently quite busy with my job. Probably a matter of weeks.

 

So far here is the state of my thinking about this:

  • We'll propably have to limit the input to valid XHTML only. It would be possible to clean dirty html outside of the library with http://htmlcleaner.sourceforge.net/ or JTidy.
  • The convertion of <html>, <head>, <img> should be pretty straight forward
  • There is quite a lot of valid XHTML tag not supported by Evernote. A very long part of the work to do would be to defined what we want to do with this unsupported tags, either ignoring them or converting them.

I can put the conversion rules in Convertor based on a HashMap. This way it would be easy to parameter the library to define which XHTML tag as to be ignored or mapped and to which ENML it has to be mapped.

 

Let me know if you prefer to do it. In that case I'll be more than welcome to help you.

1 person likes this

Share this post


Link to post

I created a Clojure ENML->HTML converter, using some hints from Pierre-Denis' Java library (thanks for that by the way!) I added it to the Clojure Evernote library I'm working on, which is at https://github.com/mikebroberts/clojurenote (And the ENML translation specific part is at https://github.com/mikebroberts/clojurenote/blob/master/clojurenote/src/clojurenote/enml.clj).

 

I don't plan on working on general HTML->ENML conversion since I don't require it.  

1 person likes this

Share this post


Link to post