packages feed

pandoc 1.2 → 1.2.1

raw patch · 34 files changed

+2099/−1628 lines, 34 filesdep ~basesetup-changednew-component:exe:markdown2pdf

Dependency ranges changed: base

Files

README view
@@ -274,7 +274,7 @@ `-C` or `--custom-header` *filename* :   can be used to specify a custom document header. To see the headers     used by default, use the `-D` option: for example, `pandoc -D html`-    prints the default HTML header.+    prints the default HTML header.  Implies `--standalone`.  `--toc` or `--table-of-contents` :   includes an automatically generated table of contents (or, in the@@ -286,13 +286,14 @@ :   allows the user to specify a custom stylesheet that will be linked to     in HTML and S5 output.  This option can be used repeatedly to include     multiple stylesheets. They will be included in the order specified.+    Implies `--standalone`.  `-H` or `--include-in-header` *filename* :   includes the contents of *filename* (verbatim) at the end of the     document header. This can be used, for example, to include special     CSS or javascript in HTML documents.  This option can be used     repeatedly to include multiple files in the header.  They will be-    included in the order specified.+    included in the order specified.  Implies `--standalone`.  `-B` or `--include-before-body` *filename* :   includes the contents of *filename* (verbatim) at the beginning of@@ -313,7 +314,7 @@ :   includes *string* as a prefix at the beginning of the title that     appears in the HTML header (but not in the title as it appears at     the beginning of the HTML body). (See below on-    [Title Blocks](#title-blocks).)+    [Title Blocks](#title-blocks).)  Implies `--standalone`.  `-S` or `--smart` :   causes `pandoc` to produce typographically correct output, along the@@ -733,6 +734,9 @@     {code here}     ~~~~~~~ +Like regular code blocks, delimited code blocks must be separated+from surrounding text by blank lines.+ If the code itself contains a row of tildes, just use a longer row of tildes at the start and end: @@ -1011,7 +1015,7 @@ If you want to use a different header, just create a file containing it and specify it on the command line as follows: -	pandoc --header=MyHeaderFile+	pandoc --custom-header=MyHeaderFile  Producing S5 with Pandoc ========================@@ -1068,7 +1072,7 @@ without the `-s` option to produce the body of the S5 document, which can then be inserted into an HTML template that links to the javascript and CSS files required by S5. (See the instructions on the S5 website.)-Alternatively, you may use `-s` together with the `-H/--custom-header`+Alternatively, you may use `-s` together with the `-C/--custom-header` option.  Literate Haskell support
Setup.hs view
@@ -22,7 +22,7 @@   (outputPath, hOut) <- openTempFile tempPath "out"   runProcess "pandoc" ["--version"] Nothing Nothing Nothing (Just hOut) Nothing >>= waitForProcess   output <- readFile outputPath-  let highlightingSupport = "+highlighting" `isInfixOf` output+  let highlightingSupport = "with syntax highlighting" `isInfixOf` output   let testArgs = if highlightingSupport then ["lhs"] else []   let testCmd  = "runhaskell -i.. RunTests.hs " ++ unwords testArgs   inDirectory "tests" $ runCommand testCmd >>= waitForProcess >>= exitWith
changelog view
@@ -1,3 +1,95 @@+pandoc (1.2.1)++  [ John MacFarlane ]++  * Fixed regression with --preserveTabs. Brought back optPreserveTabs.+    The trick of setting tabStop to 0 to mean "preserve tabs" had a bad+    side effect: strings of 0 spaces were interpreted as indentation.+    So, with --preserve-tabs, unindented paragraphs were treated as+    code. Resolves Issue #138.++  * HTML writer:  wrap sections in divs.  Resolves Issue #70.++    + hierarchicalize has been rationalized; it builds a hierarchical+      representation of the document from the headers, and simultaneously+      gives each section a unique identifier based on the heading title.+    + Identifiers are now attached to the divs rather than+      to the headers themselves.+    + Table of content backlinks go to the beginning of the table, rather+      than to the section reference that was clicked.+    + Code for constructing identifiers has been moved to Text.Pandoc.Shared+      from the HTML writer, since it is now consumed only by+      hierarchicalize.+    + In --strict mode, pandoc just prints bare headings, as before+      (unless --toc has been specified).+    + In s5 output, it does not wrap sections in divs, as that seems to+      confuse the s5 javascript.++  * Man writer: break lines at end of each sentence. groff expects this+    and treats '.' and '?' differently when followed by line ending as+    opposed to ordinary space. Also, don't escape periods. Instead, use+    zero-width character \& to avoid unwanted interpretation of periods+    at start of line. Resolves Issue #148.++  * Markdown writer:  Added '#' and '>' to list of characters to be+    escaped in markdown output.  Removed '<', as it is not an officially+    escapable character. This partially resolves Issue #96.++  * Make --smart the default for man output format. Otherwise we have+    trouble dividing lists of endlines into sentences.++  * DocBook writer: Use language attribute to indicate source language+    in code blocks.++  * RST reader:++    + Allow # to continue list, even if the list was started with an+      explicit marker. For example:++        A. my list+		#. continued++      Resolves Issue #140.+    + Allow continuation lines in line blocks. Also added test cases for+      line blocks for RST reader. Resolves Issue #149.+    + Allow explicit links with spaces in URL: `link <to this>`_++  * Improved LaTeX reader's coverage of math modes. Remove displaymath*+    (which is not in LaTeX) and recognize all the amsmath environments+    that are alternatives to eqnarray, namely equation, equation*,+    gather, gather*, gathered, multline, multline*, align, align*,+    alignat, alignat*, aligned, alignedat, split. Resolves Issue #103.+    Thanks to shreevatsa.public for the patch.++  * Markdown reader:++    + Allow -, _, :, . in markdown attribute names. These are legal in+      XML attribute names.+    + Use non-breaking spaces in abbreviations.+    + Markdown reader: improved efficiency of abbreviation parsing.+      Instead of a separate abbrev parser, we just check for+      abbreviations each time we parse a string. This gives a huge+      performance boost with -S. Resolves Issue #141.++  * Improved efficiency of shared parsers:  hexNum, htmlComment,+    whitespace, indentSpaces.++  * Export HTMLMathMethod in Text.Pandoc.++  * Export languagesByExtension in Text.Pandoc.Highlighting.++  * Added new Haskell version of markdown2pdf, due to+    Paulo Tanimoto.  This should be more portable than the old+	shell script.++  * Made 'pandoc -v' more explicit about compiler options.+    Resolves Issue #139.++  * pandoc.hs:  Made --strict compatible with --standalone, --toc.++  * Use Paths_pandoc to get version number, instead of hard-coding it+    into Text/Pandoc.hs.+ pandoc (1.2)    [ John MacFarlane ]@@ -114,7 +206,7 @@       Added rawVerbatimBlock parser.  Resolves Issue #94.    * Markdown reader:-  +     + Allow URLs with spaces in them in links and references, but escape       them as "%20".     + Allow blank space at the end of horizontal rules.
pandoc.cabal view
@@ -1,5 +1,5 @@ Name:            pandoc-Version:         1.2+Version:         1.2.1 Cabal-Version:   >= 1.2 Build-Type:      Custom License:         GPL@@ -155,7 +155,7 @@                  bytestring >= 0.9, zip-archive >= 0.1.1,                  utf8-string >= 0.3, old-time >= 1   if impl(ghc >= 6.10)-    Build-depends: base >= 4, syb+    Build-depends: base >= 4 && < 5, syb   else     Build-depends: base >= 3 && < 4   if flag(highlighting)@@ -193,10 +193,11 @@                    Text.Pandoc.Writers.RTF,                    Text.Pandoc.Writers.S5   Other-Modules:   Text.Pandoc.XML,-                   Text.Pandoc.TH+                   Text.Pandoc.TH,+                   Paths_pandoc   Extensions:      CPP, TemplateHaskell, FlexibleInstances   Ghc-Options:     -O2 -Wall-  Ghc-Prof-Options: -auto-all+  Ghc-Prof-Options: -auto-all -caf-all    if flag(library)     Buildable:      True@@ -207,7 +208,7 @@   Hs-Source-Dirs:     src   Main-Is:            pandoc.hs   Ghc-Options:        -O2 -Wall -threaded-  Ghc-Prof-Options:   -auto-all+  Ghc-Prof-Options:   -auto-all -caf-all   Extensions:         CPP, TemplateHaskell    if flag(highlighting)@@ -223,6 +224,17 @@ Executable hsmarkdown   Hs-Source-Dirs:     src   Main-Is:            hsmarkdown.hs+  Ghc-Options:        -Wall -threaded+  Ghc-Prof-Options:   -auto-all+  Extensions:         CPP, TemplateHaskell+  if flag(wrappers)+    Buildable:      True+  else+    Buildable:      False++Executable markdown2pdf+  Hs-Source-Dirs:     src+  Main-Is:            markdown2pdf.hs   Ghc-Options:        -Wall -threaded   Ghc-Prof-Options:   -auto-all   Extensions:         CPP, TemplateHaskell
src/Text/Pandoc.hs view
@@ -82,6 +82,7 @@                , prettyPandoc                -- * Writer options used in writers                 , WriterOptions (..)+               , HTMLMathMethod (..)                , defaultWriterOptions                -- * Default headers for various output formats                , module Text.Pandoc.DefaultHeaders@@ -108,7 +109,9 @@ import Text.Pandoc.Writers.MediaWiki import Text.Pandoc.DefaultHeaders import Text.Pandoc.Shared+import Data.Version (showVersion)+import Paths_pandoc (version)  -- | Version number of pandoc library. pandocVersion :: String-pandocVersion = "1.2"+pandocVersion = showVersion version
src/Text/Pandoc/CharacterReferences.hs view
@@ -50,7 +50,7 @@   return $ chr $ num   hexNum :: GenParser Char st Int -hexNum = oneOf "Xx" >> many1 hexDigit >>= return . read . ("0x" ++)+hexNum = oneOf "Xx" >> many1 hexDigit >>= return . read . (\xs -> '0':'x':xs)  decNum :: GenParser Char st Int  decNum = many1 digit >>= return . read
src/Text/Pandoc/Highlighting.hs view
@@ -29,11 +29,11 @@ Exports functions for syntax highlighting. -} -module Text.Pandoc.Highlighting ( languages, highlightHtml, defaultHighlightingCss ) where+module Text.Pandoc.Highlighting ( languages, highlightHtml, defaultHighlightingCss, languagesByExtension ) where import Text.XHtml import Text.Pandoc.Definition #ifdef _HIGHLIGHTING-import Text.Highlighting.Kate ( languages, highlightAs, formatAsXHtml, FormatOption (..), defaultHighlightingCss )+import Text.Highlighting.Kate ( languages, highlightAs, formatAsXHtml, FormatOption (..), defaultHighlightingCss, languagesByExtension ) import Data.List (find, lookup) import Data.Maybe (fromMaybe) import Data.Char (toLower)@@ -58,6 +58,9 @@  languages :: [String] languages = []++languagesByExtension :: String -> [String]+languagesByExtension _ = []  highlightHtml :: Attr -> String -> Either String Html highlightHtml _ _ = Left "Pandoc was not compiled with support for highlighting"
src/Text/Pandoc/Readers/HTML.hs view
@@ -346,7 +346,9 @@ htmlComment :: GenParser Char st [Char] htmlComment = try $ do   string "<!--"-  comment <- manyTill anyChar (try (string "-->"))+  comment <- many (   (satisfy (/='-'))+                  <|> (char '-' >>~ notFollowedBy (try $ char '-' >> char '>')))+  string "-->"   return $ "<!--" ++ comment ++ "-->"  --
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -701,7 +701,9 @@  math4 :: GenParser Char st String math4 = try $ do-  name <- begin "equation" <|> begin "equation*" <|> begin "displaymath" <|> begin "displaymath*"+  name <- begin "displaymath" <|> begin "equation" <|> begin "equation*" <|>+           begin "gather" <|> begin "gather*" <|> begin "gathered" <|>+             begin "multline" <|> begin "multline*"   spaces   manyTill anyChar (end name) @@ -710,10 +712,12 @@  math6 :: GenParser Char st String math6 = try $ do-  name <- begin "eqnarray" <|> begin "eqnarray*"+  name <- begin "eqnarray" <|> begin "eqnarray*" <|> begin "align" <|>+           begin "align*" <|> begin "alignat" <|> begin "alignat*" <|>+             begin "split" <|> begin "aligned" <|> begin "alignedat"   spaces   res <- manyTill anyChar (end name)-  return $ filter (/= '&') res  -- remove eqnarray alignment codes+  return $ filter (/= '&') res  -- remove alignment codes  -- -- links and images
src/Text/Pandoc/Readers/Markdown.hs view
@@ -34,7 +34,7 @@  import Data.List ( transpose, isPrefixOf, isSuffixOf, lookup, sortBy, findIndex, intercalate ) import Data.Ord ( comparing )-import Data.Char ( isAlphaNum, isAlpha, isLower, isDigit, isUpper )+import Data.Char ( isAlphaNum, isUpper ) import Data.Maybe import Text.Pandoc.Definition import Text.Pandoc.Shared @@ -55,9 +55,6 @@ -- Constants and data structure definitions -- -spaceChars :: [Char]-spaceChars = " \t"- bulletListMarkers :: [Char] bulletListMarkers = "*+-" @@ -79,8 +76,8 @@ indentSpaces = try $ do   state <- getState   let tabStop = stateTabStop state-  try (count tabStop (char ' ')) <|> -    (many (char ' ') >> string "\t") <?> "indentation"+  count tabStop (char ' ') <|>+    string "\t" <?> "indentation"  nonindentSpaces :: GenParser Char ParserState [Char] nonindentSpaces = do@@ -91,6 +88,15 @@      then return sps      else unexpected "indented line" +skipNonindentSpaces :: GenParser Char ParserState ()+skipNonindentSpaces = do+  state <- getState+  atMostSpaces (stateTabStop state - 1)++atMostSpaces :: Int -> GenParser Char ParserState ()+atMostSpaces 0 = notFollowedBy (char ' ')+atMostSpaces n = (char ' ' >> atMostSpaces (n-1)) <|> return ()+ -- | Fail unless we're at beginning of a line. failUnlessBeginningOfLine :: GenParser tok st ()  failUnlessBeginningOfLine = do@@ -185,7 +191,7 @@ referenceKey :: GenParser Char ParserState [Char] referenceKey = try $ do   startPos <- getPosition-  nonindentSpaces+  skipNonindentSpaces   lab <- reference   char ':'   skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[')@@ -316,7 +322,7 @@   skipSpaces   start <- oneOf hruleChars   count 2 (skipSpaces >> char start)-  skipMany (oneOf spaceChars <|> char start)+  skipMany (spaceChar <|> char start)   newline   optional blanklines   return HorizontalRule@@ -356,7 +362,7 @@ identifier :: GenParser Char st [Char] identifier = do   first <- letter-  rest <- many alphaNum+  rest <- many $ alphaNum <|> oneOf "-_:."   return (first:rest)  identifierAttr :: GenParser Char st ([Char], [a], [a1])@@ -432,7 +438,7 @@ --  emailBlockQuoteStart :: GenParser Char ParserState Char-emailBlockQuoteStart = try $ nonindentSpaces >> char '>' >>~ optional (char ' ')+emailBlockQuoteStart = try $ skipNonindentSpaces >> char '>' >>~ optional (char ' ')  emailBlockQuote :: GenParser Char ParserState [[Char]] emailBlockQuote = try $ do@@ -459,7 +465,7 @@ bulletListStart :: GenParser Char ParserState () bulletListStart = try $ do   optional newline -- if preceded by a Plain block in a list context-  nonindentSpaces+  skipNonindentSpaces   notFollowedBy' hrule     -- because hrules start out just like lists   oneOf bulletListMarkers   spaceChar@@ -468,7 +474,7 @@ anyOrderedListStart :: GenParser Char ParserState (Int, ListNumberStyle, ListNumberDelim)  anyOrderedListStart = try $ do   optional newline -- if preceded by a Plain block in a list context-  nonindentSpaces+  skipNonindentSpaces   notFollowedBy $ string "p." >> spaceChar >> digit  -- page number   state <- getState   if stateStrict state@@ -625,7 +631,7 @@ htmlBlock = try $ do     failUnlessBeginningOfLine     first <- htmlElement-    finalSpace <- many (oneOf spaceChars)+    finalSpace <- many spaceChar     finalNewlines <- many newline     return $ RawHtml $ first ++ finalSpace ++ finalNewlines @@ -690,11 +696,11 @@  -- Parse a table footer - dashed lines followed by blank line. tableFooter :: GenParser Char ParserState [Char]-tableFooter = try $ nonindentSpaces >> many1 (dashedLine '-') >> blanklines+tableFooter = try $ skipNonindentSpaces >> many1 (dashedLine '-') >> blanklines  -- Parse a table separator - dashed line. tableSep :: GenParser Char ParserState String-tableSep = try $ nonindentSpaces >> many1 (dashedLine '-') >> string "\n"+tableSep = try $ skipNonindentSpaces >> many1 (dashedLine '-') >> string "\n"  -- Parse a raw line and split it into chunks by indices. rawTableLine :: [Int]@@ -737,7 +743,7 @@ -- and followed by blank lines. tableCaption :: GenParser Char ParserState [Inline] tableCaption = try $ do-  nonindentSpaces+  skipNonindentSpaces   string "Table:"   result <- many1 inline   blanklines@@ -814,8 +820,7 @@ inline = choice inlineParsers <?> "inline"  inlineParsers :: [GenParser Char ParserState Inline]-inlineParsers = [ abbrev-                , str+inlineParsers = [ str                 , smartPunctuation                 , whitespace                 , endline@@ -930,38 +935,14 @@  superscript :: GenParser Char ParserState Inline superscript = failIfStrict >> enclosed (char '^') (char '^') -              (notFollowedBy' whitespace >> inline) >>= -- may not contain Space+              (notFollowedBy spaceChar >> inline) >>= -- may not contain Space               return . Superscript  subscript :: GenParser Char ParserState Inline subscript = failIfStrict >> enclosed (char '~') (char '~')-            (notFollowedBy' whitespace >> inline) >>=  -- may not contain Space+            (notFollowedBy spaceChar >> inline) >>=  -- may not contain Space             return . Subscript  -abbrev :: GenParser Char ParserState Inline-abbrev = failUnlessSmart >>-         (assumedAbbrev <|> knownAbbrev) >>= return . Str . (++ ".\160")---- an string of letters followed by a period that does not end a sentence--- is assumed to be an abbreviation.  It is assumed that sentences don't--- start with lowercase letters or numerals.-assumedAbbrev :: GenParser Char ParserState [Char]-assumedAbbrev = try $ do-  result <- many1 $ satisfy isAlpha-  string ". "-  lookAhead $ satisfy (\x -> isLower x || isDigit x)-  return result---- these strings are treated as abbreviations even if they are followed--- by a capital letter (such as a name).-knownAbbrev :: GenParser Char ParserState [Char]-knownAbbrev = try $ do-  result <- oneOfStrings [ "Mr", "Mrs", "Ms", "Capt", "Dr", "Prof", "Gen",-                           "Gov", "e.g", "i.e", "Sgt", "St", "vol", "vs",-                           "Sen", "Rep", "Pres", "Hon", "Rev" ]-  string ". "-  return result- smartPunctuation :: GenParser Char ParserState Inline smartPunctuation = failUnlessSmart >>                     choice [ quoted, apostrophe, dash, ellipses ]@@ -1044,20 +1025,41 @@ emDash = oneOfStrings ["---", "--"] >> return EmDash  whitespace :: GenParser Char ParserState Inline-whitespace = do-  sps <- many1 (oneOf spaceChars)-  if length sps >= 2-     then option Space (endline >> return LineBreak)-     else return Space <?> "whitespace"+whitespace = spaceChar >>+  (   (spaceChar >> skipMany spaceChar >> option Space (endline >> return LineBreak))+  <|> (skipMany spaceChar >> return Space) ) <?> "whitespace"  nonEndline :: GenParser Char st Char nonEndline = satisfy (/='\n')  strChar :: GenParser Char st Char-strChar = noneOf (specialChars ++ spaceChars ++ "\n")+strChar = noneOf (specialChars ++ " \t\n") -str :: GenParser Char st Inline-str = many1 strChar >>= return . Str+str :: GenParser Char ParserState Inline+str = do+  result <- many1 strChar+  state <- getState+  let spacesToNbr = map (\c -> if c == ' ' then '\160' else c)+  if stateSmart state+     then case likelyAbbrev result of+               []        -> return $ Str result+               xs        -> choice (map (\x ->+                               try (string x >> char ' ' >>+                                    notFollowedBy spaceChar >>+                                    return (Str $ result ++ spacesToNbr x ++ "\160"))) xs)+                           <|> (return $ Str result)+     else return $ Str result++-- | if the string matches the beginning of an abbreviation (before+-- the first period, return strings that would finish the abbreviation.+likelyAbbrev :: String -> [String]+likelyAbbrev x =+  let abbrevs = [ "Mr.", "Mrs.", "Ms.", "Capt.", "Dr.", "Prof.",+                  "Gen.", "Gov.", "e.g.", "i.e.", "Sgt.", "St.",+                  "vol.", "vs.", "Sen.", "Rep.", "Pres.", "Hon.",+                  "Rev.", "Ph.D.", "M.D.", "M.A." ]+      abbrPairs = map (break (=='.')) abbrevs+  in  map snd $ filter (\(y,_) -> y == x) abbrPairs  -- an endline character that can be treated as a space, not a structural break endline :: GenParser Char ParserState Inline
src/Text/Pandoc/Readers/RST.hs view
@@ -75,14 +75,12 @@ -- promote all the other headers.  titleTransform :: [Block]              -- ^ list of blocks                -> ([Block], [Inline])  -- ^ modified list of blocks, title-titleTransform ((Header 1 head1):(Header 2 head2):rest) =  -- title subtitle-    if (any (isHeader 1) rest) || (any (isHeader 2) rest)-       then ((Header 1 head1):(Header 2 head2):rest, [])-       else ((promoteHeaders 2 rest), head1 ++ [Str ":", Space] ++ head2)-titleTransform ((Header 1 head1):rest) =       -- title, no subtitle-    if (any (isHeader 1) rest)-       then ((Header 1 head1):rest, [])-       else ((promoteHeaders 1 rest), head1)+titleTransform ((Header 1 head1):(Header 2 head2):rest) |+   not (any (isHeader 1) rest || any (isHeader 2) rest) =  -- both title & subtitle+   (promoteHeaders 2 rest, head1 ++ [Str ":", Space] ++ head2)+titleTransform ((Header 1 head1):rest) |+   not (any (isHeader 1) rest) =  -- title, no subtitle+   (promoteHeaders 1 rest, head1) titleTransform blocks = (blocks, [])  parseRST :: GenParser Char ParserState Pandoc@@ -125,8 +123,8 @@                , unknownDirective                , header                , hrule+               , lineBlock     -- must go before definitionList                , list-               , lineBlock                , lhsCodeBlock                , para                , plain@@ -183,14 +181,15 @@ lineBlockLine = try $ do   string "| "   white <- many (oneOf " \t")-  line <- manyTill inline newline-  return $ (if null white then [] else [Str white]) ++ line ++ [LineBreak]+  line <- many $ (notFollowedBy newline >> inline) <|> (try $ endline >>~ char ' ')+  optional endline+  return $ normalizeSpaces $ (if null white then [] else [Str white]) ++ line  lineBlock :: GenParser Char ParserState Block lineBlock = try $ do   lines' <- many1 lineBlockLine   blanklines-  return $ Para (concat lines')+  return $ Para (intercalate [LineBreak] lines')  -- -- paragraph block@@ -659,7 +658,7 @@   notFollowedBy (char '`') -- `` marks start of inline code   label' <- manyTill (notFollowedBy (char '`') >> inline)                      (try (spaces >> char '<'))-  src <- manyTill (noneOf ">\n ") (char '>')+  src <- manyTill (noneOf ">\n") (char '>')   skipSpaces   string "`_"   return $ Link (normalizeSpaces label') (removeLeadingTrailingSpace src, "")
src/Text/Pandoc/Shared.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, DeriveDataTypeable #-} {- Copyright (C) 2006-8 John MacFarlane <jgm@berkeley.edu> @@ -112,13 +112,16 @@ import Text.PrettyPrint.HughesPJ ( Doc, fsep, ($$), (<>), empty, isEmpty, text, nest ) import qualified Text.PrettyPrint.HughesPJ as PP import Text.Pandoc.CharacterReferences ( characterReference )-import Data.Char ( toLower, toUpper, ord, isLower, isUpper )+import Data.Char ( toLower, toUpper, ord, isLower, isUpper, isAlpha,+                   isPunctuation ) import Data.List ( find, isPrefixOf, intercalate )-import Control.Monad ( join ) import Network.URI ( parseURI, URI (..), isAllowedInURI ) import System.Directory import Prelude hiding ( putStrLn, writeFile, readFile, getContents ) import System.IO.UTF8+import Data.Generics+import qualified Control.Monad.State as S+import Control.Monad (join)  -- -- List processing@@ -609,8 +612,9 @@                   -> ListNumberDelim                    -> GenParser Char st Int orderedListMarker style delim = do-  let num = case style of-               DefaultStyle -> decimal <|> defaultNum+  let num = defaultNum <|>  -- # can continue any kind of list+            case style of+               DefaultStyle -> decimal                Decimal      -> decimal                UpperRoman   -> upperRoman                LowerRoman   -> lowerRoman@@ -878,22 +882,74 @@  -- | Data structure for defining hierarchical Pandoc documents data Element = Blk Block -             | Sec [Inline] [Element] deriving (Eq, Read, Show)+             | Sec Int String [Inline] [Element]+             --    lvl  ident  label    contents+             deriving (Eq, Read, Show, Typeable, Data) --- | Returns @True@ on Header block with at least the specified level-headerAtLeast :: Int -> Block -> Bool-headerAtLeast level (Header x _) = x <= level-headerAtLeast _ _ = False+-- | Convert Pandoc inline list to plain text identifier.+inlineListToIdentifier :: [Inline] -> String+inlineListToIdentifier = dropWhile (not . isAlpha) . inlineListToIdentifier' +inlineListToIdentifier' :: [Inline] -> [Char]+inlineListToIdentifier' [] = ""+inlineListToIdentifier' (x:xs) =+  xAsText ++ inlineListToIdentifier' xs+  where xAsText = case x of+          Str s          -> filter (\c -> c == '-' || not (isPunctuation c)) $+                            intercalate "-" $ words $ map toLower s+          Emph lst       -> inlineListToIdentifier' lst+          Strikeout lst  -> inlineListToIdentifier' lst+          Superscript lst -> inlineListToIdentifier' lst+          SmallCaps   lst -> inlineListToIdentifier' lst+          Subscript lst  -> inlineListToIdentifier' lst+          Strong lst     -> inlineListToIdentifier' lst+          Quoted _ lst   -> inlineListToIdentifier' lst+          Cite   _ lst   -> inlineListToIdentifier' lst+          Code s         -> s+          Space          -> "-"+          EmDash         -> "-"+          EnDash         -> "-"+          Apostrophe     -> ""+          Ellipses       -> ""+          LineBreak      -> "-"+          Math _ _       -> ""+          TeX _          -> ""+          HtmlInline _   -> ""+          Link lst _     -> inlineListToIdentifier' lst+          Image lst _    -> inlineListToIdentifier' lst+          Note _         -> ""+ -- | Convert list of Pandoc blocks into (hierarchical) list of Elements hierarchicalize :: [Block] -> [Element]-hierarchicalize [] = []-hierarchicalize (block:rest) = -  case block of-    (Header level title) -> -         let (thisSection, rest') = break (headerAtLeast level) rest-         in  (Sec title (hierarchicalize thisSection)):(hierarchicalize rest') -    x -> (Blk x):(hierarchicalize rest)+hierarchicalize blocks = S.evalState (hierarchicalizeWithIds blocks) []++hierarchicalizeWithIds :: [Block] -> S.State [String] [Element]+hierarchicalizeWithIds [] = return []+hierarchicalizeWithIds ((Header level title'):xs) = do+  usedIdents <- S.get+  let ident = uniqueIdent title' usedIdents+  S.modify (ident :)+  let (sectionContents, rest) = break (headerLtEq level) xs+  sectionContents' <- hierarchicalizeWithIds sectionContents+  rest' <- hierarchicalizeWithIds rest+  return $ Sec level ident title' sectionContents' : rest'+hierarchicalizeWithIds (x:rest) = do+  rest' <- hierarchicalizeWithIds rest+  return $ (Blk x) : rest'++headerLtEq :: Int -> Block -> Bool+headerLtEq level (Header l _) = l <= level+headerLtEq _ _ = False++uniqueIdent :: [Inline] -> [String] -> String+uniqueIdent title' usedIdents =+  let baseIdent = inlineListToIdentifier title'+      numIdent n = baseIdent ++ "-" ++ show n+  in  if baseIdent `elem` usedIdents+        then case find (\x -> numIdent x `notElem` usedIdents) ([1..60000] :: [Int]) of+                  Just x  -> numIdent x+                  Nothing -> baseIdent   -- if we have more than 60,000, allow repeats+        else baseIdent  -- | True if block is a Header block. isHeaderBlock :: Block -> Bool
src/Text/Pandoc/Writers/Docbook.hs view
@@ -33,7 +33,9 @@ import Text.Pandoc.Shared import Text.Pandoc.Readers.TeXMath import Data.List ( isPrefixOf, drop, intercalate )+import Data.Char ( toLower ) import Text.PrettyPrint.HughesPJ hiding ( Str )+import Text.Pandoc.Highlighting (languages, languagesByExtension)  -- | Convert list of authors to a docbook <author> section authorToDocbook :: [Char] -> Doc@@ -80,7 +82,7 @@ -- | Convert an Element to Docbook. elementToDocbook :: WriterOptions -> Element -> Doc elementToDocbook opts (Blk block) = blockToDocbook opts block -elementToDocbook opts (Sec title elements) =+elementToDocbook opts (Sec _ _ title elements) =   -- Docbook doesn't allow sections with no content, so insert some if needed   let elements' = if null elements                     then [Blk (Para [])]@@ -129,8 +131,18 @@ blockToDocbook opts (Para lst) = inTagsIndented "para" $ wrap opts lst blockToDocbook opts (BlockQuote blocks) =   inTagsIndented "blockquote" $ blocksToDocbook opts blocks-blockToDocbook _ (CodeBlock _ str) = -  text "<screen>\n" <> text (escapeStringForXML str) <> text "\n</screen>"+blockToDocbook _ (CodeBlock (_,classes,_) str) = +  text ("<screen" ++ lang ++ ">\n") <>+     text (escapeStringForXML str) <> text "\n</screen>"+    where lang  = if null langs+                     then ""+                     else " language=\"" ++ escapeStringForXML (head langs) +++                          "\""+          isLang l    = map toLower l `elem` map (map toLower) languages+          langsFrom s = if isLang s+                           then [s]+                           else languagesByExtension . map toLower $ s+          langs       = concatMap langsFrom classes blockToDocbook opts (BulletList lst) =    inTagsIndented "itemizedlist" $ listItemsToDocbook opts lst  blockToDocbook _ (OrderedList _ []) = empty 
src/Text/Pandoc/Writers/HTML.hs view
@@ -36,22 +36,21 @@ import Text.Pandoc.Readers.TeXMath import Text.Pandoc.Highlighting ( highlightHtml, defaultHighlightingCss ) import Numeric ( showHex )-import Data.Char ( ord, toLower, isAlpha )+import Data.Char ( ord, toLower ) import Data.List ( isPrefixOf, intercalate )+import Data.Maybe ( catMaybes ) import qualified Data.Set as S import Control.Monad.State import Text.XHtml.Transitional hiding ( stringToHtml )  data WriterState = WriterState     { stNotes            :: [Html]       -- ^ List of notes-    , stIds              :: [String]     -- ^ List of header identifiers     , stMath             :: Bool         -- ^ Math is used in document     , stCSS              :: S.Set String -- ^ CSS to include in header     } deriving Show  defaultWriterState :: WriterState-defaultWriterState = WriterState {stNotes= [], stIds = [], -                                  stMath = False, stCSS = S.empty}+defaultWriterState = WriterState {stNotes= [], stMath = False, stCSS = S.empty}  -- Helpers to render HTML with the appropriate function. @@ -107,15 +106,13 @@                     not (writerS5 opts)                         then h1 ! [theclass "title"] $ topTitle                         else noHtml-      headerBlocks = filter isHeaderBlock blocks-      ids          = uniqueIdentifiers $ -                     map (\(Header _ lst) -> lst) headerBlocks+      sects        = hierarchicalize blocks       toc          = if writerTableOfContents opts -                        then tableOfContents opts headerBlocks ids+                        then evalState (tableOfContents opts sects) defaultWriterState                         else noHtml-      (blocks', newstate) = -                     runState (blockListToHtml opts blocks)-                     (defaultWriterState {stIds = ids})+      (blocks', newstate) = runState +                            (mapM (elementToHtml opts) sects >>= return . toHtmlFromList)+                            defaultWriterState       cssLines     = stCSS newstate       css          = if S.null cssLines                         then noHtml@@ -146,36 +143,37 @@          then head' +++ body thebody          else thebody --- | Construct table of contents from list of header blocks and identifiers.--- Assumes there are as many identifiers as header blocks.-tableOfContents :: WriterOptions -> [Block] -> [String] -> Html-tableOfContents _ [] _ = noHtml-tableOfContents opts headers ids =+-- | Construct table of contents from list of elements.+tableOfContents :: WriterOptions -> [Element] -> State WriterState Html+tableOfContents _ [] = return noHtml+tableOfContents opts sects = do   let opts'        = opts { writerIgnoreNotes = True }-      contentsTree = hierarchicalize headers-      contents     = evalState (mapM (elementToListItem opts') contentsTree) -                     (defaultWriterState {stIds = ids})-  in  thediv ! [identifier "toc"] $ unordList contents+  contents  <- mapM (elementToListItem opts') sects+  return $ thediv ! [identifier "TOC"] $ unordList $ catMaybes contents  -- | Converts an Element to a list item for a table of contents, -- retrieving the appropriate identifier from state.-elementToListItem :: WriterOptions -> Element -> State WriterState Html-elementToListItem _ (Blk _) = return noHtml-elementToListItem opts (Sec headerText subsecs) = do-  st <- get-  let ids = stIds st-  let (id', rest) = if null ids-                      then ("", [])-                      else (head ids, tail ids)-  put $ st {stIds = rest}+elementToListItem :: WriterOptions -> Element -> State WriterState (Maybe Html)+elementToListItem _ (Blk _) = return Nothing+elementToListItem opts (Sec _ id' headerText subsecs) = do   txt <- inlineListToHtml opts headerText-  subHeads <- mapM (elementToListItem opts) subsecs+  subHeads <- mapM (elementToListItem opts) subsecs >>= return . catMaybes   let subList = if null subHeads                    then noHtml-                   else unordList subHeads -  return $ (anchor ! [href ("#" ++ id'), identifier ("TOC-" ++ id')] $ txt) +++ -           subList+                   else unordList subHeads+  return $ Just $ (anchor ! [href ("#" ++ id')] $ txt) +++ subList +-- | Convert an Element to Html.+elementToHtml :: WriterOptions -> Element -> State WriterState Html+elementToHtml opts (Blk block) = blockToHtml opts block +elementToHtml opts (Sec level id' title' elements) = do+  innerContents <- mapM (elementToHtml opts) elements+  header' <- blockToHtml opts (Header level title')+  return $ if writerS5 opts || (writerStrictMarkdown opts && not (writerTableOfContents opts))+              -- S5 gets confused by the extra divs around sections+              then toHtmlFromList (header' : innerContents)+              else thediv ! [identifier id'] << (header' : innerContents)+ -- | Convert list of Note blocks to a footnote <div>. -- Assumes notes are sorted. footnoteSection :: [Html] -> Html@@ -236,15 +234,6 @@ obfuscateString :: String -> String obfuscateString = concatMap obfuscateChar . decodeCharacterReferences --- | True if character is a punctuation character (unicode).-isPunctuation :: Char -> Bool-isPunctuation c =-  let c' = ord c-  in  if c `elem` "!\"'()*,-./:;<>?[\\]`{|}~" || c' >= 0x2000 && c' <= 0x206F ||-         c' >= 0xE000 && c' <= 0xE0FF-         then True-         else False- -- | Add CSS for document header. addToCSS :: String -> State WriterState () addToCSS item = do@@ -252,50 +241,6 @@   let current = stCSS st   put $ st {stCSS = S.insert item current} --- | Convert Pandoc inline list to plain text identifier.-inlineListToIdentifier :: [Inline] -> String-inlineListToIdentifier = dropWhile (not . isAlpha) . inlineListToIdentifier'--inlineListToIdentifier' :: [Inline] -> [Char]-inlineListToIdentifier' [] = ""-inlineListToIdentifier' (x:xs) = -  xAsText ++ inlineListToIdentifier' xs-  where xAsText = case x of-          Str s          -> filter (\c -> c == '-' || not (isPunctuation c)) $-                            intercalate "-" $ words $ map toLower s-          Emph lst       -> inlineListToIdentifier' lst-          Strikeout lst  -> inlineListToIdentifier' lst-          Superscript lst -> inlineListToIdentifier' lst-          SmallCaps   lst -> inlineListToIdentifier' lst-          Subscript lst  -> inlineListToIdentifier' lst-          Strong lst     -> inlineListToIdentifier' lst-          Quoted _ lst   -> inlineListToIdentifier' lst-          Cite   _ lst   -> inlineListToIdentifier' lst-          Code s         -> s-          Space          -> "-"-          EmDash         -> "-"-          EnDash         -> "-"-          Apostrophe     -> ""-          Ellipses       -> ""-          LineBreak      -> "-"-          Math _ _       -> ""-          TeX _          -> ""-          HtmlInline _   -> ""-          Link lst _     -> inlineListToIdentifier' lst-          Image lst _    -> inlineListToIdentifier' lst-          Note _         -> ""---- | Return unique identifiers for list of inline lists.-uniqueIdentifiers :: [[Inline]] -> [String]-uniqueIdentifiers ls =-  let addIdentifier (nonuniqueIds, uniqueIds) l =-        let new = inlineListToIdentifier l-            matches = length $ filter (== new) nonuniqueIds-            new' = (if null new then "section" else new) ++ -                   if matches > 0 then ("-" ++ show matches) else ""-        in  (new:nonuniqueIds, new':uniqueIds)-  in  reverse $ snd $ foldl addIdentifier ([],[]) ls- -- | Convert Pandoc block element to HTML. blockToHtml :: WriterOptions -> Block -> State WriterState Html blockToHtml _ Null = return $ noHtml @@ -335,26 +280,17 @@      else blockListToHtml opts blocks >>= (return . blockquote) blockToHtml opts (Header level lst) = do    contents <- inlineListToHtml opts lst-  st <- get-  let ids = stIds st-  let (id', rest) = if null ids-                      then ("", [])-                      else (head ids, tail ids)-  put $ st {stIds = rest}-  let attribs = if writerStrictMarkdown opts && not (writerTableOfContents opts)-                   then []-                   else [identifier id']   let contents'  = if writerTableOfContents opts-                      then anchor ! [href ("#TOC-" ++ id')] $ contents+                      then anchor ! [href "#TOC"] $ contents                       else contents   return $ case level of-              1 -> h1 contents' ! attribs-              2 -> h2 contents' ! attribs-              3 -> h3 contents' ! attribs-              4 -> h4 contents' ! attribs-              5 -> h5 contents' ! attribs-              6 -> h6 contents' ! attribs-              _ -> paragraph contents' ! attribs+              1 -> h1 contents'+              2 -> h2 contents'+              3 -> h3 contents'+              4 -> h4 contents'+              5 -> h5 contents'+              6 -> h6 contents'+              _ -> paragraph contents' blockToHtml opts (BulletList lst) = do   contents <- mapM (blockListToHtml opts) lst   let attribs = if writerIncremental opts@@ -492,7 +428,7 @@                                   return $ primHtml $ "<EQ>" ++ str ++ "</EQ>"                                PlainMath ->                                    inlineListToHtml opts (readTeXMath str) >>=-                                  return . (thespan ! [theclass "math"])) +                                  return . (thespan ! [theclass "math"]) )      (TeX str)        -> case writerHTMLMathMethod opts of                               LaTeXMathML _ -> do modify (\st -> st {stMath = True})                                                   return $ primHtml str
src/Text/Pandoc/Writers/Man.hs view
@@ -35,6 +35,7 @@ import Data.List ( isPrefixOf, drop, nub, intersperse, intercalate ) import Text.PrettyPrint.HughesPJ hiding ( Str ) import Control.Monad.State+import Control.Monad ( liftM )  type Notes = [[Block]] type Preprocessors = [String] -- e.g. "t" for tbl@@ -100,7 +101,7 @@  -- | Association list of characters to escape. manEscapes :: [(Char, String)]-manEscapes = [('\160', "\\ "), ('\'', "\\[aq]")] ++ backslashEscapes ".@\\"+manEscapes = [('\160', "\\ "), ('\'', "\\[aq]")] ++ backslashEscapes "@\\"  -- | Escape special characters for Man. escapeString :: String -> String@@ -110,15 +111,43 @@ escapeCode :: String -> String escapeCode = escapeStringUsing (manEscapes ++ backslashEscapes "\t ") +-- We split inline lists into sentences, and print one sentence per+-- line.  groff/troff treats the line-ending period differently.+-- See http://code.google.com/p/pandoc/issues/detail?id=148.++-- | Returns the first sentence in a list of inlines, and the rest.+breakSentence :: [Inline] -> ([Inline], [Inline])+breakSentence [] = ([],[])+breakSentence xs =+  let isSentenceEndInline (Str ".") = True+      isSentenceEndInline (Str "?") = True+      isSentenceEndInline _         = False+      (as, bs) = break isSentenceEndInline xs+  in  case bs of+           []             -> (as, [])+           [c]            -> (as ++ [c], [])+           (c:Space:cs)   -> (as ++ [c], cs)+           (Str ".":Str ")":cs) -> (as ++ [Str ".", Str ")"], cs)+           (c:cs)         -> (as ++ [c] ++ ds, es)+              where (ds, es) = breakSentence cs++-- | Split a list of inlines into sentences.+splitSentences :: [Inline] -> [[Inline]]+splitSentences xs =+  let (sent, rest) = breakSentence xs+  in  if null rest then [sent] else sent : splitSentences rest+ -- | Convert Pandoc block element to man. blockToMan :: WriterOptions -- ^ Options                 -> Block         -- ^ Block element                 -> State WriterState Doc  blockToMan _ Null = return empty blockToMan opts (Plain inlines) = -  wrapIfNeeded opts (inlineListToMan opts) inlines+  liftM vcat $ mapM (wrapIfNeeded opts (inlineListToMan opts)) $+    splitSentences inlines blockToMan opts (Para inlines) = do-  contents <- wrapIfNeeded opts (inlineListToMan opts) inlines+  contents <- liftM vcat $ mapM (wrapIfNeeded opts (inlineListToMan opts)) $+    splitSentences inlines   return $ text ".PP" $$ contents  blockToMan _ (RawHtml str) = return $ text str blockToMan _ HorizontalRule = return $ text $ ".PP\n   *   *   *   *   *"@@ -237,6 +266,10 @@  -- | Convert list of Pandoc inline elements to man. inlineListToMan :: WriterOptions -> [Inline] -> State WriterState Doc+-- if list starts with ., insert a zero-width character \& so it+-- won't be interpreted as markup if it falls at the beginning of a line.+inlineListToMan opts lst@(Str "." : _) = mapM (inlineToMan opts) lst >>=+  (return . (text "\\&" <>)  . hcat) inlineListToMan opts lst = mapM (inlineToMan opts) lst >>= (return . hcat)  -- | Convert Pandoc inline element to man.
src/Text/Pandoc/Writers/Markdown.hs view
@@ -102,7 +102,7 @@ -- | Escape special characters for Markdown. escapeString :: String -> String escapeString = escapeStringUsing markdownEscapes-  where markdownEscapes = backslashEscapes "`<\\*_^~"+  where markdownEscapes = backslashEscapes "\\`*_>#~^"  -- | Convert bibliographic information into Markdown header. metaToMarkdown :: WriterOptions -> Meta -> State WriterState Doc@@ -138,7 +138,7 @@ -- | Converts an Element to a list item for a table of contents, elementToListItem :: Element -> [Block] elementToListItem (Blk _) = []-elementToListItem (Sec headerText subsecs) = [Plain headerText] ++ +elementToListItem (Sec _ _ headerText subsecs) = [Plain headerText] ++    if null subsecs      then []      else [BulletList $ map elementToListItem subsecs]
src/Text/Pandoc/Writers/RTF.hs view
@@ -59,7 +59,7 @@  elementToListItem :: Element -> [Block] elementToListItem (Blk _) = []-elementToListItem (Sec sectext subsecs) = [Plain sectext] +++elementToListItem (Sec _ _ sectext subsecs) = [Plain sectext] ++   if null subsecs      then []      else [BulletList (map elementToListItem subsecs)]
+ src/markdown2pdf.hs view
@@ -0,0 +1,198 @@+module Main where++import Data.List (isInfixOf, intercalate, (\\))+import Data.Maybe (isNothing)++import Control.Monad (when, unless, guard)+import Control.Exception (tryJust, bracket)++import System.IO (stderr, hPutStrLn)+import System.IO.Error (isDoesNotExistError)+import System.Exit (ExitCode (..), exitWith)+import System.FilePath+import System.Directory+import System.Process (readProcessWithExitCode)+import System.Environment (getArgs, getProgName)+++run :: FilePath -> [String] -> IO (Either String String)+run file opts = do+  (code, out, err) <- readProcessWithExitCode file opts ""+  let msg = out ++ err+  case code of+    ExitFailure _ -> return $ Left  $! msg+    ExitSuccess   -> return $ Right $! msg++parsePandocArgs :: [String] -> IO (Maybe ([String], String))+parsePandocArgs args = do+  result <- run "pandoc" $ ["--dump-args"] ++ args+  return $ either (const Nothing) (parse . map trim . lines) result+  where parse []         = Nothing+        parse ("-":[])   = Just ([], "stdin") -- no output or input+        parse ("-":x:xs) = Just (x:xs, dropExtension x) -- no output+        parse ( x :xs)   = Just (xs,   dropExtension x) -- at least output+        --trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace+        trim = takeWhile (/='\r') . dropWhile (=='\r')++runPandoc :: [String] -> FilePath -> IO (Either String FilePath)+runPandoc inputs output = do+  let texFile = replaceExtension output "tex"+  result <- run "pandoc" $+    ["-s", "--no-wrap", "-r", "markdown", "-w", "latex"]+    ++ inputs ++ ["-o", texFile]+  return $ either Left (const $ Right texFile) result++runLatexRaw :: FilePath -> IO (Either (Either String String) FilePath)+runLatexRaw file = do+  -- we ignore the ExitCode because pdflatex always fails the first time+  run "pdflatex" ["-interaction=batchmode", "-output-directory",+    takeDirectory file, dropExtension file] >> return ()+  let pdfFile = replaceExtension file "pdf"+  let logFile = replaceExtension file "log"+  txt <- tryJust (guard . isDoesNotExistError) (readFile logFile)+  let  checks = checkLatex $ either (const "") id txt+  case checks of+  -- err  , bib , ref , msg+    (True , _    , _   , msg) -> return $ Left $ Left msg   -- failure+    (False, True , _   , msg) -> runBibtex file >>+                                (return $ Left $ Right msg) -- citations+    (False, _    , True, msg) -> return $ Left $ Right msg  -- references+    (False, False, False, _ ) -> return $ Right pdfFile     -- success++runLatex :: FilePath -> IO (Either String FilePath)+runLatex file = step 3+  where+  step 0 = return $ Left "Limit of attempts reached"+  step n = do+    result <- runLatexRaw file+    case result of+      Left (Left err) -> return $ Left err+      Left (Right _ ) -> step (n-1 :: Int)+      Right pdfFile   -> return $ Right pdfFile++checkLatex :: String -> (Bool, Bool, Bool, String)+checkLatex ""  = (True, False, False, "Could not read log file")+checkLatex txt = (err , bib, ref, unlines $! msgs ++ tips)+  where+  xs `oneOf` x = any (flip isInfixOf x) xs+  msgs = filter (oneOf ["Error:", "Warning:"]) (lines txt)+  tips = checkPackages msgs+  err = any (oneOf ["LaTeX Error:", "Latex Error:"]) msgs+  bib = any (oneOf ["Warning: Citation"+                   ,"Warning: There were undefined citations"]) msgs+  ref = any (oneOf ["Warning: Reference"+                   ,"Warning: Label"+                   ,"Warning: There were undefined references"+                   ,"--toc", "--table-of-contents"]) msgs++checkPackages :: [String] -> [String]+checkPackages = concatMap chks+  where -- for each message, search 'pks' for matches and give a hint+  chks x = concatMap (chk x) pks+  chk x (k,v) = if sub k `isInfixOf` x then tip k v else []+  sub k   = "`" ++ k ++ ".sty' not found"+  tip k v = ["Please install the '" ++ k +++             "' package from CTAN:", "  " ++ v]+  pks = [("ucs"+         ,"http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/")+        ,("ulem"+         ,"http://www.ctan.org/tex-archive/macros/latex/contrib/misc/")+        ,("graphicx"+         ,"http://www.ctan.org/tex-archive/macros/latex/required/graphics/")+        ,("fancyhdr"+         ,"http://www.ctan.org/tex-archive/macros/latex/contrib/fancyhdr/")+        ,("array"+         ,"http://www.ctan.org/tex-archive/macros/latex/required/tools/")]++runBibtex :: FilePath -> IO (Either String FilePath)+runBibtex file = do+  let auxFile = replaceExtension file "aux"+  result <- run "bibtex" [auxFile]+  return $ either Left (const $ Right auxFile) result++exit :: String -> IO a+exit x = do+  progName <- getProgName+  hPutStrLn stderr $ progName ++ ": " ++ x+  exitWith $ ExitFailure 1++saveStdin :: FilePath -> IO (Either String FilePath)+saveStdin file = do+  text <- getContents+  writeFile file text+  fileExist <- doesFileExist file+  case fileExist of+    False -> return $ Left $! "Could not create " ++ file+    True  -> return $ Right file++saveOutput :: FilePath -> FilePath -> IO ()+saveOutput input output = do+  outputExist <- doesFileExist output+  when outputExist $ do+    let output' = output ++ "~"+    renameFile output output'+    putStrLn $! "Created backup file " ++ output'+  copyFile input output+  putStrLn $! "Created " ++ output++main :: IO ()+main = bracket+  -- acquire resource+  (do dir <- getTemporaryDirectory+      let tmp = dir </> "pandoc"+      createDirectoryIfMissing True tmp+      return tmp)++  -- release resource+  ( \tmp -> removeDirectoryRecursive tmp)++  -- run computation+  $ \tmp -> do+    -- check for executable files+    let execs = ["pandoc", "pdflatex", "bibtex"]+    paths <- mapM findExecutable execs+    let miss = map snd $ filter (isNothing . fst) $ zip paths execs+    unless (null miss) $ exit $! "Could not find " ++ intercalate ", " miss+    args <- getArgs+    -- check for invalid arguments and print help message if needed+    let goodopts = ["-f","-r","--from","--read","--strict","-N",+                   "-p","--preserve-tabs","--tab-stop","-R","--parse-raw",+                   "--toc","--table-of-contents",+                   "--number-sections","-H","--include-in-header",+                   "-B","--include-before-body","-A","--include-after-body",+                   "-C","--custom-header","-o","--output"]+    let goodoptsLong = filter (\op -> length op > 2) goodopts+    let isOpt ('-':_) = True+        isOpt _       = False+    unless (null (filter isOpt args \\ goodopts)) $ do+      (code, out, _err) <- readProcessWithExitCode "pandoc" ["--help"] ""+      putStrLn "markdown2pdf [OPTIONS] [FILES]\nOptions:"+      putStr $ unlines $+               filter (\l -> any (`isInfixOf` l) goodoptsLong) $ lines out+      exitWith code+    -- parse arguments+    -- if no input given, use 'stdin'+    pandocArgs <- parsePandocArgs args+    (input, output) <- case pandocArgs of+      Nothing      -> exit "Could not parse arguments"+      Just ([],out) -> do+        stdinFile <- saveStdin (replaceDirectory (takeBaseName out) tmp)+        case stdinFile of+          Left err  -> exit err+          Right f   -> return ([f], out)+      -- no need because we'll pass all arguments to pandoc+      Just (_ ,out) -> return ([], out)+    -- run pandoc+    pandocRes <- runPandoc (input ++ args) $ replaceDirectory output tmp+    case pandocRes of+      Left err -> exit err+      Right texFile  -> do+        -- run pdflatex+        latexRes <- runLatex texFile+        case latexRes of+          Left err      -> exit err+          Right pdfFile -> do+            -- save the output creating a backup if necessary+            saveOutput pdfFile $+              replaceDirectory pdfFile (takeDirectory output)+
src/pandoc.hs view
@@ -33,7 +33,9 @@ import Text.Pandoc import Text.Pandoc.ODT import Text.Pandoc.Shared ( HTMLMathMethod (..), tabFilter, ObfuscationMethod (..) )+#ifdef _HIGHLIGHTING import Text.Pandoc.Highlighting ( languages )+#endif import System.Environment ( getArgs, getProgName, getEnvironment ) import System.Exit ( exitWith, ExitCode (..) ) import System.FilePath@@ -59,18 +61,13 @@ compileInfo :: String compileInfo = #ifdef _CITEPROC-  " +citeproc" ++-#else-  " -citeproc" +++  "\nCompiled with citeproc support." ++ #endif #ifdef _HIGHLIGHTING-  " +highlighting" ++-#else-  " -highlighting" +++   "\nCompiled with syntax highlighting support for:\n" +++       wrapWords 78 languages ++ #endif-  if null languages-     then "\n"-     else "\nCompiled with syntax highlighting support for:\n" ++ wrapWords 78 languages+   ""  -- | Converts a list of strings into a single string with the items printed as -- comma separated words in lines with a maximum line length.@@ -131,6 +128,7 @@ -- | Data structure for command line options. data Opt = Opt     { optTabStop           :: Int     -- ^ Number of spaces per tab+    , optPreserveTabs      :: Bool    -- ^ Preserve tabs instead of converting to spaces     , optStandalone        :: Bool    -- ^ Include header, footer     , optReader            :: String  -- ^ Reader format     , optWriter            :: String  -- ^ Writer format@@ -166,6 +164,7 @@ defaultOpts :: Opt defaultOpts = Opt     { optTabStop           = 4+    , optPreserveTabs      = False     , optStandalone        = False     , optReader            = ""    -- null for default reader     , optWriter            = ""    -- null for default writer@@ -226,7 +225,7 @@      , Option "p" ["preserve-tabs"]                  (NoArg-                  (\opt -> return opt { optTabStop = 0 }))+                  (\opt -> return opt { optPreserveTabs = True }))                  "" -- "Preserve tabs instead of converting to spaces"      , Option "" ["tab-stop"]@@ -507,7 +506,8 @@   -- thread option data structure through all supplied option actions   opts <- foldl (>>=) (return defaultOpts') actions -  let Opt    { optTabStop           = tabStop+  let Opt    {  optTabStop           = tabStop+              , optPreserveTabs      = preserveTabs               , optStandalone        = standalone               , optReader            = readerName               , optWriter            = writerName@@ -567,7 +567,7 @@                  Just cols -> read cols                  Nothing   -> stateColumns defaultParserState -  let standalone' = (standalone && not strict) || isNonTextOutput writerName'+  let standalone' = standalone || isNonTextOutput writerName'  #ifdef _CITEPROC   refs <- if null biblioFile then return [] else readBiblioFile biblioFile biblioFormat@@ -584,7 +584,7 @@                               stateCitations       = map citeKey refs, #endif                               stateSmart           = smart || writerName' `elem`-                                                              ["latex", "context"],+                                                              ["latex", "context", "man"],                               stateColumns         = columns,                               stateStrict          = strict }   let csslink = if null css@@ -601,7 +601,6 @@                                       writerTitlePrefix      = titlePrefix,                                       writerTabStop          = tabStop,                                       writerTableOfContents  = toc &&-                                                               not strict &&                                                                writerName' /= "s5",                                       writerHTMLMathMethod   = mathMethod,                                       writerS5               = (writerName' == "s5"),@@ -633,7 +632,9 @@       readSource "-" = getContents       readSource src = readFile src -  doc <- fmap (reader startParserState . tabFilter tabStop . intercalate "\n") (readSources sources)+  let convertTabs = tabFilter (if preserveTabs then 0 else tabStop)++  doc <- fmap (reader startParserState . convertTabs . intercalate "\n") (readSources sources)    doc' <- do #ifdef _CITEPROC
tests/lhs-test.fragment.html+lhs view
@@ -1,49 +1,51 @@-<h1 id="lhs-test"->lhs test</h1-><p-><code-  >unsplit</code-  > is an arrow that takes a pair of values and combines them to return a single value:</p-><pre class="sourceCode literatehaskell"-><code-  ><span class="Char Special"-    >&gt;</span-    ><span class="Function FunctionDefinition"-    > unsplit ::</span-    ><span class="Normal NormalText"-    > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span-    ><br-     /><span class="Char Special"-    >&gt;</span-    ><span class="Normal NormalText"-    > unsplit = arr . </span-    ><span class="Function"-    >uncurry</span-    ><span class="Normal NormalText"-    >       </span-    ><br-     /><span class="Char Special"-    >&gt;</span-    ><span class="Normal NormalText"-    >           </span-    ><span class="Comment"-    >-- arr (\op (x,y) -&gt; x `op` y) </span-    ><br-     /></code-  ></pre-><p-><code-  >(***)</code-  > combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p-><pre-><code-  >f *** g = first f &gt;&gt;&gt; second g+<div id="lhs-test"+><h1+  >lhs test</h1+  ><p+  ><code+    >unsplit</code+    > is an arrow that takes a pair of values and combines them to return a single value:</p+  ><pre class="sourceCode literatehaskell"+  ><code+    ><span class="Char Special"+      >&gt;</span+      ><span class="Function FunctionDefinition"+      > unsplit ::</span+      ><span class="Normal NormalText"+      > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span+      ><br+       /><span class="Char Special"+      >&gt;</span+      ><span class="Normal NormalText"+      > unsplit = arr . </span+      ><span class="Function"+      >uncurry</span+      ><span class="Normal NormalText"+      >       </span+      ><br+       /><span class="Char Special"+      >&gt;</span+      ><span class="Normal NormalText"+      >           </span+      ><span class="Comment"+      >-- arr (\op (x,y) -&gt; x `op` y) </span+      ><br+       /></code+    ></pre+  ><p+  ><code+    >(***)</code+    > combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p+  ><pre+  ><code+    >f *** g = first f &gt;&gt;&gt; second g </code-  ></pre-><p->Block quote:</p-><blockquote-><p-  >foo bar</p-  ></blockquote+    ></pre+  ><p+  >Block quote:</p+  ><blockquote+  ><p+    >foo bar</p+    ></blockquote+  ></div >
tests/lhs-test.html view
@@ -29,48 +29,50 @@ </style     ></head   ><body-  ><h1 id="lhs-test"-    >lhs test</h1-    ><p-    ><code-      >unsplit</code-      > is an arrow that takes a pair of values and combines them to return a single value:</p-    ><pre class="sourceCode haskell"-    ><code-      ><span class="Function FunctionDefinition"-	>unsplit ::</span-	><span class="Normal NormalText"-	> (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span-	><br-	 /><span class="Normal NormalText"-	>unsplit = arr . </span-	><span class="Function"-	>uncurry</span-	><span class="Normal NormalText"-	>       </span-	><br-	 /><span class="Normal NormalText"-	>          </span-	><span class="Comment"-	>-- arr (\op (x,y) -&gt; x `op` y) </span-	><br-	 /></code-      ></pre-    ><p-    ><code-      >(***)</code-      > combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p-    ><pre-    ><code-      >f *** g = first f &gt;&gt;&gt; second g+  ><div id="lhs-test"+    ><h1+      >lhs test</h1+      ><p+      ><code+	>unsplit</code+	> is an arrow that takes a pair of values and combines them to return a single value:</p+      ><pre class="sourceCode haskell"+      ><code+	><span class="Function FunctionDefinition"+	  >unsplit ::</span+	  ><span class="Normal NormalText"+	  > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span+	  ><br+	   /><span class="Normal NormalText"+	  >unsplit = arr . </span+	  ><span class="Function"+	  >uncurry</span+	  ><span class="Normal NormalText"+	  >       </span+	  ><br+	   /><span class="Normal NormalText"+	  >          </span+	  ><span class="Comment"+	  >-- arr (\op (x,y) -&gt; x `op` y) </span+	  ><br+	   /></code+	></pre+      ><p+      ><code+	>(***)</code+	> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p+      ><pre+      ><code+	>f *** g = first f &gt;&gt;&gt; second g </code-      ></pre-    ><p-    >Block quote:</p-    ><blockquote-    ><p-      >foo bar</p-      ></blockquote+	></pre+      ><p+      >Block quote:</p+      ><blockquote+      ><p+	>foo bar</p+	></blockquote+      ></div     ></body   ></html >
tests/lhs-test.html+lhs view
@@ -29,54 +29,56 @@ </style     ></head   ><body-  ><h1 id="lhs-test"-    >lhs test</h1-    ><p-    ><code-      >unsplit</code-      > is an arrow that takes a pair of values and combines them to return a single value:</p-    ><pre class="sourceCode literatehaskell"-    ><code-      ><span class="Char Special"-	>&gt;</span-	><span class="Function FunctionDefinition"-	> unsplit ::</span-	><span class="Normal NormalText"-	> (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span-	><br-	 /><span class="Char Special"-	>&gt;</span-	><span class="Normal NormalText"-	> unsplit = arr . </span-	><span class="Function"-	>uncurry</span-	><span class="Normal NormalText"-	>       </span-	><br-	 /><span class="Char Special"-	>&gt;</span-	><span class="Normal NormalText"-	>           </span-	><span class="Comment"-	>-- arr (\op (x,y) -&gt; x `op` y) </span-	><br-	 /></code-      ></pre-    ><p-    ><code-      >(***)</code-      > combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p-    ><pre-    ><code-      >f *** g = first f &gt;&gt;&gt; second g+  ><div id="lhs-test"+    ><h1+      >lhs test</h1+      ><p+      ><code+	>unsplit</code+	> is an arrow that takes a pair of values and combines them to return a single value:</p+      ><pre class="sourceCode literatehaskell"+      ><code+	><span class="Char Special"+	  >&gt;</span+	  ><span class="Function FunctionDefinition"+	  > unsplit ::</span+	  ><span class="Normal NormalText"+	  > (Arrow a) =&gt; (b -&gt; c -&gt; d) -&gt; a (b, c) d</span+	  ><br+	   /><span class="Char Special"+	  >&gt;</span+	  ><span class="Normal NormalText"+	  > unsplit = arr . </span+	  ><span class="Function"+	  >uncurry</span+	  ><span class="Normal NormalText"+	  >       </span+	  ><br+	   /><span class="Char Special"+	  >&gt;</span+	  ><span class="Normal NormalText"+	  >           </span+	  ><span class="Comment"+	  >-- arr (\op (x,y) -&gt; x `op` y) </span+	  ><br+	   /></code+	></pre+      ><p+      ><code+	>(***)</code+	> combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).</p+      ><pre+      ><code+	>f *** g = first f &gt;&gt;&gt; second g </code-      ></pre-    ><p-    >Block quote:</p-    ><blockquote-    ><p-      >foo bar</p-      ></blockquote+	></pre+      ><p+      >Block quote:</p+      ><blockquote+      ><p+	>foo bar</p+	></blockquote+      ></div     ></body   ></html >
tests/rst-reader.native view
@@ -146,6 +146,10 @@     , OrderedList (1,DefaultStyle,DefaultDelim)       [ [ Plain [Str "Nested."] ]      ] ] ]+, Para [Str "Autonumbering",Space,Str "with",Space,Str "explicit",Space,Str "start",Str ":"]+, OrderedList (4,LowerAlpha,TwoParens)+  [ [ Plain [Str "item",Space,Str "1"] ]+  , [ Plain [Str "item",Space,Str "2"] ] ] , Header 2 [Str "Definition"] , DefinitionList   [  ([Str "term",Space,Str "1"],@@ -234,5 +238,8 @@ , Header 1 [Str "Comments"] , Para [Str "First",Space,Str "paragraph"] , Para [Str "Another",Space,Str "paragraph"]-, Para [Str "A",Space,Str "third",Space,Str "paragraph"] ]+, Para [Str "A",Space,Str "third",Space,Str "paragraph"]+, Header 1 [Str "Line",Space,Str "blocks"]+, Para [Str "But",Space,Str "can",Space,Str "a",Space,Str "bee",Space,Str "be",Space,Str "said",Space,Str "to",Space,Str "be",LineBreak,Str "    ",Str "or",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "an",Space,Str "entire",Space,Str "bee,",LineBreak,Str "        ",Str "when",Space,Str "half",Space,Str "the",Space,Str "bee",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "bee,",LineBreak,Str "            ",Str "due",Space,Str "to",Space,Str "some",Space,Str "ancient",Space,Str "injury?"]+, Para [Str "Continuation",Space,Str "line",LineBreak,Str "  ",Str "and",Space,Str "another"] ] 
tests/rst-reader.rst view
@@ -242,6 +242,11 @@          #. Nested. +Autonumbering with explicit start:++(d)  item 1+(#)  item 2+ Definition ---------- @@ -427,4 +432,17 @@     preceding level.  A third paragraph++Line blocks+===========++| But can a bee be said to be+|     or not to be an entire bee,+|         when half the bee is not a bee,+|             due to some ancient injury?++| Continuation+ line+|   and+       another 
tests/s5.basic.html view
@@ -276,24 +276,24 @@ <div id="currentSlide"></div> <div id="header"></div> <div id="footer">-<h1 id="july-15-2006"+<h1     >July 15, 2006</h1-    ><h2 id="my-s5-document"+    ><h2     >My S5 Document</h2     ></div> </div> <div class="presentation">  <div class="slide">-<h1 id="my-s5-document-1"+<h1     >My S5 Document</h1-    ><h3 id="sam-smith-jen-jones"+    ><h3     >Sam Smith, Jen Jones</h3-    ><h4 id="july-15-2006-1"+    ><h4     >July 15, 2006</h4     ></div> <div class="slide">-<h1 id="first-slide"+<h1     >First slide</h1     ><ul     ><li@@ -303,7 +303,7 @@       ></ul     ></div> <div class="slide">-<h1 id="math"+<h1     >Math</h1     ><ul     ><li
tests/s5.fancy.html view
@@ -484,24 +484,24 @@ <div id="currentSlide"></div> <div id="header"></div> <div id="footer">-<h1 id="july-15-2006"+<h1     >July 15, 2006</h1-    ><h2 id="my-s5-document"+    ><h2     >My S5 Document</h2     ></div> </div> <div class="presentation">  <div class="slide">-<h1 id="my-s5-document-1"+<h1     >My S5 Document</h1-    ><h3 id="sam-smith-jen-jones"+    ><h3     >Sam Smith, Jen Jones</h3-    ><h4 id="july-15-2006-1"+    ><h4     >July 15, 2006</h4     ></div> <div class="slide">-<h1 id="first-slide"+<h1     >First slide</h1     ><ul class="incremental"     ><li@@ -511,7 +511,7 @@       ></ul     ></div> <div class="slide">-<h1 id="math"+<h1     >Math</h1     ><ul class="incremental"     ><li
tests/s5.fragment.html view
@@ -1,41 +1,45 @@-<h1 id="first-slide"->First slide</h1-><ul-><li-  >first bullet</li+<div id="first-slide"+><h1+  >First slide</h1+  ><ul   ><li-  >second bullet</li-  ></ul-><h1 id="math"->Math</h1-><ul-><li-  ><span class="math"-    >\frac{<em-      >d</em-      >}{<em-      >dx</em-      >}<em-      >f</em-      >(<em-      >x</em-      >)=\lim<sub-      ><em-	>h</em-	>&#8201;&#8594;&#8201;0</sub+    >first bullet</li+    ><li+    >second bullet</li+    ></ul+  ></div+><div id="math"+><h1+  >Math</h1+  ><ul+  ><li+    ><span class="math"       >\frac{<em-      >f</em-      >(<em-      >x</em-      >+<em-      >h</em-      >)-<em-      >f</em-      >(<em-      >x</em-      >)}{<em-      >h</em-      >}</span-    ></li-  ></ul+	>d</em+	>}{<em+	>dx</em+	>}<em+	>f</em+	>(<em+	>x</em+	>)=\lim<sub+	><em+	  >h</em+	  >&#8201;&#8594;&#8201;0</sub+	>\frac{<em+	>f</em+	>(<em+	>x</em+	>+<em+	>h</em+	>)-<em+	>f</em+	>(<em+	>x</em+	>)}{<em+	>h</em+	>}</span+      ></li+    ></ul+  ></div >
tests/s5.inserts.html view
@@ -15,46 +15,50 @@   >STUFF INSERTED <h1 class="title"     >My S5 Document</h1-    ><h1 id="first-slide"-    >First slide</h1-    ><ul-    ><li-      >first bullet</li+    ><div id="first-slide"+    ><h1+      >First slide</h1+      ><ul       ><li-      >second bullet</li-      ></ul-    ><h1 id="math"-    >Math</h1-    ><ul-    ><li-      ><span class="math"-	>\frac{<em-	  >d</em-	  >}{<em-	  >dx</em-	  >}<em-	  >f</em-	  >(<em-	  >x</em-	  >)=\lim<sub-	  ><em-	    >h</em-	    >&#8201;&#8594;&#8201;0</sub+	>first bullet</li+	><li+	>second bullet</li+	></ul+      ></div+    ><div id="math"+    ><h1+      >Math</h1+      ><ul+      ><li+	><span class="math" 	  >\frac{<em-	  >f</em-	  >(<em-	  >x</em-	  >+<em-	  >h</em-	  >)-<em-	  >f</em-	  >(<em-	  >x</em-	  >)}{<em-	  >h</em-	  >}</span-	></li-      ></ul+	    >d</em+	    >}{<em+	    >dx</em+	    >}<em+	    >f</em+	    >(<em+	    >x</em+	    >)=\lim<sub+	    ><em+	      >h</em+	      >&#8201;&#8594;&#8201;0</sub+	    >\frac{<em+	    >f</em+	    >(<em+	    >x</em+	    >+<em+	    >h</em+	    >)-<em+	    >f</em+	    >(<em+	    >x</em+	    >)}{<em+	    >h</em+	    >}</span+	  ></li+	></ul+      ></div     >STUFF INSERTED </body   ></html
tests/tables.man view
@@ -1,7 +1,7 @@ .PP Simple table with caption: .PP-Demonstration of simple table syntax\.+Demonstration of simple table syntax. .TS tab(@); rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).@@ -90,7 +90,7 @@ .PP Simple table indented two spaces: .PP-Demonstration of simple table syntax\.+Demonstration of simple table syntax. .TS tab(@); rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).@@ -135,7 +135,7 @@ .PP Multiline table with caption: .PP-Here\[aq]s the caption\. It may span multiple lines\.+Here\[aq]s the caption. It may span multiple lines. .TS tab(@); cw(10.50n) lw(9.63n) rw(11.38n) lw(23.63n).@@ -154,18 +154,19 @@ T}@T{ row T}@T{-12\.0+12.0 T}@T{-Example of a row that spans multiple lines\.+Example of a row that spans multiple lines. T} T{ Second T}@T{ row T}@T{-5\.0+5.0 T}@T{-Here\[aq]s another one\. Note the blank line between rows\.+Here\[aq]s another one.+Note the blank line between rows. T} .TE .PP@@ -189,17 +190,18 @@ T}@T{ row T}@T{-12\.0+12.0 T}@T{-Example of a row that spans multiple lines\.+Example of a row that spans multiple lines. T} T{ Second T}@T{ row T}@T{-5\.0+5.0 T}@T{-Here\[aq]s another one\. Note the blank line between rows\.+Here\[aq]s another one.+Note the blank line between rows. T} .TE
tests/testsuite.native view
@@ -165,7 +165,7 @@       [ [ Plain [Str "Nested",Str "."] ]      ] ] ] , Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]-, Para [Str "M",Str ".",Str "A.\160",Str "2007"]+, Para [Str "M.A.\160",Str "2007"] , Para [Str "B",Str ".",Space,Str "Williams"] , HorizontalRule , Header 1 [Str "Definition",Space,Str "Lists"]
tests/writer.html view
@@ -15,1067 +15,1129 @@     ><p     >This is a set of tests for pandoc. Most of them are adapted from John Gruber&rsquo;s markdown test suite.</p     ><hr-     /><h1 id="headers"-    >Headers</h1-    ><h2 id="level-2-with-an-embedded-link"-    >Level 2 with an <a href="/url"-      >embedded link</a-      ></h2-    ><h3 id="level-3-with-emphasis"-    >Level 3 with <em-      >emphasis</em-      ></h3-    ><h4 id="level-4"-    >Level 4</h4-    ><h5 id="level-5"-    >Level 5</h5-    ><h1 id="level-1"-    >Level 1</h1-    ><h2 id="level-2-with-emphasis"-    >Level 2 with <em-      >emphasis</em-      ></h2-    ><h3 id="level-3"-    >Level 3</h3-    ><p-    >with no blank line</p-    ><h2 id="level-2"-    >Level 2</h2-    ><p-    >with no blank line</p-    ><hr-     /><h1 id="paragraphs"-    >Paragraphs</h1-    ><p-    >Here&rsquo;s a regular paragraph.</p-    ><p-    >In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p-    ><p-    >Here&rsquo;s one with a bullet. * criminey.</p-    ><p-    >There should be a hard line break<br-       />here.</p-    ><hr-     /><h1 id="block-quotes"-    >Block Quotes</h1-    ><p-    >E-mail style:</p-    ><blockquote-    ><p-      >This is a block quote. It is pretty short.</p-      ></blockquote-    ><blockquote-    ><p-      >Code in a block quote:</p-      ><pre-      ><code-	>sub status {-    print &quot;working&quot;;-}-</code-	></pre-      ><p-      >A list:</p-      ><ol style="list-style-type: decimal;"-      ><li-	>item one</li-	><li-	>item two</li-	></ol-      ><p-      >Nested block quotes:</p-      ><blockquote-      ><p-	>nested</p-	></blockquote-      ><blockquote-      ><p-	>nested</p-	></blockquote-      ></blockquote-    ><p-    >This should not be a block quote: 2 &gt; 1.</p-    ><p-    >And a following paragraph.</p-    ><hr-     /><h1 id="code-blocks"-    >Code Blocks</h1-    ><p-    >Code:</p-    ><pre-    ><code-      >---- (should be four hyphens)--sub status {-    print &quot;working&quot;;-}--this code block is indented by one tab-</code-      ></pre-    ><p-    >And:</p-    ><pre-    ><code-      >    this code block is indented by two tabs--These should not be escaped:  \$ \\ \&gt; \[ \{-</code-      ></pre-    ><hr-     /><h1 id="lists"-    >Lists</h1-    ><h2 id="unordered"-    >Unordered</h2-    ><p-    >Asterisks tight:</p-    ><ul-    ><li-      >asterisk 1</li-      ><li-      >asterisk 2</li-      ><li-      >asterisk 3</li-      ></ul-    ><p-    >Asterisks loose:</p-    ><ul-    ><li-      ><p-	>asterisk 1</p-	></li-      ><li-      ><p-	>asterisk 2</p-	></li-      ><li-      ><p-	>asterisk 3</p-	></li-      ></ul-    ><p-    >Pluses tight:</p-    ><ul-    ><li-      >Plus 1</li-      ><li-      >Plus 2</li-      ><li-      >Plus 3</li-      ></ul-    ><p-    >Pluses loose:</p-    ><ul-    ><li-      ><p-	>Plus 1</p-	></li-      ><li-      ><p-	>Plus 2</p-	></li-      ><li-      ><p-	>Plus 3</p-	></li-      ></ul-    ><p-    >Minuses tight:</p-    ><ul-    ><li-      >Minus 1</li-      ><li-      >Minus 2</li-      ><li-      >Minus 3</li-      ></ul-    ><p-    >Minuses loose:</p-    ><ul-    ><li-      ><p-	>Minus 1</p-	></li-      ><li-      ><p-	>Minus 2</p-	></li-      ><li-      ><p-	>Minus 3</p-	></li-      ></ul-    ><h2 id="ordered"-    >Ordered</h2-    ><p-    >Tight:</p-    ><ol style="list-style-type: decimal;"-    ><li-      >First</li-      ><li-      >Second</li-      ><li-      >Third</li-      ></ol-    ><p-    >and:</p-    ><ol style="list-style-type: decimal;"-    ><li-      >One</li-      ><li-      >Two</li-      ><li-      >Three</li-      ></ol-    ><p-    >Loose using tabs:</p-    ><ol style="list-style-type: decimal;"-    ><li-      ><p-	>First</p-	></li-      ><li-      ><p-	>Second</p-	></li-      ><li-      ><p-	>Third</p-	></li-      ></ol-    ><p-    >and using spaces:</p-    ><ol style="list-style-type: decimal;"-    ><li-      ><p-	>One</p-	></li-      ><li-      ><p-	>Two</p-	></li-      ><li-      ><p-	>Three</p-	></li-      ></ol-    ><p-    >Multiple paragraphs:</p-    ><ol style="list-style-type: decimal;"-    ><li-      ><p-	>Item 1, graf one.</p-	><p-	>Item 1. graf two. The quick brown fox jumped over the lazy dog&rsquo;s back.</p-	></li-      ><li-      ><p-	>Item 2.</p-	></li-      ><li-      ><p-	>Item 3.</p-	></li-      ></ol-    ><h2 id="nested"-    >Nested</h2-    ><ul-    ><li-      >Tab<ul-	><li-	  >Tab<ul-	    ><li-	      >Tab</li-	      ></ul-	    ></li-	  ></ul-	></li-      ></ul-    ><p-    >Here&rsquo;s another:</p-    ><ol style="list-style-type: decimal;"-    ><li-      >First</li-      ><li-      >Second:<ul-	><li-	  >Fee</li-	  ><li-	  >Fie</li-	  ><li-	  >Foe</li-	  ></ul-	></li-      ><li-      >Third</li-      ></ol-    ><p-    >Same thing but with paragraphs:</p-    ><ol style="list-style-type: decimal;"-    ><li-      ><p-	>First</p-	></li-      ><li-      ><p-	>Second:</p-	><ul-	><li-	  >Fee</li-	  ><li-	  >Fie</li-	  ><li-	  >Foe</li-	  ></ul-	></li-      ><li-      ><p-	>Third</p-	></li-      ></ol-    ><h2 id="tabs-and-spaces"-    >Tabs and spaces</h2-    ><ul-    ><li-      ><p-	>this is a list item indented with tabs</p-	></li-      ><li-      ><p-	>this is a list item indented with spaces</p-	><ul-	><li-	  ><p-	    >this is an example list item indented with tabs</p-	    ></li-	  ><li-	  ><p-	    >this is an example list item indented with spaces</p-	    ></li-	  ></ul-	></li-      ></ul-    ><h2 id="fancy-list-markers"-    >Fancy list markers</h2-    ><ol start="2" style="list-style-type: decimal;"-    ><li-      >begins with 2</li-      ><li-      ><p-	>and now 3</p-	><p-	>with a continuation</p-	><ol start="4" style="list-style-type: lower-roman;"-	><li-	  >sublist with roman numerals, starting with 4</li-	  ><li-	  >more items<ol style="list-style-type: upper-alpha;"-	    ><li-	      >a subsublist</li-	      ><li-	      >a subsublist</li-	      ></ol-	    ></li-	  ></ol-	></li-      ></ol-    ><p-    >Nesting:</p-    ><ol style="list-style-type: upper-alpha;"-    ><li-      >Upper Alpha<ol style="list-style-type: upper-roman;"-	><li-	  >Upper Roman.<ol start="6" style="list-style-type: decimal;"-	    ><li-	      >Decimal start with 6<ol start="3" style="list-style-type: lower-alpha;"-		><li-		  >Lower alpha with paren</li-		  ></ol-		></li-	      ></ol-	    ></li-	  ></ol-	></li-      ></ol-    ><p-    >Autonumbering:</p-    ><ol-    ><li-      >Autonumber.</li-      ><li-      >More.<ol-	><li-	  >Nested.</li-	  ></ol-	></li-      ></ol-    ><p-    >Should not be a list item:</p-    ><p-    >M.A.&nbsp;2007</p-    ><p-    >B. Williams</p-    ><hr-     /><h1 id="definition-lists"-    >Definition Lists</h1-    ><p-    >Tight using spaces:</p-    ><dl-    ><dt-      >apple</dt-      ><dd-      >red fruit</dd-      ><dt-      >orange</dt-      ><dd-      >orange fruit</dd-      ><dt-      >banana</dt-      ><dd-      >yellow fruit</dd-      ></dl-    ><p-    >Tight using tabs:</p-    ><dl-    ><dt-      >apple</dt-      ><dd-      >red fruit</dd-      ><dt-      >orange</dt-      ><dd-      >orange fruit</dd-      ><dt-      >banana</dt-      ><dd-      >yellow fruit</dd-      ></dl-    ><p-    >Loose:</p-    ><dl-    ><dt-      >apple</dt-      ><dd-      ><p-	>red fruit</p-	></dd-      ><dt-      >orange</dt-      ><dd-      ><p-	>orange fruit</p-	></dd-      ><dt-      >banana</dt-      ><dd-      ><p-	>yellow fruit</p-	></dd-      ></dl-    ><p-    >Multiple blocks with italics:</p-    ><dl-    ><dt-      ><em-	>apple</em-	></dt-      ><dd-      ><p-	>red fruit</p-	><p-	>contains seeds, crisp, pleasant to taste</p-	></dd-      ><dt-      ><em-	>orange</em-	></dt-      ><dd-      ><p-	>orange fruit</p-	><pre-	><code-	  >{ orange code block }-</code-	  ></pre-	><blockquote-	><p-	  >orange block quote</p-	  ></blockquote-	></dd-      ></dl-    ><h1 id="html-blocks"-    >HTML Blocks</h1-    ><p-    >Simple block on one line:</p-    ><div>foo</div>-<p-    >And nested without indentation:</p-    ><div>-<div>-<div>foo</div>-</div>-<div>bar</div>-</div>-<p-    >Interpreted markdown in a table:</p-    ><table>-<tr>-<td>This is <em-    >emphasized</em-    ></td>-<td>And this is <strong-    >strong</strong-    ></td>-</tr>-</table>--<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>-<p-    >Here&rsquo;s a simple block:</p-    ><div>-    foo</div>-<p-    >This should be a code block, though:</p-    ><pre-    ><code-      >&lt;div&gt;-    foo-&lt;/div&gt;-</code-      ></pre-    ><p-    >As should this:</p-    ><pre-    ><code-      >&lt;div&gt;foo&lt;/div&gt;-</code-      ></pre-    ><p-    >Now, nested:</p-    ><div>-    <div>-        <div>-            foo</div>-    </div>-</div>-<p-    >This should just be an HTML comment:</p-    ><!-- Comment -->-<p-    >Multiline:</p-    ><!---Blah-Blah--->--<!---    This is another comment.--->-<p-    >Code block:</p-    ><pre-    ><code-      >&lt;!-- Comment --&gt;-</code-      ></pre-    ><p-    >Just plain comment, with trailing spaces on the line:</p-    ><!-- foo -->   -<p-    >Code:</p-    ><pre-    ><code-      >&lt;hr /&gt;-</code-      ></pre-    ><p-    >Hr&rsquo;s:</p-    ><hr>--<hr />--<hr />--<hr>   --<hr />  --<hr /> --<hr class="foo" id="bar" />--<hr class="foo" id="bar" />--<hr class="foo" id="bar">-<hr-     /><h1 id="inline-markup"-    >Inline Markup</h1-    ><p-    >This is <em-      >emphasized</em-      >, and so <em-      >is this</em-      >.</p-    ><p-    >This is <strong-      >strong</strong-      >, and so <strong-      >is this</strong-      >.</p-    ><p-    >An <em-      ><a href="/url"-	>emphasized link</a-	></em-      >.</p-    ><p-    ><strong-      ><em-	>This is strong and em.</em-	></strong-      ></p-    ><p-    >So is <strong-      ><em-	>this</em-	></strong-      > word.</p-    ><p-    ><strong-      ><em-	>This is strong and em.</em-	></strong-      ></p-    ><p-    >So is <strong-      ><em-	>this</em-	></strong-      > word.</p-    ><p-    >This is code: <code-      >&gt;</code-      >, <code-      >$</code-      >, <code-      >\</code-      >, <code-      >\$</code-      >, <code-      >&lt;html&gt;</code-      >.</p-    ><p-    ><span style="text-decoration: line-through;"-      >This is <em-	>strikeout</em-	>.</span-      ></p-    ><p-    >Superscripts: a<sup-      >bc</sup-      >d a<sup-      ><em-	>hello</em-	></sup-      > a<sup-      >hello&nbsp;there</sup-      >.</p-    ><p-    >Subscripts: H<sub-      >2</sub-      >O, H<sub-      >23</sub-      >O, H<sub-      >many&nbsp;of&nbsp;them</sub-      >O.</p-    ><p-    >These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</p-    ><hr-     /><h1 id="smart-quotes-ellipses-dashes"-    >Smart quotes, ellipses, dashes</h1-    ><p-    >&ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;</p-    ><p-    >&lsquo;A&rsquo;, &lsquo;B&rsquo;, and &lsquo;C&rsquo; are letters.</p-    ><p-    >&lsquo;Oak,&rsquo; &lsquo;elm,&rsquo; and &lsquo;beech&rsquo; are names of trees. So is &lsquo;pine.&rsquo;</p-    ><p-    >&lsquo;He said, &ldquo;I want to go.&rdquo;&rsquo; Were you alive in the 70&rsquo;s?</p-    ><p-    >Here is some quoted &lsquo;<code-      >code</code-      >&rsquo; and a &ldquo;<a href="http://example.com/?foo=1&amp;bar=2"-      >quoted link</a-      >&rdquo;.</p-    ><p-    >Some dashes: one&mdash;two &mdash; three&mdash;four &mdash; five.</p-    ><p-    >Dashes between numbers: 5&ndash;7, 255&ndash;66, 1987&ndash;1999.</p-    ><p-    >Ellipses&hellip;and&hellip;and&hellip;.</p-    ><hr-     /><h1 id="latex"-    >LaTeX</h1-    ><ul-    ><li-      ></li-      ><li-      ><span class="math"-	>2+2=4</span-	></li-      ><li-      ><span class="math"-	><em-	  >x</em-	  >&#8201;&#8712;&#8201;<em-	  >y</em-	  ></span-	></li-      ><li-      ><span class="math"-	>&#945;&#8201;&#8743;&#8201;&#969;</span-	></li-      ><li-      ><span class="math"-	>223</span-	></li-      ><li-      ><span class="math"-	><em-	  >p</em-	  ></span-	>-Tree</li-      ><li-      >Here&rsquo;s some display math: <span class="math"-	>\frac{<em-	  >d</em-	  >}{<em-	  >dx</em-	  >}<em-	  >f</em-	  >(<em-	  >x</em-	  >)=\lim<sub-	  ><em-	    >h</em-	    >&#8201;&#8594;&#8201;0</sub-	  >\frac{<em-	  >f</em-	  >(<em-	  >x</em-	  >+<em-	  >h</em-	  >)-<em-	  >f</em-	  >(<em-	  >x</em-	  >)}{<em-	  >h</em-	  >}</span-	></li-      ><li-      >Here&rsquo;s one that has a line break in it: <span class="math"-	>&#945;+&#969;&#8201;×&#8201;<em-	  >x</em-	  ><sup-	  >2</sup-	  ></span-	>.</li-      ></ul-    ><p-    >These shouldn&rsquo;t be math:</p-    ><ul-    ><li-      >To get the famous equation, write <code-	>$e = mc^2$</code-	>.</li-      ><li-      >$22,000 is a <em-	>lot</em-	> of money. So is $34,000. (It worked if &ldquo;lot&rdquo; is emphasized.)</li-      ><li-      >Shoes ($20) and socks ($5).</li-      ><li-      >Escaped <code-	>$</code-	>: $73 <em-	>this should be emphasized</em-	> 23$.</li-      ></ul-    ><p-    >Here&rsquo;s a LaTeX table:</p-    ><p-    ></p-    ><hr-     /><h1 id="special-characters"-    >Special Characters</h1-    ><p-    >Here is some unicode:</p-    ><ul-    ><li-      >I hat: Î</li-      ><li-      >o umlaut: ö</li-      ><li-      >section: §</li-      ><li-      >set membership: &#8712;</li-      ><li-      >copyright: ©</li-      ></ul-    ><p-    >AT&amp;T has an ampersand in their name.</p-    ><p-    >AT&amp;T is another way to write it.</p-    ><p-    >This &amp; that.</p-    ><p-    >4 &lt; 5.</p-    ><p-    >6 &gt; 5.</p-    ><p-    >Backslash: \</p-    ><p-    >Backtick: `</p-    ><p-    >Asterisk: *</p-    ><p-    >Underscore: _</p-    ><p-    >Left brace: {</p-    ><p-    >Right brace: }</p-    ><p-    >Left bracket: [</p-    ><p-    >Right bracket: ]</p-    ><p-    >Left paren: (</p-    ><p-    >Right paren: )</p-    ><p-    >Greater-than: &gt;</p-    ><p-    >Hash: #</p-    ><p-    >Period: .</p-    ><p-    >Bang: !</p-    ><p-    >Plus: +</p-    ><p-    >Minus: -</p-    ><hr-     /><h1 id="links"-    >Links</h1-    ><h2 id="explicit"-    >Explicit</h2-    ><p-    >Just a <a href="/url/"-      >URL</a-      >.</p-    ><p-    ><a href="/url/" title="title"-      >URL and title</a-      >.</p-    ><p-    ><a href="/url/" title="title preceded by two spaces"-      >URL and title</a-      >.</p-    ><p-    ><a href="/url/" title="title preceded by a tab"-      >URL and title</a-      >.</p-    ><p-    ><a href="/url/" title="title with &quot;quotes&quot; in it"-      >URL and title</a-      ></p-    ><p-    ><a href="/url/" title="title with single quotes"-      >URL and title</a-      ></p-    ><p-    ><a href="/url/with_underscore"-      >with_underscore</a-      ></p-    ><p-    ><script type="text/javascript"-      >-<!---h='&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#46;&#110;&#x65;&#116;';a='&#64;';n='&#110;&#x6f;&#98;&#x6f;&#100;&#x79;';e=n+a+h;-document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'Email link'+'<\/'+'a'+'>');-// -->-</script-      ><noscript-      >&#x45;&#x6d;&#x61;&#x69;&#108;&#32;&#108;&#x69;&#110;&#x6b;&#32;&#40;&#110;&#x6f;&#98;&#x6f;&#100;&#x79;&#32;&#x61;&#116;&#32;&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#32;&#100;&#x6f;&#116;&#32;&#110;&#x65;&#116;&#x29;</noscript-      ></p-    ><p-    ><a href=""-      >Empty</a-      >.</p-    ><h2 id="reference"-    >Reference</h2-    ><p-    >Foo <a href="/url/"-      >bar</a-      >.</p-    ><p-    >Foo <a href="/url/"-      >bar</a-      >.</p-    ><p-    >Foo <a href="/url/"-      >bar</a-      >.</p-    ><p-    >With <a href="/url/"-      >embedded [brackets]</a-      >.</p-    ><p-    ><a href="/url/"-      >b</a-      > by itself should be a link.</p-    ><p-    >Indented <a href="/url"-      >once</a-      >.</p-    ><p-    >Indented <a href="/url"-      >twice</a-      >.</p-    ><p-    >Indented <a href="/url"-      >thrice</a-      >.</p-    ><p-    >This should [not][] be a link.</p-    ><pre-    ><code-      >[not]: /url-</code-      ></pre-    ><p-    >Foo <a href="/url/" title="Title with &quot;quotes&quot; inside"-      >bar</a-      >.</p-    ><p-    >Foo <a href="/url/" title="Title with &quot;quote&quot; inside"-      >biz</a-      >.</p-    ><h2 id="with-ampersands"-    >With ampersands</h2-    ><p-    >Here&rsquo;s a <a href="http://example.com/?foo=1&amp;bar=2"-      >link with an ampersand in the URL</a-      >.</p-    ><p-    >Here&rsquo;s a link with an amersand in the link text: <a href="http://att.com/" title="AT&amp;T"-      >AT&amp;T</a-      >.</p-    ><p-    >Here&rsquo;s an <a href="/script?foo=1&amp;bar=2"-      >inline link</a-      >.</p-    ><p-    >Here&rsquo;s an <a href="/script?foo=1&amp;bar=2"-      >inline link in pointy braces</a-      >.</p-    ><h2 id="autolinks"-    >Autolinks</h2-    ><p-    >With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2"-      ><code-	>http://example.com/?foo=1&amp;bar=2</code-	></a-      ></p-    ><ul-    ><li-      >In a list?</li-      ><li-      ><a href="http://example.com/"-	><code-	  >http://example.com/</code-	  ></a-	></li-      ><li-      >It should.</li-      ></ul-    ><p-    >An e-mail address: <script type="text/javascript"-      >-<!---h='&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#46;&#110;&#x65;&#116;';a='&#64;';n='&#110;&#x6f;&#98;&#x6f;&#100;&#x79;';e=n+a+h;-document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+'a'+'>');-// -->-</script-      ><noscript-      >&#110;&#x6f;&#98;&#x6f;&#100;&#x79;&#32;&#x61;&#116;&#32;&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#32;&#100;&#x6f;&#116;&#32;&#110;&#x65;&#116;</noscript-      ></p-    ><blockquote-    ><p-      >Blockquoted: <a href="http://example.com/"-	><code-	  >http://example.com/</code-	  ></a-	></p-      ></blockquote-    ><p-    >Auto-links should not occur here: <code-      >&lt;http://example.com/&gt;</code-      ></p-    ><pre-    ><code-      >or here: &lt;http://example.com/&gt;-</code-      ></pre-    ><hr-     /><h1 id="images"-    >Images</h1-    ><p-    >From &ldquo;Voyage dans la Lune&rdquo; by Georges Melies (1902):</p-    ><p-    ><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"-       /></p-    ><p-    >Here is a movie <img src="movie.jpg" alt="movie"-       /> icon.</p-    ><hr-     /><h1 id="footnotes"-    >Footnotes</h1-    ><p-    >Here is a footnote reference,<a href="#fn1" class="footnoteRef" id="fnref1"-      ><sup-	>1</sup-	></a-      > and another.<a href="#fn2" class="footnoteRef" id="fnref2"-      ><sup-	>2</sup-	></a-      > This should <em-      >not</em-      > be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a href="#fn3" class="footnoteRef" id="fnref3"-      ><sup-	>3</sup-	></a-      ></p-    ><blockquote-    ><p-      >Notes can go in quotes.<a href="#fn4" class="footnoteRef" id="fnref4"-	><sup-	  >4</sup-	  ></a-	></p-      ></blockquote-    ><ol style="list-style-type: decimal;"-    ><li-      >And in list items.<a href="#fn5" class="footnoteRef" id="fnref5"-	><sup-	  >5</sup-	  ></a-	></li-      ></ol-    ><p-    >This paragraph should not be part of the note, as it is not indented.</p+     /><div id="headers"+    ><h1+      >Headers</h1+      ><div id="level-2-with-an-embedded-link"+      ><h2+	>Level 2 with an <a href="/url"+	  >embedded link</a+	  ></h2+	><div id="level-3-with-emphasis"+	><h3+	  >Level 3 with <em+	    >emphasis</em+	    ></h3+	  ><div id="level-4"+	  ><h4+	    >Level 4</h4+	    ><div id="level-5"+	    ><h5+	      >Level 5</h5+	      ></div+	    ></div+	  ></div+	></div+      ></div+    ><div id="level-1"+    ><h1+      >Level 1</h1+      ><div id="level-2-with-emphasis"+      ><h2+	>Level 2 with <em+	  >emphasis</em+	  ></h2+	><div id="level-3"+	><h3+	  >Level 3</h3+	  ><p+	  >with no blank line</p+	  ></div+	></div+      ><div id="level-2"+      ><h2+	>Level 2</h2+	><p+	>with no blank line</p+	><hr+	 /></div+      ></div+    ><div id="paragraphs"+    ><h1+      >Paragraphs</h1+      ><p+      >Here&rsquo;s a regular paragraph.</p+      ><p+      >In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p+      ><p+      >Here&rsquo;s one with a bullet. * criminey.</p+      ><p+      >There should be a hard line break<br+	 />here.</p+      ><hr+       /></div+    ><div id="block-quotes"+    ><h1+      >Block Quotes</h1+      ><p+      >E-mail style:</p+      ><blockquote+      ><p+	>This is a block quote. It is pretty short.</p+	></blockquote+      ><blockquote+      ><p+	>Code in a block quote:</p+	><pre+	><code+	  >sub status {+    print &quot;working&quot;;+}+</code+	  ></pre+	><p+	>A list:</p+	><ol style="list-style-type: decimal;"+	><li+	  >item one</li+	  ><li+	  >item two</li+	  ></ol+	><p+	>Nested block quotes:</p+	><blockquote+	><p+	  >nested</p+	  ></blockquote+	><blockquote+	><p+	  >nested</p+	  ></blockquote+	></blockquote+      ><p+      >This should not be a block quote: 2 &gt; 1.</p+      ><p+      >And a following paragraph.</p+      ><hr+       /></div+    ><div id="code-blocks"+    ><h1+      >Code Blocks</h1+      ><p+      >Code:</p+      ><pre+      ><code+	>---- (should be four hyphens)++sub status {+    print &quot;working&quot;;+}++this code block is indented by one tab+</code+	></pre+      ><p+      >And:</p+      ><pre+      ><code+	>    this code block is indented by two tabs++These should not be escaped:  \$ \\ \&gt; \[ \{+</code+	></pre+      ><hr+       /></div+    ><div id="lists"+    ><h1+      >Lists</h1+      ><div id="unordered"+      ><h2+	>Unordered</h2+	><p+	>Asterisks tight:</p+	><ul+	><li+	  >asterisk 1</li+	  ><li+	  >asterisk 2</li+	  ><li+	  >asterisk 3</li+	  ></ul+	><p+	>Asterisks loose:</p+	><ul+	><li+	  ><p+	    >asterisk 1</p+	    ></li+	  ><li+	  ><p+	    >asterisk 2</p+	    ></li+	  ><li+	  ><p+	    >asterisk 3</p+	    ></li+	  ></ul+	><p+	>Pluses tight:</p+	><ul+	><li+	  >Plus 1</li+	  ><li+	  >Plus 2</li+	  ><li+	  >Plus 3</li+	  ></ul+	><p+	>Pluses loose:</p+	><ul+	><li+	  ><p+	    >Plus 1</p+	    ></li+	  ><li+	  ><p+	    >Plus 2</p+	    ></li+	  ><li+	  ><p+	    >Plus 3</p+	    ></li+	  ></ul+	><p+	>Minuses tight:</p+	><ul+	><li+	  >Minus 1</li+	  ><li+	  >Minus 2</li+	  ><li+	  >Minus 3</li+	  ></ul+	><p+	>Minuses loose:</p+	><ul+	><li+	  ><p+	    >Minus 1</p+	    ></li+	  ><li+	  ><p+	    >Minus 2</p+	    ></li+	  ><li+	  ><p+	    >Minus 3</p+	    ></li+	  ></ul+	></div+      ><div id="ordered"+      ><h2+	>Ordered</h2+	><p+	>Tight:</p+	><ol style="list-style-type: decimal;"+	><li+	  >First</li+	  ><li+	  >Second</li+	  ><li+	  >Third</li+	  ></ol+	><p+	>and:</p+	><ol style="list-style-type: decimal;"+	><li+	  >One</li+	  ><li+	  >Two</li+	  ><li+	  >Three</li+	  ></ol+	><p+	>Loose using tabs:</p+	><ol style="list-style-type: decimal;"+	><li+	  ><p+	    >First</p+	    ></li+	  ><li+	  ><p+	    >Second</p+	    ></li+	  ><li+	  ><p+	    >Third</p+	    ></li+	  ></ol+	><p+	>and using spaces:</p+	><ol style="list-style-type: decimal;"+	><li+	  ><p+	    >One</p+	    ></li+	  ><li+	  ><p+	    >Two</p+	    ></li+	  ><li+	  ><p+	    >Three</p+	    ></li+	  ></ol+	><p+	>Multiple paragraphs:</p+	><ol style="list-style-type: decimal;"+	><li+	  ><p+	    >Item 1, graf one.</p+	    ><p+	    >Item 1. graf two. The quick brown fox jumped over the lazy dog&rsquo;s back.</p+	    ></li+	  ><li+	  ><p+	    >Item 2.</p+	    ></li+	  ><li+	  ><p+	    >Item 3.</p+	    ></li+	  ></ol+	></div+      ><div id="nested"+      ><h2+	>Nested</h2+	><ul+	><li+	  >Tab<ul+	    ><li+	      >Tab<ul+		><li+		  >Tab</li+		  ></ul+		></li+	      ></ul+	    ></li+	  ></ul+	><p+	>Here&rsquo;s another:</p+	><ol style="list-style-type: decimal;"+	><li+	  >First</li+	  ><li+	  >Second:<ul+	    ><li+	      >Fee</li+	      ><li+	      >Fie</li+	      ><li+	      >Foe</li+	      ></ul+	    ></li+	  ><li+	  >Third</li+	  ></ol+	><p+	>Same thing but with paragraphs:</p+	><ol style="list-style-type: decimal;"+	><li+	  ><p+	    >First</p+	    ></li+	  ><li+	  ><p+	    >Second:</p+	    ><ul+	    ><li+	      >Fee</li+	      ><li+	      >Fie</li+	      ><li+	      >Foe</li+	      ></ul+	    ></li+	  ><li+	  ><p+	    >Third</p+	    ></li+	  ></ol+	></div+      ><div id="tabs-and-spaces"+      ><h2+	>Tabs and spaces</h2+	><ul+	><li+	  ><p+	    >this is a list item indented with tabs</p+	    ></li+	  ><li+	  ><p+	    >this is a list item indented with spaces</p+	    ><ul+	    ><li+	      ><p+		>this is an example list item indented with tabs</p+		></li+	      ><li+	      ><p+		>this is an example list item indented with spaces</p+		></li+	      ></ul+	    ></li+	  ></ul+	></div+      ><div id="fancy-list-markers"+      ><h2+	>Fancy list markers</h2+	><ol start="2" style="list-style-type: decimal;"+	><li+	  >begins with 2</li+	  ><li+	  ><p+	    >and now 3</p+	    ><p+	    >with a continuation</p+	    ><ol start="4" style="list-style-type: lower-roman;"+	    ><li+	      >sublist with roman numerals, starting with 4</li+	      ><li+	      >more items<ol style="list-style-type: upper-alpha;"+		><li+		  >a subsublist</li+		  ><li+		  >a subsublist</li+		  ></ol+		></li+	      ></ol+	    ></li+	  ></ol+	><p+	>Nesting:</p+	><ol style="list-style-type: upper-alpha;"+	><li+	  >Upper Alpha<ol style="list-style-type: upper-roman;"+	    ><li+	      >Upper Roman.<ol start="6" style="list-style-type: decimal;"+		><li+		  >Decimal start with 6<ol start="3" style="list-style-type: lower-alpha;"+		    ><li+		      >Lower alpha with paren</li+		      ></ol+		    ></li+		  ></ol+		></li+	      ></ol+	    ></li+	  ></ol+	><p+	>Autonumbering:</p+	><ol+	><li+	  >Autonumber.</li+	  ><li+	  >More.<ol+	    ><li+	      >Nested.</li+	      ></ol+	    ></li+	  ></ol+	><p+	>Should not be a list item:</p+	><p+	>M.A.&nbsp;2007</p+	><p+	>B. Williams</p+	><hr+	 /></div+      ></div+    ><div id="definition-lists"+    ><h1+      >Definition Lists</h1+      ><p+      >Tight using spaces:</p+      ><dl+      ><dt+	>apple</dt+	><dd+	>red fruit</dd+	><dt+	>orange</dt+	><dd+	>orange fruit</dd+	><dt+	>banana</dt+	><dd+	>yellow fruit</dd+	></dl+      ><p+      >Tight using tabs:</p+      ><dl+      ><dt+	>apple</dt+	><dd+	>red fruit</dd+	><dt+	>orange</dt+	><dd+	>orange fruit</dd+	><dt+	>banana</dt+	><dd+	>yellow fruit</dd+	></dl+      ><p+      >Loose:</p+      ><dl+      ><dt+	>apple</dt+	><dd+	><p+	  >red fruit</p+	  ></dd+	><dt+	>orange</dt+	><dd+	><p+	  >orange fruit</p+	  ></dd+	><dt+	>banana</dt+	><dd+	><p+	  >yellow fruit</p+	  ></dd+	></dl+      ><p+      >Multiple blocks with italics:</p+      ><dl+      ><dt+	><em+	  >apple</em+	  ></dt+	><dd+	><p+	  >red fruit</p+	  ><p+	  >contains seeds, crisp, pleasant to taste</p+	  ></dd+	><dt+	><em+	  >orange</em+	  ></dt+	><dd+	><p+	  >orange fruit</p+	  ><pre+	  ><code+	    >{ orange code block }+</code+	    ></pre+	  ><blockquote+	  ><p+	    >orange block quote</p+	    ></blockquote+	  ></dd+	></dl+      ></div+    ><div id="html-blocks"+    ><h1+      >HTML Blocks</h1+      ><p+      >Simple block on one line:</p+      ><div>foo</div>+<p+      >And nested without indentation:</p+      ><div>+<div>+<div>foo</div>+</div>+<div>bar</div>+</div>+<p+      >Interpreted markdown in a table:</p+      ><table>+<tr>+<td>This is <em+      >emphasized</em+      ></td>+<td>And this is <strong+      >strong</strong+      ></td>+</tr>+</table>++<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>+<p+      >Here&rsquo;s a simple block:</p+      ><div>+    foo</div>+<p+      >This should be a code block, though:</p+      ><pre+      ><code+	>&lt;div&gt;+    foo+&lt;/div&gt;+</code+	></pre+      ><p+      >As should this:</p+      ><pre+      ><code+	>&lt;div&gt;foo&lt;/div&gt;+</code+	></pre+      ><p+      >Now, nested:</p+      ><div>+    <div>+        <div>+            foo</div>+    </div>+</div>+<p+      >This should just be an HTML comment:</p+      ><!-- Comment -->+<p+      >Multiline:</p+      ><!--+Blah+Blah+-->++<!--+    This is another comment.+-->+<p+      >Code block:</p+      ><pre+      ><code+	>&lt;!-- Comment --&gt;+</code+	></pre+      ><p+      >Just plain comment, with trailing spaces on the line:</p+      ><!-- foo -->   +<p+      >Code:</p+      ><pre+      ><code+	>&lt;hr /&gt;+</code+	></pre+      ><p+      >Hr&rsquo;s:</p+      ><hr>++<hr />++<hr />++<hr>   ++<hr />  ++<hr /> ++<hr class="foo" id="bar" />++<hr class="foo" id="bar" />++<hr class="foo" id="bar">+<hr+       /></div+    ><div id="inline-markup"+    ><h1+      >Inline Markup</h1+      ><p+      >This is <em+	>emphasized</em+	>, and so <em+	>is this</em+	>.</p+      ><p+      >This is <strong+	>strong</strong+	>, and so <strong+	>is this</strong+	>.</p+      ><p+      >An <em+	><a href="/url"+	  >emphasized link</a+	  ></em+	>.</p+      ><p+      ><strong+	><em+	  >This is strong and em.</em+	  ></strong+	></p+      ><p+      >So is <strong+	><em+	  >this</em+	  ></strong+	> word.</p+      ><p+      ><strong+	><em+	  >This is strong and em.</em+	  ></strong+	></p+      ><p+      >So is <strong+	><em+	  >this</em+	  ></strong+	> word.</p+      ><p+      >This is code: <code+	>&gt;</code+	>, <code+	>$</code+	>, <code+	>\</code+	>, <code+	>\$</code+	>, <code+	>&lt;html&gt;</code+	>.</p+      ><p+      ><span style="text-decoration: line-through;"+	>This is <em+	  >strikeout</em+	  >.</span+	></p+      ><p+      >Superscripts: a<sup+	>bc</sup+	>d a<sup+	><em+	  >hello</em+	  ></sup+	> a<sup+	>hello&nbsp;there</sup+	>.</p+      ><p+      >Subscripts: H<sub+	>2</sub+	>O, H<sub+	>23</sub+	>O, H<sub+	>many&nbsp;of&nbsp;them</sub+	>O.</p+      ><p+      >These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</p+      ><hr+       /></div+    ><div id="smart-quotes-ellipses-dashes"+    ><h1+      >Smart quotes, ellipses, dashes</h1+      ><p+      >&ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;</p+      ><p+      >&lsquo;A&rsquo;, &lsquo;B&rsquo;, and &lsquo;C&rsquo; are letters.</p+      ><p+      >&lsquo;Oak,&rsquo; &lsquo;elm,&rsquo; and &lsquo;beech&rsquo; are names of trees. So is &lsquo;pine.&rsquo;</p+      ><p+      >&lsquo;He said, &ldquo;I want to go.&rdquo;&rsquo; Were you alive in the 70&rsquo;s?</p+      ><p+      >Here is some quoted &lsquo;<code+	>code</code+	>&rsquo; and a &ldquo;<a href="http://example.com/?foo=1&amp;bar=2"+	>quoted link</a+	>&rdquo;.</p+      ><p+      >Some dashes: one&mdash;two &mdash; three&mdash;four &mdash; five.</p+      ><p+      >Dashes between numbers: 5&ndash;7, 255&ndash;66, 1987&ndash;1999.</p+      ><p+      >Ellipses&hellip;and&hellip;and&hellip;.</p+      ><hr+       /></div+    ><div id="latex"+    ><h1+      >LaTeX</h1+      ><ul+      ><li+	></li+	><li+	><span class="math"+	  >2+2=4</span+	  ></li+	><li+	><span class="math"+	  ><em+	    >x</em+	    >&#8201;&#8712;&#8201;<em+	    >y</em+	    ></span+	  ></li+	><li+	><span class="math"+	  >&#945;&#8201;&#8743;&#8201;&#969;</span+	  ></li+	><li+	><span class="math"+	  >223</span+	  ></li+	><li+	><span class="math"+	  ><em+	    >p</em+	    ></span+	  >-Tree</li+	><li+	>Here&rsquo;s some display math: <span class="math"+	  >\frac{<em+	    >d</em+	    >}{<em+	    >dx</em+	    >}<em+	    >f</em+	    >(<em+	    >x</em+	    >)=\lim<sub+	    ><em+	      >h</em+	      >&#8201;&#8594;&#8201;0</sub+	    >\frac{<em+	    >f</em+	    >(<em+	    >x</em+	    >+<em+	    >h</em+	    >)-<em+	    >f</em+	    >(<em+	    >x</em+	    >)}{<em+	    >h</em+	    >}</span+	  ></li+	><li+	>Here&rsquo;s one that has a line break in it: <span class="math"+	  >&#945;+&#969;&#8201;×&#8201;<em+	    >x</em+	    ><sup+	    >2</sup+	    ></span+	  >.</li+	></ul+      ><p+      >These shouldn&rsquo;t be math:</p+      ><ul+      ><li+	>To get the famous equation, write <code+	  >$e = mc^2$</code+	  >.</li+	><li+	>$22,000 is a <em+	  >lot</em+	  > of money. So is $34,000. (It worked if &ldquo;lot&rdquo; is emphasized.)</li+	><li+	>Shoes ($20) and socks ($5).</li+	><li+	>Escaped <code+	  >$</code+	  >: $73 <em+	  >this should be emphasized</em+	  > 23$.</li+	></ul+      ><p+      >Here&rsquo;s a LaTeX table:</p+      ><p+      ></p+      ><hr+       /></div+    ><div id="special-characters"+    ><h1+      >Special Characters</h1+      ><p+      >Here is some unicode:</p+      ><ul+      ><li+	>I hat: Î</li+	><li+	>o umlaut: ö</li+	><li+	>section: §</li+	><li+	>set membership: &#8712;</li+	><li+	>copyright: ©</li+	></ul+      ><p+      >AT&amp;T has an ampersand in their name.</p+      ><p+      >AT&amp;T is another way to write it.</p+      ><p+      >This &amp; that.</p+      ><p+      >4 &lt; 5.</p+      ><p+      >6 &gt; 5.</p+      ><p+      >Backslash: \</p+      ><p+      >Backtick: `</p+      ><p+      >Asterisk: *</p+      ><p+      >Underscore: _</p+      ><p+      >Left brace: {</p+      ><p+      >Right brace: }</p+      ><p+      >Left bracket: [</p+      ><p+      >Right bracket: ]</p+      ><p+      >Left paren: (</p+      ><p+      >Right paren: )</p+      ><p+      >Greater-than: &gt;</p+      ><p+      >Hash: #</p+      ><p+      >Period: .</p+      ><p+      >Bang: !</p+      ><p+      >Plus: +</p+      ><p+      >Minus: -</p+      ><hr+       /></div+    ><div id="links"+    ><h1+      >Links</h1+      ><div id="explicit"+      ><h2+	>Explicit</h2+	><p+	>Just a <a href="/url/"+	  >URL</a+	  >.</p+	><p+	><a href="/url/" title="title"+	  >URL and title</a+	  >.</p+	><p+	><a href="/url/" title="title preceded by two spaces"+	  >URL and title</a+	  >.</p+	><p+	><a href="/url/" title="title preceded by a tab"+	  >URL and title</a+	  >.</p+	><p+	><a href="/url/" title="title with &quot;quotes&quot; in it"+	  >URL and title</a+	  ></p+	><p+	><a href="/url/" title="title with single quotes"+	  >URL and title</a+	  ></p+	><p+	><a href="/url/with_underscore"+	  >with_underscore</a+	  ></p+	><p+	><script type="text/javascript"+	  >+<!--+h='&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#46;&#110;&#x65;&#116;';a='&#64;';n='&#110;&#x6f;&#98;&#x6f;&#100;&#x79;';e=n+a+h;+document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'Email link'+'<\/'+'a'+'>');+// -->+</script+	  ><noscript+	  >&#x45;&#x6d;&#x61;&#x69;&#108;&#32;&#108;&#x69;&#110;&#x6b;&#32;&#40;&#110;&#x6f;&#98;&#x6f;&#100;&#x79;&#32;&#x61;&#116;&#32;&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#32;&#100;&#x6f;&#116;&#32;&#110;&#x65;&#116;&#x29;</noscript+	  ></p+	><p+	><a href=""+	  >Empty</a+	  >.</p+	></div+      ><div id="reference"+      ><h2+	>Reference</h2+	><p+	>Foo <a href="/url/"+	  >bar</a+	  >.</p+	><p+	>Foo <a href="/url/"+	  >bar</a+	  >.</p+	><p+	>Foo <a href="/url/"+	  >bar</a+	  >.</p+	><p+	>With <a href="/url/"+	  >embedded [brackets]</a+	  >.</p+	><p+	><a href="/url/"+	  >b</a+	  > by itself should be a link.</p+	><p+	>Indented <a href="/url"+	  >once</a+	  >.</p+	><p+	>Indented <a href="/url"+	  >twice</a+	  >.</p+	><p+	>Indented <a href="/url"+	  >thrice</a+	  >.</p+	><p+	>This should [not][] be a link.</p+	><pre+	><code+	  >[not]: /url+</code+	  ></pre+	><p+	>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside"+	  >bar</a+	  >.</p+	><p+	>Foo <a href="/url/" title="Title with &quot;quote&quot; inside"+	  >biz</a+	  >.</p+	></div+      ><div id="with-ampersands"+      ><h2+	>With ampersands</h2+	><p+	>Here&rsquo;s a <a href="http://example.com/?foo=1&amp;bar=2"+	  >link with an ampersand in the URL</a+	  >.</p+	><p+	>Here&rsquo;s a link with an amersand in the link text: <a href="http://att.com/" title="AT&amp;T"+	  >AT&amp;T</a+	  >.</p+	><p+	>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2"+	  >inline link</a+	  >.</p+	><p+	>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2"+	  >inline link in pointy braces</a+	  >.</p+	></div+      ><div id="autolinks"+      ><h2+	>Autolinks</h2+	><p+	>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2"+	  ><code+	    >http://example.com/?foo=1&amp;bar=2</code+	    ></a+	  ></p+	><ul+	><li+	  >In a list?</li+	  ><li+	  ><a href="http://example.com/"+	    ><code+	      >http://example.com/</code+	      ></a+	    ></li+	  ><li+	  >It should.</li+	  ></ul+	><p+	>An e-mail address: <script type="text/javascript"+	  >+<!--+h='&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#46;&#110;&#x65;&#116;';a='&#64;';n='&#110;&#x6f;&#98;&#x6f;&#100;&#x79;';e=n+a+h;+document.write('<a h'+'ref'+'="ma'+'ilto'+':'+e+'">'+'<code>'+e+'</code>'+'<\/'+'a'+'>');+// -->+</script+	  ><noscript+	  >&#110;&#x6f;&#98;&#x6f;&#100;&#x79;&#32;&#x61;&#116;&#32;&#110;&#x6f;&#x77;&#104;&#x65;&#114;&#x65;&#32;&#100;&#x6f;&#116;&#32;&#110;&#x65;&#116;</noscript+	  ></p+	><blockquote+	><p+	  >Blockquoted: <a href="http://example.com/"+	    ><code+	      >http://example.com/</code+	      ></a+	    ></p+	  ></blockquote+	><p+	>Auto-links should not occur here: <code+	  >&lt;http://example.com/&gt;</code+	  ></p+	><pre+	><code+	  >or here: &lt;http://example.com/&gt;+</code+	  ></pre+	><hr+	 /></div+      ></div+    ><div id="images"+    ><h1+      >Images</h1+      ><p+      >From &ldquo;Voyage dans la Lune&rdquo; by Georges Melies (1902):</p+      ><p+      ><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"+	 /></p+      ><p+      >Here is a movie <img src="movie.jpg" alt="movie"+	 /> icon.</p+      ><hr+       /></div+    ><div id="footnotes"+    ><h1+      >Footnotes</h1+      ><p+      >Here is a footnote reference,<a href="#fn1" class="footnoteRef" id="fnref1"+	><sup+	  >1</sup+	  ></a+	> and another.<a href="#fn2" class="footnoteRef" id="fnref2"+	><sup+	  >2</sup+	  ></a+	> This should <em+	>not</em+	> be a footnote reference, because it contains a space.[^my note] Here is an inline note.<a href="#fn3" class="footnoteRef" id="fnref3"+	><sup+	  >3</sup+	  ></a+	></p+      ><blockquote+      ><p+	>Notes can go in quotes.<a href="#fn4" class="footnoteRef" id="fnref4"+	  ><sup+	    >4</sup+	    ></a+	  ></p+	></blockquote+      ><ol style="list-style-type: decimal;"+      ><li+	>And in list items.<a href="#fn5" class="footnoteRef" id="fnref5"+	  ><sup+	    >5</sup+	    ></a+	  ></li+	></ol+      ><p+      >This paragraph should not be part of the note, as it is not indented.</p+      ></div     ><div class="footnotes"     ><hr        /><ol
tests/writer.man view
@@ -1,7 +1,7 @@ .TH Pandoc "" "July 17, 2006" "Test Suite" .PP-This is a set of tests for pandoc\. Most of them are adapted from-John Gruber's markdown test suite\.+This is a set of tests for pandoc.+Most of them are adapted from John Gruber's markdown test suite. .PP    *   *   *   *   * .SH Headers@@ -21,19 +21,22 @@    *   *   *   *   * .SH Paragraphs .PP-Here's a regular paragraph\.+Here's a regular paragraph. .PP-In Markdown 1\.0\.0 and earlier\. Version 8\. This line turns into-a list item\. Because a hard-wrapped line in the middle of a-paragraph looked like a list item\.+In Markdown 1.0.0 and earlier.+Version 8.+This line turns into a list item.+Because a hard-wrapped line in the middle of a paragraph looked+like a list item. .PP-Here's one with a bullet\. * criminey\.+Here's one with a bullet.+* criminey. .PP There should be a hard line break .PD 0 .P .PD-here\.+here. .PP    *   *   *   *   * .SH Block Quotes@@ -41,7 +44,8 @@ E-mail style: .RS .PP-This is a block quote\. It is pretty short\.+This is a block quote.+It is pretty short. .RE .RS .PP@@ -70,9 +74,9 @@ .RE .RE .PP-This should not be a block quote: 2 > 1\.+This should not be a block quote: 2 > 1. .PP-And a following paragraph\.+And a following paragraph. .PP    *   *   *   *   * .SH Code Blocks@@ -184,16 +188,17 @@ .PP Multiple paragraphs: .IP "1." 3-Item 1, graf one\.+Item 1, graf one. .RS 4 .PP-Item 1\. graf two\. The quick brown fox jumped over the lazy dog's-back\.+Item 1.+graf two.+The quick brown fox jumped over the lazy dog's back. .RE .IP "2." 3-Item 2\.+Item 2. .IP "3." 3-Item 3\.+Item 3. .SS Nested .IP \[bu] 2 Tab@@ -273,7 +278,7 @@ Upper Alpha .RS 4 .IP "I." 3-Upper Roman\.+Upper Roman. .RS 4 .IP "(6)" 4 Decimal start with 6@@ -286,19 +291,20 @@ .PP Autonumbering: .IP "1." 3-Autonumber\.+Autonumber. .IP "2." 3-More\.+More. .RS 4 .IP "1." 3-Nested\.+Nested. .RE .PP Should not be a list item: .PP-M\.A\.\ 2007+M.A.\ 2007 .PP-B\. Williams+B.+Williams .PP    *   *   *   *   * .SH Definition Lists@@ -497,51 +503,53 @@    *   *   *   *   * .SH Inline Markup .PP-This is \f[I]emphasized\f[], and so \f[I]is this\f[]\.+This is \f[I]emphasized\f[], and so \f[I]is this\f[]. .PP-This is \f[B]strong\f[], and so \f[B]is this\f[]\.+This is \f[B]strong\f[], and so \f[B]is this\f[]. .PP-An \f[I]emphasized link (/url)\f[]\.+An \f[I]emphasized link (/url)\f[]. .PP-\f[B]\f[I]This is strong and em\.\f[]\f[]+\f[B]\f[I]This is strong and em.\f[]\f[] .PP-So is \f[B]\f[I]this\f[]\f[] word\.+So is \f[B]\f[I]this\f[]\f[] word. .PP-\f[B]\f[I]This is strong and em\.\f[]\f[]+\f[B]\f[I]This is strong and em.\f[]\f[] .PP-So is \f[B]\f[I]this\f[]\f[] word\.+So is \f[B]\f[I]this\f[]\f[] word. .PP This is code: \f[B]>\f[], \f[B]$\f[], \f[B]\\\f[], \f[B]\\$\f[],-\f[B]<html>\f[]\.+\f[B]<html>\f[]. .PP-[STRIKEOUT:This is \f[I]strikeout\f[]\.]+[STRIKEOUT:This is \f[I]strikeout\f[].] .PP-Superscripts: a^bc^d a^\f[I]hello\f[]^ a^hello\ there^\.+Superscripts: a^bc^d a^\f[I]hello\f[]^ a^hello\ there^. .PP-Subscripts: H~2~O, H~23~O, H~many\ of\ them~O\.+Subscripts: H~2~O, H~23~O, H~many\ of\ them~O. .PP These should not be superscripts or subscripts, because of the-unescaped spaces: a^b c^d, a~b c~d\.+unescaped spaces: a^b c^d, a~b c~d. .PP    *   *   *   *   * .SH Smart quotes, ellipses, dashes .PP-\[lq]Hello,\[rq] said the spider\. \[lq]`Shelob' is my name\.\[rq]+\[lq]Hello,\[rq] said the spider.+\[lq]`Shelob' is my name.\[rq] .PP-`A', `B', and `C' are letters\.+`A', `B', and `C' are letters. .PP-`Oak,' `elm,' and `beech' are names of trees\. So is `pine\.'+`Oak,' `elm,' and `beech' are names of trees.+So is `pine.' .PP-`He said, \[lq]I want to go\.\[rq]' Were you alive in the 70's?+`He said, \[lq]I want to go.\[rq]' Were you alive in the 70's? .PP Here is some quoted `\f[B]code\f[]' and a-\[lq]quoted link (http://example.com/?foo=1&bar=2)\[rq]\.+\[lq]quoted link (http://example.com/?foo=1&bar=2)\[rq]. .PP-Some dashes: one\[em]two \[em] three\[em]four \[em] five\.+Some dashes: one\[em]two \[em] three\[em]four \[em] five. .PP-Dashes between numbers: 5\[en]7, 255\[en]66, 1987\[en]1999\.+Dashes between numbers: 5\[en]7, 255\[en]66, 1987\[en]1999. .PP-Ellipses\&...and\&...and\&...\.+Ellipses\&...and\&...and\&.... .PP    *   *   *   *   * .SH LaTeX@@ -563,18 +571,19 @@ .RE .IP \[bu] 2 Here's one that has a line break in it:-\f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[]\.+\f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[]. .PP These shouldn't be math: .IP \[bu] 2-To get the famous equation, write \f[B]$e\ =\ mc^2$\f[]\.+To get the famous equation, write \f[B]$e\ =\ mc^2$\f[]. .IP \[bu] 2-$22,000 is a \f[I]lot\f[] of money\. So is $34,000\. (It worked if-\[lq]lot\[rq] is emphasized\.)+$22,000 is a \f[I]lot\f[] of money.+So is $34,000.+(It worked if \[lq]lot\[rq] is emphasized.) .IP \[bu] 2-Shoes ($20) and socks ($5)\.+Shoes ($20) and socks ($5). .IP \[bu] 2-Escaped \f[B]$\f[]: $73 \f[I]this should be emphasized\f[] 23$\.+Escaped \f[B]$\f[]: $73 \f[I]this should be emphasized\f[] 23$. .PP Here's a LaTeX table: .PP@@ -594,15 +603,15 @@ .IP \[bu] 2 copyright: © .PP-AT&T has an ampersand in their name\.+AT&T has an ampersand in their name. .PP-AT&T is another way to write it\.+AT&T is another way to write it. .PP-This & that\.+This & that. .PP-4 < 5\.+4 < 5. .PP-6 > 5\.+6 > 5. .PP Backslash: \\ .PP@@ -628,7 +637,7 @@ .PP Hash: # .PP-Period: \.+Period: \&. .PP Bang: ! .PP@@ -640,13 +649,13 @@ .SH Links .SS Explicit .PP-Just a URL (/url/)\.+Just a URL (/url/). .PP-URL and title (/url/)\.+URL and title (/url/). .PP-URL and title (/url/)\.+URL and title (/url/). .PP-URL and title (/url/)\.+URL and title (/url/). .PP URL and title (/url/) .PP@@ -656,45 +665,45 @@ .PP Email link (mailto:nobody@nowhere.net) .PP-Empty ()\.+Empty (). .SS Reference .PP-Foo bar (/url/)\.+Foo bar (/url/). .PP-Foo bar (/url/)\.+Foo bar (/url/). .PP-Foo bar (/url/)\.+Foo bar (/url/). .PP-With embedded [brackets] (/url/)\.+With embedded [brackets] (/url/). .PP-b (/url/) by itself should be a link\.+b (/url/) by itself should be a link. .PP-Indented once (/url)\.+Indented once (/url). .PP-Indented twice (/url)\.+Indented twice (/url). .PP-Indented thrice (/url)\.+Indented thrice (/url). .PP-This should [not][] be a link\.+This should [not][] be a link. .PP \f[CR]       [not]:\ /url \f[] .PP-Foo bar (/url/)\.+Foo bar (/url/). .PP-Foo biz (/url/)\.+Foo biz (/url/). .SS With ampersands .PP Here's a-link with an ampersand in the URL (http://example.com/?foo=1&bar=2)\.+link with an ampersand in the URL (http://example.com/?foo=1&bar=2). .PP Here's a link with an amersand in the link text:-AT&T (http://att.com/)\.+AT&T (http://att.com/). .PP-Here's an inline link (/script?foo=1&bar=2)\.+Here's an inline link (/script?foo=1&bar=2). .PP-Here's an inline link in pointy braces (/script?foo=1&bar=2)\.+Here's an inline link in pointy braces (/script?foo=1&bar=2). .SS Autolinks .PP With an ampersand: <http://example.com/?foo=1&bar=2>@@ -703,7 +712,7 @@ .IP \[bu] 2 <http://example.com/> .IP \[bu] 2-It should\.+It should. .PP An e-mail address: <nobody@nowhere.net> .RS@@ -711,10 +720,10 @@ Blockquoted: <http://example.com/> .RE .PP-Auto-links should not occur here: \f[B]<http://example\.com/>\f[]+Auto-links should not occur here: \f[B]<http://example.com/>\f[] .PP \f[CR]-      or\ here:\ <http://example\.com/>+      or\ here:\ <http://example.com/> \f[] .PP    *   *   *   *   *@@ -724,56 +733,58 @@ .PP [IMAGE: lalune (lalune.jpg)] .PP-Here is a movie [IMAGE: movie (movie.jpg)] icon\.+Here is a movie [IMAGE: movie (movie.jpg)] icon. .PP    *   *   *   *   * .SH Footnotes .PP-Here is a footnote reference,[1] and another\.[2] This should+Here is a footnote reference,[1] and another.[2] This should \f[I]not\f[] be a footnote reference, because it contains a-space\.[^my note] Here is an inline note\.[3]+space.[^my note] Here is an inline note.[3] .RS .PP-Notes can go in quotes\.[4]+Notes can go in quotes.[4] .RE .IP "1." 3-And in list items\.[5]+And in list items.[5] .PP This paragraph should not be part of the note, as it is not-indented\.+indented. .SH NOTES  .SS [1] .PP-Here is the footnote\. It can go anywhere after the footnote-reference\. It need not be placed at the end of the document\.+Here is the footnote.+It can go anywhere after the footnote reference.+It need not be placed at the end of the document.  .SS [2] .PP-Here's the long note\. This one contains multiple blocks\.+Here's the long note.+This one contains multiple blocks. .PP Subsequent blocks are indented to show that they belong to the-footnote (as with list items)\.+footnote (as with list items). .PP \f[CR]       \ \ {\ <code>\ } \f[] .PP If you want, you can indent every line, but you can also be lazy-and just indent the first line of each block\.+and just indent the first line of each block.  .SS [3] .PP-This is \f[I]easier\f[] to type\. Inline notes may contain-links (http://google.com) and \f[B]]\f[] verbatim characters, as-well as [bracketed text]\.+This is \f[I]easier\f[] to type.+Inline notes may contain links (http://google.com) and \f[B]]\f[]+verbatim characters, as well as [bracketed text].  .SS [4] .PP-In quote\.+In quote.  .SS [5] .PP-In list\.+In list. .SH AUTHORS John MacFarlane, Anonymous
tests/writer.markdown view
@@ -72,7 +72,7 @@ >  > > nested -This should not be a block quote: 2 > 1.+This should not be a block quote: 2 \> 1.  And a following paragraph. @@ -537,9 +537,9 @@  This & that. -4 \< 5.+4 < 5. -6 > 5.+6 \> 5.  Backslash: \\ @@ -561,9 +561,9 @@  Right paren: ) -Greater-than: >+Greater-than: \> -Hash: #+Hash: \#  Period: . 
tests/writer.native view
@@ -165,7 +165,7 @@       [ [ Plain [Str "Nested",Str "."] ]      ] ] ] , Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]-, Para [Str "M",Str ".",Str "A.\160",Str "2007"]+, Para [Str "M.A.\160",Str "2007"] , Para [Str "B",Str ".",Space,Str "Williams"] , HorizontalRule , Header 1 [Str "Definition",Space,Str "Lists"]