Re: [PATCH] ox: fix comment exported as a blank line

2022-07-04 Thread Ihor Radchenko
Phil Estival  writes:

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

I think that this change may be useful in general. `org-export--skip-p'
is sometimes too rigid.

However, the proposed feature should probably be added as a
customization that is not enabled by default.

Best,
Ihor



Re: [PATCH] ox: fix comment exported as a blank line

2022-06-02 Thread Max Nikulin

On 02/06/2022 12:02, Phil Estival wrote:

Still, the writing experience is much improved
when comments are allowed inside paragraphs
without disrupting the publication, and this
definitely worth a few modifications.


There are at least a couple of workarounds for inline comments, however 
some care is required to not add a spurious blank line (I think, 
ox-latex should strip blank lines from paragraphs).


Maxim Nikulin. Re: Comments break up a paragraph when writing 
one-setence-per-line. Sun, 18 Jul 2021 15:21:39 +0700. 
https://list.orgmode.org/sd0oak$k5h$1...@ciao.gmane.io


#+macro: comment

Another test
{{{comment(some text
)}}} with macro comment.

or

Export snippets
@@c: a comment
@@ may be used with any non-existing backend name.


I believe that comments breaking paragraphs is an unnecessary pitfall. 
While comments are not passed to exporters there are should be no great 
problems besides users who rely on current behavior. I am unsure how 
many of them do it intentionally. Attributes and other keywords are more 
tricky case, but rather independent of comments.




Re: [PATCH] ox: fix comment exported as a blank line

2022-06-01 Thread Phil Estival



Le 01/06/2022 à 13:48, Max Nikulin wrote :

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.

unfortunately, you took a wrong direction
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



Max,

Right, thanks for the clarifications.

A hook at pre-export stage to filter out the
line-comments is one correct way to get an output
compliant with different backends. Yet the removal
of comments may provide an AST different from the
one of the emacs buffer.

>> However there [are] users in this thread who
>> expect that "# " or "#+latex:" should not be
>> "element" and should be a part of surrounding
>> paragraph.

That's an interesting idea.  This would add an
attribute to the previous element.

If we keep speculating on that, the rendering path
would change. It would have to consider this
property too when showing or hiding elements.

And it would require additional function to
reallocate this attribute like a node.

And this would probably break some conceptual
integrity.

The org spec is correct to handle the comments the
way it does. As I see it now, that's the only
possible attempts to reconcile the behaviors of
different backends.

Still, the writing experience is much improved
when comments are allowed inside paragraphs
without disrupting the publication, and this
definitely worth a few modifications.


Phil




Re: [PATCH] ox: fix comment exported as a blank line

2022-06-01 Thread Kaushal Modi
On Wed, Jun 1, 2022 at 1:32 AM 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.

This is a pretty big breaking change. In your next PATCH email, I see
that you are also modifying the test that ensures that a comment line
gets parsed as a paragraph break.



Re: [PATCH] ox: fix comment exported as a blank line

2022-06-01 Thread Max Nikulin

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:
: 
: Paragraph 1.
: 
: 
: Paragraph 2.

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