emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <uj292b$t54$1@ciao.gmane.io> (raw)
In-Reply-To: <87sf5f7h04.fsf@t14.reltub.ca>

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.





      parent reply	other threads:[~2023-11-15 11:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 10:59 org-ditaa woes Florin Boariu
2023-10-20 17:22 ` Leo Butler
2023-10-20 18:16   ` Dr. Arne Babenhauserheide
2023-10-20 19:31     ` Leo Butler
2023-10-20 21:39   ` Florin Boariu
2023-10-21  3:50     ` Max Nikulin
2023-10-23 11:18       ` Florin Boariu
2023-10-24  7:55         ` Max Nikulin
2023-10-24  9:31           ` Florin Boariu
2023-10-24  9:38             ` Ihor Radchenko
2023-10-25 19:00               ` Leo Butler
2023-10-26  8:44                 ` Max Nikulin
2023-10-26  9:30                 ` Ihor Radchenko
2023-12-20 18:03               ` Leo Butler
2023-12-21 14:15                 ` Ihor Radchenko
2023-10-26 15:32           ` Leo Butler
2023-10-23 12:25       ` Florin Boariu
2023-10-21  7:44     ` Dr. Arne Babenhauserheide
2023-10-21  8:56       ` [TASK] Allow customizeable ditaa executable in ob-ditaa.el (was: org-ditaa woes) Ihor Radchenko
2023-11-09  3:17         ` [TASK] Allow customizeable ditaa executable in ob-ditaa.el Leo Butler
2023-11-09 12:17           ` Max Nikulin
2023-11-10  3:19             ` Leo Butler
2023-11-10 10:09               ` Ihor Radchenko
2023-11-10 10:38               ` Max Nikulin
2023-11-10 15:21                 ` Leo Butler
2023-11-11 10:07                   ` Ihor Radchenko
2023-11-10 10:18           ` Ihor Radchenko
2023-11-10 14:59             ` Leo Butler
2023-11-11 10:24               ` Ihor Radchenko
2023-11-13 16:26                 ` Leo Butler
2023-11-15 11:12           ` Max Nikulin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='uj292b$t54$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).