Re: [O] Is it possible to repeat a block of org-mode text on export, maybe with replacement?
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 t...@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 ga...@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
[O] Is it possible to repeat a block of org-mode text on export, maybe with replacement?
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
Re: [O] Is it possible to repeat a block of org-mode text on export, maybe with replacement?
Gary Oberbrunner ga...@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. :-) 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 ga...@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. :-) 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
Re: [O] Is it possible to repeat a block of org-mode text on export, maybe with replacement?
Gary Oberbrunner ga...@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. The following Org-mode file. #+Title: Example demonstrating repetition of a block of text * Top When exported, say as ASCII, I'd like this: #+call: w/replacement(replacement=foo) :results list #+call: w/replacement(replacement=bar) :results list #+call: w/replacement(replacement=baz) :results list * COMMENT Support #+name: lines 1. this is the first line 2. this is the second line with %VARIANT% as the value 3. this is the third line #+name: w/replacement #+begin_src emacs-lisp :var lines=lines :var replacement=rep :results list (mapcar (lambda (line) (replace-regexp-in-string (regexp-quote %VARIANT%) replacement line 'fixedcase)) lines) #+end_src #+RESULTS: w/replacement - this is the first line - this is the second line with rep as the value - this is the third line exports to the following ASCII __ EXAMPLE DEMONSTRATING REPETITION OF A BLOCK OF TEXT __ Table of Contents _ 1 Top 1 Top = When exported, say as ASCII, I'd like this: - this is the first line - this is the second line with foo as the value - this is the third line - this is the first line - this is the second line with bar as the value - this is the third line - this is the first line - this is the second line with baz as the value - this is the third line Cheers, Of course if the right answer is I should write a python script to generate my org-mode text, well, that's OK too. :-) -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D
Re: [O] Is it possible to repeat a block of org-mode text on export, maybe with replacement?
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 ga...@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