Sfoglia il codice sorgente

ox-ascii: Add missing ASCII and UTF-8 conversion functions

* lisp/ox-ascii.el (org-ascii-convert-region-to-ascii):
(org-ascii-convert-region-to-utf8): New functions.
* doc/org-manual.org (Export in Foreign Buffers): Document new
  functions.

Reported-by: Alexander Adolf <alexander.adolf@condition-alpha.com>
<http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00294.html>
Nicolas Goaziou 6 anni fa
parent
commit
4832a432f0
2 ha cambiato i file con 24 aggiunte e 0 eliminazioni
  1. 10 0
      doc/org-manual.org
  2. 14 0
      lisp/ox-ascii.el

+ 10 - 0
doc/org-manual.org

@@ -15238,6 +15238,16 @@ regions.  A convenient feature of this in-place conversion is that the
 exported output replaces the original source.  Here are such
 functions:
 
+- ~org-ascii-convert-region-to-ascii~ ::
+
+     #+findex: org-ascii-convert-region-to-ascii
+     Convert the selected region into ASCII.
+
+- ~org-ascii-convert-region-to-utf8~ ::
+
+     #+findex: org-ascii-convert-region-to-utf8
+     Convert the selected region into UTF-8.
+
 - ~org-html-convert-region-to-html~ ::
 
      #+findex: org-html-convert-region-to-html

+ 14 - 0
lisp/ox-ascii.el

@@ -2064,6 +2064,20 @@ a communication channel."
 
 ;;; End-user functions
 
+;;;###autoload
+(defun org-ascii-convert-region-to-ascii ()
+  "Assume region has Org syntax, and convert it to plain ASCII."
+  (interactive)
+  (let ((org-ascii-charset 'ascii))
+    (org-export-replace-region-by 'ascii)))
+
+;;;###autoload
+(defun org-ascii-convert-region-to-utf8 ()
+  "Assume region has Org syntax, and convert it to UTF-8."
+  (interactive)
+  (let ((org-ascii-charset 'utf-8))
+    (org-export-replace-region-by 'ascii)))
+
 ;;;###autoload
 (defun org-ascii-export-as-ascii
   (&optional async subtreep visible-only body-only ext-plist)