Process fic footnotes properly

master
trémeur 2 years ago
parent a1a487b450
commit a636884879

@ -1,6 +1,10 @@
(defun fic-ao3 ()
(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)
@ -10,6 +14,7 @@
(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)
@ -27,6 +32,9 @@
(while (re-search-forward "</div>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "<h2.*>" nil t)
(replace-match ""))
(goto-char (point-min))
(while (re-search-forward "\n\n" nil t)
(replace-match "\n"))
(write-file newname)
@ -52,6 +60,7 @@
(setq chaptertitles (y-or-n-p "Titled chapters?")))
(setq ffx (y-or-n-p "FFX fic?"))))
(org-format)
(save-buffer)
(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}@@"))
@ -59,7 +68,7 @@
(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))
(save-buffer)
(revert-buffer t t)
(setq htmlfile (concat (file-name-base) ".html"))
(find-file-noselect htmlfile)
(with-current-buffer htmlfile

Loading…
Cancel
Save