Browse Source

ox-koma-letter: Add hyperref support

* ox-koma-letter.el (org-koma-letter-template): Insert hyperref setup.
Rasmus 10 years ago
parent
commit
510bb46b69
1 changed files with 13 additions and 7 deletions
  1. 13 7
      contrib/lisp/ox-koma-letter.el

+ 13 - 7
contrib/lisp/ox-koma-letter.el

@@ -618,11 +618,9 @@ holding export options."
        (format "\\setkomavar{fromaddress}{%s}\n" from-address)))
    ;; Date.
    (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
-   ;; Document start
-   "\\begin{document}\n\n"
-   ;; Subject and title
+   ;; Hyperref, document start, and subject and title.
    (let ((with-subject (plist-get info :with-subject)))
-     (when with-subject
+     (when (and with-subject (plist-get info :with-title))
        (concat
 	(unless (eq with-subject t)
 	  (format "\\KOMAoption{subject}{%s}\n"
@@ -639,10 +637,18 @@ holding export options."
 			    (org-string-nw-p
 			     (org-export-data (plist-get info :title) info))))
 	       (subject (if title-as-subject (or subject* title*) subject*))
-	       (title (if title-as-subject (and subject* title*) title*)))
+	       (title (if title-as-subject (and subject* title*) title*))
+	       (hyperref-template (plist-get info :latex-hyperref-template))
+	       (spec (append (list (cons ?t (or title subject "")))
+			     (org-latex--format-spec info))))
 	  (concat
-	   (and subject (format "\\setkomavar{subject}{%s}\n" subject))
-	   (and title (format "\\setkomavar{title}{%s}\n" title))
+	   ;; Hyperref.
+	   (format-spec hyperref-template spec)
+	   ;; Document start.
+	   "\\begin{document}\n\n"
+	   ;; Subject and title.
+	   (when subject (format "\\setkomavar{subject}{%s}\n" subject))
+	   (when title (format "\\setkomavar{title}{%s}\n" title))
 	   (when (or (org-string-nw-p title) (org-string-nw-p subject)) "\n"))))))
    ;; Letter start.
    (format "\\begin{letter}{%%\n%s}\n\n"