[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug? org-export-unravel-code inserts a spurious newline at end o

From: Nicolas Goaziou
Subject: Re: [O] 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


> 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.

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.


Nicolas Goaziou

reply via email to

[Prev in Thread] Current Thread [Next in Thread]