From 25d9bbfbe4d8145fbc62b7b9598adaef11b12ffb Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 13 Apr 2018 22:37:11 +0200 Subject: Add prologue to circuit; epilogue to control body parts --- ob-spice.org | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ob-spice.org b/ob-spice.org index 740a6a5..9033804 100644 --- a/ob-spice.org +++ b/ob-spice.org @@ -174,8 +174,7 @@ Access with ~$x[0]~ or ~$x[2-len]~. (let ((vars (org-babel--get-vars params)) (prologue (cdr (assq :prologue params))) (epilogue (cdr (assq :epilogue params))) - (file (cdr (assq :file params))) - (old-body "")) + (file (cdr (assq :file params)))) (setq body (org-babel-spice-replace-vars body vars)) ;; TODO :file stuff .... @@ -210,16 +209,16 @@ Access with ~$x[0]~ or ~$x[2-len]~. (no-source (cdr (assq :no-source params))) (break-index (if (string-match "^ *\.end *$" body) (match-end 0) 0)) - ;;todo: add prologue - (circuit-body (org-babel-spice-replace-vars + ;;vars need to be replaced as they don't work when using source + (circuit-body (org-babel-expand-body:spice (substring body 0 break-index) - vars));vars need to be replaced as they don't work when using source + (assq-delete-all :epilogue (copy-alist params)))) ;; todo: replace vars. :-( → set vars break when doing something like $file.txt - ;; todo: add only epilogue, not prologue (control-body (org-babel-spice-trim-body (substring body break-index))) (full-control-body (if control-body (org-babel-expand-body:generic - control-body params + control-body + (assq-delete-all :prologue (copy-alist params)) (org-babel-variable-assignments:spice params)))) (circuit-file (if circuit-body (org-babel-temp-file "spice-body-" ".cir"))) (result)) -- cgit v1.2.3