Re: included text
the include route seems brittle to me, as you have to name the file you are in. this would be interesting: #+include: {{{input-file}}}::#yada-quote (i have a bug in org more recent than a pretty old version so idk if this is already possible.) On 11/4/19, Richard Lawrence wrote: > "Fraga, Eric" writes: > >> Mind you, an alternative could be #+CALL-ing a src block >> that generates the text as output? > > On these lines: I've been thinking recently that it would be great to be > able to tangle/export other kinds of blocks (quotes, examples, etc.) via > the same kind of mechanism that src blocks use. > > This would be really useful for me for making e.g. handouts from the > file that contains notes for a talk or a paper. > > I've done this in the past with src blocks containing Org source code. > So instead of writing > > #+begin_quote > Yada yada > #+end_quote > > I write > > #+begin_src org :tangle handout.org > ,#+begin_quote > Yada yada > ,#+end_quote > #+end_src > > and create the handout.org file via org-babel-tangle. > > This works but it is pretty clunky, and you lose a lot of the benefit of > having the original quote block. For one thing, it no longer exports as > a quote from the original file, but as source code. I'd rather just > write: > > #+begin_quote :tangle handout.org > Yada yada > #+end_quote > > or even better: > > #+name: yada-quote > #+begin_quote > Yada yada > #+end_quote > > and then in handout.org, something like: > > #+include: talk.org::#yada-quote > > Is there anyone who would be interested in this besides just me and > Samuel? (Can this already be done somehow in a non-clunky way?? I find > John's suggestion intriguing but too clunky: it seems like I shouldn't > have to pass a block of text through a shell or Python interpreter just > to include it verbatim in another Org file!) > > -- > Best, > Richard > -- The Kafka Pandemic What is misopathy? https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html The disease DOES progress. MANY people have died from it. And ANYBODY can get it at any time.
Re: included text
"Fraga, Eric" writes: > Mind you, an alternative could be #+CALL-ing a src block > that generates the text as output? On these lines: I've been thinking recently that it would be great to be able to tangle/export other kinds of blocks (quotes, examples, etc.) via the same kind of mechanism that src blocks use. This would be really useful for me for making e.g. handouts from the file that contains notes for a talk or a paper. I've done this in the past with src blocks containing Org source code. So instead of writing #+begin_quote Yada yada #+end_quote I write #+begin_src org :tangle handout.org ,#+begin_quote Yada yada ,#+end_quote #+end_src and create the handout.org file via org-babel-tangle. This works but it is pretty clunky, and you lose a lot of the benefit of having the original quote block. For one thing, it no longer exports as a quote from the original file, but as source code. I'd rather just write: #+begin_quote :tangle handout.org Yada yada #+end_quote or even better: #+name: yada-quote #+begin_quote Yada yada #+end_quote and then in handout.org, something like: #+include: talk.org::#yada-quote Is there anyone who would be interested in this besides just me and Samuel? (Can this already be done somehow in a non-clunky way?? I find John's suggestion intriguing but too clunky: it seems like I shouldn't have to pass a block of text through a shell or Python interpreter just to include it verbatim in another Org file!) -- Best, Richard
Re: included text
Along the lines of what Eric suggested, you can put inline calls to src-blocks in the text. Here are some ways you could get something like what you describe I think. * text to be included :noexport: #+name: block-1 #+BEGIN_SRC python :results value :var a="a" b="b" return f"<<{a} {b} c>>" #+END_SRC #+name: lorem #+BEGIN_EXAMPLE Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat. #+END_EXAMPLE #+name: lorem-2 #+BEGIN_EXAMPLE Pellentesque dapibus suscipit ligula. #+END_EXAMPLE #+name: block-2 #+BEGIN_SRC sh :results output :var content=lorem echo $content #+END_SRC * blog post 1 twinkle star call_block-1() {{{results(=<>=)}}} Later call_block-1(a=1) {{{results(=<<1 b c>>=)}}} or call_block-1(a=5, b=7) {{{results(=<<5 7 c>>=)}}} call_block-2(lorem) {{{results(=Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa\, cursus ut\, gravida ut\, lobortis eget\, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci\, porta a\, aliquet quis\, semper a\, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.=)}}} call_block-2(lorem-2) {{{results(=Pellentesque dapibus suscipit ligula.=)}}} John --- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Mon, Nov 4, 2019 at 3:42 AM Fraga, Eric wrote: > On Sunday, 3 Nov 2019 at 12:37, Samuel Wales wrote: > > ah, or do you mean you refer the reader to the text by a regular link > > instaed of including? that's not what i am lokoing for here as these > > are separate posts. > > Yes, this is what I meant, in case the adjusted use case were of some > use. But it would seem that it won't help you in this case. Therefore, > I would suggest macros for short amounts of text or #+include for larger > text blocks. Mind you, an alternative could be #+CALL-ing a src block > that generates the text as output? > > -- > : Professor Eric S Fraga, http://www.homepages.ucl.ac.uk/~ucecesf > : PGP/GPG key: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D > : Use plain text email when possible: https://useplaintext.email/ > >
Re: included text
On Sunday, 3 Nov 2019 at 12:37, Samuel Wales wrote: > ah, or do you mean you refer the reader to the text by a regular link > instaed of including? that's not what i am lokoing for here as these > are separate posts. Yes, this is what I meant, in case the adjusted use case were of some use. But it would seem that it won't help you in this case. Therefore, I would suggest macros for short amounts of text or #+include for larger text blocks. Mind you, an alternative could be #+CALL-ing a src block that generates the text as output? -- : Professor Eric S Fraga, http://www.homepages.ucl.ac.uk/~ucecesf : PGP/GPG key: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D : Use plain text email when possible: https://useplaintext.email/
Re: included text
ah, or do you mean you refer the reader to the text by a regular link instaed of including? that's not what i am lokoing for here as these are separate posts. On 11/3/19, Samuel Wales wrote: > can you give an example of using an internal link? this would work > for me. but i am not getting what you mean. > > * text to be included > <> > * blog post 1 > twinkle star [syntactic magic] > > ? > > On 11/3/19, Fraga, Eric wrote: >> I use macros generally for this. For longer bits of text, I reword and, >> instead of repeating the text inline, I use internal links. These links >> can be inserted automatically if you use radio targets/links. >> >> -- >> Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78 >> > > > -- > The Kafka Pandemic > > What is misopathy? > https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html > > The disease DOES progress. MANY people have died from it. And ANYBODY > can get it at any time. > -- The Kafka Pandemic What is misopathy? https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html The disease DOES progress. MANY people have died from it. And ANYBODY can get it at any time.
Re: included text
can you give an example of using an internal link? this would work for me. but i am not getting what you mean. * text to be included <> * blog post 1 twinkle star [syntactic magic] ? On 11/3/19, Fraga, Eric wrote: > I use macros generally for this. For longer bits of text, I reword and, > instead of repeating the text inline, I use internal links. These links > can be inserted automatically if you use radio targets/links. > > -- > Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78 > -- The Kafka Pandemic What is misopathy? https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html The disease DOES progress. MANY people have died from it. And ANYBODY can get it at any time.
Re: included text
I use macros generally for this. For longer bits of text, I reword and, instead of repeating the text inline, I use internal links. These links can be inserted automatically if you use radio targets/links. -- Eric S Fraga via Emacs 27.0.50, Org release_9.2.6-552-g8c5a78
included text
org has a bunch of mechanisms for included text, including macros, the include statement, and maybe babel. i want to take some text and stick it in a paragraph in a few subtrees, but have it be in a single entry. so like: === * my insertable text alpha, beta, gamma * one blog post whatever whatever some greek letters include [syntax for including] and more. * another blog post some types of radiation include [syntax for including]. === what's the usual most non-breakable mechanism for this? thanks. -- The Kafka Pandemic What is misopathy? https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html The disease DOES progress. MANY people have died from it. And ANYBODY can get it at any time.