July 6, 2004 12:08 AM
Till this very date, the permanent links to the blog entries were of
the form, AnEntryYYYY-MM-DD
though I can't remember why I came up
with such a ridiculous naming scheme in the first place. It's ugliness
has become too much to bear. Changing it to the standard form,
YYYY.MM.DD
involved replacing the regexp used to validate that it is
a blog entry and not a normal wiki and a simple rewrite of the date
extraction functions. The links do look tidier now.
Have caught a bug in the pages where multiple entries are dumped. Footnotes on more than one entry in the same page results in a clash and the links always point to the first occurrence. Will fix this as soon as time1 permits. A renaming technique that creates unique anchors after the page has been converted to html is easy. Thinking of attaching some sort of info about the page each time a footnote is added. That would resolve collisions but will look ugly.
[1] Note the time when this page was published. Yawn...
Footnote Fixes
9:30 PM
The duplicate footnote anchors have been dealt with. In pages where
there is a dump of more than one blog entry, when each blog entry is
being evaluated, all footnote anchors are attached with a count
corresponding to the number of the entry. This was easier than
expected and it seems to work fine. The code for the dump of entries
was originally obtained from GaneshSwami. Here's the lame fix (Updated
2004.08.23):
(defun ani-remove-duplicate-footnotes (content count) "To remove duplicate footnotes in the dump of entries. content is the processed html markup of a blog entry. count is a unique integer that will be inserted in between fnr or fn and .[0-9]" (with-temp-buffer (insert content) (goto-char 0) ;repeat till no more unprocessed footnotes (while (re-search-forward "\"fnr\\(.\\)[0-9]\"" nil t) ;match has been found now replace all 4 occurrences (replace-match (concat (int-to-string count) ".") t t nil 1) (re-search-forward "\"#fn\\(.\\)[0-9]\"" nil t) (replace-match (concat (int-to-string count) ".") t t nil 1) (re-search-forward "\"fn\\(.\\)[0-9]\"" nil t) (replace-match (concat (int-to-string count) ".") t t nil 1) (re-search-forward "\"#fnr\\(.\\)[0-9]\"" nil t) (replace-match (concat (int-to-string count) ".") t t nil 1) (goto-char 0)) ;return the final footnotes renumbered string (buffer-substring-no-properties 1 (point-max))))
Pass the result of each entry's emacs-wiki-replace-markup
to
ani-remove-duplicate-footnotes
along with a unique integer value
specific to that blog entry.