This is really kind of klugey (sp?) but it gets you (or at least me) about 
90% of the way towards turning HTML from web pages into TW5 mark-up. It 
attempts to convert most common markups including links, images and tables.

Someone who understood TW5 better would probably build a DOM tree 
structure, and then parse out the parts piece by piece. 

What I did was to simply apply a series of regular expressions. The problem 
with this approach is that mismatched tags can really throw the translation 
off the rails. So use at your own risk. You should check to make sure that 
all original content is still present. You are likely to need to adjust 
bullets and tables. It's likely that certain situations I haven't thought 
of will break it more severely.

Maybe this will be an incentive for someone to come up with something 
better ;-)

As always, make sure that you have a backup of any TW you try this in. Just 
import the attached json and then reload your TW file. Put your HTML 
contents in a designated tiddler. In the HTML2TW Launcher supply the name 
of the source tiddler and click on the convert button. The resulting 
mark-up should appear in the tiddler with the same name as the original 
tiddler plus "-converted" appended to the title..

Thanks to BJ, Eric, and Jed for helping me with the launcher.

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/543fe6f7-bc8e-4e91-8e49-8a30e342de46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: html2tw.json
Description: application/json

Reply via email to