BIBLIOGRAPHY
관련연구
cashpw 예시
cashpw-dotfiles-node/config/doom/config-personal.org
(defun cashpw/pandoc--convert-buffer-from-markdown-to-org-in-place ()
"Converts the current buffer to org-mode in place."
(interactive)
(let ((buffer-content (buffer-string))
(tmp-file
(format "/tmp/%s.md" (format-time-string "%s" (current-time)))))
(with-temp-buffer
(insert buffer-content)
(write-file tmp-file))
(erase-buffer)
(insert
(shell-command-to-string
(concat
(format "pandoc --wrap=none -f markdown -t org %s" tmp-file)
;; Remove :PROPERTIES: drawers beneath headings
" | sed -E '/^[[:space:]]*:/d'")))
(org-mode)))
(defun cashpw/pandoc-cli (command)
(let ((pandoc-command (format "pandoc %s" command)))
(message "Running %s" pandoc-command)
(shell-command-to-string pandoc-command)))
(defun cashpw/pandoc-convert (text source-format target-format)
"Convert TEXT from SOURCE-FORMAT to TARGET-FORMAT."
(cashpw/pandoc-cli
(s-lex-format "-f ${source-format} -t ${target-format} <<< \"${text}\"")))
(defun cashpw/pandoc-convert-via-file (text source-format target-format)
"Convert TEXT from SOURCE-FORMAT to TARGET-FORMAT."
(let ((tmp-input-file-path
(format "/tmp/pandoc-tmp-input-%s" (format-time-string "%s")))
(tmp-output-file-path
(format "/tmp/pandoc-tmp-output-%s" (format-time-string "%s"))))
(with-temp-buffer text
(let ((coding-system-for-write 'utf-8))
(write-file tmp-input-file-path)))
(cashpw/pandoc-cli
(s-lex-format
"${tmp-input-file-path} -f ${source-format} -t ${target-format} -o ${tmp-output-file-path}"))
(with-current-buffer (find-file-noselect tmp-output-file-path)
(buffer-substring-no-properties (point-min) (point-max)))))