|
|
(defun org-format ()
|
|
|
"Correct formatting in an org file"
|
|
|
(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 " +…" 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 "=”" 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\"")))
|
|
|
|
|
|
(defun org-format-fr ()
|
|
|
"Correct formatting in a French org file"
|
|
|
(interactive)
|
|
|
(org-format)
|
|
|
(goto-char (point-min))
|
|
|
(let ((case-fold-search nil))
|
|
|
(while (re-search-forward "oe" 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 "”" 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 " ;" 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 " !" 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– ")))
|