2008-08-30 17:46Importing from WordPress to SerendipitySo, it turns out that the wonderful import process didn’t quite go according to plan. If it hadn’t been for some very obvious changes in the way the syntax highlighting plugins working between the two platforms (“obvious” if you remember to check a page written under the old system after switching to the new system) then I might not have been bothered to go back over every one of my blog posts and bring them up to date. I’m glad I did, though, not least for reasons of nostalgia, but also because I managed to spot a few other mistakes made by the import process or by my former inexperience with blogging. Of course, I wouldn’t want to be obsessive about rewriting my old work to fit my current ideals, since then I wouldn’t get the benefit of having the blog as time capsule of my writing preferences and character, but there were some long-standing issues I had been meaning to fix to make my blog more readable. Firstly, I want to detail the things which either the import process or possibly WordPress got wrong. There was an issue of character encoding that meant Serendipity was storing “â” instead of “—” and “â®” instead of “…”, among other punctuation, and also entire words in other languages were corrupted. Fortunately I knew of the command line program recode and could run echo “ÅarÄaÅto” | recode utf8..latin1 to transcode some corrupted Latin characters into their correct Unicode forms. Something in the import process also seems to have stripped the backslashes from some of my posts, which in the middle of a regular expression can be difficult to detect. Fortunately, with syntax highlighting enabled for the affected text, the splurge of “incorrect” colour for large parts of the source code I was blogging made the error easy to detect. That brings me on to two other points, the more embarrassing of which is that I once used “effected” in a sentence when I meant “affected”. There were also a few mistakes which I wouldn’t have made if I had written the posts using a modern version of Firefox which checks your spelling, although “effected” would not have been caught that way. If I updated the script I wrote which extracts all the words in all the blog posts I’ve written, it would then make sense for me to go back and fix all my old spelling mistakes. The other point is that the WordPress syntax highlighting plugin (which is based on GeSHi) allowed for shorthand like [php]echo ‘foo’;[/php] whereas GeSHi prefers (and the Serendipity plugin mandates) that the text inside the initial pair of brackets be “geshi lang=php” (for example) and in the final pair of brackets “/geshi”. While on the subject of plugins, I noticed on one page that half a sentence had been unnecessarily italicised, and that the italicisation began at the string “rewrite” of “mod_rewrite”, which was a bug (or feature) of a Serendipity plugin I had installed. The default text parser / formatter that comes with Serendipity is very basic and almost leaves the HTML formatting up to you, which is a nice idea, but I quickly switched to something more compatible with WordPress’s in-built formatter by installing a plugin called Markdown. When I installed it, though, I thought that I only needed the standard features that WordPress would have provided, so I chose “No” when the plugin asked if I wanted to “Apply Markdown Extra markup to entry text”. It turns out I should have followed the link it included to explain what this extra markup was, because one of its features is to “no longer set strong emphasis in the middle of a word using underscores”. Before I had spotted this simple solution, though, I had tried using Textile which seemed to use a very sensible and usable syntax, not unlike WikiCreole. Unfortunately the Serendipity plugin version didn’t seem to work the same way as the web-based version on their site worked, which made it unusable for me. For some of my very early posts I didn’t have syntax highlighting for the source code I included, and specifically mentioned this fact. I also recorded when I did finally install a plugin which added this functionality. This meant it would have been strange to alter those early posts to use syntax highlighting, even if I had wanted to, but there were some other characteristics of my earlier posts that I did change. One was that I used to use Finally, to get the formatting right under the new Markdown and syntax highlighting plugins, I had to add a few style rules to the CSS of the theme I am using. There were also a couple of changes I needed to make to the theme itself, but I managed to do this all with a section at the bottom of style.css and have included that section below for reference: /********* Hagfish’s Styles ********/ code, tt { white-space: pre; } .perl, .php, .bash, .mysql, .dot, .html4strict, .sql, .xml, .css, blockquote, pre { margin-top: -0.5em; margin-bottom: 0.5em; margin-left: 2em;} h4, h3 { margin-bottom: 1em; } .serendipity_entry p { margin-bottom: 1em; } dt { font-weight: bold; margin-top: 1ex; } blockquote { white-space: pre-wrap; } li h3 { display: inline; } .serendipity_entry li { list-style-position: outside; margin-top: 1ex; margin-bottom: 1ex; } /****** End Hagfish’s Styles *******/ One of these in particular is worth mentioning, which is the “ Having added to these rules as I went along, and not restarting the checking of my posts from the beginning each time, what is the likelihood of me introducing regressions? Trackbacks
Trackback specific URI for this entry
No Trackbacks
|
QuicksearchCategoriesSyndicate This BlogBlog Administration |