diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-08-09 20:19:06 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-08-09 20:24:05 -0700 |
commit | 0cb7362f62410f58e2356381bbf2c1fe85abe2a5 (patch) | |
tree | b6158a288fde45e430fe1afb094306ec442575b1 /src/Text/Pandoc/Templates.hs | |
parent | 71e0c206c169c12e30bec4869dd04e166ef7ed5d (diff) | |
download | pandoc-0cb7362f62410f58e2356381bbf2c1fe85abe2a5.tar.gz |
Removed `--strict`, added extensions to writer/reader names.
* The `--strict` option has been removed.
* Instead of using `--strict`, one can now use `strict` instead of
`markdown` as an input or output format name.
* The `--enable` and `--disable` optinos have been removed.
* It is now possible to enable or disable specific extensions
by appending them (with '+' or '-') to the writer or reader
name. For example `pandoc -f markdown-footnotes+hard_line_breaks`.
* The lhs extensions are now implemented this way, too; you can
use either `+lhs` or `+literate_haskell`.
Diffstat (limited to 'src/Text/Pandoc/Templates.hs')
-rw-r--r-- | src/Text/Pandoc/Templates.hs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs index 061be29aa..899f6510a 100644 --- a/src/Text/Pandoc/Templates.hs +++ b/src/Text/Pandoc/Templates.hs @@ -86,15 +86,16 @@ import qualified Control.Exception.Extensible as E (try, IOException) getDefaultTemplate :: (Maybe FilePath) -- ^ User data directory to search first -> String -- ^ Name of writer -> IO (Either E.IOException String) -getDefaultTemplate _ "native" = return $ Right "" -getDefaultTemplate _ "json" = return $ Right "" -getDefaultTemplate _ "docx" = return $ Right "" -getDefaultTemplate user "odt" = getDefaultTemplate user "opendocument" -getDefaultTemplate user "epub" = getDefaultTemplate user "html" getDefaultTemplate user writer = do - let format = takeWhile (/='+') writer -- strip off "+lhs" if present - let fname = "templates" </> "default" <.> format - E.try $ readDataFile user fname + let format = takeWhile (`notElem` "+-") writer -- strip off extensions + case format of + "native" -> return $ Right "" + "json" -> return $ Right "" + "docx" -> return $ Right "" + "odt" -> getDefaultTemplate user "opendocument" + "epub" -> return $ Right "" + _ -> let fname = "templates" </> "default" <.> format + in E.try $ readDataFile user fname data TemplateState = TemplateState Int [(String,String)] |