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"))
(find-file-noselect texfile)
(with-current-buffer texfile
(shell-command
(format "pandoc %s -o %s.epub"
(shell-quote-argument (buffer-file-name))
(shell-quote-argument (file-name-base))))
(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
(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))
(while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t)
(replace-match "label{\\1}\n\\\\lettrine{\\2}{\\3}"))
@ -228,26 +242,26 @@
(goto-char (point-max))
(save-buffer)
;; (unless draftmode
(shell-command
(format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name))))
(shell-command
(format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name))))
(shell-command
(format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name))))
(shell-command
(format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name))))
;; )
(kill-current-buffer))
;; (unless draftmode
(delete-file "FFXYevon.ttf")
(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"))
(delete-file (concat (file-name-base) ".log")))
(delete-file (concat (file-name-base) ".log")))
(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"))
(delete-file (concat (file-name-base) ".toc")))
(delete-file (concat (file-name-base) ".toc")))
(if (file-exists-p "texput.log")
(delete-file "texput.log"))
(delete-file "texput.log"))
(delete-file texfile)
;; )
(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