I want to add a bunch of php files that are in a directory into an org document as separate code blocks. This is what I want to achieve:
#+begin_src html :tangle "/sudo::/srv/http/01.php"
<?php
// code of 01.php
?>
#+end_src
#+begin_src html :tangle "sudo::/srv/http/02.php"
<?php
// code of 02.php
?>
#+end_src
The idea is to have an org document with the php code imbedded. Then it is easy to create the website from one org document by running org-babel-tangle. Right now I'm using a bash code block to create results:
#+name: php-files
#+BEGIN_SRC bash :results output
cd $HOME/Downloads/;
for f in *; do
echo "#+begin_src html :tangle '/sudo::/srv/http/$f'"
paste /dev/null - < "$f" #pukes out php content of file
echo "#+end_src"
echo ""
done
#+end_src
#+RESULTS: php-files
#+begin_example
,#+begin_src html :tangle '/sudo::/srv/http/01.php'
<?php
// code of 01.php
?>
,#+end_src
,#+begin_src html :tangle '/sudo::/srv/http/02.php'
<?php
// code of 01.php
}
?>
#+end_example
This output is almost what I want. Except the comma prefixes ([default behavior of code blocks](https://orgmode.org/manual/Literal-Examples.html#Literal-Examples) ) and single quote instead of double quote. (the double quotes can be generated by the bash script. I will figure this out later).
At the moment I am using a keyboard macro to remove the , and overwrite ' with ". This can also be done by evil mode. My question is if there are other ways to create these code block outputs? Preferably the code should be part of the org document, to make the document portable.