git.iko.soy/typeable/pandoc
on master help sign in
Changed default template naming scheme.
fd34dcbJohn MacFarlane
README+9−5
@@ -324,13 +324,17 @@ Options
324`--template=`*FILE*
324`--template=`*FILE*
325: Use *FILE* as a custom template for the generated document. Implies
325: Use *FILE* as a custom template for the generated document. Implies
326 `--standalone`. See [Templates](#templates) below for a description
326 `--standalone`. See [Templates](#templates) below for a description
327+ of template syntax. If no extension is specified, an extension
328+ corresponding to the writer will be added, so that `--template=special`
329+ looks for `special.html` for HTML output. If the template is not
330+ found, pandoc will search for it in the user data directory
327− of template syntax. If this option is not used, a default
331+ (see `--data-dir`). If this option is not used, a default
328− template appropriate for the output format will be used. See also
332+ template appropriate for the output format will be used (see
329− `-D/--print-default-template`.
333+ `-D/--print-default-template`).
330
334
331`-V` *KEY=VAL*, `--variable=`*KEY:VAL*
335`-V` *KEY=VAL*, `--variable=`*KEY:VAL*
332: Set the template variable *KEY* to the value *VAL* when rendering the
336: Set the template variable *KEY* to the value *VAL* when rendering the
333− document in standalone mode. This is only useful when the
337+ document in standalone mode. This is generally only useful when the
334 `--template` option is used to specify a custom template, since
338 `--template` option is used to specify a custom template, since
335 pandoc automatically sets the variables used in the default
339 pandoc automatically sets the variables used in the default
336 templates.
340 templates.
@@ -498,7 +502,7 @@ document. To see the default template that is used, just type
498where `FORMAT` is the name of the output format. A custom template
502where `FORMAT` is the name of the output format. A custom template
499can be specified using the `--template` option. You can also override
503can be specified using the `--template` option. You can also override
500the system default templates for a given output format `FORMAT`
504the system default templates for a given output format `FORMAT`
501−by putting a file `templates/FORMAT.template` in the user data
505+by putting a file `templates/default.FORMAT` in the user data
502directory (see `--data-dir`, above).
506directory (see `--data-dir`, above).
503
507
504Templates may contain *variables*. Variable names are sequences of
508Templates may contain *variables*. Variable names are sequences of
pandoc.cabal+8−8
@@ -37,14 +37,14 @@ Description: Pandoc is a Haskell library for converting from one markup
37 only adding a reader or writer.
37 only adding a reader or writer.
38Data-Files:
38Data-Files:
39 -- templates
39 -- templates
40− templates/html.template, templates/docbook.template,
40+ templates/default.html, templates/default.docbook,
41− templates/opendocument.template, templates/latex.template,
41+ templates/default.opendocument, templates/default.latex,
42− templates/context.template, templates/texinfo.template,
42+ templates/default.context, templates/default.texinfo,
43− templates/man.template, templates/markdown.template,
43+ templates/default.man, templates/default.markdown,
44− templates/rst.template, templates/plain.template,
44+ templates/default.rst, templates/default.plain,
45− templates/mediawiki.template, templates/rtf.template,
45+ templates/default.mediawiki, templates/default.rtf,
46− templates/s5.template, templates/slidy.template,
46+ templates/default.s5, templates/default.slidy,
47− templates/textile.template, templates/org.template
47+ templates/default.textile, templates/default.org
48 -- data for ODT writer
48 -- data for ODT writer
49 reference.odt,
49 reference.odt,
50 -- stylesheet for EPUB writer
50 -- stylesheet for EPUB writer
src/Text/Pandoc/Templates.hs+1−1
@@ -85,7 +85,7 @@ getDefaultTemplate _ "native" = return $ Right ""
85getDefaultTemplate user "odt" = getDefaultTemplate user "opendocument"
85getDefaultTemplate user "odt" = getDefaultTemplate user "opendocument"
86getDefaultTemplate user writer = do
86getDefaultTemplate user writer = do
87 let format = takeWhile (/='+') writer -- strip off "+lhs" if present
87 let format = takeWhile (/='+') writer -- strip off "+lhs" if present
88− let fname = "templates" </> format <.> "template"
88+ let fname = "templates" </> "default" <.> format
89 E.try $ readDataFile user fname
89 E.try $ readDataFile user fname
90
90
91data TemplateState = TemplateState Int [(String,String)]
91data TemplateState = TemplateState Int [(String,String)]
src/pandoc.hs+9−2
@@ -738,10 +738,17 @@ main = do
738 case deftemp of
738 case deftemp of
739 Left e -> throwIO e
739 Left e -> throwIO e
740 Right t -> return t
740 Right t -> return t
741+ Just tp -> do
742+ -- strip off "+lhs" if present
743+ let format = takeWhile (/='+') writerName'
744+ let tp' = case takeExtension tp of
745+ "" -> tp <.> format
746+ _ -> tp
741− Just tp -> catch (UTF8.readFile tp)
747+ catch (UTF8.readFile tp')
742 (\e -> if isDoesNotExistError e
748 (\e -> if isDoesNotExistError e
743 then catch
749 then catch
744− (readDataFile datadir tp)
750+ (readDataFile datadir $
751+ "templates" </> tp')
745 (\_ -> throwIO e)
752 (\_ -> throwIO e)
746 else throwIO e)
753 else throwIO e)
747
754
templates+1−1

Submodule changed.