emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [ANN] ASCII back-end for new export engine


From: Thomas S. Dye
Subject: Re: [O] [ANN] ASCII back-end for new export engine
Date: Fri, 27 Jan 2012 07:00:01 -1000

Nicolas Goaziou <address@hidden> writes:

> Hello,
>
> I've commited an ASCII back-end for new export engine.
>
> Assuming contrib directory is in your load-path, you just need to
> (require 'org-export) to have both LaTeX and ASCII exporters ready to
> boot.
>
> You can then access to the dispatcher with M-x org-export-dispatch and
> test various configurations from there.
>
> As a reminder, you can ask for a table of contents, list of tables and
> list of listings with, respectively, "#+toc: headlines", "#+toc: tables"
> and "#+toc: listings". Also, drawers[1] are exported transparently by
> default.
>
> Feedback is welcome.
>
>
> Regards,
>
> [1] properties drawers excepted: those are different elements anyway.

Aloha Nicolas,

I haven't been able to export a listing yet.  The following source
exports with the old exporter, but fails with the experimental exporter.

* Listing heading

#+BEGIN_SRC python :results output
print "hello world"
#+END_SRC

With the old exporter I get:
\section{Listing heading}
\label{sec-6}



\begin{verbatim}
print "hello world"
\end{verbatim}

The backtrace with the experimental exporter follows.

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  get-file-buffer(nil)
  (org-babel-expand-noweb-references info (get-file-buffer 
org-current-export-file))
  (if (org-babel-noweb-p (nth 2 info) :export) 
(org-babel-expand-noweb-references info (get-file-buffer 
org-current-export-file)) (nth 1 info))
  (setcar (nthcdr 1 info) (if (org-babel-noweb-p ... :export) 
(org-babel-expand-noweb-references info ...) (nth 1 info)))
  (setf (nth 1 info) (if (org-babel-noweb-p ... :export) 
(org-babel-expand-noweb-references info ...) (nth 1 info)))
  (progn (when (member ... ...) (org-babel-exp-in-export-file lang ...) (setf 
hash ...)) (setf (nth 1 info) (if ... ... ...)) (org-babel-exp-do-export info 
(quote block) hash))
  (if info (progn (when ... ... ...) (setf ... ...) (org-babel-exp-do-export 
info ... hash)))
  (when info (when (member ... ...) (org-babel-exp-in-export-file lang ...) 
(setf hash ...)) (setf (nth 1 info) (if ... ... ...)) (org-babel-exp-do-export 
info (quote block) hash))
  (let* ((info ...) (lang ...) (raw-params ...) hash) (when info (when ... ... 
...) (setf ... ...) (org-babel-exp-do-export info ... hash)))
  (save-excursion (goto-char (match-beginning 0)) (let* (... ... ... hash) 
(when info ... ... ...)))
  org-babel-exp-src-block(#("print \"hello world\"\n" 0 1 (fontified t 
font-lock-fontified t font-lock-multiline t face py-builtins-face) 1 5 
(fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 
5 6 (fontified t font-lock-fontified t font-lock-multiline t face nil) 6 7 
(fontified t font-lock-fontified t font-lock-multiline t face 
font-lock-string-face) 7 19 (fontified t font-lock-fontified t 
font-lock-multiline t face font-lock-string-face) 19 20 (fontified t 
font-lock-fontified t font-lock-multiline t face font-lock-string-face)) 
#("python" 0 6 (font-lock-multiline t face org-block-begin-line 
font-lock-fontified t fontified t)) #(":results" 0 8 (font-lock-multiline t 
face org-block-begin-line font-lock-fontified t fontified t)) #("output" 0 6 
(font-lock-multiline t face org-block-begin-line font-lock-fontified t 
fontified t)))
  apply(org-babel-exp-src-block #("print \"hello world\"\n" 0 1 (fontified t 
font-lock-fontified t font-lock-multiline t face py-builtins-face) 1 5 
(fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 
5 6 (fontified t font-lock-fontified t font-lock-multiline t face nil) 6 7 
(fontified t font-lock-fontified t font-lock-multiline t face 
font-lock-string-face) 7 19 (fontified t font-lock-fontified t 
font-lock-multiline t face font-lock-string-face) 19 20 (fontified t 
font-lock-fontified t font-lock-multiline t face font-lock-string-face)) 
(#("python" 0 6 (font-lock-multiline t face org-block-begin-line 
font-lock-fontified t fontified t)) #(":results" 0 8 (font-lock-multiline t 
face org-block-begin-line font-lock-fontified t fontified t)) #("output" 0 6 
(font-lock-multiline t face org-block-begin-line font-lock-fontified t 
fontified t))))
  (if (memq type org-export-blocks-witheld) "" (apply func body headers))
  (progn (if (memq type org-export-blocks-witheld) "" (apply func body 
headers)))
  (unwind-protect (progn (if ... "" ...)) (set-match-data 
save-match-data-internal (quote evaporate)))
  (let ((save-match-data-internal ...)) (unwind-protect (progn ...) 
(set-match-data save-match-data-internal ...)))
  (save-match-data (if (memq type org-export-blocks-witheld) "" (apply func 
body headers)))
  (let ((replacement ...)) (when replacement (delete-region match-start 
match-end) (goto-char match-start) (insert replacement) (unless preserve-indent 
...)))
  (progn (let (...) (when replacement ... ... ... ...)))
  (if (setq func (cadr ...)) (progn (let ... ...)))
  (when (setq func (cadr ...)) (let (...) (when replacement ... ... ... ...)))
  (let* ((match-start ...) (body-start ...) (indentation ...) (inner-re ...) 
(type ...) (headers ...) (balanced 1) (preserve-indent ...) match-end) (while 
(and ... ...) (if ... ... ...)) (when (not ...) (error "unbalanced begin/end_%s 
blocks with %S" type ...)) (setq match-end (copy-marker ...)) (unless 
preserve-indent (setq body ...)) (unless (memq type types) (setq types ...)) 
(save-match-data (interblock start match-start)) (when (setq func ...) (let ... 
...)) (set-marker match-start nil) (set-marker body-start nil) (set-marker 
match-end nil))
  (while (re-search-forward beg-re nil t) (let* (... ... ... ... ... ... ... 
... match-end) (while ... ...) (when ... ...) (setq match-end ...) (unless 
preserve-indent ...) (unless ... ...) (save-match-data ...) (when ... ...) 
(set-marker match-start nil) (set-marker body-start nil) (set-marker match-end 
nil)) (setq start (point)))
  (let ((beg-re "^\\([  ]*\\)#\\+begin_\\(\\S-+\\)[     ]*\\(.*\\)?[
\n]")) (while (re-search-forward beg-re nil t) (let* ... ... ... ... ... ... 
... ... ... ... ...) (setq start ...)))
  (progn (fset (quote interblock) (function* ...)) (goto-char (point-min)) 
(setq start (point)) (let (...) (while ... ... ...)) (interblock start 
(point-max)) (run-hooks (quote org-export-blocks-postblock-hook)))
  (unwind-protect (progn (fset ... ...) (goto-char ...) (setq start ...) (let 
... ...) (interblock start ...) (run-hooks ...)) (if --cl-letf-bound-- (fset 
... --cl-letf-save--) (fmakunbound ...)))
  (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect (progn 
... ... ... ... ... ...) (if --cl-letf-bound-- ... ...)))
  (letf ((... ...)) (goto-char (point-min)) (setq start (point)) (let (...) 
(while ... ... ...)) (interblock start (point-max)) (run-hooks (quote 
org-export-blocks-postblock-hook)))
  (letf* ((... ...)) (goto-char (point-min)) (setq start (point)) (let (...) 
(while ... ... ...)) (interblock start (point-max)) (run-hooks (quote 
org-export-blocks-postblock-hook)))
  (flet ((interblock ... ...)) (goto-char (point-min)) (setq start (point)) 
(let (...) (while ... ... ...)) (interblock start (point-max)) (run-hooks 
(quote org-export-blocks-postblock-hook)))
  (let ((case-fold-search t) (types ...) matched indentation type func start 
end body headers preserve-indent progress-marker) (flet (...) (goto-char ...) 
(setq start ...) (let ... ...) (interblock start ...) (run-hooks ...)))
  (save-window-excursion (let (... ... matched indentation type func start end 
body headers preserve-indent progress-marker) (flet ... ... ... ... ... ...)))
  org-export-blocks-preprocess()
  (progn (org-export-blocks-preprocess) (org-element-parse-buffer nil 
visible-only))
  (let ((buffer-invisibility-spec nil)) (org-clone-local-variables 
--original-buffer "^\\(org-\\|orgtbl-\\|major-mode$\\|outline-regexp$\\)") 
(insert --buffer-string) (mapc (lambda ... ...) --overlays) (goto-char 
(point-min)) (progn (org-export-blocks-preprocess) (org-element-parse-buffer 
nil visible-only)))
  (progn (let (...) (org-clone-local-variables --original-buffer 
"^\\(org-\\|orgtbl-\\|major-mode$\\|outline-regexp$\\)") (insert 
--buffer-string) (mapc ... --overlays) (goto-char ...) (progn ... ...)))
  (unwind-protect (progn (let ... ... ... ... ... ...)) (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ...) 
(and ... ...)))
  (with-current-buffer temp-buffer (unwind-protect (progn ...) (and ... ...)))
  (let ((temp-buffer ...)) (with-current-buffer temp-buffer (unwind-protect ... 
...)))
  (with-temp-buffer (let (...) (org-clone-local-variables --original-buffer 
"^\\(org-\\|orgtbl-\\|major-mode$\\|outline-regexp$\\)") (insert 
--buffer-string) (mapc ... --overlays) (goto-char ...) (progn ... ...)))
  (let ((--original-buffer #<buffer latex-export.org>) (--offset 0) 
(--buffer-string #("#+TITLE:     latex-export.org\n#+AUTHOR:    Thomas 
Dye\n#+EMAIL:     address@hidden:      2012-01-21 
Sat\n#+DESCRIPTION:\n#+KEYWORDS:\n#+LANGUAGE:  en\n#+OPTIONS:   H:3 num:1 
toc:nil \\n:nil @:t ::t |:t ^:t -:t f:t *:t <:t\n#+OPTIONS:   TeX:t LaTeX:t 
skip:nil d:nil todo:t pri:nil tags:not-in-toc\n#+INFOJS_OPT: view:nil toc:nil 
ltoc:t mouse:underline buttons:0 
path:http://orgmode.org/org-info.js\n#+EXPORT_SELECT_TAGS: 
export\n#+EXPORT_EXCLUDE_TAGS: noexport\n#+LINK_UP:   \n#+LINK_HOME: 
\n#+XSLT:\n#+LaTeX_HEADER: \\usepackage{paralist}\n\n#+BEGIN_abstract\nThis is 
an abstract.\n#+END_abstract\n\n#+toc: headlines\n#+toc: tables\n#+toc: 
figures\n\n* First heading\n  :PROPERTIES:\n  :ID:       
A0EF6F8D-DC06-4AA7-8090-401B90BDACF0\n  :END:\n\nNote the use of =#+toc: 
headlines= together with =#+OPTIONS: toc:nil=\nto produce a table of contents 
without a =\\vspace*= following.\n\nIn Section [[First heading]] we will set up 
Section [[Table heading]].\n\n** First sub heading\nThis is some text after the 
subheading.\n\n* Table heading\nThis is a test table.  Note that the new 
exporter faithfully\nreproduces the behavior of the old exporter.  Look into 
how it might\nbe modified to produce tables with the booktabs package. 
\n\n#+CAPTION: A test table\n#+LABEL: tab:test\n| One | Two |\n|-----+-----|\n| 
1   | 2   |\n\n* Figure heading\n\nThis is an example of adding a 
figure.\n\n#+CAPTION[An example photograph]: An example photograph.\n#+NAME: 
fig:photo\n[[file:~/Public/projects/308/photo/IMG_0072_cropped.jpg]]\n\n* 
Reference heading\n\nThis is a reference \n\n* List heading\nThis is an 
in-paragraph enumerated list:\n  #+attr_latex: inparaenum (i)\n  - one;\n  - 
two; and\n  - three.\n\nThis should be a sentence in a new paragraph.\n* 
Listing heading\nThis is a listing.\n\n#+BEGIN_SRC python :results 
output\nprint \"hello world\"\n#+END_SRC\n\n#+RESULTS:\n: hello world\n\n" 0 8 
... 8 13 ... 13 29 ... 29 30 ... 30 39 ... 39 43 ... 43 53 ... 53 54 ... 54 62 
... 62 67 ... 67 80 ... 80 81 ... 81 88 ... 88 94 ... 94 108 ... 108 109 ... 
109 123 ... 123 124 ... 124 135 ... 135 136 ... 136 151 ... 151 152 ... 152 221 
... 221 222 ... 222 294 ... 294 295 ... 295 364 ... 364 393 ... 393 394 ... 394 
395 ... 395 423 ... 423 424 ... 424 455 ... 455 456 ... 456 469 ... 469 470 ... 
470 483 ... 483 484 ... 484 491 ... 491 492 ... 492 529 ... 529 530 ... 530 531 
... 531 547 ... 547 548 ... 548 568 ... 568 569 ... 569 583 ... 583 584 ... 584 
585 ... 585 601 ... 601 602 ... 602 615 ... 615 616 ... 616 630 ... 630 631 ... 
631 632 ... 632 634 ... 634 647 ... 647 648 ... 648 662 ... 662 665 ... 665 669 
... 669 676 ... 676 712 ... 712 713 ... 713 720 ... 720 737 ... 737 738 ... 738 
756 ... 756 757 ... 757 770 ... 770 771 ... 771 791 ... 791 832 ... 832 833 ... 
833 843 ... 843 844 ... 844 867 ... 867 868 ... 868 869 ... 869 881 ... 881 882 
... 882 883 ... 883 884 ... 884 908 ... 908 909 ... 909 910 ... 910 922 ... 922 
923 ... 923 924 ... 924 925 ... 925 928 ... 928 929 ... 929 931 ... 931 948 ... 
948 990 ... 990 992 ... 992 1005 ... 1005 1067 ... 1067 1279 ... 1279 1280 ... 
1280 1282 ... 1282 1296 ... 1296 1338 ... 1338 1394 ... 1394 1395 ... 1395 1412 
... 1412 1413 ... 1413 1414 ... 1414 1415 ... 1415 1467 ... 1467 1468 ... 1468 
1469 ... 1469 1470 ... 1470 1472 ... 1472 1474 ... 1474 1491 ... 1491 1515 ... 
1515 1517 ... 1517 1529 ... 1529 1530 ... 1530 1571 ... 1571 1601 ... 1601 1682 
... 1682 1684 ... 1684 1699 ... 1699 1700 ... 1700 1719 ... 1719 1720 ... 1720 
1754 ... 1754 1755 ... 1755 1756 ... 1756 1760 ... 1760 1761 ... 1761 1762 ... 
1762 1774 ... 1774 1775 ... 1775 1784 ... 1784 1785 ... 1785 1786 ... 1786 1796 
... 1796 1797 ... 1797 1799 ... 1799 1811 ... 1811 1812 ...)) (--overlays ...)) 
(with-temp-buffer (let ... ... ... ... ... ...)))
  (org-export-with-current-buffer-copy (org-export-blocks-preprocess) 
(org-element-parse-buffer nil visible-only))
  (org-export-filter-apply-functions (plist-get info :filter-parse-tree) 
(org-export-with-current-buffer-copy (org-export-blocks-preprocess) 
(org-element-parse-buffer nil visible-only)) backend)
  (progn (when subtreep (let ... ...)) (org-export-filter-apply-functions 
(plist-get info :filter-parse-tree) (org-export-with-current-buffer-copy ... 
...) backend))
  (let* ((info ...) (raw-data ...)) (setq info (org-combine-plists info ...)) 
(let* (... ... ...) (when org-export-copy-to-kill-ring ...) output))
  (save-restriction (when (org-region-active-p) (narrow-to-region ... ...) 
(goto-char ...)) (when (and subtreep ...) (org-with-limited-levels ...)) (let* 
(... ...) (setq info ...) (let* ... ... output)))
  (save-excursion (save-restriction (when ... ... ...) (when ... ...) (let* ... 
... ...)))
  org-export-as(e-latex nil nil nil nil)
  (let ((out ...) (buffer ...)) (with-current-buffer buffer (erase-buffer) 
(insert out) (goto-char ...)) buffer)
  org-export-to-buffer(e-latex "*Org E-LaTeX Export*" nil nil nil)
  (let ((outbuf ...)) (with-current-buffer outbuf (latex-mode)) (when 
org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))
  (cond ((member* --cl-var-- ...) (let ... ... ...)) ((member* --cl-var-- ...) 
(org-e-ascii-export-to-ascii ... ... ... ...)) ((eql --cl-var-- ...) (let ... 
... ...)) ((eql --cl-var-- ...) (org-e-latex-export-to-latex ... ... ...)) 
((eql --cl-var-- ...) (org-e-latex-export-to-pdf ... ... ...)) ((eql --cl-var-- 
...) (org-open-file ...)) (t (error "No command associated with key %s" ...)))
  (let ((--cl-var-- ...)) (cond (... ...) (... ...) (... ...) (... ...) (... 
...) (... ...) (t ...)))
  (case (if (< raw-key 27) (+ raw-key 96) raw-key) ((65 78 85) (let ... ... 
...)) ((97 110 117) (org-e-ascii-export-to-ascii ... ... ... ...)) (76 (let ... 
... ...)) (108 (org-e-latex-export-to-latex ... ... ...)) (112 
(org-e-latex-export-to-pdf ... ... ...)) (100 (org-open-file ...)) (t (error 
"No command associated with key %s" ...)))
  (let* ((input ...) (raw-key ...) (scope ...)) (case (if ... ... raw-key) (... 
...) (... ...) (76 ...) (108 ...) (112 ...) (100 ...) (t ...)))
  org-export-dispatch()
  call-interactively(org-export-dispatch t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]