emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gary Oberbrunner <garyo@oberbrunner.com>
To: "Thomas S. Dye" <tsd@tsdye.com>
Cc: Orgmode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: Is it possible to repeat a block of org-mode text on export, maybe with replacement?
Date: Thu, 21 Nov 2013 18:23:20 -0500	[thread overview]
Message-ID: <CAFChFyikhrx2g6eJs8S651ppwrOLHk+uhH==ZCf3WfC0ZEUEXg@mail.gmail.com> (raw)
In-Reply-To: <m14n78qpgy.fsf@tsdye.com>

[-- Attachment #1: Type: text/plain, Size: 3705 bytes --]

Thanks everyone!  Much appreciated. I think I can get what I want by
fiddling with these.  Thomas, I'm not sure why but yours comes out with
weird indentation which makes the first line not part of the list.  Eric,
yours doesn't seem to create a proper numbered list at all, but is
otherwise just what I'm looking for.  Thorsten, yours comes out looking
great but having to Emacs-stringize the text is, well, you know...

Again thanks all for your helpful suggestions!


On Tue, Nov 19, 2013 at 12:19 PM, Thomas S. Dye <tsd@tsdye.com> wrote:

> Hi Gary,
>
> I came up with this, which uses example blocks.
>
> #+name: example
> #+begin_example
>  1. this is the first line
>  2. this is the second line with %VARIANT% as the value
>  3. this is the third line
> #+end_example
>
> #+name: repeated-text
> #+header: :results raw
> #+header: :var x=""
> #+header: :var eg=example
> #+begin_src emacs-lisp
>   (let ((result))
>     (setf result (replace-regexp-in-string "%VARIANT%" x eg t))
>     result)
> #+end_src
>
> #+call: repeated-text(x="foo") :results raw
>
> #+results:
> 1. this is the first line
>  2. this is the second line with foo as the value
>  3. this is the third line
>
> #+call: repeated-text(x="bar") :results raw
> #+results:
> 1. this is the first line
>  2. this is the second line with bar as the value
>  3. this is the third line
>
> #+call: repeated-text(x="baz") :results raw
>
> #+results:
> 1. this is the first line
>  2. this is the second line with baz as the value
>  3. this is the third line
>
> All the best,
> Tom
>
> Gary Oberbrunner <garyo@oberbrunner.com> writes:
>
> > I don't know if this is beyond the capabilities of org-mode or not.  I'd
> > like to have a block of text repeated multiple times with slight
> > variations.  For the sake of the example, a numbered list:
> >
> > 1. this is the first line
> > 1. this is the second line with %VARIANT% as the value
> > 1. this is the third line
> >
> > When exported, say as ASCII, I'd like this:
> >
> > 1. this is the first line
> > 2. this is the second line with foo as the value
> > 3. this is the third line
> >
> > 1. this is the first line
> > 2. this is the second line with bar as the value
> > 3. this is the third line
> >
> > 1. this is the first line
> > 2. this is the second line with baz as the value
> > 3. this is the third line
> >
> > I'm not sure how to go about this; I assume I'd use org-babel with source
> > blocks that contain org-mode text or elisp or something.
> >
> > Of course if the right answer is I should write a python script to
> generate
> > my org-mode text, well, that's OK too. :-)
> >
> > --
> > Gary
> > I don't know if this is beyond the capabilities of org-mode or not. I'd
> > like to have a block of text repeated multiple times with slight
> > variations. For the sake of the example, a numbered list:
> >
> > 1. this is the first line
> > 1. this is the second line with %VARIANT% as the value
> > 1. this is the third line
> >
> > When exported, say as ASCII, I'd like this:
> >
> > 1. this is the first line
> > 2. this is the second line with foo as the value
> > 3. this is the third line
> >
> > 1. this is the first line
> > 2. this is the second line with bar as the value
> > 3. this is the third line
> >
> > 1. this is the first line
> > 2. this is the second line with baz as the value
> > 3. this is the third line
> >
> > I'm not sure how to go about this; I assume I'd use org-babel with
> > source blocks that contain org-mode text or elisp or something.
> >
> > Of course if the right answer is I should write a python script to
> > generate my org-mode text, well, that's OK too. :-)
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>



-- 
Gary

[-- Attachment #2: Type: text/html, Size: 4981 bytes --]

      reply	other threads:[~2013-11-21 23:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 13:47 Is it possible to repeat a block of org-mode text on export, maybe with replacement? Gary Oberbrunner
2013-11-19 16:13 ` Thorsten Jolitz
2013-11-19 16:36 ` Eric Schulte
2013-11-19 17:19 ` Thomas S. Dye
2013-11-21 23:23   ` Gary Oberbrunner [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='CAFChFyikhrx2g6eJs8S651ppwrOLHk+uhH==ZCf3WfC0ZEUEXg@mail.gmail.com' \
    --to=garyo@oberbrunner.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tsd@tsdye.com \
    /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).