How did I not know about the Sourcecode tags? I have spent years trying to figure out how to post nice looking code to my blog and was misled by all the plug-in nonsense which only applies if you are hosting your own wordpress instance – which I’m not. Here is the link to the docs for formatting source code in your wordpress.org or wordpress.com hosted blog.
I’m a bit disappointed that there is not an HTML language definition, but that’s OK, I write XHTML in any case so XML works just fine.
function makeRooms(edit) { var t = getTag("roomsBody", "div"); if (t != null) { var div = "<div id='rooms'>"; //if (rooms === undefined) rooms = []; for (var i = 0; i < rooms.length; i++) { if (edit) { div += makeRoomDivEdit(rooms[i], imgpath, i); } else { div += makeRoomDiv(rooms[i], imgpath); } } div += "</div>"; if (edit) div += "<a style='padding:5px;' class='instruction' href='addRoom()'>Add Room</a>"; t.innerHTML = div; } }
Leave a Reply