From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug? org-export-unravel-code inserts a spurious newline at end of inline-src-block elements
Date: Sat, 27 Aug 2016 18:44:05 -0400 [thread overview]
Message-ID: <bb59c909-1ab6-90aa-3d2f-af3fde1bbc85@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1435 bytes --]
Exporting the following file to HTML yields the following:
#+PROPERTY: header-args :exports code
This code has many src_python{def}s.
<p>
This code has many <code class="src src-python"><span style="color: #b4fa70;">def</span>
</code>s.
</p>
This renders as ~This code has many def s~, instead of the expected ~This code has many defs~. The extra space is due to the newline after before the closing </code> tag in the HTML exported sources.
This newline is added by ~org-export-unravel-code~:
;; Get code and clean it. Remove blank lines at its
;; beginning and end.
(code (replace-regexp-in-string
"\\`\\([ \t]*\n\\)+" ""
(replace-regexp-in-string
"\\([ \t]*\n\\)*[ \t]*\\'" "\n"
(if (or org-src-preserve-indentation
(org-element-property :preserve-indent element))
value
(org-remove-indentation value)))))
The documentation of this function seems slightly wrong, too, as it gets passed elements of type ~inline-src-block~:
(defun org-export-unravel-code (element)
"Clean source code and extract references out of it.
ELEMENT has either a `src-block' an `example-block' type.
I'd be happy to provide a patch, but it's not clear that it's a good idea to always remove the last blank line, so I'd rather defer to experts on these matters :)
Cheers,
Clément.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next reply other threads:[~2016-08-27 22:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-27 22:44 Clément Pit--Claudel [this message]
2016-08-28 10:04 ` Bug? org-export-unravel-code inserts a spurious newline at end of inline-src-block elements Nicolas Goaziou
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=bb59c909-1ab6-90aa-3d2f-af3fde1bbc85@gmail.com \
--to=clement.pit@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).