test-org-export-preproc.el 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. (require 'org-export-generic)
  2. (defun test-preproc ()
  3. (interactive)
  4. (let ((string
  5. (let ((region
  6. (buffer-substring
  7. (if (org-region-active-p) (region-beginning) (point-min))
  8. (if (org-region-active-p) (region-end) (point-max))))
  9. (opt-plist (org-combine-plists (org-default-export-plist)
  10. (org-infile-export-plist)))
  11. (export-plist '("tikiwiki" :file-suffix ".txt" :key-binding 85 :header-prefix "" :header-suffix "" :title-format "-= %s =-\n" :date-export nil :toc-export nil :body-header-section-numbers nil :body-section-prefix "\n" :body-section-header-prefix
  12. ("! " "!! " "!!! " "!!!! " "!!!!! " "!!!!!! " "!!!!!!! ")
  13. :body-section-header-suffix
  14. (" \n" " \n" " \n" " \n" " \n" " \n")
  15. :body-line-export-preformated t :body-line-format "%s " :body-line-wrap nil :body-line-fixed-format " %s\n" :body-list-format "* %s\n" :body-number-list-format "# %s\n" :blockquote-start "\n^\n" :blockquote-end "^\n\n" :body-newline-paragraph "\n" :bold-format "__%s__" :italic-format "''%s''" :underline-format "===%s===" :strikethrough-format "--%s--" :code-format "-+%s+-" :verbatim-format "~pp~%s~/pp~")))
  16. (org-export-preprocess-string
  17. region
  18. :for-ascii t
  19. :skip-before-1st-heading
  20. (plist-get opt-plist :skip-before-1st-heading)
  21. :drawers (plist-get export-plist :drawers-export)
  22. :tags (plist-get export-plist :tags-export)
  23. :priority (plist-get export-plist :priority-export)
  24. :footnotes (plist-get export-plist :footnotes-export)
  25. :timestamps (plist-get export-plist :timestamps-export)
  26. :todo-keywords (plist-get export-plist :todo-keywords-export)
  27. :verbatim-multiline t
  28. :select-tags (plist-get export-plist :select-tags-export)
  29. :exclude-tags (plist-get export-plist :exclude-tags-export)
  30. :emph-multiline t
  31. :archived-trees
  32. (plist-get export-plist :archived-trees-export)
  33. :add-text (plist-get opt-plist :text)))))
  34. (save-excursion
  35. (org-pop-to-buffer-same-window "*preproc-temp*")
  36. (point-max)
  37. (insert string))))