emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: karol.wojcik--- via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: Emacs Orgmode <emacs-orgmode@gnu.org>
Subject: How to not include newlines in strip-export?
Date: Sun, 17 Jan 2021 16:40:58 +0100 (CET)	[thread overview]
Message-ID: <MRG-PeM--3-2@tuta.io> (raw)

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

I'm using the following snippet for saving the plot  in python snippets

#+NAME: save-file
#+BEGIN_SRC python :results silent :var filename="filename" plt="plt" :exports none
return f"\nfname = 'assets/' + filename + '.png'\nplt.savefig(fname)\nfname"
#+END_SRC

Using it like so
#+BEGIN_SRC python :var fig=1 filename="some-filename" :noweb strip-export :results file :session t :exports both :cache yes
import matplotlib.pyplot as plt

plt.plot(1, 1)

<<save-file("filename", "plt")>>
#+END_SRC

The issue is that `save-file` adds some extra newlines in export which I would rather omit. What am I doing wrong?

Best Regards,
Karol Wójcik

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

                 reply	other threads:[~2021-01-17 15:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=MRG-PeM--3-2@tuta.io \
    --to=emacs-orgmode@gnu.org \
    --cc=karol.wojcik@tuta.io \
    --subject='Re: How to not include newlines in strip-export?' \
    /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

Code repositories for project(s) associated with this 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).