;;; gpgweb.el --- elisp helper code for the GnuPG web pages (require 'org-exp) (defun gpgweb-insert-header () (goto-char (point-min)) (insert " " title "
")) (defun gpgweb-insert-footer () (goto-char (point-max)) (insert "
These web pages are Copyright 1998--2013 The GnuPG Projectยน and licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. See copying for details.
")) ;; Our publishing tweaks: ;; ;; - Substitute @FNAME@ by the actual file name. ;; - Substitute @MENU-ACTIVE@ by an empty string. (defun gpgweb-postprocess-html () (let ((fname (file-name-nondirectory (buffer-file-name))) (generated-at (org-today))) (gpgweb-insert-header) (gpgweb-insert-footer) (when (string-match "\\.\\([a-z][a-z]\\.\\)?html$" fname) (setq fname (substring fname 0 (match-beginning 0)))) (goto-char (point-min)) (while (search-forward "href=\"@FNAME@" nil t) (replace-match (concat "href=\"" ) t nil)) (goto-char (point-min)) (while (search-forward "@MENU-ACTIVE@" nil t) (replace-match "" t nil)))) (defun gpgweb-org-to-html (plist filename pub-dir) (add-hook 'org-export-html-final-hook 'gpgweb-postprocess-html) (org-publish-org-to-html plist filename pub-dir) (remove-hook 'org-export-html-final-hook 'gpgweb-postprocess-html)) (defun gpgweb-upload () (let ((stagedir (plist-get project-plist :publishing-directory))) (message "gpgweb rootdir '%s'" gpgweb-root-dir) (message "gpgweb stagedir '%s'" stagedir) (shell-command (concat "rsync -rlt --exclude \"*~\" " stagedir "/ " "werner@trithemius.gnupg.org:" "/var/www/www/w3.gnupg.org/htdocs/")))) (provide 'gpgweb)