On 01/06/2022 12:30, Phil Estival wrote:

* lisp/ox.el (org-export--skip-p): no longer export single-line
comments as blank lines which did break paragraphs in two.

Phil, thank you for your attempt to improve handling of paragraph during export, there are enough various gotchas. Are the purpose of your patch the following?

#+begin_src elisp
  (org-export-string-as "Line 1.\n# comment\nLine 2." 'latex t)
#+end_src

#+RESULTS:
: Line 1.
: Line 2.

If so, unfortunately, you took a wrong direction, consider

#+begin_src elisp
  (org-export-string-as "Paragraph 1.\n# comment\nParagraph 2." 'html t)
#+end_src

#+RESULTS:
: <p>
: Paragraph 1.
: </p>
: <p>
: Paragraph 2.</p>

So there are still 2 separate paragraphs. It is necessary to either modify org-element parser or to apply a filter before passing AST to exporters. Last time it was discussed in

Ihor Radchenko. Merging paragraphs separated by comment lines during export (was: About 'inline special blocks') Thu, 26 May 2022 10:54:34 +0800. https://list.orgmode.org/875ylt6m1h.fsf@localhost

Notice that accordingly to
https://orgmode.org/worg/dev/org-syntax.html
comment (that is "element") can not be a part of a paragraph. So current behavior is intentional. In your next patch fixing a test "Para1" and "Para2" are meaningful names assuming paragraphs. If behavior is changed "Line1" and "Line2" should be less confusing.

If you are interested in other cases when org paragraph is not the same as exported LaTeX one, see the following thread:

Max Nikulin. Comments break up a paragraph when writing one-setence-per-line. Sun, 3 Oct 2021 18:34:10 +0700. https://list.orgmode.org/sjc4fk$76r$1...@ciao.gmane.io

Reply via email to