feat: removed unused code

This commit is contained in:
Lucien Cartier-Tilet 2024-09-12 22:39:39 +02:00
parent 2e8f06da0e
commit 13500e3ab0
Signed by: phundrak
GPG Key ID: 347803E8073EACE0

View File

@ -85,106 +85,6 @@
(text (completing-read "Text: " `(,heading) nil nil heading))) (text (completing-read "Text: " `(,heading) nil nil heading)))
(insert (format "[[file:./%s.md#%s][%s]]" filename slug text)))) (insert (format "[[file:./%s.md#%s][%s]]" filename slug text))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Text transformation ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Eittlandic ;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar conlanging--eittlandic-latin-to-latex '((", *\\|\\. *" . "\\\\tripledot")
(" +" . ":")
("hv" . "x")
("í" . "i")
("é" . "\\\\e")
("ę\\" . "æ")
("ý" . "y")
("œ" . "ø")
("ú" . "u")
("ó" . "o")
("á\\" . "a")
("j" . "i"))
"Eittlandic Latin script to LaTeX code.
The first element of a pair is the Latin script orthography, the
second is the Runic LaTeX code equivalent.")
(defvar conlanging--eittlandic-latin-to-runes '((", *\\|\\. *" . "")
(" +\\|:" . "")
("hv" . "")
("i\\\\|j" . "")
("é" . "")
("e\\\\" . "")
("y\\" . "")
("ø\\" . "")
("u\\\\|v\\|w" . "")
("o\\" . "")
("a\\\\" . "")
("p" . "")
("b" . "")
("f" . "")
("t" . "")
("d" . "")
("þ" . "")
("ð" . "")
("s" . "")
("k" . "")
("g" . "")
("h" . "")
("m" . "")
("n" . "")
("r" . "")
("l" . ""))
"Eittlandic latin orthography to runes.
The first element of a pair is the Latin script orthography, the
second is the Runic equivalent.")
(defvar conlanging-language-list `((eittlandic-runes . ,conlanging--eittlandic-latin-to-runes)
(eittlandic-latex . ,conlanging--eittlandic-latin-to-latex)))
(defun conlanging--translate (text table)
"Translate TEXT through its correspondance TABLE."
(let ((rune-table (cdr (assoc table conlanging-language-list))))
(dolist (elem rune-table text)
(setq text (replace-regexp-in-string (car elem) (cdr elem) text)))))
(defun conlanging--replace-region-by-translation (table)
"Replace region with its translation through TABLE.
See `conlanging--translate'."
(interactive)
(let* ((beg (region-beginning))
(end (region-end))
(region-str (buffer-substring-no-properties beg end)))
(delete-region beg end)
(goto-char beg)
(insert (conlanging--translate region-str table))))
;;;###autoload
(defun conlanging-language-to-script (text language)
"Transform TEXT or current word or region in LANGUAGE to its native script.
LANGUAGE can be one of the values found in `conlanging-language-list'."
(interactive)
(let* ((table (alist-get language conlanging-language-list)))
(conlanging--translate text table)))
;;;###autoload
(defun conlanging-to-org-runes (text language)
"Translate TEXT from LANGUAGE to LaTeX runes equivalent for org exports.
LANGUAGE must be one of the following values:
- `matter'
- `eittlandic'"
(interactive)
(if (org-export-derived-backend-p org-export-current-backend 'latex)
(format "\\textarm{%s}" (conlanging--translate text
(pcase language
('eittlandic 'eittlandic-latex)
('matter 'matter-latex)
(otherwise (error "Option \"%s\" not supported" otherwise)))))
(conlanging--translate text
(pcase language
('eittlandic 'eittlandic-runes)
('matter 'matter-runes)
(otherwise (error "Option \"%s\" not supported" otherwise))))))
(provide 'conlanging) (provide 'conlanging)
;;; conlanging.el ends here ;;; conlanging.el ends here