As some of you may have noticed, I’ve been working on documentation for the WPMU DEV plugins and themes. Part of the documentation on the primary page for each plugin consists of a, expandable/collapsible tree (an unordered list with glyphs) listing the contents of the plugin folder. Now, generating this by hand has been a relatively easy task for most of the plugins. However, last night I began working on the documentation for Snapshot and quickly realized creating the directory listing by hand would be incredibly cumbersome (Snapshot contains 709 items). I did some Google searches, but wasn’t able to find any online tools for converting a plain text list to an HTML list. I did find several python scripts and other miscellaneous scripts to do it, but what I wanted was (and what I’m sure others could use is) a JavaScript-based tool for doing so.
After a bit more research, I found a CoffeeScript which did (mostly) what I needed, but it had some bugs and turned out to be almost unusable. I spent a few hours working on the issue, and eventually posted over on StackOverflow. A helpful StackOverflow user was able to craft a script to do exactly what I wanted (i.e., converted an indented plain-text list to a properly marked-up HTML list).
I’ve created a temporary home for the script (while I work on a more permanent page to host it) here. n.b., if you plan on bookmarking the script for later use, please bookmark the shortlink (i.e., http://z13.me/HTML-ListGenerator ) not the actual location (which will be changing in the near future).
I figure this will be useful to other members of the community. At least I find myself having to convert lists into HTML with relative frequency. This is a far easier (and far faster) solution than manually coding lists each time they are needed.