diff --git a/config.org b/config.org index f54aaa2..71ec9ca 100644 --- a/config.org +++ b/config.org @@ -490,8 +490,9 @@ Add the =memoir= class for LaTeX export. (add-to-list 'org-latex-classes '("memoir" "\\documentclass[9pt,b6paper]{memoir} - [NO-DEFAULT-PACKAGES] - \\input{header.tex}" + [NO-DEFAULT-PACKAGES] + \\usepackage[namechapters]{optional} + \\input{$HOME/.emacs.d/fic-export-files/header.tex} %$" ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") diff --git a/custom/asal-functions.el b/custom/asal-functions.el deleted file mode 100644 index 3a7aa16..0000000 --- a/custom/asal-functions.el +++ /dev/null @@ -1,63 +0,0 @@ -(defun asal-post () - (interactive) - (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")) - (goto-char (point-min)) - (while (re-search-forward "\\\\noindent\\\\rule{\\\\textwidth}{0.5pt}" nil t) - (replace-match "\\sephim" nil t)) - (goto-char (point-min)) - (while (re-search-forward "\\\\maketitle" nil t) - (replace-match "\\begin{titlingpage}\n\\titleGM\n\\end{titlingpage}" nil t)) - (goto-char (point-min)) - (while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t) - (replace-match "label{\\1}\n\\\\lettrine{\\2}{\\3}")) - (goto-char (point-min)) - (while (re-search-forward "label{\\(.*\\)}\nā€œ\\([A-Z]\\)\\([a-z]*\\)" nil t) - (replace-match "label{\\1}\n\\\\lettrine{ā€œ\\2}{\\3}"))) - -(defun asal-pre () - (interactive) - (org-format) - (goto-char (point-min)) - (while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t) - (replace-match "@@html:\\2@@@@latex:\\\\footnote{\\2}@@"))) - -(defun asal-export () - (interactive) - (let ((org-html-head "")) - (org-html-export-to-html)) - (org-latex-export-to-latex)) diff --git a/custom/fic.el b/custom/fic.el new file mode 100644 index 0000000..58fb56e --- /dev/null +++ b/custom/fic.el @@ -0,0 +1,225 @@ +(defun fic-ao3 () + (interactive) + (org-format) + (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)) + (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 "\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))) + +(defun fic-export () + (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?")))) + (org-format) + (goto-char (point-min)) + (while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t) + (replace-match "@@html:\\2@@@@latex:\\\\footnote{\\2}@@")) + (let ((user-full-name "ovely") + (org-html-head "")) + (org-html-export-to-html) + (org-latex-export-to-latex)) + (save-buffer) + (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 "