If you follow me on Google+ or Twitter (or LinkedIn), you’ll have seen a lot of posts from me lately, mostly reposts of older articles, in a giant flood of content. I apologize for that – I guess I’d not really thought a whole lot of the social media impact of all of the data at once.
However, one thing I’ve been doing has been of interest, and is actually new: namely, I wrote a tool to help me repost all that stuff, using JavaFX.
The format of the data is XML, so the actual content is all escaped HTML; that’s a pain. So I figured, why not write an app that does the conversion for me? It couldn’t take long (less time than finding a pre-existing app, maybe?) and could be fairly interesting.
Initially I’d thought of using Swing, but then it occurred to me: why not try JavaFX? I’ve never used it, and it might be fun.
So I give you the fruits of my (miniscule) efforts: Convert-to-HTML, hosted on GitHub, licensed under the ASLv2.
It’s horribly simple: two text areas, two buttons. The top text area is where you paste in escaped HTML, and when you press the “convert” button, it fills the bottom text area with the converted text, and selects all of the text as well (so all you have to do is tell your desktop environment to copy the content.)
There’s also a “clear” button that clears all content and sets focus to the top text area.
It really is quite simple, maybe 30 lines of code, total. JavaFX isn’t being leveraged much; I might consider an HTML preview at some point (it’d be nice to validate the translation), but it really isn’t something that needs JavaFX. With that said, JavaFX didn’t get in my way, which was nice.
It’s also not very efficient for large blocks of content; I had to use it for each reposted article, which was a drag.
I have another series to convert (as articles, not blog posts, so the content shouldn’t spill out over social media); I’m likely to write a command-line app to process the XML (and automatically post it) so I can process the entire series in bulk, instead of doing it piecemeal.
Of course, it might be quicker just to do it manually…