diff options
-rw-r--r-- | INSTALL | 5 | ||||
-rw-r--r-- | Main.hs (renamed from src/Main.hs) | 0 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | Text/Pandoc.hs (renamed from src/Text/Pandoc.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Blocks.hs (renamed from src/Text/Pandoc/Blocks.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/CharacterReferences.hs (renamed from src/Text/Pandoc/CharacterReferences.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Definition.hs (renamed from src/Text/Pandoc/Definition.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Include.hs | 60 | ||||
-rw-r--r-- | Text/Pandoc/Readers/HTML.hs (renamed from src/Text/Pandoc/Readers/HTML.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Readers/LaTeX.hs (renamed from src/Text/Pandoc/Readers/LaTeX.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Readers/Markdown.hs (renamed from src/Text/Pandoc/Readers/Markdown.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Readers/RST.hs (renamed from src/Text/Pandoc/Readers/RST.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Shared.hs (renamed from src/Text/Pandoc/Shared.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/UTF8.hs (renamed from src/Text/Pandoc/UTF8.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/ConTeXt.hs (renamed from src/Text/Pandoc/Writers/ConTeXt.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/DefaultHeaders.hs (renamed from src/templates/DefaultHeaders.hs) | 10 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Docbook.hs (renamed from src/Text/Pandoc/Writers/Docbook.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/HTML.hs (renamed from src/Text/Pandoc/Writers/HTML.hs) | 8 | ||||
-rw-r--r-- | Text/Pandoc/Writers/LaTeX.hs (renamed from src/Text/Pandoc/Writers/LaTeX.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Man.hs (renamed from src/Text/Pandoc/Writers/Man.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Markdown.hs (renamed from src/Text/Pandoc/Writers/Markdown.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/RST.hs (renamed from src/Text/Pandoc/Writers/RST.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/RTF.hs (renamed from src/Text/Pandoc/Writers/RTF.hs) | 0 | ||||
-rw-r--r-- | Text/Pandoc/Writers/S5.hs (renamed from src/templates/S5.hs) | 17 | ||||
-rw-r--r-- | data/ASCIIMathML.js (renamed from src/ASCIIMathML.js) | 0 | ||||
-rw-r--r-- | data/headers/ConTeXtHeader (renamed from src/headers/ConTeXtHeader) | 0 | ||||
-rw-r--r-- | data/headers/DocbookHeader (renamed from src/headers/DocbookHeader) | 0 | ||||
-rw-r--r-- | data/headers/LaTeXHeader (renamed from src/headers/LaTeXHeader) | 0 | ||||
-rw-r--r-- | data/headers/RTFHeader (renamed from src/headers/RTFHeader) | 0 | ||||
-rw-r--r-- | data/headers/S5Header (renamed from src/headers/S5Header) | 0 | ||||
-rw-r--r-- | data/ui/default/blank.gif (renamed from src/ui/default/blank.gif) | bin | 49 -> 49 bytes | |||
-rw-r--r-- | data/ui/default/bodybg.gif (renamed from src/ui/default/bodybg.gif) | bin | 10119 -> 10119 bytes | |||
-rw-r--r-- | data/ui/default/framing.css (renamed from src/ui/default/framing.css) | 0 | ||||
-rw-r--r-- | data/ui/default/iepngfix.htc (renamed from src/ui/default/iepngfix.htc) | 0 | ||||
-rw-r--r-- | data/ui/default/opera.css (renamed from src/ui/default/opera.css) | 0 | ||||
-rw-r--r-- | data/ui/default/outline.css (renamed from src/ui/default/outline.css) | 0 | ||||
-rw-r--r-- | data/ui/default/pretty.css (renamed from src/ui/default/pretty.css) | 0 | ||||
-rw-r--r-- | data/ui/default/print.css (renamed from src/ui/default/print.css) | 0 | ||||
-rw-r--r-- | data/ui/default/s5-core.css (renamed from src/ui/default/s5-core.css) | 0 | ||||
-rw-r--r-- | data/ui/default/slides.css (renamed from src/ui/default/slides.css) | 0 | ||||
-rw-r--r-- | data/ui/default/slides.js (renamed from src/ui/default/slides.js) | 0 | ||||
-rw-r--r-- | pandoc.cabal | 12 | ||||
-rw-r--r-- | src/templates/ASCIIMathML.hs | 7 | ||||
-rw-r--r-- | src/templates/Makefile | 20 | ||||
-rwxr-xr-x | src/templates/fillTemplates.pl | 131 | ||||
-rw-r--r-- | tests/s5.fancy.html | 57 | ||||
-rw-r--r-- | wrappers/common.sh (renamed from src/wrappers/common.sh) | 0 | ||||
-rw-r--r-- | wrappers/hsmarkdown.in (renamed from src/wrappers/hsmarkdown.in) | 0 | ||||
-rw-r--r-- | wrappers/html2markdown.in (renamed from src/wrappers/html2markdown.in) | 0 | ||||
-rw-r--r-- | wrappers/markdown2pdf.in (renamed from src/wrappers/markdown2pdf.in) | 0 | ||||
-rw-r--r-- | wrappers/tempdir.sh (renamed from src/wrappers/tempdir.sh) | 0 |
51 files changed, 137 insertions, 200 deletions
@@ -107,15 +107,12 @@ but are documented here for packagers and developers: * `configure`: Performs the needed preprocessing to create a proper Cabal package for Pandoc: - - Builds `ASCIIMathML.hs`, `DefaultHeaders.hs`, and `S5.hs` - from templates in `src/templates` and data in `src/ASCIIMathML.js`, - `src/ui`, and `src/headers`. - Stores values of relevant environment variables in `vars` for persistence. - Runs Cabal's "configure" command. * `build-exec`: Builds `pandoc` executable (using Cabal's "build" command) and creates the wrappers `html2markdown` and `markdown2pdf` - from templates in `src/wrappers`. + from templates in `wrappers`. * `build-doc`: Builds program documentation (e.g. `README.html`). * `build-lib-doc`: Builds Haddock documentation for Pandoc libraries. * `install-doc`, `uninstall-doc`: Installs/uninstalls user documentation @@ -4,7 +4,7 @@ # Constant names and commands in source tree #------------------------------------------------------------------------------- CABAL := pandoc.cabal -SRCDIR := src +SRCDIR := . MANDIR := man TESTDIR := tests BUILDDIR := dist @@ -91,10 +91,6 @@ all: build-program %.1: %.1.md $(MAIN) ./$(MAIN) -s -S -w man $< >$@ || rm -f $@ -.PHONY: templates -templates: $(SRCDIR)/templates - $(MAKE) -C $(SRCDIR)/templates - define generate-shell-script echo >&2 "Generating $@..."; \ awk ' \ @@ -118,7 +114,7 @@ $(WRAPPERS): %: $(SRCDIR)/wrappers/%.in $(SRCDIR)/wrappers/*.sh .PHONY: configure cleanup_files+=Setup.hi Setup.o $(BUILDCMD) $(BUILDVARS) -configure: $(BUILDCONF) templates +configure: $(BUILDCONF) $(BUILDCONF): $(CABAL) ghc -package Cabal Setup.hs -o $(BUILDCMD) $(BUILDCMD) configure --prefix=$(PREFIX) @@ -283,7 +279,6 @@ cleanup_files+=$(tarball) tarball: $(tarball) $(tarball): svn export . $(PKGID) - $(MAKE) -C $(PKGID) templates $(MAKE) -C $(PKGID) wrappers tar cvzf $(tarball) $(PKGID) -rm -rf $(PKGID) @@ -343,6 +338,5 @@ distclean: clean fi clean: - make -C $(SRCDIR)/templates clean -if [ -f $(BUILDCONF) ]; then $(BUILDCMD) clean; fi -rm -rf $(cleanup_files) diff --git a/src/Text/Pandoc.hs b/Text/Pandoc.hs index 7633bf7ef..7633bf7ef 100644 --- a/src/Text/Pandoc.hs +++ b/Text/Pandoc.hs diff --git a/src/Text/Pandoc/Blocks.hs b/Text/Pandoc/Blocks.hs index cfc22cb3e..cfc22cb3e 100644 --- a/src/Text/Pandoc/Blocks.hs +++ b/Text/Pandoc/Blocks.hs diff --git a/src/Text/Pandoc/CharacterReferences.hs b/Text/Pandoc/CharacterReferences.hs index 466f5d8f4..466f5d8f4 100644 --- a/src/Text/Pandoc/CharacterReferences.hs +++ b/Text/Pandoc/CharacterReferences.hs diff --git a/src/Text/Pandoc/Definition.hs b/Text/Pandoc/Definition.hs index 7d1125c5a..7d1125c5a 100644 --- a/src/Text/Pandoc/Definition.hs +++ b/Text/Pandoc/Definition.hs diff --git a/Text/Pandoc/Include.hs b/Text/Pandoc/Include.hs new file mode 100644 index 000000000..288706225 --- /dev/null +++ b/Text/Pandoc/Include.hs @@ -0,0 +1,60 @@ +{- +Copyright (C) 2007 John MacFarlane <jgm@berkeley.edu> + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-} + +{- | + Module : Text.Pandoc.Include + Copyright : Copyright (C) 2006-7 John MacFarlane + License : GNU GPL, version 2 or above + + Maintainer : John MacFarlane <jgm@berkeley.edu> + Stability : alpha + Portability : portable + +Template Haskell functions for including contents of files at compile time. +Usage: myConstant = $(includeStrFrom "myfile") +Note that "myfile" need be present only at compile time. +-} +module Text.Pandoc.Include ( includeStrFrom + , s5Path + , asciiMathMLPath + , headerPath + ) where + +import Language.Haskell.TH +import Control.Monad (liftM) +import System.FilePath + +-- path of data files +dataPath = "data" + +-- | Include contents of file as a string. +includeStrFrom :: FilePath -> ExpQ +includeStrFrom fpath = (runIO $ readFile fpath) >>= stringE + +-- | Path of an S5 file. +s5Path :: FilePath -> FilePath +s5Path p = joinPath [dataPath,"ui","default",p] + +-- | Path of ASCIIMathML.js. +asciiMathMLPath :: FilePath +asciiMathMLPath = joinPath [dataPath,"ASCIIMathML.js"] + +-- | Path of headers. +headerPath :: FilePath -> FilePath +headerPath p = joinPath [dataPath,"headers",p] + diff --git a/src/Text/Pandoc/Readers/HTML.hs b/Text/Pandoc/Readers/HTML.hs index 70a071152..70a071152 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/Text/Pandoc/Readers/HTML.hs diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/Text/Pandoc/Readers/LaTeX.hs index 37cc2bfe4..37cc2bfe4 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/Text/Pandoc/Readers/LaTeX.hs diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/Text/Pandoc/Readers/Markdown.hs index df84c0ac7..df84c0ac7 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/Text/Pandoc/Readers/Markdown.hs diff --git a/src/Text/Pandoc/Readers/RST.hs b/Text/Pandoc/Readers/RST.hs index 1239eb688..1239eb688 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/Text/Pandoc/Readers/RST.hs diff --git a/src/Text/Pandoc/Shared.hs b/Text/Pandoc/Shared.hs index f27c3ae75..f27c3ae75 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/Text/Pandoc/Shared.hs diff --git a/src/Text/Pandoc/UTF8.hs b/Text/Pandoc/UTF8.hs index 16bdb9218..16bdb9218 100644 --- a/src/Text/Pandoc/UTF8.hs +++ b/Text/Pandoc/UTF8.hs diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/Text/Pandoc/Writers/ConTeXt.hs index 13912a9f3..13912a9f3 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/Text/Pandoc/Writers/ConTeXt.hs diff --git a/src/templates/DefaultHeaders.hs b/Text/Pandoc/Writers/DefaultHeaders.hs index 1bd9fe1d2..55a189a46 100644 --- a/src/templates/DefaultHeaders.hs +++ b/Text/Pandoc/Writers/DefaultHeaders.hs @@ -35,18 +35,20 @@ module Text.Pandoc.Writers.DefaultHeaders ( defaultRTFHeader ) where import Text.Pandoc.Writers.S5 +import Text.Pandoc.Include ( includeStrFrom, headerPath ) defaultLaTeXHeader :: String -defaultLaTeXHeader = "@LaTeXHeader@" +defaultLaTeXHeader = $(includeStrFrom $ headerPath "LaTeXHeader") defaultConTeXtHeader :: String -defaultConTeXtHeader = "@ConTeXtHeader@" +defaultConTeXtHeader = $(includeStrFrom $ headerPath "ConTeXtHeader") defaultDocbookHeader :: String -defaultDocbookHeader = "@DocbookHeader@" +defaultDocbookHeader = $(includeStrFrom $ headerPath "DocbookHeader") defaultS5Header :: String defaultS5Header = s5Meta ++ s5CSS ++ s5Javascript defaultRTFHeader :: String -defaultRTFHeader = "@RTFHeader@" +defaultRTFHeader = $(includeStrFrom $ headerPath "RTFHeader") + diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/Text/Pandoc/Writers/Docbook.hs index 13dc8585d..13dc8585d 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/Text/Pandoc/Writers/Docbook.hs diff --git a/src/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs index 7ec95d8ef..41e82272d 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/Text/Pandoc/Writers/HTML.hs @@ -29,7 +29,6 @@ Conversion of 'Pandoc' documents to HTML. -} module Text.Pandoc.Writers.HTML ( writeHtml , writeHtmlString ) where import Text.Pandoc.Definition -import Text.Pandoc.ASCIIMathML import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Text.Pandoc.Shared import Text.Regex ( mkRegex, matchRegex ) @@ -39,6 +38,7 @@ import Data.List ( isPrefixOf, intersperse ) import qualified Data.Set as S import Control.Monad.State import Text.XHtml.Transitional +import Text.Pandoc.Include ( includeStrFrom, asciiMathMLPath ) data WriterState = WriterState { stNotes :: [Html] -- ^ List of notes @@ -47,6 +47,8 @@ data WriterState = WriterState , stCSS :: S.Set String -- ^ CSS to include in header } deriving Show +asciiMathMLScript = $(includeStrFrom asciiMathMLPath) + defaultWriterState :: WriterState defaultWriterState = WriterState {stNotes= [], stIds = [], stMath = False, stCSS = S.empty} @@ -104,7 +106,9 @@ writeHtml opts (Pandoc (Meta tit authors date) blocks) = Just path -> script ! [src path, thetype "text/javascript"] $ noHtml - Nothing -> primHtml asciiMathMLScript + Nothing -> script ! + [thetype "text/javascript"] $ + primHtml asciiMathMLScript else noHtml head = header $ metadata +++ math +++ css +++ primHtml (writerHeader opts) diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/Text/Pandoc/Writers/LaTeX.hs index f64e06e24..f64e06e24 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/Text/Pandoc/Writers/LaTeX.hs diff --git a/src/Text/Pandoc/Writers/Man.hs b/Text/Pandoc/Writers/Man.hs index 8e14c2bf0..8e14c2bf0 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/Text/Pandoc/Writers/Man.hs diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/Text/Pandoc/Writers/Markdown.hs index 4cecaae5d..4cecaae5d 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/Text/Pandoc/Writers/Markdown.hs diff --git a/src/Text/Pandoc/Writers/RST.hs b/Text/Pandoc/Writers/RST.hs index ddcbf95c0..ddcbf95c0 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/Text/Pandoc/Writers/RST.hs diff --git a/src/Text/Pandoc/Writers/RTF.hs b/Text/Pandoc/Writers/RTF.hs index 3bd5c63b2..3bd5c63b2 100644 --- a/src/Text/Pandoc/Writers/RTF.hs +++ b/Text/Pandoc/Writers/RTF.hs diff --git a/src/templates/S5.hs b/Text/Pandoc/Writers/S5.hs index a0b69b132..3bcda60d5 100644 --- a/src/templates/S5.hs +++ b/Text/Pandoc/Writers/S5.hs @@ -43,30 +43,33 @@ import Text.Pandoc.Shared ( joinWithSep, WriterOptions ) import Text.Pandoc.Writers.HTML ( writeHtml, writeHtmlString ) import Text.Pandoc.Definition import Text.XHtml.Strict +import Text.Pandoc.Include ( includeStrFrom, s5Path ) s5Meta :: String s5Meta = "<!-- configuration parameters -->\n<meta name=\"defaultView\" content=\"slideshow\" />\n<meta name=\"controlVis\" content=\"hidden\" />\n" s5Javascript :: String -s5Javascript = "<script type=\"text/javascript\">\n@slides.js@</script>\n" +s5Javascript = "<script type=\"text/javascript\">\n" ++ + $(includeStrFrom $ s5Path "slides.js") ++ + "</script>\n" s5CoreCSS :: String -s5CoreCSS = "@s5-core.css@" +s5CoreCSS = $(includeStrFrom $ s5Path "s5-core.css") s5FramingCSS :: String -s5FramingCSS = "@framing.css@" +s5FramingCSS = $(includeStrFrom $ s5Path "framing.css") s5PrettyCSS :: String -s5PrettyCSS = "@pretty.css@" +s5PrettyCSS = $(includeStrFrom $ s5Path "pretty.css") s5OperaCSS :: String -s5OperaCSS = "@opera.css@" +s5OperaCSS = $(includeStrFrom $ s5Path "opera.css") s5OutlineCSS :: String -s5OutlineCSS = "@outline.css@" +s5OutlineCSS = $(includeStrFrom $ s5Path "outline.css") s5PrintCSS :: String -s5PrintCSS = "@print.css@" +s5PrintCSS = $(includeStrFrom $ s5Path "print.css") s5CSS :: String s5CSS = "<style type=\"text/css\" media=\"projection\" id=\"slideProj\">\n" ++ s5CoreCSS ++ "\n" ++ s5FramingCSS ++ "\n" ++ s5PrettyCSS ++ "\n</style>\n<style type=\"text/css\" media=\"projection\" id=\"operaFix\">\n" ++ s5OperaCSS ++ "\n</style>\n<style type=\"text/css\" media=\"screen\" id=\"outlineStyle\">\n" ++ s5OutlineCSS ++ "\n</style>\n<style type=\"text/css\" media=\"print\" id=\"slidePrint\">\n" ++ s5PrintCSS ++ "\n</style>\n" diff --git a/src/ASCIIMathML.js b/data/ASCIIMathML.js index 282cc15fb..282cc15fb 100644 --- a/src/ASCIIMathML.js +++ b/data/ASCIIMathML.js diff --git a/src/headers/ConTeXtHeader b/data/headers/ConTeXtHeader index 41648081c..41648081c 100644 --- a/src/headers/ConTeXtHeader +++ b/data/headers/ConTeXtHeader diff --git a/src/headers/DocbookHeader b/data/headers/DocbookHeader index 7b26b2c73..7b26b2c73 100644 --- a/src/headers/DocbookHeader +++ b/data/headers/DocbookHeader diff --git a/src/headers/LaTeXHeader b/data/headers/LaTeXHeader index d891b5f63..d891b5f63 100644 --- a/src/headers/LaTeXHeader +++ b/data/headers/LaTeXHeader diff --git a/src/headers/RTFHeader b/data/headers/RTFHeader index b4368694b..b4368694b 100644 --- a/src/headers/RTFHeader +++ b/data/headers/RTFHeader diff --git a/src/headers/S5Header b/data/headers/S5Header index ebb24ebe2..ebb24ebe2 100644 --- a/src/headers/S5Header +++ b/data/headers/S5Header diff --git a/src/ui/default/blank.gif b/data/ui/default/blank.gif Binary files differindex 75b945d25..75b945d25 100644 --- a/src/ui/default/blank.gif +++ b/data/ui/default/blank.gif diff --git a/src/ui/default/bodybg.gif b/data/ui/default/bodybg.gif Binary files differindex 5f448a16f..5f448a16f 100644 --- a/src/ui/default/bodybg.gif +++ b/data/ui/default/bodybg.gif diff --git a/src/ui/default/framing.css b/data/ui/default/framing.css index 14d8509e9..14d8509e9 100644 --- a/src/ui/default/framing.css +++ b/data/ui/default/framing.css diff --git a/src/ui/default/iepngfix.htc b/data/ui/default/iepngfix.htc index bba2db756..bba2db756 100644 --- a/src/ui/default/iepngfix.htc +++ b/data/ui/default/iepngfix.htc diff --git a/src/ui/default/opera.css b/data/ui/default/opera.css index 9e9d2a3c5..9e9d2a3c5 100644 --- a/src/ui/default/opera.css +++ b/data/ui/default/opera.css diff --git a/src/ui/default/outline.css b/data/ui/default/outline.css index 62db519ed..62db519ed 100644 --- a/src/ui/default/outline.css +++ b/data/ui/default/outline.css diff --git a/src/ui/default/pretty.css b/data/ui/default/pretty.css index 3d3acefff..3d3acefff 100644 --- a/src/ui/default/pretty.css +++ b/data/ui/default/pretty.css diff --git a/src/ui/default/print.css b/data/ui/default/print.css index 4a3554ddd..4a3554ddd 100644 --- a/src/ui/default/print.css +++ b/data/ui/default/print.css diff --git a/src/ui/default/s5-core.css b/data/ui/default/s5-core.css index 86444e041..86444e041 100644 --- a/src/ui/default/s5-core.css +++ b/data/ui/default/s5-core.css diff --git a/src/ui/default/slides.css b/data/ui/default/slides.css index 0786d7dbd..0786d7dbd 100644 --- a/src/ui/default/slides.css +++ b/data/ui/default/slides.css diff --git a/src/ui/default/slides.js b/data/ui/default/slides.js index 38fe8531c..38fe8531c 100644 --- a/src/ui/default/slides.js +++ b/data/ui/default/slides.js diff --git a/pandoc.cabal b/pandoc.cabal index a37d0029c..887af2388 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -31,15 +31,14 @@ Description: Pandoc is a Haskell library for converting from one markup which convert this native representation into a target format. Thus, adding an input or output format requires only adding a reader or writer. -Build-Depends: base, parsec, xhtml, mtl, regex-compat, network -Hs-Source-Dirs: src +Build-Depends: base, parsec, xhtml, mtl, regex-compat, network, template-haskell, filepath +Hs-Source-Dirs: . Exposed-Modules: Text.Pandoc, Text.Pandoc.Blocks, Text.Pandoc.Definition, Text.Pandoc.CharacterReferences, Text.Pandoc.Shared, Text.Pandoc.UTF8, - Text.Pandoc.ASCIIMathML, Text.Pandoc.Readers.HTML, Text.Pandoc.Readers.LaTeX, Text.Pandoc.Readers.Markdown, @@ -54,9 +53,10 @@ Exposed-Modules: Text.Pandoc, Text.Pandoc.Writers.RST, Text.Pandoc.Writers.RTF, Text.Pandoc.Writers.S5 -Ghc-Options: -O0 +Other-Modules: Text.Pandoc.Include +Ghc-Options: -O0 -fth Executable: pandoc -Hs-Source-Dirs: src +Hs-Source-Dirs: . Main-Is: Main.hs -Ghc-Options: -O0 +Ghc-Options: -O0 -fth diff --git a/src/templates/ASCIIMathML.hs b/src/templates/ASCIIMathML.hs deleted file mode 100644 index 1d04c6ff7..000000000 --- a/src/templates/ASCIIMathML.hs +++ /dev/null @@ -1,7 +0,0 @@ --- | Definitions for use of ASCIIMathML in HTML. --- (See <http://www1.chapman.edu/~jipsen/mathml/asciimath.html>.) -module Text.Pandoc.ASCIIMathML ( asciiMathMLScript ) where - --- | String containing ASCIIMathML javascript. -asciiMathMLScript :: String -asciiMathMLScript = "<script type=\"text/javascript\">\n@ASCIIMathML.js@</script>\n" diff --git a/src/templates/Makefile b/src/templates/Makefile deleted file mode 100644 index 9522666c5..000000000 --- a/src/templates/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -VPATH := .. -PROCESSOR := ./fillTemplates.pl -TARGETS := Text/Pandoc/ASCIIMathML.hs \ - Text/Pandoc/Writers/S5.hs \ - Text/Pandoc/Writers/DefaultHeaders.hs - -all: $(TARGETS) - -Text/Pandoc/ASCIIMathML.hs: ASCIIMathML.hs $(PROCESSOR) $(VPATH)/ASCIIMathML.js - perl $(PROCESSOR) $@ $(VPATH) - -Text/Pandoc/Writers/S5.hs: S5.hs $(PROCESSOR) $(VPATH)/ui/default/* - perl $(PROCESSOR) $@ $(VPATH) - -Text/Pandoc/Writers/DefaultHeaders.hs: DefaultHeaders.hs $(PROCESSOR) $(VPATH)/headers/* - perl $(PROCESSOR) $@ $(VPATH) - -.PHONY: clean -clean: - cd $(VPATH); rm -f $(TARGETS) diff --git a/src/templates/fillTemplates.pl b/src/templates/fillTemplates.pl deleted file mode 100755 index 85e6eaa18..000000000 --- a/src/templates/fillTemplates.pl +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env perl -# Fills templates with haskell-escaped strings slurped from input files. -# Takes two arguments, the first specifying the pathname of the target -# relative to the root directory, the second specifying the root directory -# (defaulting to ..). The template is assumed to have the same base name -# as the target and to reside in the templates subdirectory of the root -# directory. - -use strict; -use warnings; - -# Utility routines: - -sub slurp { - open FILE, $_[0] or die "couldn't open file '$_[0]': $!"; - my $contents = do { local $/; <FILE>;}; - close FILE; - return $contents; -} - -sub escape_for_haskell { - my ($contents) = @_; - - $contents =~ s/\\/\\\\/g; - $contents =~ s/\t/\\t/g; - $contents =~ s/"/\\"/g; - $contents =~ s/\n/\\n/g; - return $contents; -} - -# Template processors. - -my %processor = ( - # -------------------------------------------------------------------------- - 'Text/Pandoc/Writers/S5.hs' => { - # -------------------------------------------------------------------------- - proc => sub { - my ($template) = @_; - - my (@files) = qw(slides.js s5-core.css framing.css pretty.css - opera.css outline.css print.css); - - foreach my $file (@files) { - my $replacement = escape_for_haskell(slurp "ui/default/$file"); - my $escapedfile = $file; - $escapedfile =~ s/\./\\./g; - $template =~ s/\@$escapedfile\@/$replacement/; - } - return $template; - }, - }, - # -------------------------------------------------------------------------- - 'Text/Pandoc/ASCIIMathML.hs' => { - # -------------------------------------------------------------------------- - proc => sub { - my ($template) = @_; - - my $script = escape_for_haskell(slurp "ASCIIMathML.js"); - my $acknowledgements = - " ASCIIMathML.js - copyright Peter Jipsen,". - " released under the GPL\\nSee ". - "http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ "; - $script =~ s/\/\*.*?\*\//\/\*$acknowledgements\*\//g; # strip comments - $template =~ s/\@ASCIIMathML\.js@/$script/; - - return $template; - }, - }, - # -------------------------------------------------------------------------- - 'Text/Pandoc/Writers/DefaultHeaders.hs' => { - # -------------------------------------------------------------------------- - proc => sub { - my ($template) = @_; - - my (@headers) = split(/\s/,`ls headers`); - foreach my $header (@headers) { - my ($replacement) = escape_for_haskell(slurp "headers/$header"); - $template =~ s/\@$header\@/$replacement/; - } - - return $template; - }, - }, - # -------------------------------------------------------------------------- - # 'foo/bar/baz' => { - # -------------------------------------------------------------------------- - # template => 'optional-template-filename-defaults-to-baz' - # proc => sub { - # my ($template) = @_; - # # Process. - # return $template; - # }, - #}, -); - -# Main. - -my $target = shift @ARGV; -if (!defined $target || !length $target) { - print STDERR "Available targets:\n\n" . join "\n", keys %processor; - die "\n\nYou must supply a target!\n"; -} - -die "No processor exists for '$target'!\n" if ! exists $processor{$target}; - -my $rootdir = shift @ARGV || '..'; -chdir $rootdir or die "Couldn't chdir to '$rootdir': $!"; - -my $template; -if (exists $processor{$target}->{template}) { - $template = $processor{$target}->{template}; -} -else { - ($template = $target) =~ s!.*/+!!; -} -$template = "templates/$template"; -die "No template exists for '$target'!\n" if ! -f "$template"; - -open OUTFILE, ">$target" or die "couldn't open file '$target': $!"; -print OUTFILE <<END; ----------------------------------------------------- --- Do not edit this file by hand. Edit --- '$template' --- and run $0 $target ----------------------------------------------------- - -END - -print OUTFILE $processor{$target}->{proc}->(slurp($template)); -print OUTFILE "\n"; -close OUTFILE; diff --git a/tests/s5.fancy.html b/tests/s5.fancy.html index 5e6e1b243..e6030502d 100644 --- a/tests/s5.fancy.html +++ b/tests/s5.fancy.html @@ -8,9 +8,38 @@ /><meta name="author" content="Sam Smith" /><meta name="author" content="Jen Jones" /><meta name="date" content="July 15, 2006" - /><script type="text/javascript"> -/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL -See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */ + /><script type="text/javascript" + >/* +ASCIIMathML.js +============== +This file contains JavaScript functions to convert ASCII math notation +to Presentation MathML. The conversion is done while the (X)HTML page +loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet +Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/). +Just add the next line to your (X)HTML page with this file in the same folder: +<script type="text/javascript" src="ASCIIMathML.js"></script> +This is a convenient and inexpensive solution for authoring MathML. + +Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen +Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js +For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt +If you use it on a webpage, please send the URL to jipsen@chapman.edu + +Modified July 2006 by John MacFarlane (added CODE to list of contexts +in which replacement does not occur, modified AMisMathMLAvailable +to better identify Safari browser, changed mathcolor to ""). + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License (at http://www.gnu.org/copyleft/gpl.html) +for more details. +*/ var checkForMathML = true; // check if browser can display MathML var notifyIfNoMathML = true; // display note if no MathML capability @@ -59,8 +88,7 @@ function AMnoMathMLNote() { } function AMisMathMLavailable() { - var regex = /KHTML/; /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL -See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */ + var regex = /KHTML/; /* This line and the next two modified by JM for better Safari detection */ if (navigator.appName.slice(0,8)=="Netscape") if (navigator.appVersion.slice(0,1)>="5" && !regex.test(navigator.userAgent)) return null; else return AMnoMathMLNote(); @@ -443,8 +471,16 @@ function AMremoveBrackets(node) { } } -/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL -See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */ +/*Parsing ASCII math expressions with the following grammar +v ::= [A-Za-z] | greek letters | numbers | other constant symbols +u ::= sqrt | text | bb | other unary symbols for font commands +b ::= frac | root | stackrel binary symbols +l ::= ( | [ | { | (: | {: left brackets +r ::= ) | ] | } | :) | :} right brackets +S ::= v | lEr | uS | bSS Simple expression +I ::= S_S | S^S | S_S^S | S Intermediate expression +E ::= IE | I/I Expression +Each terminal symbol is translated into a corresponding mathml node.*/ var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol; @@ -783,8 +819,7 @@ function AMprocessNodeR(n, linebreaks) { if ((n.nodeType!=8 || linebreaks) && n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" && n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" && - n.parentNode.nodeName!="code" && n.parentNode.nodeName!="CODE" && /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL -See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */ + n.parentNode.nodeName!="code" && n.parentNode.nodeName!="CODE" && /* added by JM */ n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") { str = n.nodeValue; if (!(str == null)) { @@ -919,8 +954,8 @@ else window.onload = generic; } } -</script> -<!-- configuration parameters --> +</script + ><!-- configuration parameters --> <meta name="defaultView" content="slideshow" /> <meta name="controlVis" content="hidden" /> <style type="text/css" media="projection" id="slideProj"> diff --git a/src/wrappers/common.sh b/wrappers/common.sh index 9605f5940..9605f5940 100644 --- a/src/wrappers/common.sh +++ b/wrappers/common.sh diff --git a/src/wrappers/hsmarkdown.in b/wrappers/hsmarkdown.in index 17f970234..17f970234 100644 --- a/src/wrappers/hsmarkdown.in +++ b/wrappers/hsmarkdown.in diff --git a/src/wrappers/html2markdown.in b/wrappers/html2markdown.in index 0f4297128..0f4297128 100644 --- a/src/wrappers/html2markdown.in +++ b/wrappers/html2markdown.in diff --git a/src/wrappers/markdown2pdf.in b/wrappers/markdown2pdf.in index 37be69469..37be69469 100644 --- a/src/wrappers/markdown2pdf.in +++ b/wrappers/markdown2pdf.in diff --git a/src/wrappers/tempdir.sh b/wrappers/tempdir.sh index f25ae7f51..f25ae7f51 100644 --- a/src/wrappers/tempdir.sh +++ b/wrappers/tempdir.sh |