emacs-orgmode
[Top][All Lists]
Advanced

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

Trailing whitespace after export snippets without a transcoder (was: [PA


From: Ihor Radchenko
Subject: Trailing whitespace after export snippets without a transcoder (was: [PATCH v2] org-faq.org: Inline comments)
Date: Sat, 20 Apr 2024 11:14:33 +0000

Max Nikulin <manikulin@gmail.com> writes:

>>>>>> +#+begin_src org
>>>>>> +The following line may become a patagraph separator.
>>>>>> +@@comment: might give unexpected effect @@
>>>>>> +Put some text before @@comment: a better variant
>>>>>> +@@ and after instread.
>>>>>> +#+end_src
>> 
>> I am no longer able to reproduce the problem with @@comment:...@@
>> splitting paragraph in the above example.
>
> I see no changes in respect to ox-md on the main branch.

Right.
Upon debugging further, to my great surprise, I found the following
comment in ox.el:

                        ;; Export snippets never return a nil value so
                        ;; that white spaces following them are never
                        ;; ignored.
                        (and (eq type 'export-snippet) "")

and then even a test:

;; Ignored export snippets do not remove any blank.
  (should
   (equal "begin  end\n"
          (org-test-with-parsed-data "begin @@test:A@@ end"
            (org-export-data-with-backend
             tree
             (org-export-create-backend
              :transcoders
              '((paragraph . (lambda (paragraph contents info) contents))
                (section . (lambda (section contents info) contents))))
             info))))

The test was added in the commit
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a6d9fd82e

    Back-end developers should pay attention to the fact that white spaces
    before and after an ignored export snippet now are accumulated in the
    output.

I have no clue about the rationale of this special behaviour - it dates
back to the days when Org export was merged. It is also not documented
anywhere, AFAIK.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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