Org writer: don't force blank line after headers

Closes: #6554
This commit is contained in:
Albert Krewinkel 2020-07-31 15:58:48 +02:00
parent 2077739a35
commit 6b08a37bbd
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 1 additions and 28 deletions

View file

@ -138,7 +138,7 @@ blockToOrg (Header level attr inlines) = do
let drawerStr = if attr == nullAttr let drawerStr = if attr == nullAttr
then empty then empty
else cr <> nest (level + 1) (propertiesDrawer attr) else cr <> nest (level + 1) (propertiesDrawer attr)
return $ headerStr <> " " <> contents <> drawerStr <> blankline return $ headerStr <> " " <> contents <> drawerStr <> cr
blockToOrg (CodeBlock (_,classes,kvs) str) = do blockToOrg (CodeBlock (_,classes,kvs) str) = do
let startnum = maybe "" (\x -> " " <> trimr x) $ lookup "startFrom" kvs let startnum = maybe "" (\x -> " " <> trimr x) $ lookup "startFrom" kvs
let numberlines = if "numberLines" `elem` classes let numberlines = if "numberLines" `elem` classes

View file

@ -12,49 +12,40 @@ markdown test suite.
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: headers :CUSTOM_ID: headers
:END: :END:
** Level 2 with an [[/url][embedded link]] ** Level 2 with an [[/url][embedded link]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-2-with-an-embedded-link :CUSTOM_ID: level-2-with-an-embedded-link
:END: :END:
*** Level 3 with /emphasis/ *** Level 3 with /emphasis/
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-3-with-emphasis :CUSTOM_ID: level-3-with-emphasis
:END: :END:
**** Level 4 **** Level 4
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-4 :CUSTOM_ID: level-4
:END: :END:
***** Level 5 ***** Level 5
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-5 :CUSTOM_ID: level-5
:END: :END:
* Level 1 * Level 1
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-1 :CUSTOM_ID: level-1
:END: :END:
** Level 2 with /emphasis/ ** Level 2 with /emphasis/
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-2-with-emphasis :CUSTOM_ID: level-2-with-emphasis
:END: :END:
*** Level 3 *** Level 3
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-3 :CUSTOM_ID: level-3
:END: :END:
with no blank line with no blank line
** Level 2 ** Level 2
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: level-2 :CUSTOM_ID: level-2
:END: :END:
with no blank line with no blank line
-------------- --------------
@ -63,7 +54,6 @@ with no blank line
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: paragraphs :CUSTOM_ID: paragraphs
:END: :END:
Here's a regular paragraph. Here's a regular paragraph.
In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.
@ -81,7 +71,6 @@ here.
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: block-quotes :CUSTOM_ID: block-quotes
:END: :END:
E-mail style: E-mail style:
#+BEGIN_QUOTE #+BEGIN_QUOTE
@ -123,7 +112,6 @@ And a following paragraph.
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: code-blocks :CUSTOM_ID: code-blocks
:END: :END:
Code: Code:
#+BEGIN_EXAMPLE #+BEGIN_EXAMPLE
@ -150,12 +138,10 @@ And:
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: lists :CUSTOM_ID: lists
:END: :END:
** Unordered ** Unordered
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: unordered :CUSTOM_ID: unordered
:END: :END:
Asterisks tight: Asterisks tight:
- asterisk 1 - asterisk 1
@ -202,7 +188,6 @@ Minuses loose:
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: ordered :CUSTOM_ID: ordered
:END: :END:
Tight: Tight:
1. First 1. First
@ -334,7 +319,6 @@ B. Williams
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: definition-lists :CUSTOM_ID: definition-lists
:END: :END:
Tight using spaces: Tight using spaces:
- apple :: red fruit - apple :: red fruit
@ -403,7 +387,6 @@ Blank line after term, indented marker, alternate markers:
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: html-blocks :CUSTOM_ID: html-blocks
:END: :END:
Simple block on one line: Simple block on one line:
foo foo
@ -561,7 +544,6 @@ Hr's:
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: inline-markup :CUSTOM_ID: inline-markup
:END: :END:
This is /emphasized/, and so /is this/. This is /emphasized/, and so /is this/.
This is *strong*, and so *is this*. This is *strong*, and so *is this*.
@ -593,7 +575,6 @@ spaces: a^b c^d, a~b c~d.
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: smart-quotes-ellipses-dashes :CUSTOM_ID: smart-quotes-ellipses-dashes
:END: :END:
"Hello," said the spider. "'Shelob' is my name." "Hello," said the spider. "'Shelob' is my name."
'A', 'B', and 'C' are letters. 'A', 'B', and 'C' are letters.
@ -650,7 +631,6 @@ Cat & 1 \\ \hline
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: special-characters :CUSTOM_ID: special-characters
:END: :END:
Here is some unicode: Here is some unicode:
- I hat: Î - I hat: Î
@ -707,12 +687,10 @@ Minus: -
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: links :CUSTOM_ID: links
:END: :END:
** Explicit ** Explicit
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: explicit :CUSTOM_ID: explicit
:END: :END:
Just a [[/url/][URL]]. Just a [[/url/][URL]].
[[/url/][URL and title]]. [[/url/][URL and title]].
@ -735,7 +713,6 @@ Just a [[/url/][URL]].
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: reference :CUSTOM_ID: reference
:END: :END:
Foo [[/url/][bar]]. Foo [[/url/][bar]].
With [[/url/][embedded [brackets]]]. With [[/url/][embedded [brackets]]].
@ -762,7 +739,6 @@ Foo [[/url/][biz]].
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: with-ampersands :CUSTOM_ID: with-ampersands
:END: :END:
Here's a [[http://example.com/?foo=1&bar=2][link with an ampersand in the Here's a [[http://example.com/?foo=1&bar=2][link with an ampersand in the
URL]]. URL]].
@ -776,7 +752,6 @@ Here's an [[/script?foo=1&bar=2][inline link in pointy braces]].
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: autolinks :CUSTOM_ID: autolinks
:END: :END:
With an ampersand: [[http://example.com/?foo=1&bar=2]] With an ampersand: [[http://example.com/?foo=1&bar=2]]
- In a list? - In a list?
@ -801,7 +776,6 @@ Auto-links should not occur here: =<http://example.com/>=
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: images :CUSTOM_ID: images
:END: :END:
From "Voyage dans la Lune" by Georges Melies (1902): From "Voyage dans la Lune" by Georges Melies (1902):
#+CAPTION: lalune #+CAPTION: lalune
@ -815,7 +789,6 @@ Here is a movie [[file:movie.jpg]] icon.
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: footnotes :CUSTOM_ID: footnotes
:END: :END:
Here is a footnote reference,[fn:1] and another.[fn:2] This should /not/ be a Here is a footnote reference,[fn:1] and another.[fn:2] This should /not/ be a
footnote reference, because it contains a space.[^my note] Here is an inline footnote reference, because it contains a space.[^my note] Here is an inline
note.[fn:3] note.[fn:3]