2023-10-15 21:38:56 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
file_path="${DIR}/test_document.org"
|
|
|
|
|
2023-10-16 00:22:46 +00:00
|
|
|
for TARGET_VARIABLE in RESULTS CAPTION HEADER DATA NAME PLOT; do
|
|
|
|
INIT_SCRIPT=$(cat <<EOF
|
2023-10-15 21:38:56 +00:00
|
|
|
(progn
|
|
|
|
(erase-buffer)
|
|
|
|
(require 'org)
|
|
|
|
(defun org-table-align () t)
|
|
|
|
(setq vc-handled-backends nil)
|
2023-10-16 00:22:46 +00:00
|
|
|
(find-file "/input/${file_path}")
|
2023-10-15 21:38:56 +00:00
|
|
|
(org-mode)
|
2023-10-16 00:22:46 +00:00
|
|
|
(replace-regexp-in-region "foo" "${TARGET_VARIABLE}")
|
2023-10-15 21:38:56 +00:00
|
|
|
(message "%s" (pp-to-string (org-element-parse-buffer)))
|
|
|
|
)
|
|
|
|
EOF
|
2023-10-16 00:22:46 +00:00
|
|
|
)
|
|
|
|
docker run --init --rm -i --mount type=tmpfs,destination=/tmp -v "/:/input:ro" -w /input --entrypoint "" organic-test emacs -q --no-site-file --no-splash --batch --eval "$INIT_SCRIPT" 2> "${DIR}/${TARGET_VARIABLE}"
|
|
|
|
done
|
|
|
|
|
|
|
|
# exec docker run --init --rm -i -t --mount type=tmpfs,destination=/tmp -v "/:/input:ro" -w /input --entrypoint "" organic-test emacs -q --no-site-file --no-splash --eval "$INIT_SCRIPT"
|
2023-10-15 21:38:56 +00:00
|
|
|
|
2023-10-16 00:22:46 +00:00
|
|
|
# org-element-dual-keywords ("CAPTION" "RESULTS")
|
|
|
|
# org-element-parsed-keywords ("CAPTION")
|
|
|
|
# org-element-multiple-keywords ("CAPTION" "HEADER")
|
|
|
|
# org-babel-results-keyword "RESULTS"
|