From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: Is it possible to repeat a block of org-mode text on export, maybe with replacement? Date: Tue, 19 Nov 2013 17:13:45 +0100 Message-ID: <878uwks72e.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VinwE-0006cq-8a for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 11:14:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vinw6-0000y3-GQ for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 11:14:06 -0500 Received: from plane.gmane.org ([80.91.229.3]:35027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vinw6-0000ti-5j for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 11:13:58 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Vinw2-0003Ij-Vs for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 17:13:54 +0100 Received: from e178188021.adsl.alicedsl.de ([85.178.188.21]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 19 Nov 2013 17:13:54 +0100 Received: from tjolitz by e178188021.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 19 Nov 2013 17:13:54 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Gary Oberbrunner 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. :-) Maybe something like this? #+header: :var lst='("foo" "bar" "baz") #+begin_src emacs-lisp :results raw value :exports results (mapconcat (lambda (--elem) (format (concat "1. this is The first line\n" "2. this is the second line with %s as the value\n" "3. this is the third line\n") --elem)) lst "\n") #+end_src #+results: 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 #+begin_src emacs-lisp :exports none :results raw (org-export-as 'ascii) #+end_src #+results: _________________ 506 Thorsten Jolitz _________________ Table of Contents _________________ 1 --text follows this line-- 1 --text follows this line-- ============================ Gary Oberbrunner 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. :-) Maybe something 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 4. this is The first line 5. this is the second line with bar as the value 6. this is the third line 7. this is The first line 8. this is the second line with baz as the value 9. this is the third line -- cheers, Thorsten -- cheers, Thorsten