Cracking the Code

A forum for discussion of the front-page blog posts on the Wongery.
Post Reply
Clé
Posts: 111
Joined: Thu Dec 20, 2012 12:41 pm

Cracking the Code

Post by Clé »

D minus five days and counting...

As I've said several times before, the Wongery is not currently anywhere near where I wanted it to be by the time of the hard launch, and given that I have only five days remaining it certainly won't be by the time of said launch. While I'm not going to get everything done that I wanted to before the hard launch, or even a significant fraction of what I wanted to get done, there are a few things that I want to prioritize. Even if I don't get anything else done before the hard launch, I want to focus on these. Here's a list of the most important things I most want to get done on the website before the hard launch:
  • Implementing custom namespaces and subspaces: the Gamespace, Buildspace, etc.
  • Implementing a
    BBcode to parse wikitext in forum posts.
  • Updating the layout of the base site (that is, the part of the site that isn't the forum or a wiki). Including maybe finally making a title graphic—though that probably won't happen before the hard launch.
  • Putting up at least some rough maps of some of the Wongery worlds in the corresponding articles.
  • Fixing the 404 page (there is a 404 page currently, but I think there's something going on with the interaction .htaccess and the directory structure and it's kind of buggy and doesn't always work).
  • Editing old articles and blog posts to fix typos and Meta:links, resolve contradictions, and update vocabulary.
There are also a few things I want to get done that aren't directly related to work on the website itself. For example, I intend to register a copyright on all the material currently on the Wongery. By current IP law, works are automatically copyrighted from the moment they're created even if that copyright isn't officially registered, but there are advantages to registering; among other things, it makes it easier to prove your copyright, if it comes to that, and may be required in order to collect damages (not that I expect that to ever be an issue). Also, I still intend to move the Wongery to a separate hosting plan, just in case someone thinks to compare the IP address with that of one of my other websites and so figure out my identity that way. Not that this is at all likely to happen; while I do have several other websites, they're all obscure and unvisited, and the chances of anyone curious about my real identity even knowing about my other sites, let alone connecting them to the Wongery, are pretty much negligible. Still, I want to do this anyway, because... well, okay, for no good reason at all, I guess.

But let's focus for now on the items in the list. The first one is... maybe the most urgent? It's also going to be by far the most difficult, though, and I admit I haven't really started on it yet... except insofar as maybe creating another extension sort of helped me learn the basic ropes of how MediaWiki extensions work. The last item is also fairly urgent, but is also going to be the most enjoyable to do—not that I find copyediting particularly entertaining, but it will be sort of fun to go through and revisit all the old articles. Anyway, I'm going to save that one for last; I know how I'm spending my New Year's Eve. (I have no life.)

So that leaves the middle three items. And of those, the one that I've been spending the most time on today is the second: implementing a
BBcode to parse wikitext in forum posts. This, of course, involves writing a phpBB extension, and, as with the RandomRules extension I wrote for MediaWiki, my phpBB extension is publicly available on Github. You can get it at https://github.com/ClaySalvage/Wikitext.

You can, but you probably shouldn't, because it doesn't work.

Okay, I hope I'm not being too optimistic in revising that sentence to say it doesn't work yet. It doesn't work at the time I'm making this post. I'm going to keep on it, though, and hopefully it will be working by tomorrow. It's at about the same stage currently as, well, as my RandomRules extension was at the time I wrote the blog post about it: it's installed; it doesn't break the forum; but it doesn't actually do anything.

Well, that's not strictly true. It does replace the
BBCode tags by <span></span> HTML tags, which I guess isn't technically doing nothing. But it doesn't actually parse any wikitext between those tags, which is the whole point of what it's supposed to do.

Even getting it to this stage was a chore, because, well, I had a lot of trouble figuring out how phpBB extensions worked at all. I said before that I found the documentation for creating MediaWiki extensions "confusing and elliptical", but compared to the documentation for creating phpBB extensions the former was a model of comprehensivity and clarity. Although, as I said with the MediaWiki extensions, this is likely more due to my lack of coding skills and experience than it is due to any fault in the documentation itself; it's very possible that the documentation is perfectly clear and comprehensible to capable programmers, of which I am not one. There is a tutorial for writing phpBB extensions, but it was (for me) very difficult to follow, and seemed to me to take a lot for granted and leave out a lot of vital information, though, again, the information it left out is probably so obvious to skilled programmers that it didn't really need to be included.

I thought maybe if I could find an existing extension, I could try to pattern mine after it. After all, what I wanted to do was ultimately very simple, n'est ce pas? All I wanted to do was implement a new BBCode. Surely this was something that many people had done previously. Surely there were many such existing extensions I could examine.

And there were, sort of. The phpBB Customization Database had a whole category for custom BBCodes. And some of them looked like they should be very simple—a custom BBCode tag for subscript text; a custom BBCode tag for keyboard shortcuts; a custom BBCode tag to put visible anchors in text... these all seemed like things that should be simple enough that it shouldn't be too hard to understand the code and modify it for my needs. However, I ran into an immediate problem. When went to the detail page for any of these customizations, I couldn't find download link. I thought maybe the downloads were only available to logged-in users, so I went ahead and created a forum account, but I still didn't see any way to download the extensions. It took me far too long to realize the reason that in retrospect should have been obvious: the reason there was no download link was because there was nothing to download. These weren't extensions; they were just text to be copied into the fields to set up custom BBCode in the Adminstrator Control Panel.

Okay. So what I needed was to find an example of a custom BBCode that was complicated enough that it couldn't be implemented just through an HTML replacement and would need to run some actual PHP code, but would hopefully be simple enough I could understand it. With some searching, I found one that might fit the bill: an extension called imgsize that added attributes to the default [img] BBCode tag. Granted, this was modifying the functionality an existing BBCode rather than creating a new one, but I had by now figured out how to implement a new BBCode tag through the ACP (and I would later find an example of how to do that within the extension), so I thought implementing the functionality of my
tag should work the same way.


Except it apparently doesn't. The function that's supposed to be called to parse the wikitext isn't getting called. I'm not sure what's going wrong, but then I don't really understand what the code is doing in the first place; I'm just more or less copying that other extension, and apparently there's something sufficiently different about what I'm trying to do that I can't use exactly the same technique.

So that's where I'm at right now. My extension partially works insofar as it implements my custom BBCode tag, but it doesn't work in that it doesn't actually perform its main purpose of parsing the wikitext. Still, again, when I wrote my first blog post about my RandomRules MediaWiki extension it wasn't doing anything, and I got it working by the next day, so... I'm cautiously optimistic that I'll figure out how to get my Wikitext extension working by tomorrow.

And then I guess I'll tackle the big one, the Subspaces extension... not sure I'll be able to get that working before the hard launch, but I'm going to try my best.

D minus five days and counting...

Post Reply