This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; this is another version that doesn't require any user parameters | |
(defun org-babel-execute:chess (body params) | |
"Execute a block of Chess code with org-babel. | |
This function is called by `org-babel-execute-src-block'." | |
(let* ((output-file (concat (file-name-sans-extension (buffer-file-name)) (format "_%s_chess_output.svg" (format-time-string "%Y-%m-%d_%H-%M-%S")) )) | |
(notation (cdr (assq :notation params))) | |
(extension (if (equal notation "fen") ".fen" ".pgn")) | |
(notation-file (make-temp-file "chess-notation" nil extension)) | |
(cmd (format "python ~/configs/elchess.py %s %s %s" notation-file output-file notation))) |