Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Org writer: some issues and possible improvements with lists #7810

Closed
soficshift opened this issue Jan 7, 2022 · 2 comments
Closed

Org writer: some issues and possible improvements with lists #7810

soficshift opened this issue Jan 7, 2022 · 2 comments

Comments

@soficshift
Copy link
Contributor

soficshift commented Jan 7, 2022

Hi, while writing tests for a org writer PR about lists I found a few corner cases related to newlines that are not handled very well. So I am filing this issue to keep a record of them.

  1. This one is actually a bug since it generates invalid org (see this observation): the org file

    - 
      #+begin_example
        aa
      #+end_example
    - test
    

    "round trips" (--from org --to org) to

    - #+begin_example
      aa
      #+end_example
    
     - test
    

    which is not valid org as jgm noted (only plain or para should appear on the bullet line).

  2. This next one is also present in RST (the code was copied I guess): when a list item is empty, space is added after the item so that

    - a
    - 
    - a
    - a
    

    "round trips" (--from org --to org) to

    -  a
    -  
    
    -  a
    -  a
    
  3. This is a suggestion that I think is related to item 2: currently, nested lists (even "tight" ones) are written with unnecessary newlines around them, like so:

    -  a
    
       -  b
       -  b
    
    -  a
    -  a
    

    maybe it is possible to write without such newlines (like the markdown writer).

@jgm
Copy link
Owner

jgm commented Jan 9, 2022

On 3: the code contains a comment that says

-- ensure that sublists have preceding blank line

but I have no idea why (I didn't write this writer). It seems to me that this is not necessary at all in org.
(Aha! Looks like it was copied from RST, where this is needed -- as you noted.)

jgm added a commit that referenced this issue Jan 9, 2022
The code to do this was apparently copied over from the RST
writer, but these blank lines aren't necessary or desirable
in org.  See #7810 comment 3.
jgm added a commit that referenced this issue Jan 9, 2022
jgm added a commit that referenced this issue Jan 9, 2022
jgm added a commit that referenced this issue Jan 9, 2022
T.P.Writers.Shared `endsWithPlain` now returns True if
the list ends with a list which ends with a Plain.

See #7810.
@jgm jgm closed this as completed in 66636c8 Jan 9, 2022
@jgm
Copy link
Owner

jgm commented Jan 9, 2022

I believe I've now fixed all three issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants