1 ;;; ob-php.el --- Execute PHP within org-mode source blocks.
2 ;; Copyright 2016 stardiviner
4 ;; Author: stardiviner <numbchild@gmail.com>
5 ;; Maintainer: stardiviner <numbchild@gmail.com>
6 ;; Keywords: org babel php
7 ;; URL: https://repo.or.cz/ob-php.git
8 ;; Created: 04th May 2016
10 ;; Package-Requires: ((org "8"))
14 ;; Execute PHP within org-mode blocks.
20 "org-mode blocks for PHP."
23 (defcustom org-babel-php-command
"php"
24 "The command to execute babel body code."
28 (defcustom org-babel-php-command-options nil
29 "The php command options to use when execute code."
33 (defcustom ob-php
:inf-php-buffer
"*php*"
34 "Default PHP inferior buffer."
39 (defun org-babel-execute:php
(body params
)
40 "Orgmode Babel PHP evaluate function for `BODY' with `PARAMS'."
41 (let* ((cmd (concat org-babel-php-command
" " org-babel-php-command-options
))
42 (code (if (string-match-p "<\\?\\(?:php\\|=\\)\\_>" body
)
44 (concat "<?php\n\n" body
))))
45 (org-babel-eval cmd code
)))
49 '(add-to-list 'org-src-lang-modes
'("php" . php
)))
51 (defvar org-babel-default-header-args
:php
'())
53 (add-to-list 'org-babel-default-header-args
:php
54 '(:results .
"output"))
58 ;;; ob-php.el ends here