2023-04-20 08:11:19 -04:00
|
|
|
;;; ox-org.el --- Org Backend for Org Export Engine -*- lexical-binding: t; -*-
|
2013-01-27 17:11:34 -05:00
|
|
|
|
2023-01-01 05:31:12 -05:00
|
|
|
;; Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
|
|
|
;; Author: Nicolas Goaziou <n.goaziou@gmail.com>
|
2021-10-03 02:54:33 -04:00
|
|
|
;; Maintainer: Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
2013-01-27 17:11:34 -05:00
|
|
|
;; Keywords: org, wp
|
|
|
|
|
Backport changes from Emacs revs 115081 and 115082
2013-11-12 Stefan Monnier <monnier@iro.umontreal.ca>
Address some byte-compiler warnings.
* ob-abc.el (org-babel-expand-body:abc): Use dolist.
(org-babel-execute:abc): Fix regexp quoting.
* ob-calc.el (org--var-syms): Rename from `var-syms'.
* ob-lilypond.el (ly-compile-lilyfile): Remove redundant let-binding.
* ob-table.el (sbe): Move debug declaration.
* org-clock.el (org--msg-extra): Rename from `msg-extra'.
* org.el (org-version): Avoid var name starting with _.
(org-inhibit-startup, org-called-with-limited-levels)
(org-link-search-inhibit-query, org-time-was-given)
(org-end-time-was-given, org-def, org-defdecode, org-with-time):
* org-colview.el (org-agenda-overriding-columns-format):
* org-agenda.el (org-agenda-multi, org-depend-tag-blocked)
(org-agenda-show-log-scoped):
* ob-python.el (py-which-bufname, python-shell-buffer-name):
* ob-haskell.el (org-export-copy-to-kill-ring):
* ob-exp.el (org-link-search-inhibit-query):
* ob-R.el (ess-eval-visibly-p):
* ob-core.el (org-src-window-setup): Declare before use.
(org-babel-expand-noweb-references): Remove unused `blocks-in-buffer'.
* ox-odt.el (org-odt-hfy-face-to-css):
* org-src.el (org-src-associate-babel-session, org-src-get-lang-mode):
* org-bibtex.el (org-bibtex-get, org-bibtex-ask, org-bibtex)
(org-bibtex-check):
* ob-tangle.el (org-babel-tangle, org-babel-spec-to-string)
(org-babel-tangle-single-block, org-babel-tangle-comment-links):
* ob-table.el (sbe):
* ob-sqlite.el (org-babel-sqlite-expand-vars):
* ob-sql.el (org-babel-sql-expand-vars):
* ob-shen.el (org-babel-execute:shen):
* ob-sh.el (org-babel-execute:sh, org-babel-sh-evaluate):
* ob-scala.el (org-babel-scala-evaluate):
* ob-ruby.el (org-babel-ruby-table-or-string)
(org-babel-ruby-evaluate):
* ob-python.el (org-babel-python-table-or-string)
(org-babel-python-evaluate-external-process)
(org-babel-python-evaluate-session):
* ob-picolisp.el (org-babel-execute:picolisp):
* ob-perl.el (org-babel-perl-evaluate):
* ob-maxima.el (org-babel-execute:maxima):
* ob-lisp.el (org-babel-execute:lisp):
* ob-java.el (org-babel-execute:java):
* ob-io.el (org-babel-io-evaluate):
* ob-haskell.el (org-babel-execute:haskell):
* ob-fortran.el (org-babel-execute:fortran):
* ob-exp.el (org-babel-exp-code):
* ob-emacs-lisp.el (org-babel-execute:emacs-lisp):
* ob-ditaa.el (org-babel-execute:ditaa):
* ob-core.el (org-babel-execute-src-block, org-babel-sha1-hash)
(org-babel-parse-header-arguments, org-babel-reassemble-table)
(org-babel-goto-src-block-head, org-babel-mark-block)
(org-babel-expand-noweb-references, org-babel-script-escape)
(org-babel-process-file-name):
* ob-clojure.el (org-babel-execute:clojure):
* ob-calc.el (org-babel-execute:calc):
* ob-awk.el (org-babel-execute:awk):
* ob-abc.el (org-babel-execute:abc):
* ob-R.el (org-babel-expand-body:R):
* ob-C.el (org-babel-C-execute): Avoid deprecated ((lambda) ...).
2013-11-12 Glenn Morris <rgm@gnu.org>
* ox-html.el (org-html-scripts): Add 2013 to copyright years.
(org-html-infojs-template): Copyright holder to FSF.
2013-11-12 14:57:31 -05:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2013-02-23 03:56:24 -05:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2013-01-27 17:11:34 -05:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
2013-02-23 03:56:24 -05:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
2013-01-27 17:11:34 -05:00
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 18:52:52 -04:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2013-01-27 17:11:34 -05:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
2013-12-15 08:52:46 -05:00
|
|
|
|
2022-08-04 09:53:05 -04:00
|
|
|
(require 'org-macs)
|
|
|
|
(org-assert-version)
|
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
(require 'ox)
|
2016-05-14 22:56:53 -04:00
|
|
|
(declare-function htmlize-buffer "ext:htmlize" (&optional buffer))
|
2015-11-05 17:40:53 -05:00
|
|
|
(defvar htmlize-output-type)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
2013-03-02 12:46:07 -05:00
|
|
|
(defgroup org-export-org nil
|
|
|
|
"Options for exporting Org mode files to Org."
|
|
|
|
:tag "Org Export Org"
|
2013-03-02 13:31:12 -05:00
|
|
|
:group 'org-export
|
|
|
|
:version "24.4"
|
|
|
|
:package-version '(Org . "8.0"))
|
2013-03-02 12:46:07 -05:00
|
|
|
|
|
|
|
(defcustom org-org-htmlized-css-url nil
|
|
|
|
"URL pointing to the CSS defining colors for htmlized Emacs buffers.
|
|
|
|
Normally when creating an htmlized version of an Org buffer,
|
|
|
|
htmlize will create the CSS to define the font colors. However,
|
|
|
|
this does not work when converting in batch mode, and it also can
|
|
|
|
look bad if different people with different fontification setup
|
|
|
|
work on the same website. When this variable is non-nil,
|
|
|
|
creating an htmlized version of an Org buffer using
|
|
|
|
`org-org-export-as-org' will include a link to this URL if the
|
2015-09-21 00:24:12 -04:00
|
|
|
setting of `org-html-htmlize-output-type' is `css'."
|
2013-03-02 12:46:07 -05:00
|
|
|
:group 'org-export-org
|
|
|
|
:type '(choice
|
|
|
|
(const :tag "Don't include external stylesheet link" nil)
|
|
|
|
(string :tag "URL or local href")))
|
|
|
|
|
2013-03-19 11:24:40 -04:00
|
|
|
(org-export-define-backend 'org
|
|
|
|
'((babel-call . org-org-identity)
|
|
|
|
(bold . org-org-identity)
|
|
|
|
(center-block . org-org-identity)
|
|
|
|
(clock . org-org-identity)
|
|
|
|
(code . org-org-identity)
|
|
|
|
(diary-sexp . org-org-identity)
|
|
|
|
(drawer . org-org-identity)
|
|
|
|
(dynamic-block . org-org-identity)
|
|
|
|
(entity . org-org-identity)
|
|
|
|
(example-block . org-org-identity)
|
2016-05-13 11:57:11 -04:00
|
|
|
(export-block . org-org-export-block)
|
2013-03-19 11:24:40 -04:00
|
|
|
(fixed-width . org-org-identity)
|
2014-05-21 12:33:53 -04:00
|
|
|
(footnote-definition . ignore)
|
2013-03-19 11:24:40 -04:00
|
|
|
(footnote-reference . org-org-identity)
|
|
|
|
(headline . org-org-headline)
|
|
|
|
(horizontal-rule . org-org-identity)
|
|
|
|
(inline-babel-call . org-org-identity)
|
|
|
|
(inline-src-block . org-org-identity)
|
|
|
|
(inlinetask . org-org-identity)
|
|
|
|
(italic . org-org-identity)
|
|
|
|
(item . org-org-identity)
|
|
|
|
(keyword . org-org-keyword)
|
|
|
|
(latex-environment . org-org-identity)
|
|
|
|
(latex-fragment . org-org-identity)
|
|
|
|
(line-break . org-org-identity)
|
2015-01-29 13:31:03 -05:00
|
|
|
(link . org-org-link)
|
2013-03-19 11:24:40 -04:00
|
|
|
(node-property . org-org-identity)
|
2013-11-15 18:20:13 -05:00
|
|
|
(template . org-org-template)
|
2013-03-19 11:24:40 -04:00
|
|
|
(paragraph . org-org-identity)
|
|
|
|
(plain-list . org-org-identity)
|
|
|
|
(planning . org-org-identity)
|
|
|
|
(property-drawer . org-org-identity)
|
|
|
|
(quote-block . org-org-identity)
|
|
|
|
(radio-target . org-org-identity)
|
2014-05-21 12:33:53 -04:00
|
|
|
(section . org-org-section)
|
2013-03-19 11:24:40 -04:00
|
|
|
(special-block . org-org-identity)
|
|
|
|
(src-block . org-org-identity)
|
|
|
|
(statistics-cookie . org-org-identity)
|
|
|
|
(strike-through . org-org-identity)
|
|
|
|
(subscript . org-org-identity)
|
|
|
|
(superscript . org-org-identity)
|
|
|
|
(table . org-org-identity)
|
|
|
|
(table-cell . org-org-identity)
|
|
|
|
(table-row . org-org-identity)
|
|
|
|
(target . org-org-identity)
|
2018-01-08 09:39:01 -05:00
|
|
|
(timestamp . org-org-timestamp)
|
2013-03-19 11:24:40 -04:00
|
|
|
(underline . org-org-identity)
|
|
|
|
(verbatim . org-org-identity)
|
2013-04-04 09:09:22 -04:00
|
|
|
(verse-block . org-org-identity))
|
|
|
|
:menu-entry
|
|
|
|
'(?O "Export to Org"
|
|
|
|
((?O "As Org buffer" org-org-export-as-org)
|
|
|
|
(?o "As Org file" org-org-export-to-org)
|
|
|
|
(?v "As Org file and open"
|
|
|
|
(lambda (a s v b)
|
|
|
|
(if a (org-org-export-to-org t s v b)
|
2017-03-15 09:30:52 -04:00
|
|
|
(org-open-file (org-org-export-to-org nil s v b)))))))
|
|
|
|
:filters-alist '((:filter-parse-tree . org-org--add-missing-sections)))
|
|
|
|
|
|
|
|
(defun org-org--add-missing-sections (tree _backend _info)
|
|
|
|
"Ensure each headline has an associated section.
|
|
|
|
|
|
|
|
TREE is the parse tree being exported.
|
|
|
|
|
|
|
|
Footnotes relative to the headline are inserted in the section,
|
|
|
|
using `org-org-section'. However, this function is not called if
|
|
|
|
the headline doesn't contain any section in the first place, so
|
|
|
|
we make sure it is always called."
|
|
|
|
(org-element-map tree 'headline
|
|
|
|
(lambda (h)
|
|
|
|
(let ((first-child (car (org-element-contents h)))
|
|
|
|
(new-section (org-element-create 'section)))
|
|
|
|
(pcase (org-element-type first-child)
|
|
|
|
(`section nil)
|
2023-05-16 06:41:53 -04:00
|
|
|
(`nil (org-element-adopt h new-section))
|
2017-03-15 09:30:52 -04:00
|
|
|
(_ (org-element-insert-before new-section first-child))))))
|
|
|
|
tree)
|
2013-01-27 17:11:34 -05:00
|
|
|
|
2016-05-13 11:57:11 -04:00
|
|
|
(defun org-org-export-block (export-block _contents _info)
|
|
|
|
"Transcode a EXPORT-BLOCK element from Org to LaTeX.
|
|
|
|
CONTENTS and INFO are ignored."
|
|
|
|
(and (equal (org-element-property :type export-block) "ORG")
|
|
|
|
(org-element-property :value export-block)))
|
|
|
|
|
2015-11-05 17:40:53 -05:00
|
|
|
(defun org-org-identity (blob contents _info)
|
2013-04-17 16:44:28 -04:00
|
|
|
"Transcode BLOB element or object back into Org syntax.
|
|
|
|
CONTENTS is its contents, as a string or nil. INFO is ignored."
|
2013-12-15 09:17:24 -05:00
|
|
|
(let ((case-fold-search t))
|
|
|
|
(replace-regexp-in-string
|
2021-09-30 11:13:12 -04:00
|
|
|
"^[ \t]*#\\+attr_[-_a-z0-9]+:\\(?: .*\\)?\n" ""
|
2013-12-15 09:17:24 -05:00
|
|
|
(org-export-expand blob contents t))))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
|
|
|
(defun org-org-headline (headline contents info)
|
2013-04-17 16:44:28 -04:00
|
|
|
"Transcode HEADLINE element back into Org syntax.
|
|
|
|
CONTENTS is its contents, as a string or nil. INFO is ignored."
|
2014-05-21 12:33:53 -04:00
|
|
|
(unless (org-element-property :footnote-section-p headline)
|
|
|
|
(unless (plist-get info :with-todo-keywords)
|
|
|
|
(org-element-put-property headline :todo-keyword nil))
|
|
|
|
(unless (plist-get info :with-tags)
|
|
|
|
(org-element-put-property headline :tags nil))
|
|
|
|
(unless (plist-get info :with-priority)
|
|
|
|
(org-element-put-property headline :priority nil))
|
|
|
|
(org-element-put-property headline :level
|
|
|
|
(org-export-get-relative-level headline info))
|
|
|
|
(org-element-headline-interpreter headline contents)))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
2015-11-05 17:40:53 -05:00
|
|
|
(defun org-org-keyword (keyword _contents _info)
|
2013-01-27 17:11:34 -05:00
|
|
|
"Transcode KEYWORD element back into Org syntax.
|
2014-08-08 04:34:34 -04:00
|
|
|
CONTENTS is nil. INFO is ignored."
|
2013-11-15 18:20:13 -05:00
|
|
|
(let ((key (org-element-property :key keyword)))
|
2014-08-08 04:34:34 -04:00
|
|
|
(unless (member key
|
2015-03-29 08:26:59 -04:00
|
|
|
'("AUTHOR" "CREATOR" "DATE" "EMAIL" "OPTIONS" "TITLE"))
|
2013-11-15 18:20:13 -05:00
|
|
|
(org-element-keyword-interpreter keyword nil))))
|
|
|
|
|
2020-02-14 04:00:15 -05:00
|
|
|
(defun org-org-link (link contents info)
|
2015-01-29 13:31:03 -05:00
|
|
|
"Transcode LINK object back into Org syntax.
|
|
|
|
CONTENTS is the description of the link, as a string, or nil.
|
|
|
|
INFO is a plist containing current export state."
|
2020-02-14 04:00:15 -05:00
|
|
|
(or (org-export-custom-protocol-maybe link contents 'org info)
|
2015-01-29 13:31:03 -05:00
|
|
|
(org-element-link-interpreter link contents)))
|
|
|
|
|
2013-11-15 18:20:13 -05:00
|
|
|
(defun org-org-template (contents info)
|
|
|
|
"Return Org document template with document keywords.
|
|
|
|
CONTENTS is the transcoded contents string. INFO is a plist used
|
|
|
|
as a communication channel."
|
|
|
|
(concat
|
|
|
|
(and (plist-get info :time-stamp-file)
|
|
|
|
(format-time-string "# Created %Y-%m-%d %a %H:%M\n"))
|
2014-08-08 04:29:59 -04:00
|
|
|
(org-element-normalize-string
|
|
|
|
(mapconcat #'identity
|
|
|
|
(org-element-map (plist-get info :parse-tree) 'keyword
|
|
|
|
(lambda (k)
|
|
|
|
(and (string-equal (org-element-property :key k) "OPTIONS")
|
2021-09-28 10:45:55 -04:00
|
|
|
(concat "#+options: "
|
2014-08-08 04:29:59 -04:00
|
|
|
(org-element-property :value k)))))
|
|
|
|
"\n"))
|
ox: Optional export of title
* ox.el (org-export-with-title): New variable.
* ox (org-export-options-alist),
ox-ascii.el (org-ascii-template--document-title),
ox-beamer.el (org-beamer-template), ox-html.el (org-html-template),
ox-latex.el (org-latex-template), ox-man.el (org-man-template),
ox-odt.el (org-odt-template), ox-org.el (org-org-template),
ox-publish.el (org-publish-project-alist),
ox-texinfo.el (org-texinfo-template),
ox-groff.el (org-groff--mt-head): Use new variable.
* ox-koma-letter.el (org-koma-letter-use-title): Mark obsolete.
* test-ox.el (test-org-export/parse-option-keyword): Add :with-title.
* ORG-NEWS, org.texi: Mention org-export-with-title.
This is useful in e.g. ox-html where title can be set via
`org-html-preamble-template' or when using the {{{title}}}-macro.
2015-02-10 18:09:39 -05:00
|
|
|
(and (plist-get info :with-title)
|
2021-09-28 10:45:55 -04:00
|
|
|
(format "#+title: %s\n" (org-export-data (plist-get info :title) info)))
|
2013-11-15 18:20:13 -05:00
|
|
|
(and (plist-get info :with-date)
|
|
|
|
(let ((date (org-export-data (org-export-get-date info) info)))
|
|
|
|
(and (org-string-nw-p date)
|
2021-09-28 10:45:55 -04:00
|
|
|
(format "#+date: %s\n" date))))
|
2013-11-15 18:20:13 -05:00
|
|
|
(and (plist-get info :with-author)
|
|
|
|
(let ((author (org-export-data (plist-get info :author) info)))
|
|
|
|
(and (org-string-nw-p author)
|
2021-09-28 10:45:55 -04:00
|
|
|
(format "#+author: %s\n" author))))
|
2013-11-15 18:20:13 -05:00
|
|
|
(and (plist-get info :with-email)
|
|
|
|
(let ((email (org-export-data (plist-get info :email) info)))
|
|
|
|
(and (org-string-nw-p email)
|
2021-09-28 10:45:55 -04:00
|
|
|
(format "#+email: %s\n" email))))
|
2015-03-17 10:40:52 -04:00
|
|
|
(and (plist-get info :with-creator)
|
2013-11-15 18:20:13 -05:00
|
|
|
(org-string-nw-p (plist-get info :creator))
|
2021-09-28 10:45:55 -04:00
|
|
|
(format "#+creator: %s\n" (plist-get info :creator)))
|
2015-03-17 10:40:52 -04:00
|
|
|
contents))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
2018-01-08 09:39:01 -05:00
|
|
|
(defun org-org-timestamp (timestamp _contents _info)
|
|
|
|
"Transcode a TIMESTAMP object to custom format or back into Org syntax."
|
|
|
|
(org-timestamp-translate timestamp))
|
|
|
|
|
2014-05-21 12:33:53 -04:00
|
|
|
(defun org-org-section (section contents info)
|
|
|
|
"Transcode SECTION element back into Org syntax.
|
|
|
|
CONTENTS is the contents of the section. INFO is a plist used as
|
|
|
|
a communication channel."
|
|
|
|
(concat
|
|
|
|
(org-element-normalize-string contents)
|
|
|
|
;; Insert footnote definitions appearing for the first time in this
|
2017-03-15 06:51:16 -04:00
|
|
|
;; section, or in the relative headline title. Indeed, some of
|
|
|
|
;; them may not be available to narrowing so we make sure all of
|
|
|
|
;; them are included in the result.
|
2017-03-15 09:30:52 -04:00
|
|
|
(let ((footnotes
|
|
|
|
(org-element-map
|
2023-05-18 07:35:35 -04:00
|
|
|
(list (org-element-lineage section 'headline) section)
|
2017-03-15 06:51:16 -04:00
|
|
|
'footnote-reference
|
2014-05-21 12:33:53 -04:00
|
|
|
(lambda (fn)
|
2014-05-21 15:29:16 -04:00
|
|
|
(and (eq (org-element-property :type fn) 'standard)
|
2014-05-21 12:33:53 -04:00
|
|
|
(org-export-footnote-first-reference-p fn info)
|
2017-03-15 09:30:52 -04:00
|
|
|
(org-element-normalize-string
|
|
|
|
(format "[fn:%s] %s"
|
|
|
|
(org-element-property :label fn)
|
|
|
|
(org-export-data
|
|
|
|
(org-export-get-footnote-definition fn info)
|
|
|
|
info)))))
|
2017-03-15 06:51:16 -04:00
|
|
|
info nil 'headline t)))
|
2017-03-15 09:30:52 -04:00
|
|
|
(and footnotes (concat "\n" (mapconcat #'identity footnotes "\n"))))))
|
2014-05-21 12:33:53 -04:00
|
|
|
|
2013-04-04 09:09:22 -04:00
|
|
|
;;;###autoload
|
2013-11-15 18:20:13 -05:00
|
|
|
(defun org-org-export-as-org
|
2021-09-29 03:22:47 -04:00
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2013-04-04 09:09:22 -04:00
|
|
|
"Export current buffer to an Org buffer.
|
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
asynchronously. The resulting buffer should be accessible
|
|
|
|
through the `org-export-stack' interface.
|
|
|
|
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
first.
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
contents of hidden elements.
|
|
|
|
|
2013-11-15 18:20:13 -05:00
|
|
|
When optional argument BODY-ONLY is non-nil, strip document
|
|
|
|
keywords from output.
|
|
|
|
|
2013-04-04 09:09:22 -04:00
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
Export is done in a buffer named \"*Org ORG Export*\", which will
|
|
|
|
be displayed when `org-export-show-temporary-export-buffer' is
|
|
|
|
non-nil."
|
|
|
|
(interactive)
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
(org-export-to-buffer 'org "*Org ORG Export*"
|
2013-11-15 18:20:13 -05:00
|
|
|
async subtreep visible-only body-only ext-plist (lambda () (org-mode))))
|
2013-04-04 09:09:22 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
2013-11-15 18:20:13 -05:00
|
|
|
(defun org-org-export-to-org
|
2021-09-29 03:22:47 -04:00
|
|
|
(&optional async subtreep visible-only body-only ext-plist)
|
2018-09-21 08:19:04 -04:00
|
|
|
"Export current buffer to an Org file.
|
2013-04-04 09:09:22 -04:00
|
|
|
|
|
|
|
If narrowing is active in the current buffer, only export its
|
|
|
|
narrowed part.
|
|
|
|
|
|
|
|
If a region is active, export that region.
|
|
|
|
|
|
|
|
A non-nil optional argument ASYNC means the process should happen
|
|
|
|
asynchronously. The resulting file should be accessible through
|
|
|
|
the `org-export-stack' interface.
|
|
|
|
|
|
|
|
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
|
|
at point, extracting information from the headline properties
|
|
|
|
first.
|
|
|
|
|
|
|
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
|
|
contents of hidden elements.
|
|
|
|
|
2013-11-15 18:20:13 -05:00
|
|
|
When optional argument BODY-ONLY is non-nil, strip document
|
|
|
|
keywords from output.
|
|
|
|
|
2013-04-04 09:09:22 -04:00
|
|
|
EXT-PLIST, when provided, is a property list with external
|
|
|
|
parameters overriding Org default settings, but still inferior to
|
|
|
|
file-local settings.
|
|
|
|
|
|
|
|
Return output file name."
|
|
|
|
(interactive)
|
|
|
|
(let ((outfile (org-export-output-file-name ".org" subtreep)))
|
Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 04:35:42 -04:00
|
|
|
(org-export-to-file 'org outfile
|
2013-11-16 03:19:22 -05:00
|
|
|
async subtreep visible-only body-only ext-plist)))
|
2013-04-04 09:09:22 -04:00
|
|
|
|
2013-02-22 07:42:02 -05:00
|
|
|
;;;###autoload
|
2013-02-19 13:17:20 -05:00
|
|
|
(defun org-org-publish-to-org (plist filename pub-dir)
|
2018-09-21 08:19:04 -04:00
|
|
|
"Publish an Org file to Org.
|
2013-02-19 13:17:20 -05:00
|
|
|
|
|
|
|
FILENAME is the filename of the Org file to be published. PLIST
|
|
|
|
is the property list for the given project. PUB-DIR is the
|
|
|
|
publishing directory.
|
|
|
|
|
|
|
|
Return output file name."
|
2013-03-02 12:46:07 -05:00
|
|
|
(org-publish-org-to 'org filename ".org" plist pub-dir)
|
|
|
|
(when (plist-get plist :htmlized-source)
|
2023-01-23 10:06:46 -05:00
|
|
|
(org-require-package 'htmlize)
|
2013-03-02 12:46:07 -05:00
|
|
|
(require 'ox-html)
|
2013-03-19 06:15:08 -04:00
|
|
|
(let* ((org-inhibit-startup t)
|
|
|
|
(htmlize-output-type 'css)
|
2013-04-03 07:25:11 -04:00
|
|
|
(html-ext (concat "." (or (plist-get plist :html-extension)
|
|
|
|
org-html-extension "html")))
|
2013-03-19 06:15:08 -04:00
|
|
|
(visitingp (find-buffer-visiting filename))
|
2014-05-28 23:45:29 -04:00
|
|
|
(work-buffer (or visitingp (find-file-noselect filename)))
|
2013-03-19 06:15:08 -04:00
|
|
|
newbuf)
|
2014-05-28 23:45:29 -04:00
|
|
|
(with-current-buffer work-buffer
|
2022-06-30 07:06:21 -04:00
|
|
|
(font-lock-ensure)
|
2022-01-16 02:07:25 -05:00
|
|
|
(org-fold-show-all)
|
2014-05-28 23:45:29 -04:00
|
|
|
(setq newbuf (htmlize-buffer)))
|
2013-03-02 12:46:07 -05:00
|
|
|
(with-current-buffer newbuf
|
|
|
|
(when org-org-htmlized-css-url
|
|
|
|
(goto-char (point-min))
|
|
|
|
(and (re-search-forward
|
2023-04-25 15:06:50 -04:00
|
|
|
"<style type=\"text/css\">\\(?:.\\|\n\\)*?\n[ \t]*</style>.*" nil t)
|
2013-03-02 12:46:07 -05:00
|
|
|
(replace-match
|
|
|
|
(format
|
|
|
|
"<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">"
|
2014-05-28 23:45:29 -04:00
|
|
|
org-org-htmlized-css-url)
|
|
|
|
t t)))
|
2013-04-03 07:25:11 -04:00
|
|
|
(write-file (concat pub-dir (file-name-nondirectory filename) html-ext)))
|
2013-03-19 06:15:08 -04:00
|
|
|
(kill-buffer newbuf)
|
2023-04-20 04:45:05 -04:00
|
|
|
(unless visitingp (kill-buffer work-buffer)))))
|
2013-01-27 17:11:34 -05:00
|
|
|
|
2013-04-04 09:09:22 -04:00
|
|
|
|
2013-01-27 17:11:34 -05:00
|
|
|
(provide 'ox-org)
|
|
|
|
|
|
|
|
;; Local variables:
|
|
|
|
;; generated-autoload-file: "org-loaddefs.el"
|
|
|
|
;; End:
|
|
|
|
|
|
|
|
;;; ox-org.el ends here
|