A random assortment of updates and announcements.

A few days ago, I decided to bite the bullet and convert the repository that sits behind this site from CVS to Subversion. I did this “by hand,” not using any CVS to Subversion conversion script.

I've been wanting to play with Subversion for a while and I specifically wanted to take advantage of the ability to create a “pre-commit” hook in Subversion to enforce additional constraints on all my essays. In particular, that they be not only valid but also have IDs on all the paragraphs. I've been forgetting to put IDs on the paragraphs and it's been bugging me. Now I can't forget anymore.

In other news:

Needless to say, if anyone notices something that I've broken, please report it.

Comments:

What will happen when you need to insert a paragraph? Or delete? Will al unique links shift or stay the same?

Posted by Anne on 10 Feb 2005 @ 11:48a UTC [link]

Adding a new paragraph won't change any of the existing IDs. The ID-generating code just adds a new one. Deleting a paragraph would remove its ID, but I'll probably avoid deleting paragraphs for that reason. FWIW, here's my current hack for adding IDs:

 (defun blog:idparas () 
  (interactive)
  (save-excursion
    (let ((paracount 0)
	  (paraid 0))
      (beginning-of-buffer)
      (re-search-forward "\/info\\|\/essayinfo" nil t nil)
      (while (re-search-forward "\\|]*\\)>"
				nil t nil)
	(if (match-string 3)
	    (let ((attributes (match-string 3)))
	      (if (string-match " id=[\"\']\\([^\"\']+\\)[\"\']" attributes)
		  (let ((id (match-string 1 attributes)))
		    (if (string-match "^p\\([0-9]+\\)$" id)
			(let ((idnum (string-to-number (match-string 1 id))))
			  (if (> idnum paraid)
			      (setq paraid idnum)))))))))
      (setq paraid (+ paraid 1))
      (beginning-of-buffer)
      (re-search-forward "\/info\\|\/essayinfo" nil t nil)
      (while (re-search-forward "\\|]*\\)>"
				nil t nil)
	(if (or (not (match-string 3))
		(not (string-match " id=[\"\']\\([^\"\']+\\)[\"\']" (match-string 3))))
	    (progn
	      (forward-char -1)
	      (insert (format " id='p27" paraid))
	      (setq paracount (+ paracount 1))
	      (setq paraid (+ paraid 1)))))
      (message (format "Inserted IDs" paracount)))))(defun blog:idparas () 
  (interactive)
  (save-excursion
    (let ((paracount 0)
	  (paraid 0))
      (beginning-of-buffer)
      (re-search-forward "\/info\\|\/essayinfo" nil t nil)
      (while (re-search-forward "\\|]*\\)>"
				nil t nil)
	(if (match-string 3)
	    (let ((attributes (match-string 3)))
	      (if (string-match " id=[\"\']\\([^\"\']+\\)[\"\']" attributes)
		  (let ((id (match-string 1 attributes)))
		    (if (string-match "^p\\([0-9]+\\)$" id)
			(let ((idnum (string-to-number (match-string 1 id))))
			  (if (> idnum paraid)
			      (setq paraid idnum)))))))))
      (setq paraid (+ paraid 1))
      (beginning-of-buffer)
      (re-search-forward "\/info\\|\/essayinfo" nil t nil)
      (while (re-search-forward "\\|]*\\)>"
				nil t nil)
	(if (or (not (match-string 3))
		(not (string-match " id=[\"\']\\([^\"\']+\\)[\"\']" (match-string 3))))
	    (progn
	      (forward-char -1)
	      (insert (format " id='p27" paraid))
	      (setq paracount (+ paracount 1))
	      (setq paraid (+ paraid 1)))))
      (message (format "Inserted IDs" paracount)))))

I think I'd rather do that with XSLT, but I haven't bothered to get that working just yet.

Posted by Norman Walsh on 10 Feb 2005 @ 12:28p UTC [link]

Except, of course, "id=" in that code should now be "xml:id=". For the time being, at least.

Posted by Norman Walsh on 10 Feb 2005 @ 12:59p UTC [link]

Hmm, I hope they are not going to change it to xmlid just because some specfication is flawed. The discussion it generates on www-tag is interesting though. Especially about other specifications introducing backwards incompatible changes in the new namespace. (As far as I understand it.)

Posted by Anne on 10 Feb 2005 @ 02:32p UTC [link]

I hope so too. Alas, I don't expect the TAG to get a chance to discuss it before the 21st and perhaps not before the plenary.

Posted by Norman Walsh on 10 Feb 2005 @ 03:04p UTC [link]

The comments feeds have now been upgraded to Atom Format 05 too.

Posted by Norman Walsh on 14 Feb 2005 @ 02:15p UTC [link]
Add a comment or subscribe to (existing) comments on this essay.