From c453e2f7d5dc469a87a1399c9c8e7aa0aa4ed991 Mon Sep 17 00:00:00 2001 From: fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> Date: Tue, 8 Jan 2008 20:21:28 +0000 Subject: [PATCH] Made -c/--css option repeatable on the command line (like -H, -A, -B). Documented repeatability of these options in README. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1186 788f1e2b-df1e-0410-8736-df70ead52e1b --- Main.hs | 20 ++++++++++++-------- README | 15 +++++++++++---- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Main.hs b/Main.hs index 73ed35353..7187ca740 100644 --- a/Main.hs +++ b/Main.hs @@ -87,7 +87,7 @@ data Opt = Opt , optReader :: String -- ^ Reader format , optWriter :: String -- ^ Writer format , optParseRaw :: Bool -- ^ Parse unconvertable HTML and TeX - , optCSS :: String -- ^ CSS file to link to + , optCSS :: [String] -- ^ CSS file to link to , optTableOfContents :: Bool -- ^ Include table of contents , optIncludeInHeader :: String -- ^ File to include in header , optIncludeBeforeBody :: String -- ^ File to include at top of body @@ -116,7 +116,7 @@ defaultOpts = Opt , optReader = "" -- null for default reader , optWriter = "" -- null for default writer , optParseRaw = False - , optCSS = "" + , optCSS = [] , optTableOfContents = False , optIncludeInHeader = "" , optIncludeBeforeBody = "" @@ -240,8 +240,10 @@ options = , Option "c" ["css"] (ReqArg - (\arg opt -> return opt { optCSS = arg, - optStandalone = True }) + (\arg opt -> do + let old = optCSS opt + return opt { optCSS = old ++ [arg], + optStandalone = True }) "CSS") "" -- "Link to CSS style sheet" @@ -492,10 +494,12 @@ main = do ["latex", "context"], stateColumns = columns, stateStrict = strict } - let csslink = if (css == "") - then "" - else "<link rel=\"stylesheet\" href=\"" ++ css ++ - "\" type=\"text/css\" media=\"all\" />\n" + let csslink = if null css + then "" + else concatMap + (\f -> "<link rel=\"stylesheet\" href=\"" ++ + f ++ "\" type=\"text/css\" media=\"all\" />\n") + css let header = (if (customHeader == "DEFAULT") then defaultHeader else customHeader) ++ csslink ++ includeHeader diff --git a/README b/README index af803cf38..27eb60a20 100644 --- a/README +++ b/README @@ -277,23 +277,30 @@ For further documentation, see the `pandoc(1)` man page. `-c` or `--css` *filename* : allows the user to specify a custom stylesheet that will be linked to - in HTML and S5 output. + in HTML and S5 output. This option can be used repeatedly to include + multiple stylesheets. They will be included in the order specified. `-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. + 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. `-B` or `--include-before-body` *filename* : includes the contents of *filename* (verbatim) at the beginning of the document body (e.g. after the `<body>` tag in HTML, or the `\begin{document}` command in LaTeX). This can be used to include - navigation bars or banners in HTML documents. + navigation bars or banners in HTML documents. This option can be + used repeatedly to include multiple files. They will be included in + the order specified. `-A` or `--include-after-body` *filename* : includes the contents of *filename* (verbatim) at the end of the document body (before the `</body>` tag in HTML, or the - `\end{document}` command in LaTeX). + `\end{document}` command in LaTeX). This option can be be used + repeatedly to include multiple files. They will be included in the + order specified. `-T` or `--title-prefix` *string* : includes *string* as a prefix at the beginning of the title that