Added beamer+lhs as output format.
This commit is contained in:
parent
6787cf2fbf
commit
9766b532f3
3 changed files with 22 additions and 21 deletions
11
README
11
README
|
@ -138,7 +138,7 @@ General options
|
|||
`json` (JSON version of native AST), `markdown` (markdown),
|
||||
`textile` (Textile), `rst` (reStructuredText), `html` (HTML),
|
||||
or `latex` (LaTeX). If `+lhs` is appended to `markdown`, `rst`,
|
||||
or `latex`, the input will be treated as literate Haskell source:
|
||||
`latex`, the input will be treated as literate Haskell source:
|
||||
see [Literate Haskell support](#literate-haskell-support),
|
||||
below.
|
||||
|
||||
|
@ -156,8 +156,8 @@ General options
|
|||
slide show), or `rtf` (rich text format). Note that `odt` and `epub`
|
||||
output will not be directed to *stdout*; an output filename must
|
||||
be specified using the `-o/--output` option. If `+lhs` is appended
|
||||
to `markdown`, `rst`, `latex`, `html`, or `html5`, the output will
|
||||
be rendered as literate Haskell source: see [Literate Haskell
|
||||
to `markdown`, `rst`, `latex`, `beamer`, `html`, or `html5`, the output
|
||||
will be rendered as literate Haskell source: see [Literate Haskell
|
||||
support](#literate-haskell-support), below.
|
||||
|
||||
`-o` *FILE*, `--output=`*FILE*
|
||||
|
@ -2168,8 +2168,9 @@ Literate Haskell support
|
|||
========================
|
||||
|
||||
If you append `+lhs` to an appropriate input or output format (`markdown`,
|
||||
`rst`, or `latex` for input or output; `html` or `html5` for output only),
|
||||
pandoc will treat the document as literate Haskell source. This means that
|
||||
`rst`, or `latex` for input or output; `beamer`, `html` or `html5` for
|
||||
output only), pandoc will treat the document as literate Haskell source.
|
||||
This means that
|
||||
|
||||
- In markdown input, "bird track" sections will be parsed as Haskell
|
||||
code rather than block quotations. Text between `\begin{code}`
|
||||
|
|
|
@ -192,6 +192,8 @@ writers = [("native" , writeNative)
|
|||
writeLaTeX o{ writerLiterateHaskell = True })
|
||||
,("beamer" , \o ->
|
||||
writeLaTeX o{ writerBeamer = True })
|
||||
,("beamer+lhs" , \o ->
|
||||
writeLaTeX o{ writerBeamer = True, writerLiterateHaskell = True })
|
||||
,("context" , writeConTeXt)
|
||||
,("texinfo" , writeTexinfo)
|
||||
,("man" , writeMan)
|
||||
|
|
|
@ -833,10 +833,12 @@ main = do
|
|||
|
||||
let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
|
||||
|
||||
let laTeXOutput = writerName' == "latex" || writerName' == "beamer" ||
|
||||
writerName' == "latex+lhs" || writerName' == "beamer+lhs"
|
||||
|
||||
when pdfOutput $ do
|
||||
-- make sure writer is latex or beamer
|
||||
unless (writerName' == "latex" || writerName' == "beamer" ||
|
||||
writerName' == "latex+lhs") $
|
||||
unless laTeXOutput $
|
||||
err 47 $ "cannot produce pdf output with " ++ writerName' ++ " writer"
|
||||
-- check for latex program
|
||||
mbLatex <- findExecutable latexEngine
|
||||
|
@ -916,14 +918,13 @@ main = do
|
|||
lhsExtension sources,
|
||||
stateStandalone = standalone',
|
||||
stateCitations = map CSL.refId refs,
|
||||
stateSmart = smart || writerName' `elem`
|
||||
["latex", "context", "latex+lhs", "beamer"],
|
||||
stateSmart = smart || laTeXOutput || writerName' == "context",
|
||||
stateOldDashes = oldDashes,
|
||||
stateColumns = columns,
|
||||
stateStrict = strict,
|
||||
stateIndentedCodeClasses = codeBlockClasses,
|
||||
stateApplyMacros = writerName' `notElem`
|
||||
["latex", "latex+lhs", "beamer"] }
|
||||
stateApplyMacros = not laTeXOutput
|
||||
}
|
||||
|
||||
let writerOptions = defaultWriterOptions
|
||||
{ writerStandalone = standalone',
|
||||
|
@ -945,8 +946,7 @@ main = do
|
|||
writerReferenceLinks = referenceLinks,
|
||||
writerWrapText = wrap,
|
||||
writerColumns = columns,
|
||||
writerLiterateHaskell = "+lhs" `isSuffixOf` writerName' ||
|
||||
lhsExtension [outputFile],
|
||||
writerLiterateHaskell = False,
|
||||
writerEmailObfuscation = if strict
|
||||
then ReferenceObfuscation
|
||||
else obfuscationMethod,
|
||||
|
@ -957,7 +957,7 @@ main = do
|
|||
slideVariant == DZSlides,
|
||||
writerChapters = chapters,
|
||||
writerListings = listings,
|
||||
writerBeamer = writerName' == "beamer",
|
||||
writerBeamer = False,
|
||||
writerSlideLevel = slideLevel,
|
||||
writerHighlight = highlight,
|
||||
writerHighlightStyle = highlightStyle,
|
||||
|
@ -980,9 +980,7 @@ main = do
|
|||
|
||||
let convertTabs = tabFilter (if preserveTabs then 0 else tabStop)
|
||||
|
||||
let handleIncludes' = if readerName' == "latex" || readerName' == "beamer" ||
|
||||
readerName' == "latex+lhs" ||
|
||||
readerName' == "context"
|
||||
let handleIncludes' = if readerName' == "latex" || readerName' == "latex+lhs"
|
||||
then handleIncludes
|
||||
else return
|
||||
|
||||
|
@ -1029,18 +1027,18 @@ main = do
|
|||
| writerName' == "docx" ->
|
||||
writeDocx referenceDocx writerOptions doc2 >>= writeBinary
|
||||
| otherwise -> err 9 ("Unknown writer: " ++ writerName')
|
||||
Just _
|
||||
Just w
|
||||
| pdfOutput -> do
|
||||
res <- tex2pdf latexEngine $ writeLaTeX writerOptions doc2
|
||||
res <- tex2pdf latexEngine $ w writerOptions doc2
|
||||
case res of
|
||||
Right pdf -> writeBinary pdf
|
||||
Left err' -> err 43 $ toString err'
|
||||
Just r
|
||||
Just w
|
||||
| htmlFormat && ascii ->
|
||||
writerFn outputFile =<< selfcontain (toEntities result)
|
||||
| otherwise ->
|
||||
writerFn outputFile =<< selfcontain result
|
||||
where result = r writerOptions doc2 ++ ['\n' | not standalone']
|
||||
where result = w writerOptions doc2 ++ ['\n' | not standalone']
|
||||
htmlFormat = writerName' `elem`
|
||||
["html","html+lhs","html5","html5+lhs",
|
||||
"s5","slidy","dzslides"]
|
||||
|
|
Loading…
Reference in a new issue