emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Cc: Phil Estival <pe@7d.nz>
Subject: Re: [PATCH] ox: fix comment exported as a blank line
Date: Wed, 1 Jun 2022 18:48:35 +0700	[thread overview]
Message-ID: <18449694-8ad1-3f0c-d18a-3b6fd5369478@gmail.com> (raw)
In-Reply-To: <87618398-cf6d-86b4-ba59-144f70d0f96e@7d.nz>

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


  parent reply	other threads:[~2022-06-01 11:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01  5:30 [PATCH] ox: fix comment exported as a blank line Phil Estival
2022-06-01  5:43 ` [PATCH] test-ox: no superfluous newline in exported comments Phil Estival
2022-06-01 11:48 ` Max Nikulin [this message]
2022-06-02  5:02   ` [PATCH] ox: fix comment exported as a blank line Phil Estival
2022-06-02 16:09     ` Max Nikulin
2022-06-01 13:14 ` Kaushal Modi
2022-07-04 11:47 ` Ihor Radchenko

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=18449694-8ad1-3f0c-d18a-3b6fd5369478@gmail.com \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=pe@7d.nz \
    /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).