From b985d334064da3df9c340175d75f259cf9f1d4d2 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Tue, 21 Aug 2012 19:21:51 -0700
Subject: [PATCH] Changed nomenclature, delimited -> fenced code blocks.

---
 README                              | 12 ++++++------
 src/Text/Pandoc/Options.hs          |  4 ++--
 src/Text/Pandoc/Readers/Markdown.hs |  8 ++++----
 src/Text/Pandoc/Writers/Markdown.hs |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/README b/README
index e11e3cb45..2fa8cbce5 100644
--- a/README
+++ b/README
@@ -22,7 +22,7 @@ slide shows), [ConTeXt], [RTF], [DocBook XML], [OpenDocument XML],
 [PDF] output on systems where LaTeX is installed.
 
 Pandoc's enhanced version of markdown includes syntax for footnotes,
-tables, flexible ordered lists, definition lists, delimited code blocks,
+tables, flexible ordered lists, definition lists, fenced code blocks,
 superscript, subscript, strikeout, title blocks, automatic tables of
 contents, embedded LaTeX math, citations, and markdown inside HTML block
 elements. (These enhancements, described below under
@@ -971,12 +971,12 @@ of the verbatim text, and is removed in the output.
 Note: blank lines in the verbatim text need not begin with four spaces.
 
 
-### Delimited code blocks ###
+### Fenced code blocks ###
 
-**Extension: `delimited_code_blocks`**
+**Extension: `fenced_code_blocks`**
 
 In addition to standard indented code blocks, Pandoc supports
-*delimited* code blocks.  These begin with a row of three or more
+*fenced* code blocks.  These begin with a row of three or more
 tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
 backticks that must be at least as long as the starting row. Everything
 between these lines is treated as code. No indentation is necessary:
@@ -987,7 +987,7 @@ between these lines is treated as code. No indentation is necessary:
     }
     ~~~~~~~
 
-Like regular code blocks, delimited code blocks must be separated
+Like regular code blocks, fenced code blocks must be separated
 from surrounding text by blank lines.
 
 If the code itself contains a row of tildes or backticks, just use a longer
@@ -1745,7 +1745,7 @@ work in verbatim contexts:
 **Extension: `inline_code_attributes`**
 
 Attributes can be attached to verbatim text, just as with
-[delimited code blocks](#delimited-code-blocks):
+[fenced code blocks](#fenced-code-blocks):
 
     `<$>`{.haskell}
 
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 77b134aaa..0cf514b86 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -64,7 +64,7 @@ data Extension =
     | Ext_tex_math_single_backslash  -- ^ TeX math btw \(..\) \[..\]
     | Ext_tex_math_double_backslash  -- ^ TeX math btw \\(..\\) \\[..\\]
     | Ext_latex_macros        -- ^ Parse LaTeX macro definitions (for math only)
-    | Ext_delimited_code_blocks   -- ^ Parse delimited code blocks
+    | Ext_fenced_code_blocks  -- ^ Parse fenced code blocks
     | Ext_inline_code_attributes  -- ^ Allow attributes on inline code
     | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks
     | Ext_markdown_attribute      -- ^ Interpret text inside HTML as markdown
@@ -104,7 +104,7 @@ pandocExtensions = Set.fromList
   , Ext_raw_html
   , Ext_tex_math_dollars
   , Ext_latex_macros
-  , Ext_delimited_code_blocks
+  , Ext_fenced_code_blocks
   , Ext_inline_code_attributes
   , Ext_markdown_in_html_blocks
   , Ext_escaped_line_breaks
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 792c0269a..551abd357 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -306,7 +306,7 @@ parseBlocks :: Parser [Char] ParserState (F Blocks)
 parseBlocks = mconcat <$> manyTill block eof
 
 block :: Parser [Char] ParserState (F Blocks)
-block = choice [ codeBlockDelimited
+block = choice [ codeBlockFenced
                , guardEnabled Ext_latex_macros *> (mempty <$ macro)
                , header
                , rawTeXBlock
@@ -435,9 +435,9 @@ keyValAttr = try $ do
      <|> many nonspaceChar
   return ("",[],[(key,val)])
 
-codeBlockDelimited :: Parser [Char] ParserState (F Blocks)
-codeBlockDelimited = try $ do
-  guardEnabled Ext_delimited_code_blocks
+codeBlockFenced :: Parser [Char] ParserState (F Blocks)
+codeBlockFenced = try $ do
+  guardEnabled Ext_fenced_code_blocks
   (size, attr, c) <- blockDelimiter (\c -> c == '~' || c == '`') Nothing
   contents <- manyTill anyLine (blockDelimiter (== c) (Just size))
   blanklines
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 1e381b461..425a63c90 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -292,8 +292,8 @@ blockToMarkdown opts (CodeBlock (_,classes,_) str)
     isEnabled Ext_literate_haskell opts =
   return $ prefixed "> " (text str) <> blankline
 blockToMarkdown opts (CodeBlock attribs str) = return $
-  if isEnabled Ext_delimited_code_blocks opts && attribs /= nullAttr
-     then -- use delimited code block
+  if isEnabled Ext_fenced_code_blocks opts && attribs /= nullAttr
+     then -- use fenced code block
           (tildes <> space <> attrs <> cr <> text str <>
                   cr <> tildes) <> blankline
      else nest (writerTabStop opts) (text str) <> blankline
@@ -468,7 +468,7 @@ blockListToMarkdown opts blocks =
     -- insert comment between list and indented code block, or the
     -- code block will be treated as a list continuation paragraph
     where fixBlocks (b : CodeBlock attr x : rest)
-            | (not (isEnabled Ext_delimited_code_blocks opts) || attr == nullAttr)
+            | (not (isEnabled Ext_fenced_code_blocks opts) || attr == nullAttr)
                 && isListBlock b =
                b : RawBlock "html" "<!-- -->\n" : CodeBlock attr x :
                    fixBlocks rest