(defun fic-ao3 () "Format fic for posting to AO3 and export it" (interactive) ;; (org-format) (save-buffer) (goto-char (point-min)) (while (re-search-forward "\\[fn:[^•]*•\\]" nil t) (replace-match "")) (let ((org-export-with-title 'nil) (org-export-with-author 'nil) (org-export-with-creator 'nil) (org-export-with-date 'nil) (org-export-with-section-numbers 'nil) (org-export-time-stamp-file 'nil) (org-export-with-toc 'nil) (org-html-validation-link 'nil)) (org-html-export-to-html)) (revert-buffer t t) (setq oldname (concat (file-name-base) ".org")) (setq newname (concat (file-name-base) ".html")) (find-file-noselect newname) (with-current-buffer newname (goto-char (point-min)) (setq delpoint-one (search-forward "\n")) (delete-region (point-min) delpoint-one) (goto-char (point-max)) (setq delpoint-two (search-backward "")) (delete-region delpoint-two (point-max)) (goto-char (point-min)) (while (re-search-forward "" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "\n\n" nil t) (replace-match "\n")) (write-file newname) (kill-ring-save (point-min) (point-max))) (kill-buffer newname) (with-current-buffer oldname (delete-file newname))) (unless (string-equal system-type "android") (defun fic-export () "Export fic to HTML, EPUB, PDF" (interactive) (shell-command "cp ~/.emacs.d/fic-export-files/FFXYevon.ttf .") (setq asal (y-or-n-p "ASAL?")) (if asal (progn (setq title t) (setq multichapter t) (setq chaptertitles nil) (setq ffx t)) (progn (setq title (y-or-n-p "Use the fic title in exports?")) (setq multichapter (y-or-n-p "Multichapter?")) (if multichapter (setq chaptertitles (y-or-n-p "Titled chapters?"))) (setq ffx (y-or-n-p "FFX fic?")))) ;; (setq draftmode (y-or-n-p "Edit LaTeX file manually?")) ;; (org-format) (save-buffer) (goto-char (point-min)) (while (re-search-forward "\\[fn:\\([0-9]*\\):\\([^•]*\\)•\\]" nil t) (replace-match "@@html:@@@@latex:\\\\footnote{@@\\2@@html:@@@@latex:}@@")) (let ((user-full-name "Tré") (org-html-head "") (org-export-with-author t) (org-latex-default-class "memoir")) (org-html-export-to-html) (org-latex-export-to-latex)) (revert-buffer t t) (setq htmlfile (concat (file-name-base) ".html")) (find-file-noselect htmlfile) (with-current-buffer htmlfile (goto-char (point-min)) (while (re-search-forward "
\n
" nil t) (replace-match "\n")) (goto-char (point-min)) (while (re-search-forward "
\n\n

" nil t) (replace-match "\n

\n

")) (goto-char (point-min)) (while (re-search-forward "


\n\n

" nil t) (replace-match "

\n
\n

")) (goto-char (point-min)) (while (re-search-forward "

" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "
" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "

Validate

" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "
" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "section-number-2\">\\([0-9]*\\)<" nil t) (replace-match "section-number-2\">\\1\.<")) (goto-char (point-min)) (while (re-search-forward "

" nil t) (replace-match "")) (goto-char (point-min)) (while (re-search-forward "\n\n" nil t) (replace-match "\n\n")) (if (not title) (progn (goto-char (point-min)) (while (re-search-forward "" nil t) (replace-match "")))) (progn (goto-char (point-min)) (while (re-search-forward "