From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Bug? org-export-unravel-code inserts a spurious newline at end of inline-src-block elements Date: Sun, 28 Aug 2016 12:04:22 +0200 Message-ID: <8760qlxl95.fsf@saiph.selenimh> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdwx1-00051i-Or for emacs-orgmode@gnu.org; Sun, 28 Aug 2016 06:04:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdwwx-0005LQ-Hx for emacs-orgmode@gnu.org; Sun, 28 Aug 2016 06:04:26 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:37605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdwwx-0005LL-BO for emacs-orgmode@gnu.org; Sun, 28 Aug 2016 06:04:23 -0400 In-Reply-To: (=?utf-8?Q?=22Cl=C3=A9ment?= Pit--Claudel"'s message of "Sat, 27 Aug 2016 18:44:05 -0400") 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" To: =?utf-8?Q?Cl=C3=A9ment?= Pit--Claudel Cc: emacs-orgmode@gnu.org Hello, > Exporting the following file to HTML yields the following: > > #+PROPERTY: header-args :exports code > This code has many src_python{def}s. > >

> This code has many def > s. >

> > 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 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. The documentation is correct. `org-export-unravel-code' is not meant to be called on inline source blocks since they cannot contain coderefs. I fixed "ox-html.el" accordingly. Thank you. Regards, -- Nicolas Goaziou