Improve ASAL export functions

master
trémeur 4 months ago
parent 3ae8ba63cb
commit 4847fbf799

@ -134,10 +134,24 @@
(setq texfile (concat (file-name-base) ".tex")) (setq texfile (concat (file-name-base) ".tex"))
(find-file-noselect texfile) (find-file-noselect texfile)
(with-current-buffer texfile (with-current-buffer texfile
(if asal
(progn
(goto-char (point-min))
(search-forward "\\begin{document}")
(while (re-search-forward "\n" nil t)
(replace-match "\n\n"))
(save-buffer)
(shell-command
(format "pandoc %s -o %s.epub --epub-cover-image=/home/mdd/Documents/drive/the\\ walk/cover.png"
(shell-quote-argument (buffer-file-name))
(shell-quote-argument (file-name-base)))))
(shell-command (shell-command
(format "pandoc %s -o %s.epub" (format "pandoc %s -o %s.epub"
(shell-quote-argument (buffer-file-name)) (shell-quote-argument (buffer-file-name))
(shell-quote-argument (file-name-base)))) (shell-quote-argument (file-name-base)))))
(goto-char (point-min))
(while (re-search-forward "label{\\(.*\\)}\n\n" nil t)
(replace-match "label{\\1}\n"))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t) (while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t)
(replace-match "label{\\1}\n\\\\lettrine{\\2}{\\3}")) (replace-match "label{\\1}\n\\\\lettrine{\\2}{\\3}"))

@ -0,0 +1,16 @@
(defun tagexport ()
"Export separate HTML pages for ASAL tags"
(interactive)
(find-file-noselect "~/Documents/drive/the walk/full.org")
(with-current-buffer "full.org"
(setq thetags (org-get-buffer-tags))
(setq tags nil)
(dolist (tag thetags)
(setq thetag (substring (format "%s" tag) 1 -1))
(push thetag tags))
(setq tags (remove "ignore" tags))
(dolist (thetag tags)
(setq org-export-select-tags nil)
(push thetag org-export-select-tags)
(org-export-to-file 'html (concat "tagexport/" thetag ".html"))))
(setq org-export-select-tags '("export")))
Loading…
Cancel
Save