Improve ASAL export functions

master
trémeur 7 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
(shell-command (if asal
(format "pandoc %s -o %s.epub" (progn
(shell-quote-argument (buffer-file-name)) (goto-char (point-min))
(shell-quote-argument (file-name-base)))) (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
(format "pandoc %s -o %s.epub"
(shell-quote-argument (buffer-file-name))
(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}"))
@ -228,26 +242,26 @@
(goto-char (point-max)) (goto-char (point-max))
(save-buffer) (save-buffer)
;; (unless draftmode ;; (unless draftmode
(shell-command (shell-command
(format "xelatex -interaction=batchmode %s" (format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name)))) (shell-quote-argument (buffer-file-name))))
(shell-command (shell-command
(format "xelatex -interaction=batchmode %s" (format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name)))) (shell-quote-argument (buffer-file-name))))
;; ) ;; )
(kill-current-buffer)) (kill-current-buffer))
;; (unless draftmode ;; (unless draftmode
(delete-file "FFXYevon.ttf") (delete-file "FFXYevon.ttf")
(if (file-exists-p (concat (file-name-base) ".aux")) (if (file-exists-p (concat (file-name-base) ".aux"))
(delete-file (concat (file-name-base) ".aux"))) (delete-file (concat (file-name-base) ".aux")))
(if (file-exists-p (concat (file-name-base) ".log")) (if (file-exists-p (concat (file-name-base) ".log"))
(delete-file (concat (file-name-base) ".log"))) (delete-file (concat (file-name-base) ".log")))
(if (file-exists-p (concat (file-name-base) ".out")) (if (file-exists-p (concat (file-name-base) ".out"))
(delete-file (concat (file-name-base) ".out"))) (delete-file (concat (file-name-base) ".out")))
(if (file-exists-p (concat (file-name-base) ".toc")) (if (file-exists-p (concat (file-name-base) ".toc"))
(delete-file (concat (file-name-base) ".toc"))) (delete-file (concat (file-name-base) ".toc")))
(if (file-exists-p "texput.log") (if (file-exists-p "texput.log")
(delete-file "texput.log")) (delete-file "texput.log"))
(delete-file texfile) (delete-file texfile)
;; ) ;; )
(message "Done"))) (message "Done")))

@ -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