[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Formatting worg code examples (was: Re: [TASK] Allow customizeable ditaa
From: |
Max Nikulin |
Subject: |
Formatting worg code examples (was: Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el) |
Date: |
Wed, 15 Nov 2023 18:12:08 +0700 |
User-agent: |
Mozilla Thunderbird |
On 09/11/2023 10:17, Leo Butler wrote:
diff --git a/org-contrib/babel/languages/ob-doc-ditaa.org
b/org-contrib/babel/languages/ob-doc-ditaa.org-#+BEGIN_EXAMPLE
+#+NAME: hello-world.org
+#+BEGIN_SRC org :exports code :results replace
+,#+NAME: hello-world
+,#+HEADER: :exports results
,#+BEGIN_SRC ditaa :file images/hello-world.png
+--------------+
| |
@@ -76,9 +89,11 @@ The obligatory Hello World! example in =ditaa=:
| |
+--------------+
,#+END_SRC
-#+END_EXAMPLE
+#+END_SRC
I recall the following:
Leo Butler. Re: [TIP] Exporting Maxima results to LaTeX. Tue, 14 Feb
2023 15:13:52 +0000. https//list.orgmode.org87wn4ks2j5.fsf@t14.reltub.ca
1. When editing ~org~ code blocks in an indirect buffer, it should be
possible to recursively edit a code block. That does not appear to work
at the moment.
What about noweb instead?
# Hide drawers when the document is opened
# to not be distracted by intermediate evaluation
# results that are duplication of original code.
#+startup: overview
# (require 'ob-org)
# Default ob-org settings are not suitable for code examples.
#+property: header-args:org :exports code :results replace :noweb yes
# Not necessary when ":exports results" is used for intermediate blocks.
# #+options: d:(not "noexport")
You may include code blocks in your documents.
# This one is actual example of code.
# It is not exported, but it may be easily edited using C-c '.
#+name: code-example-elisp
#+begin_src elisp :exports none :results silent :var a=()
(identity a)
#+end_src
# This one is for exported document.
# To evaluate during export ":exports both" is set.
#+name: code-example-org
#+begin_src org :exports both
,#+name: code-example
,#+begin_src elisp :var a=10
<<code-example-elisp>>
,#+end_src
#+end_src
:noexport:
# Hide duplicated code block inside a drawer.
# Ensure that elisp code (result of org block evaluation)
# is evaluated as well by ":exports results"
#+header: :exports results
#+results: code-example-org
#+name: code-example
#+begin_src elisp :var a=10
(identity a)
#+end_src
# Empty line above is important to keep :end:
# when the code of the org block is re-evaluated.
:end:
To get result of code evaluation
#+results: code-example
: 10
use =C-c C-c= while cursor is inside the code block.
- Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el, (continued)
Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el, Ihor Radchenko, 2023/11/10
Formatting worg code examples (was: Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el),
Max Nikulin <=