feat(emacs/lean-input.el): add exclude-list to lean-input-export-translations
This commit is contained in:
parent
d2b9fd073f
commit
3941cc1839
1 changed files with 14 additions and 15 deletions
|
@ -1139,24 +1139,23 @@ Suitable for use in the :set field of `defcustom'."
|
||||||
(defun lean-input-export-translations ()
|
(defun lean-input-export-translations ()
|
||||||
"Export the current translation, (input, output) pairs for
|
"Export the current translation, (input, output) pairs for
|
||||||
input-method, in a javascript format. It can be copy-pasted to
|
input-method, in a javascript format. It can be copy-pasted to
|
||||||
leanprover.github.io/js/input-method.js"
|
leanprover.github.io/tutorial/js/input-method.js"
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-current-buffer
|
(with-current-buffer
|
||||||
(get-buffer-create "*lean-translations*")
|
(get-buffer-create "*lean-translations*")
|
||||||
(insert "var corrections = {")
|
(let ((exclude-list '("\\newline")))
|
||||||
(--each
|
(insert "var corrections = {")
|
||||||
(lean-input-get-translations "Lean")
|
(--each
|
||||||
(let* ((input (substring (car it) 1))
|
(--filter (not (member (car it) exclude-list))
|
||||||
(outputs (cdr it)))
|
(lean-input-get-translations "Lean"))
|
||||||
|
(let* ((input (substring (car it) 1))
|
||||||
(insert (format "%s:\"" (prin1-to-string input)))
|
(outputs (cdr it)))
|
||||||
|
(insert (format "%s:\"" (prin1-to-string input)))
|
||||||
(cond ((vectorp outputs)
|
(cond ((vectorp outputs)
|
||||||
(insert (elt outputs 0)))
|
(insert (elt outputs 0)))
|
||||||
(t (insert-char outputs)))
|
(t (insert-char outputs)))
|
||||||
|
(insert (format "\",\n" input))))
|
||||||
(insert (format "\",\n" input))))
|
(insert "};"))))
|
||||||
(insert "};")))
|
|
||||||
|
|
||||||
(defun lean-input-export-translations-to-stdout ()
|
(defun lean-input-export-translations-to-stdout ()
|
||||||
(lean-input-export-translations)
|
(lean-input-export-translations)
|
||||||
|
|
Loading…
Reference in a new issue