contrib/lisp/ox-extra.el: fix typos/thinkos
This commit is contained in:
parent
c4ceeb34f1
commit
f05216987d
|
@ -46,36 +46,37 @@
|
||||||
(require 'ox)
|
(require 'ox)
|
||||||
(eval-when-compile (require 'cl))
|
(eval-when-compile (require 'cl))
|
||||||
|
|
||||||
(defun org-latex-header-blocks-filter ()
|
(defun org-latex-header-blocks-filter (backend)
|
||||||
(let ((positions
|
(when (org-export-derived-backend-p backend 'latex)
|
||||||
(org-element-map (org-element-parse-buffer 'greater-element nil) 'export-block
|
(let ((positions
|
||||||
(lambda (block)
|
(org-element-map (org-element-parse-buffer 'greater-element nil) 'export-block
|
||||||
(when (and (string= (org-element-property :type block) "LATEX")
|
(lambda (block)
|
||||||
(string= (org-export-read-attribute
|
(when (and (string= (org-element-property :type block) "LATEX")
|
||||||
:header block :header)
|
(string= (org-export-read-attribute
|
||||||
"yes"))
|
:header block :header)
|
||||||
(list (org-element-property :begin block)
|
"yes"))
|
||||||
(org-element-property :end block)
|
(list (org-element-property :begin block)
|
||||||
(org-element-property :post-affiliated block)))))))
|
(org-element-property :end block)
|
||||||
(mapc (lambda (pos)
|
(org-element-property :post-affiliated block)))))))
|
||||||
(goto-char (nth 2 pos))
|
(mapc (lambda (pos)
|
||||||
(destructuring-bind
|
(goto-char (nth 2 pos))
|
||||||
(beg end &rest ignore)
|
(destructuring-bind
|
||||||
(org-edit-src-find-region-and-lang)
|
(beg end &rest ignore)
|
||||||
(let ((contents-lines (split-string
|
(org-edit-src-find-region-and-lang)
|
||||||
(buffer-substring-no-properties beg end)
|
(let ((contents-lines (split-string
|
||||||
"\n")))
|
(buffer-substring-no-properties beg end)
|
||||||
(delete-region (nth 0 pos) (nth 1 pos))
|
"\n")))
|
||||||
(dolist (line contents-lines)
|
(delete-region (nth 0 pos) (nth 1 pos))
|
||||||
(insert (concat "#+latex_header: "
|
(dolist (line contents-lines)
|
||||||
(replace-regexp-in-string "\\` *" "" line)
|
(insert (concat "#+latex_header: "
|
||||||
"\n"))))))
|
(replace-regexp-in-string "\\` *" "" line)
|
||||||
;; go in reverse, to avoid wrecking the numeric positions
|
"\n"))))))
|
||||||
;; earlier in the file
|
;; go in reverse, to avoid wrecking the numeric positions
|
||||||
(reverse positions))))
|
;; earlier in the file
|
||||||
|
(reverse positions)))))
|
||||||
|
|
||||||
(defconst ox-extras
|
(defconst ox-extras
|
||||||
'((latex-header-blocks org-latex-latex-header-blocks-filter org-export-before-parsing-hook))
|
'((latex-header-blocks org-latex-header-blocks-filter org-export-before-parsing-hook))
|
||||||
"A list of org export extras that can be enabled.
|
"A list of org export extras that can be enabled.
|
||||||
|
|
||||||
Should be a list of items of the form (NAME FN HOOK). NAME is a
|
Should be a list of items of the form (NAME FN HOOK). NAME is a
|
||||||
|
|
Loading…
Reference in New Issue