;;;;
Replace heads and tails of HTML files
;;; Time-stamp: <2007-06-10 22:18:14 jcgs>
;; This program is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by the
;; Free Software Foundation; either version 2 of the License, or (at your
;; option) any later version.
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License along
;; with this program; if not, write to the Free Software Foundation, Inc.,
;; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(provide 'change-html-head-tail)
(require 'cl)
(require 'webmaster-macros)
(require 'page-structure)
;;(require 'page-status)
(defvar html-repair-pages t)
(defvar html-re-tail-hooks nil)
;;;###autoload
(defun html-re-tail-page (page &optional tail)
"Change the tail of PAGE to be TAIL -- a file containing the new tail.
If TAIL is not given, use .tail in the same directory."
(interactive "fRe-tail page file:
fGet tail for %s from: ")
(unless (and (not (interactive-p))
(string= (file-name-nondirectory page) "index.html"))
(find-file page)
(message "Updating %s with new tail from %s" page tail)
(html-with-undisturbed-timestamps
(let ((half-buffer (/ (- (point-max) (point-min)) 2)))
(save-excursion
;; todo: get this functionality working again
;; (html-jcgs-move-status-markers-to-safety)
(if (or (null tail)
(string= tail "")
(string= tail page))
(setq tail
(if (file-exists-p ".tail")
".tail"
(if (file-exists-p "../.tail")
"../.tail"
(if (file-exists-p "../../.tail")
"../../.tail"
"../../../.tail")))))
(when (catch 'found
(dolist (start-string (list html-tail-section-start
"
"
""
"