From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: Is it possible to repeat a block of org-mode text on export, maybe with replacement? Date: Tue, 19 Nov 2013 07:19:09 -1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VioyW-0006Xp-J1 for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 12:20:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VioyR-0007A8-9T for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 12:20:32 -0500 Received: from oproxy1-pub.mail.unifiedlayer.com ([66.147.249.253]:42524) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1VioyR-00079e-27 for emacs-orgmode@gnu.org; Tue, 19 Nov 2013 12:20:27 -0500 In-Reply-To: (Gary Oberbrunner's message of "Tue, 19 Nov 2013 08:47:41 -0500") 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: Gary Oberbrunner Cc: Orgmode Mailing List 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 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