;;; gpgweb.el --- elisp helper code for the GnuPG web pages (require 'org-exp) ;; cl-macs is required by ox-html.el but for whatever reasons not ;; autoloaded. (load-library "cl-macs") (defun gpgweb-setup-project () (progn (aput 'org-publish-project-alist "gpgweb-org" '(:base-directory "~/s/gnupg-doc/web" :base-extension "org" :language "en" :html-extension "html" :recursive t :publishing-directory "../stage" :publishing-function gpgweb-org-to-html :body-only t :section-numbers nil :tags nil :with-toc nil :makeindex t :auto-sitemap t :sitemap-title "GnuPG - Sitemap" :sitemap-sort-folders "last" :sitemap-file-entry-format "%t @@html:@@(%d)@@html:@@" :style-include-default nil :timestamp-file t :html-head "" :html-head-include-scripts nil)) (aput 'org-publish-project-alist "gpgweb-other" '(:base-directory "." :base-extension "jpg\\|png\\|css" :recursive t :publishing-directory "../stage" :publishing-function org-publish-attachment :completion-function gpgweb-upload)) (aput 'org-publish-project-alist "gpgweb" '(:components ("gpgweb-org" "gpgweb-other"))))) (defun gpgweb-insert-header (title) (goto-char (point-min)) (insert " " title "
 
")) (defun gpgweb-insert-footer () (goto-char (point-min)) (unless (search-forward "" nil t) (goto-char (point-max)) (insert "
\"CC-BY-SA
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.
")) (goto-char (point-max)) (insert "
")) ;;; Post-process the generated HTML file: ;;; ;;; - Insert header and footer ;;; - Insert "class=selected" into the active menu entry ;;; - Fixup sitemap. (defun gpgweb-postprocess-html (plist orgfile htmlfile) (let* ((visitingp (find-buffer-visiting htmlfile)) (work-buffer (or visitingp (find-file-noselect htmlfile)))) (prog1 (with-current-buffer work-buffer (let ((fname (file-name-nondirectory htmlfile)) (fname-2 (replace-regexp-in-string ".*/stage\\(/.*\\)$" "\\1" htmlfile t)) (title (org-publish-find-title orgfile)) (generated-at (org-today)) (tmppnt)) ;; Insert the header and mark the active menu (gpgweb-insert-header title) (setq tmppnt (point)) (goto-char (point-min)) (while (re-search-forward (concat "href=\"" (regexp-quote fname-2) "\"") tmppnt t) (replace-match "\\& class=\"selected\"" t)) ; Insert the footer (gpgweb-insert-footer) ; Fixup the sitemap (when (string-equal fname "sitemap.html") (goto-char (point-min)) (while (re-search-forward "^.*
  • .*>\\(GnuPG - \\).* ;; Date: Wed Oct 2 18:26:27 2013 -0400 ;; ;; Fix escaping of links in html export. ;; ;; * lisp/ox-html.el (org-html-link): Unescape org-escaped links an ;; re-escape for html (browser). ;; ;; ;; diff --git a/lisp/ox-html.el b/lisp/ox-html.el ;; index 66862bc..0600204 100644 ;; --- a/lisp/ox-html.el ;; +++ b/lisp/ox-html.el ;; @@ -2624,7 +2624,9 @@ INFO is a plist holding contextual information. See ;; (path ;; (cond ;; ((member type '("http" "https" "ftp" "mailto")) ;; - (concat type ":" raw-path)) ;; + (org-link-escape ;; + (org-link-unescape ;; + (concat type ":" raw-path)) org-link-escape-chars-browser)) ;; ((string= type "file") ;; ;; Treat links to ".org" files as ".html", if needed. ;; (setq raw-path