diff options
author | Maciej Barć <xgqt@gentoo.org> | 2023-08-22 15:48:26 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2023-08-26 08:51:06 +0200 |
commit | 9ad1e2555ee67d4cd7dfc538f09f37b1eecc5566 (patch) | |
tree | 01493a40ba74c9f9a9c489b4a8034de73c03f1c2 /eclass/elisp-common.eclass | |
parent | elisp-common.eclass: Document sed script in elisp-site-file-install (diff) | |
download | gentoo-9ad1e2555ee67d4cd7dfc538f09f37b1eecc5566.tar.gz gentoo-9ad1e2555ee67d4cd7dfc538f09f37b1eecc5566.tar.bz2 gentoo-9ad1e2555ee67d4cd7dfc538f09f37b1eecc5566.zip |
eclass/elisp-common.eclass: add elisp-org-export-to
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'eclass/elisp-common.eclass')
-rw-r--r-- | eclass/elisp-common.eclass | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index 03e47d931f44..ef24622d405e 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -348,6 +348,39 @@ elisp-make-autoload-file() { eend $? "elisp-make-autoload-file: batch-update-autoloads failed" || die } +# @FUNCTION: elisp-org-export-to +# @USAGE: <export file type> <Org file path> +# @DESCRIPTION: +# Use Emacs Org "export-to" functions to convert a given Org file to a picked +# format. +# +# Example: +# @CODE +# elisp-org-export-to texinfo README.org +# mv README.texi ${PN}.texi || die +# @CODE + +elisp-org-export-to() { + local export_format="${1}" + local org_file_path="${2}" + + local export_group + case ${export_format} in + info) export_group=texinfo ;; # Straight to ".info". + markdown) export_group=md ;; + pdf) export_group=latex ;; + *) export_group=${export_format} ;; + esac + + # export_format = texinfo => org-texinfo-export-to-texinfo + # export_format = pdf => org-latex-export-to-pdf + + local export_function=org-${export_group}-export-to-${export_format} + + ${EMACS} ${EMACSFLAGS} "${org_file_path}" -f "${export_function}" \ + || die "Org export to ${export_format} failed" +} + # @FUNCTION: elisp-test-buttercup # @USAGE: [test-subdirectory] [test-runner-opts] ... # @DESCRIPTION: |