You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would make it possible to use a lot of additional org features. The following come in to my mind but there are certainly many more:
Macros
Use macros to replace text snippets during export.
* Project template
:PROPERTIES:
:package: test
:END:
#+MACRO: macro-input (eval (completing-read "Type: " '("First" "Second") nil t "First"))
#+MACRO: poem Rose is $1, violet's $2. Life's ordered: Org assists you.
{{{poem(red,blue)}}}
{{{macro-input}}}
{{{property(package)}}}
This lets the user select from First and Second and exports as:
#+macro: macro-input (eval (completing-read "Type: " '("First" "Second") nil t "First"))
#+macro: poem Rose is $1, violet's $2. Life's ordered: Org assists you.
Rose is red, violet's blue. Life's ordered: Org assists you.
First
test
(only part disturbing is that the user-input macro is evaluated even if the expansion is not in the subtree, but could be solved by copying the subtree to another buffer first or whatever. Or of course let the user have an org file for each template.)
Include
Include other files:
#+INCLUDE: "~/dev/file-templates/GPLv3.txt"
Source block
Source block noweb
Include the code or the result of other source blocks with noweb.
An example with a simple named block and a shell source block:
#+NAME: year
: 2020
#+NAME: whoami
#+BEGIN_SRC sh
whoami
#+END_SRC
* Subtree
#+BEGIN_SRC emacs-lisp :noweb yes
; by <<whoami()>> in <<year()>>
#+END_SRC
Exports to in my case:
#+begin_src emacs-lisp
; by hubisan in 2020
#+end_src
Macros could be used as variables for the source blocks as far as I know.
Inlines source blocks
this is some src_elisp[:results raw]{(concat "inline" "-" "code")}
> this is some inline-code
Call on separate line or inline
The source block called can even be located in another files.
#+CALL: file.org:whoami()
my username is call_file.org:whoami()
The text was updated successfully, but these errors were encountered:
Just an idea: It would be quite cool to export the subtree as org before generating the template with
This would make it possible to use a lot of additional org features. The following come in to my mind but there are certainly many more:
Macros
Use macros to replace text snippets during export.
This lets the user select from First and Second and exports as:
(only part disturbing is that the user-input macro is evaluated even if the expansion is not in the subtree, but could be solved by copying the subtree to another buffer first or whatever. Or of course let the user have an org file for each template.)
Include
Include other files:
Source block
Source block noweb
Include the code or the result of other source blocks with noweb.
An example with a simple named block and a shell source block:
Exports to in my case:
Macros could be used as variables for the source blocks as far as I know.
Inlines source blocks
Call on separate line or inline
The source block called can even be located in another files.
The text was updated successfully, but these errors were encountered: