Greg
Web site conversion stuff
Greg's home page
Greg's diary
Greg's photos
Greg's links
Google
This page contains stuff I need to remember while I'm upgrading my web site. It's almost certainly of no use to anybody else.

Converting diary-foo.html to diary-foo.php

  1. Remove header, replace with:
    <!-- for Emacs, this is a -*- html-fill -*- document -->
    <!-- $Id: diary-mar2008.php,v 1.27 2008/03/20 23:50:56 grog Exp $ -->
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php
      include "diary-header.php";
    
      $month = "June 2004";
      $lastmonth = "may2004";
      $nextmonth = "jul2004";
      if (array_key_exists ("size", $_GET))
        $size = $_GET ["size"];
      else
        $size = "tiny";
    ?>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <?php diary_title ($month); ?>
      </head>
    
      <body>
        <?php diary_header ($month, $lastmonth, $nextmonth); ?>
    
        <div align="justify">
    
  2. Replace footer with:
         </div>
        <?php diary_footer ($lastmonth, $nextmonth, '$Id$'); ?>
      </body>
    </html>
    
    
  3. Add daytitles. Fix the following by replacing the month name and number. First is day 1-9, second the rest.
    (eval-expression (quote (query-replace-regexp "<h2>.*[^0-9]\\([0-9]\\) May \\([0-9]+\\)</a></h2>"
    "<?php daytitle (\\2050\\1, \"Wantadilla\"); ?>
    <p>" nil)) nil)
    
    (eval-expression (quote (query-replace-regexp "<h2>.*[^0-9]\\([0-9]+\\) May \\([0-9]+\\)</a></h2>"
    "<?php daytitle (\\205\\1, \"Wantadilla\"); ?>
    <p>" nil)) nil)
    
    
  4. Replace img tags with showphoto. This needs fixing. Do each in sequence.
    (query-replace-regexp "<a.*<img.*
    .*
    .*src=\"\\(.*\\)tiny/\\([^\"]+\\)\".*" "<?php showphoto (\"\\1\\2\"); ?>" nil)
    
    (query-replace-regexp "<a.*<img.*
    .*src=\"\\(.*\\)tiny/\\([^\"]+\\)\".*" "<?php showphoto (\"\\1\\2\"); ?>" nil)
    
    ;; This one for gifs and things.
    
    (query-replace-regexp "<img.*src=\"Images/\\([^\"]+\\)\".*" "<?php showphoto (\"Photos/\\1\"); ?>" nil)
    
    


Greg's home page Greg's diary Greg's photos
Valid XHTML 1.0! $Id: misc.php,v 1.1 2008/03/19 21:53:37 grog Exp $