 				(number-to-string (org-element-property :minute-start timestamp)))
 	  date-part)))
 
+(defun org-trec-template (contents info)
+  "Wrap the complete exported contents"
+  (concat "<DOC>\n" contents "</TEXT>\n</DOC>"))
+
 ;; http://orgmode.org/worg/dev/org-export-reference.html
 ;; c.f. org-export-registered-backends
 (when (require 'ox nil 'noerror)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Org mode export to TREC format ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; boring, undecorated stuff
(defun org-trec-export-raw (element contents info)
  contents)
(defun org-trec-export-value (element contents info)
  (org-element-property :value element))

(defun org-trec-link (link desc info)
  desc)
(defun org-trec-plain-text (text info)
  text)
;; i don't often use it in this context...
(defun org-trec-subscript (element contents info)
  (concat "_" contents))

;; other stuff
(defun org-trec-headline (headline contents info)
 ;;(with-output-to-string (princ (org-element-property :title headline)))
  (concat (org-export-data (org-element-property :title headline) info) "\n" contents
		  ;;(with-output-to-string (princ (org-element-contents headline)))
		  )
)

(defun org-trec-planning (planning contents info)

   'trec
   '((bold . org-trec-export-raw)
	 (center-block . org-trec-export-raw)
	 (clock . org-trec-export-raw)
	 (code . org-trec-export-value)
	 (comment . nil)
	 (comment-block . nil)
