From 306c253fff2138d817a04a35fad1eb8715b6a0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Wed, 25 Jan 2023 23:09:47 +0000 Subject: [PATCH] Sort ASAL functions --- custom/asal-clean.el | 38 ------------------ custom/asal-functions.el | 85 ++++++++++++++++++++++++++++++++++++++++ memoir.el | 9 +++++ 3 files changed, 94 insertions(+), 38 deletions(-) delete mode 100644 custom/asal-clean.el create mode 100644 custom/asal-functions.el create mode 100644 memoir.el diff --git a/custom/asal-clean.el b/custom/asal-clean.el deleted file mode 100644 index bb38d80..0000000 --- a/custom/asal-clean.el +++ /dev/null @@ -1,38 +0,0 @@ -(defun asal-clean () - (interactive) - (goto-char (region-beginning)) - (while (re-search-forward "
\n
" nil t) - (replace-match "\n")) - (goto-char (region-beginning)) - (while (re-search-forward "
\n\n

" nil t) - (replace-match "\n

\n

")) - (goto-char (region-beginning)) - (while (re-search-forward "

" nil t) - (replace-match "")) - (goto-char (region-beginning)) - (while (re-search-forward "
" nil t) - (replace-match "")) - (goto-char (region-beginning)) - (while (re-search-forward "

Validate

" nil t) - (replace-match "")) - (goto-char (region-beginning)) - (while (re-search-forward "
" nil t) - (replace-match "")) - (goto-char (region-beginning)) - (while (re-search-forward "\\\\noindent\\\\rule{\\\\textwidth}{0.5pt}" nil t) - (replace-match "\\sephim" nil t)) - (goto-char (region-beginning)) - (while (re-search-forward "\\\\maketitle" nil t) - (replace-match "\\begin{titlingpage}\n\\titleGM\n\\end{titlingpage}" nil t))) - -(defun asal-note () - (interactive) - (setq footnotemark (read-string "Unique name: ")) - (setq footnotecontent (read-string "Content of note: ")) - (insert (concat "@@html:" footnotecontent "@@@@latex:\\footnote{" footnotecontent "}@@"))) diff --git a/custom/asal-functions.el b/custom/asal-functions.el new file mode 100644 index 0000000..fa3be9e --- /dev/null +++ b/custom/asal-functions.el @@ -0,0 +1,85 @@ +(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 "

" 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 "\\\\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) + (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 " \\.\\.\\." 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" nil t) + (replace-match "\n")) + (goto-char (point-min)) + (while (re-search-forward "\n\"" nil t) + (replace-match "\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 "“/" nil t) + (replace-match "/“")) + (goto-char (point-min)) + (while (re-search-forward "/”" nil t) + (replace-match "”/")) + (goto-char (point-min)) + (while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t) + (replace-match "@@html:\\2@@@@latex:\\\\footnote{\\2}@@")) + (goto-char (point-min)) + (insert "#+TITLE: A Shot At Life\n#+AUTHOR: ovely\n#+STARTUP: fninline\n#+OPTIONS: toc:nil author:nil creator:nil date:nil timestamp:nil html-style:nil\n#+HTML_HEAD: \n#+LATEX_COMPILER: xelatex\n#+LATEX_CLASS: memoir\n#+LATEX_CLASS_OPTIONS: [9pt,b6paper]\n#+LATEX_HEADER: \\input{header.tex}\n\n")) diff --git a/memoir.el b/memoir.el new file mode 100644 index 0000000..e83a038 --- /dev/null +++ b/memoir.el @@ -0,0 +1,9 @@ +(require 'ox-latex) +(add-to-list 'org-latex-classes + '("memoir" + "\\documentclass{memoir} + [NO-DEFAULT-PACKAGES]" + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))