News:

Rings of Reznor!

Main Menu

Random Board Utility

Started by stumpy, March 24, 2009, 09:42:34 AM

Previous topic - Next topic

stumpy

Well, some may have noticed that I finally got off my butt and copied over the Game FAQ to the new board. (It was getting annoying that I wanted to update it and I couldn't. Also, it really depends heavily on internal links that don't point to the right place now that the archive is at a different place.)

That thread was very heavily formatted - to the point where I really, really didn't want to copy-paste it over as text and then have to re-format all of the different italics, colors, lists, code tags, tables, etc. Tedious tasks like that are the sort that I never get around to doing.  <_<

But, once in a great while I have been known to do some coding... So, I hacked together some python code to read the HTML of an Archived FR thread and change it back to BB Code so that it can be re-posted in a new thread. (Did that take longer than the tedious hand re-formatting would have? Yeah. But, the code uses iterative recursion to handle multiply nested quote and code blocks. I'm not made of stone, man! :lol:)

Anyway, we've been up long enough now that it's not going to be a big issue, but there may be a couple of informative posts, tutorials, etc. on the archive that people would like to add to without wanting to recreate their intricate work. So, in case anyone else is interested, the code I used is below.

[edit]Okay, in a bit of semi-irony, my code that coverts HTML back into SMF BB Code can't itself be posted on this board! (Probably because the code contains the [code] tags.) Anyway, here is a download link to FRPostConvertHTML2BBCode.py.

To use it, save the link above to a file, then open the code in your favorite python editor (e.g. PythonWin). Then just add the right string to the PageLocation = line beneath the opening comments. It can take either a URL or a path name for a file, useful if you have saved the thread as a web page. When you run the code, it will print out the postable BB code.

BTW, I only tested this on a few pages, since my principle aim was to do the Game FAQ. I only handled the common tags I know about and see used, though our SMF-powered board offers many (glow, move, etc.) that I didn't bother with. And, it is quite likely that there are some tricky pages or pages that it can't do properly because of regional differences (dates display differently where I am then elsewhere) etc. Buyer beware...  :P
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

Epimethee

Nice! Reformatting by hand is one of the punishments sufferred in Hell, they say. And thanks for the the Phœnix rebirth of the FAQ. :)
FFX add-on for FFvsTTR at ffx.freedomforceforever.com

stumpy

The FAQ shall always be reborn!  :P

Yeah, I started thinking about bringing over the FAQ when I saw you had brought over the FFX bug reporting thread, which must have been a task on its own. Every time I looked at the FAQ, with its embedded links, lists, colors, etc. I just cringed.  :(  Finally, I decided writing a translator would be more bearable than all that format tweaking.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg