ox-org.el 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ;;; ox-org.el --- Org Back-End for Org Export Engine
  2. ;; Copyright (C) 2013 Free Software Foundation, Inc.
  3. ;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
  4. ;; Keywords: org, wp
  5. ;; This program is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation, either version 3 of the License, or
  8. ;; (at your option) any later version.
  9. ;; This program is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. ;;; Commentary:
  16. ;; This library implements an Org back-end for Org exporter. Since
  17. ;; its usage is mainly internal, it doesn't provide any interactive
  18. ;; function.
  19. ;;; Code:
  20. (require 'ox)
  21. (org-export-define-backend org
  22. ((babel-call . org-org-identity)
  23. (bold . org-org-identity)
  24. (center-block . org-org-identity)
  25. (clock . org-org-identity)
  26. (code . org-org-identity)
  27. (diary-sexp . org-org-identity)
  28. (drawer . org-org-identity)
  29. (dynamic-block . org-org-identity)
  30. (entity . org-org-identity)
  31. (example-block . org-org-identity)
  32. (fixed-width . org-org-identity)
  33. (footnote-definition . org-org-identity)
  34. (footnote-reference . org-org-identity)
  35. (headline . org-org-headline)
  36. (horizontal-rule . org-org-identity)
  37. (inline-babel-call . org-org-identity)
  38. (inline-src-block . org-org-identity)
  39. (inlinetask . org-org-identity)
  40. (italic . org-org-identity)
  41. (item . org-org-identity)
  42. (keyword . org-org-keyword)
  43. (latex-environment . org-org-identity)
  44. (latex-fragment . org-org-identity)
  45. (line-break . org-org-identity)
  46. (link . org-org-identity)
  47. (node-property . org-org-identity)
  48. (paragraph . org-org-identity)
  49. (plain-list . org-org-identity)
  50. (planning . org-org-identity)
  51. (property-drawer . org-org-identity)
  52. (quote-block . org-org-identity)
  53. (quote-section . org-org-identity)
  54. (radio-target . org-org-identity)
  55. (section . org-org-identity)
  56. (special-block . org-org-identity)
  57. (src-block . org-org-identity)
  58. (statistics-cookie . org-org-identity)
  59. (strike-through . org-org-identity)
  60. (subscript . org-org-identity)
  61. (superscript . org-org-identity)
  62. (table . org-org-identity)
  63. (table-cell . org-org-identity)
  64. (table-row . org-org-identity)
  65. (target . org-org-identity)
  66. (timestamp . org-org-identity)
  67. (underline . org-org-identity)
  68. (verbatim . org-org-identity)
  69. (verse-block . org-org-identity)))
  70. (defun org-org-identity (blob contents info)
  71. "Transcode BLOB element or object back into Org syntax."
  72. (funcall
  73. (intern (format "org-element-%s-interpreter" (org-element-type blob)))
  74. blob contents))
  75. (defun org-org-headline (headline contents info)
  76. "Transcode HEADLINE element back into Org syntax."
  77. (unless (plist-get info :with-todo-keywords)
  78. (org-element-put-property headline :todo-keyword nil))
  79. (unless (plist-get info :with-tags)
  80. (org-element-put-property headline :tags nil))
  81. (unless (plist-get info :with-priority)
  82. (org-element-put-property headline :priority nil))
  83. (org-element-headline-interpreter headline contents))
  84. (defun org-org-keyword (keyword contents info)
  85. "Transcode KEYWORD element back into Org syntax.
  86. Ignore keywords targeted at other export back-ends."
  87. (unless (member (org-element-property :key keyword)
  88. (mapcar
  89. (lambda (block-cons)
  90. (and (eq (cdr block-cons) 'org-element-export-block-parser)
  91. (car block-cons)))
  92. org-element-block-name-alist))
  93. (org-element-keyword-interpreter keyword nil)))
  94. (provide 'ox-org)
  95. ;; Local variables:
  96. ;; generated-autoload-file: "org-loaddefs.el"
  97. ;; End:
  98. ;;; ox-org.el ends here