Update ASAL functions

This commit is contained in:
trémeur 2023-01-28 13:56:46 +00:00
parent 306c253fff
commit eb5399f8a4
5 changed files with 96 additions and 84 deletions

View file

@ -13,6 +13,9 @@
(while (re-search-forward "<hr />\n\n<p>" nil t)
(replace-match "</section>\n<section>\n<p class=\"newthought\">"))
(goto-char (point-min))
(while (re-search-forward "<hr>\n\n<p>" nil t)
(replace-match "</section>\n<section>\n<p class=\"newthought\">"))
(goto-char (point-min))
(while (re-search-forward "<div class=\"outline-text-2\" id=\".*\">" nil t)
(replace-match ""))
(goto-char (point-min))
@ -28,6 +31,12 @@
(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 "<p class=\"author.*</p>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "\n\n</body>" nil t)
(replace-match "\n</article>\n</body>"))
(goto-char (point-min))
(while (re-search-forward "\\\\noindent\\\\rule{\\\\textwidth}{0.5pt}" nil t)
(replace-match "\\sephim" nil t))
(goto-char (point-min))
@ -42,44 +51,13 @@
(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 "”/"))
(org-format)
(goto-char (point-min))
(while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t)
(replace-match "@@html:<label for=\"\\1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"\\1\" class=\"margin-toggle\"/><span class=\"sidenote\">\\2</span>@@@@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: <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"/><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin/><link href=\"https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400;1,700&display=swap\" rel=\"stylesheet\"/><link rel=\"stylesheet\" href=\"https://tre.praze.net/fic/tufte.css\"/>\n#+LATEX_COMPILER: xelatex\n#+LATEX_CLASS: memoir\n#+LATEX_CLASS_OPTIONS: [9pt,b6paper]\n#+LATEX_HEADER: \\input{header.tex}\n\n"))
(replace-match "@@html:<label for=\"\\1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"\\1\" class=\"margin-toggle\"/><span class=\"sidenote\">\\2</span>@@@@latex:\\\\footnote{\\2}@@")))
(defun asal-export ()
(interactive)
(let ((org-html-head "<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"/><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin/><link href=\"https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400;1,700&display=swap\" rel=\"stylesheet\"/><link rel=\"stylesheet\" href=\"https://tre.praze.net/fic/tufte.css\"/>"))
(org-html-export-to-html))
(org-latex-export-to-latex))

View file

@ -1,38 +1,50 @@
(defun org-format ()
(interactive)
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward " -" nil t)
(replace-match " "))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward " " nil t)
(replace-match " "))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward "/ " nil t)
(replace-match " /"))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward " \\.\\.\\." nil t)
(replace-match ""))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward "" nil t)
(replace-match " …"))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward "'" nil t)
(replace-match ""))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward " \n" nil t)
(replace-match "\n"))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward "\n\"" nil t)
(replace-match "\n"))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward " \"" nil t)
(replace-match ""))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward "\"" nil t)
(replace-match ""))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward "“/" nil t)
(replace-match "/“"))
(goto-char (region-beginning))
(goto-char (point-min))
(while (re-search-forward "/”" nil t)
(replace-match "”/")))
(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 "=\"\\1\"")))