feat: removed unused code
This commit is contained in:
parent
2e8f06da0e
commit
13500e3ab0
100
conlanging.el
100
conlanging.el
@ -85,106 +85,6 @@
|
||||
(text (completing-read "Text: " `(,heading) nil nil heading)))
|
||||
(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)
|
||||
|
||||
;;; conlanging.el ends here
|
||||
|
Loading…
Reference in New Issue
Block a user