|
@@ -204,13 +204,27 @@ then the opening will be implicitly set as the headline title."
|
|
|
|
|
|
(defcustom org-koma-letter-closing ""
|
|
|
"Letter's closing, as a string.
|
|
|
-This option can also be set with the CLOSING keyword."
|
|
|
+This option can also be set with the CLOSING keyword. Moreover,
|
|
|
+when:
|
|
|
+ (1) there's no CLOSING keyword or it is empty;
|
|
|
+ (2) `org-koma-letter-headline-is-opening-maybe' is non-nil;
|
|
|
+ (3) the letter contains a headline with the special
|
|
|
+ tag closing;
|
|
|
+then the opening will be set as the title of the closing special
|
|
|
+heading."
|
|
|
:group 'org-export-koma-letter
|
|
|
:type 'string)
|
|
|
|
|
|
(defcustom org-koma-letter-signature ""
|
|
|
"Signature, as a string.
|
|
|
-This option can also be set with the SIGNATURE keyword."
|
|
|
+This option can also be set with the SIGNATURE keyword.
|
|
|
+Moreover, when:
|
|
|
+ (1) there's no CLOSING keyword or it is empty;
|
|
|
+ (2) `org-koma-letter-headline-is-opening-maybe' is non-nil;
|
|
|
+ (3) the letter contains a headline with the special
|
|
|
+ tag closing;
|
|
|
+then the signature will be set as the content of the
|
|
|
+closing special heading."
|
|
|
:group 'org-export-koma-letter
|
|
|
:type 'string)
|
|
|
|
|
@@ -358,7 +372,7 @@ e.g. \"title-subject:t\"."
|
|
|
:group 'org-export-koma-letter
|
|
|
:type 'boolean)
|
|
|
|
|
|
-(defconst org-koma-letter-special-tags-in-letter '(to from)
|
|
|
+(defconst org-koma-letter-special-tags-in-letter '(to from closing)
|
|
|
"Header tags related to the letter itself.")
|
|
|
|
|
|
(defconst org-koma-letter-special-tags-after-closing '(ps encl cc)
|
|
@@ -665,7 +679,17 @@ holding export options."
|
|
|
;; Letter body.
|
|
|
contents
|
|
|
;; Closing.
|
|
|
- (format "\n\\closing{%s}\n" (org-export-data (plist-get info :closing) info))
|
|
|
+ (format "\n\\closing{%s}\n"
|
|
|
+ (org-export-data
|
|
|
+ (or (org-string-nw-p (plist-get info :closing))
|
|
|
+ (when (plist-get info :with-headline-opening)
|
|
|
+ (org-element-map (plist-get info :parse-tree) 'headline
|
|
|
+ (lambda (head)
|
|
|
+ (when (eq (org-koma-letter--special-tag head info)
|
|
|
+ 'closing)
|
|
|
+ (org-element-property :title head)))
|
|
|
+ info t)))
|
|
|
+ info))
|
|
|
(org-koma-letter--special-contents-as-macro
|
|
|
(plist-get info :with-after-closing))
|
|
|
;; Letter end.
|
|
@@ -711,10 +735,20 @@ a communication channel."
|
|
|
(format "\\KOMAoption{fromphone}{%s}\n"
|
|
|
(if (plist-get info :with-phone) "true" "false")))
|
|
|
;; Signature.
|
|
|
- (let ((signature (plist-get info :signature)))
|
|
|
- (and (org-string-nw-p signature)
|
|
|
- (funcall check-scope 'signature)
|
|
|
- (format "\\setkomavar{signature}{%s}\n" signature)))
|
|
|
+ (let* ((heading-val
|
|
|
+ (and (plist-get info :with-headline-opening)
|
|
|
+ (org-string-nw-p
|
|
|
+ (org-trim
|
|
|
+ (org-export-data
|
|
|
+ (org-koma-letter--get-tagged-contents 'closing)
|
|
|
+ info)))))
|
|
|
+ (signature (org-string-nw-p (plist-get info :signature)))
|
|
|
+ (signature-scope (funcall check-scope 'signature)))
|
|
|
+ (and (or (and signature signature-scope)
|
|
|
+ heading-val)
|
|
|
+ (not (and (eq scope 'global) heading-val))
|
|
|
+ (format "\\setkomavar{signature}{%s}\n"
|
|
|
+ (if signature-scope signature heading-val))))
|
|
|
;; Back address.
|
|
|
(and (funcall check-scope 'with-backaddress)
|
|
|
(format "\\KOMAoption{backaddress}{%s}\n"
|