From 57d93cca563cb162e4126e8738ecda27ce661623 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Fri, 17 Sep 2021 09:41:34 -0700
Subject: [PATCH] Org writer: don't indent contents of code blocks.

We previously indented them by two spaces, following a
common convention.  Since the convention is fading, and
the indentation is inconvenient for copy/paste, we are
discontinuing this practice.

Closes #5440.
---
 src/Text/Pandoc/Writers/Org.hs |  2 +-
 test/command/5178.md           |  8 +++----
 test/writer.org                | 40 +++++++++++++++++-----------------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index 39af6717e..f4a22695c 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -154,7 +154,7 @@ blockToOrg (CodeBlock (_,classes,kvs) str) = do
   let (beg, end) = case at of
                       []    -> ("#+begin_example" <> numberlines, "#+end_example")
                       (x:_) -> ("#+begin_src " <> x <> numberlines, "#+end_src")
-  return $ literal beg $$ nest 2 (literal str) $$ text end $$ blankline
+  return $ literal beg $$ literal str $$ text end $$ blankline
 blockToOrg (BlockQuote blocks) = do
   contents <- blockListToOrg blocks
   return $ blankline $$ "#+begin_quote" $$
diff --git a/test/command/5178.md b/test/command/5178.md
index 856f86abc..feb2c4b99 100644
--- a/test/command/5178.md
+++ b/test/command/5178.md
@@ -7,8 +7,8 @@
    unsafePerformIO main
 ^D
 #+begin_src haskell -n 42
-  main = putStrLn "Hello World!"
-  unsafePerformIO main
+main = putStrLn "Hello World!"
+unsafePerformIO main
 #+end_src
 ```
 
@@ -32,10 +32,10 @@
 ,CodeBlock ("",["commonlisp","numberLines","continuedSourceBlock"],[("org-language","lisp"),("startFrom","10")]) "(+ 2 2)\n"]
 ^D
 #+begin_src lisp -n 20
-  (+ 1 1)
+(+ 1 1)
 #+end_src
 
 #+begin_src lisp +n 10
-  (+ 2 2)
+(+ 2 2)
 #+end_src
 ```
diff --git a/test/writer.org b/test/writer.org
index df9d2b3a5..38ec35a3e 100644
--- a/test/writer.org
+++ b/test/writer.org
@@ -81,9 +81,9 @@ E-mail style:
   Code in a block quote:
 
   #+begin_example
-    sub status {
-        print "working";
-    }
+  sub status {
+      print "working";
+  }
   #+end_example
 
   A list:
@@ -115,21 +115,21 @@ And a following paragraph.
 Code:
 
 #+begin_example
-  ---- (should be four hyphens)
+---- (should be four hyphens)
 
-  sub status {
-      print "working";
-  }
+sub status {
+    print "working";
+}
 
-  this code block is indented by one tab
+this code block is indented by one tab
 #+end_example
 
 And:
 
 #+begin_example
-      this code block is indented by two tabs
+    this code block is indented by two tabs
 
-  These should not be escaped:  \$ \\ \> \[ \{
+These should not be escaped:  \$ \\ \> \[ \{
 #+end_example
 
 --------------
@@ -348,7 +348,7 @@ Multiple blocks with italics:
 - /orange/ :: orange fruit
 
   #+begin_example
-    { orange code block }
+  { orange code block }
   #+end_example
 
   #+begin_quote
@@ -446,15 +446,15 @@ foo
 This should be a code block, though:
 
 #+begin_example
-  <div>
-      foo
-  </div>
+<div>
+    foo
+</div>
 #+end_example
 
 As should this:
 
 #+begin_example
-  <div>foo</div>
+<div>foo</div>
 #+end_example
 
 Now, nested:
@@ -485,7 +485,7 @@ Multiline:
 Code block:
 
 #+begin_example
-  <!-- Comment -->
+<!-- Comment -->
 #+end_example
 
 Just plain comment, with trailing spaces on the line:
@@ -497,7 +497,7 @@ Just plain comment, with trailing spaces on the line:
 Code:
 
 #+begin_example
-  <hr />
+<hr />
 #+end_example
 
 Hr's:
@@ -728,7 +728,7 @@ Indented [[/url][thrice]].
 This should [not][] be a link.
 
 #+begin_example
-  [not]: /url
+[not]: /url
 #+end_example
 
 Foo [[/url/][bar]].
@@ -767,7 +767,7 @@ An e-mail address: [[mailto:nobody@nowhere.net][nobody@nowhere.net]]
 Auto-links should not occur here: =<http://example.com/>=
 
 #+begin_example
-  or here: <http://example.com/>
+or here: <http://example.com/>
 #+end_example
 
 --------------
@@ -810,7 +810,7 @@ This paragraph should not be part of the note, as it is not indented.
        (as with list items).
 
        #+begin_example
-           { <code> }
+         { <code> }
        #+end_example
 
        If you want, you can indent every line, but you can also be lazy and