diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs
index 174b00dac..f42f84432 100644
--- a/src/Text/Pandoc/Writers/AsciiDoc.hs
+++ b/src/Text/Pandoc/Writers/AsciiDoc.hs
@@ -160,13 +160,12 @@ blockToAsciiDoc opts (Header level (ident,_,_) inlines) = do
                _  -> empty) <> blankline
             else
               identifier $$ text (replicate level '=') <> space <> contents <> blankline)
-blockToAsciiDoc _ (CodeBlock (_,classes,_) str) = return $
-  flush (attrs <> dashes <> space <> attrs <> cr <> text str <>
-           cr <> dashes) <> blankline
-     where dashes  = text $ replicate (maximum $ map length $ lines str) '-'
-           attrs = if null classes
-                      then empty
-                      else text $ intercalate "," $ "code" : classes
+blockToAsciiDoc _ (CodeBlock (_,classes,_) str) = return $ (flush $
+  if null classes
+     then "...." $$ text str $$ "...."
+     else attrs $$ "----" $$ text str $$ "----")
+  <> blankline
+    where attrs = "[" <> text (intercalate "," ("source" : classes)) <> "]"
 blockToAsciiDoc opts (BlockQuote blocks) = do
   contents <- blockListToAsciiDoc opts blocks
   let isBlock (BlockQuote _) = True
diff --git a/tests/writer.asciidoc b/tests/writer.asciidoc
index 83869df39..8d0973675 100644
--- a/tests/writer.asciidoc
+++ b/tests/writer.asciidoc
@@ -80,11 +80,11 @@ ______________________
 --
 Code in a block quote:
 
---------------------
+....
 sub status {
     print "working";
 }
---------------------
+....
 
 A list:
 
@@ -116,7 +116,7 @@ Code Blocks
 
 Code:
 
---------------------------------------
+....
 ---- (should be four hyphens)
 
 sub status {
@@ -124,15 +124,15 @@ sub status {
 }
 
 this code block is indented by one tab
---------------------------------------
+....
 
 And:
 
---------------------------------------------
+....
     this code block is indented by two tabs
 
 These should not be escaped:  \$ \\ \> \[ \{
---------------------------------------------
+....
 
 '''''
 
@@ -325,9 +325,9 @@ _apple_::
 _orange_::
   orange fruit
   +
----------------------
+....
 { orange code block }
----------------------
+....
   +
   __________________
   orange block quote
@@ -393,17 +393,17 @@ foo
 
 This should be a code block, though:
 
--------
+....
 <div>
     foo
 </div>
--------
+....
 
 As should this:
 
---------------
+....
 <div>foo</div>
---------------
+....
 
 Now, nested:
 
@@ -415,17 +415,17 @@ Multiline:
 
 Code block:
 
-----------------
+....
 <!-- Comment -->
-----------------
+....
 
 Just plain comment, with trailing spaces on the line:
 
 Code:
 
-------
+....
 <hr />
-------
+....
 
 Hr’s:
 
@@ -616,9 +616,9 @@ Indented link:/url[thrice].
 
 This should [not][] be a link.
 
------------
+....
 [not]: /url
------------
+....
 
 Foo link:/url/[bar].
 
@@ -654,9 +654,9 @@ ________________________________
 
 Auto-links should not occur here: `<http://example.com/>`
 
-------------------------------
+....
 or here: <http://example.com/>
-------------------------------
+....
 
 '''''