pandoc 0.46 → 1.0
raw patch · 195 files changed
+11592/−17487 lines, 195 filesdep +bytestringdep +citeproc-hsdep +directorydep −regex-compatdep ~basedep ~containersdep ~mtlsetup-changedbinary-addedPVP ok
version bump matches the API change (PVP)
Dependencies added: bytestring, citeproc-hs, directory, filepath, highlighting-kate, old-time, process, template-haskell, utf8-string, zip-archive
Dependencies removed: regex-compat
Dependency ranges changed: base, containers, mtl, network, parsec, pretty, xhtml
API changes (from Hackage documentation)
- Text.Pandoc.ASCIIMathML: asciiMathMLScript :: String
- Text.Pandoc.Readers.LaTeX: rawLaTeXEnvironment :: GenParser Char st Block
- Text.Pandoc.Shared: ASCIIMathML :: (Maybe String) -> HTMLMathMethod
- Text.Pandoc.Shared: joinWithSep :: [a] -> [[a]] -> [a]
- Text.Pandoc.UTF8: fromUTF8 :: String -> String
- Text.Pandoc.UTF8: toUTF8 :: String -> String
- Text.Pandoc.Writers.DefaultHeaders: defaultConTeXtHeader :: String
- Text.Pandoc.Writers.DefaultHeaders: defaultDocbookHeader :: String
- Text.Pandoc.Writers.DefaultHeaders: defaultLaTeXHeader :: String
- Text.Pandoc.Writers.DefaultHeaders: defaultRTFHeader :: String
- Text.Pandoc.Writers.DefaultHeaders: defaultS5Header :: String
+ Text.Pandoc: writeMediaWiki :: WriterOptions -> Pandoc -> String
+ Text.Pandoc: writeOpenDocument :: WriterOptions -> Pandoc -> String
+ Text.Pandoc: writeTexinfo :: WriterOptions -> Pandoc -> String
+ Text.Pandoc.DefaultHeaders: defaultConTeXtHeader :: String
+ Text.Pandoc.DefaultHeaders: defaultDocbookHeader :: String
+ Text.Pandoc.DefaultHeaders: defaultLaTeXHeader :: String
+ Text.Pandoc.DefaultHeaders: defaultOpenDocumentHeader :: String
+ Text.Pandoc.DefaultHeaders: defaultRTFHeader :: String
+ Text.Pandoc.DefaultHeaders: defaultS5Header :: String
+ Text.Pandoc.Definition: Cite :: [Target] -> [Inline] -> Inline
+ Text.Pandoc.Definition: DisplayMath :: MathType
+ Text.Pandoc.Definition: InlineMath :: MathType
+ Text.Pandoc.Definition: SmallCaps :: [Inline] -> Inline
+ Text.Pandoc.Definition: data MathType
+ Text.Pandoc.Definition: instance Data Alignment
+ Text.Pandoc.Definition: instance Data Block
+ Text.Pandoc.Definition: instance Data Inline
+ Text.Pandoc.Definition: instance Data ListNumberDelim
+ Text.Pandoc.Definition: instance Data ListNumberStyle
+ Text.Pandoc.Definition: instance Data MathType
+ Text.Pandoc.Definition: instance Data Meta
+ Text.Pandoc.Definition: instance Data Pandoc
+ Text.Pandoc.Definition: instance Data QuoteType
+ Text.Pandoc.Definition: instance Eq MathType
+ Text.Pandoc.Definition: instance Read MathType
+ Text.Pandoc.Definition: instance Show MathType
+ Text.Pandoc.Definition: instance Typeable Alignment
+ Text.Pandoc.Definition: instance Typeable Block
+ Text.Pandoc.Definition: instance Typeable Inline
+ Text.Pandoc.Definition: instance Typeable ListNumberDelim
+ Text.Pandoc.Definition: instance Typeable ListNumberStyle
+ Text.Pandoc.Definition: instance Typeable MathType
+ Text.Pandoc.Definition: instance Typeable Meta
+ Text.Pandoc.Definition: instance Typeable Pandoc
+ Text.Pandoc.Definition: instance Typeable QuoteType
+ Text.Pandoc.Definition: processPandoc :: (Typeable a) => (a -> a) -> Pandoc -> Pandoc
+ Text.Pandoc.Definition: queryPandoc :: (Typeable a) => (a -> [b]) -> Pandoc -> [b]
+ Text.Pandoc.Definition: type Attr = (String, [String], [(String, String)])
+ Text.Pandoc.Highlighting: defaultHighlightingCss :: String
+ Text.Pandoc.Highlighting: highlightHtml :: Attr -> String -> Either String Html
+ Text.Pandoc.Highlighting: languages :: [String]
+ Text.Pandoc.LaTeXMathML: latexMathMLScript :: String
+ Text.Pandoc.ODT: saveOpenDocumentAsODT :: FilePath -> FilePath -> String -> IO ()
+ Text.Pandoc.Readers.HTML: unsanitaryURI :: String -> Bool
+ Text.Pandoc.Readers.LaTeX: rawLaTeXEnvironment' :: GenParser Char st String
+ Text.Pandoc.Shared: LaTeXMathML :: (Maybe String) -> HTMLMathMethod
+ Text.Pandoc.Shared: Pad :: Doc -> BlockWrapper
+ Text.Pandoc.Shared: Reg :: Doc -> BlockWrapper
+ Text.Pandoc.Shared: data BlockWrapper
+ Text.Pandoc.Shared: inDirectory :: FilePath -> IO a -> IO a
+ Text.Pandoc.Shared: wrappedBlocksToDoc :: [BlockWrapper] -> Doc
+ Text.Pandoc.Writers.MediaWiki: writeMediaWiki :: WriterOptions -> Pandoc -> String
+ Text.Pandoc.Writers.OpenDocument: instance Eq TextStyle
+ Text.Pandoc.Writers.OpenDocument: writeOpenDocument :: WriterOptions -> Pandoc -> String
+ Text.Pandoc.Writers.Texinfo: writeTexinfo :: WriterOptions -> Pandoc -> String
- Text.Pandoc.Definition: CodeBlock :: String -> Block
+ Text.Pandoc.Definition: CodeBlock :: Attr -> String -> Block
- Text.Pandoc.Definition: Math :: String -> Inline
+ Text.Pandoc.Definition: Math :: MathType -> String -> Inline
- Text.Pandoc.Definition: Table :: [Inline] -> [Alignment] -> [Float] -> [[Block]] -> [[[Block]]] -> Block
+ Text.Pandoc.Definition: Table :: [Inline] -> [Alignment] -> [Double] -> [[Block]] -> [[[Block]]] -> Block
- Text.Pandoc.Readers.HTML: htmlBlockElement :: ParsecT [Char] ParserState Identity [Char]
+ Text.Pandoc.Readers.HTML: htmlBlockElement :: GenParser Char ParserState [Char]
- Text.Pandoc.Readers.HTML: rawHtmlInline :: ParsecT [Char] ParserState Identity Inline
+ Text.Pandoc.Readers.HTML: rawHtmlInline :: GenParser Char ParserState Inline
Files
- BUGS +0/−2
- COPYRIGHT +97/−0
- INSTALL +165/−69
- Main.hs +211/−128
- Makefile +20/−76
- PROFILING +0/−8
- README +189/−125
- RELEASE-CHECKLIST +0/−39
- Setup.hs +58/−1
- Text/Pandoc.hs +14/−10
- Text/Pandoc/ASCIIMathML.hs +0/−14
- Text/Pandoc/Biblio.hs +66/−0
- Text/Pandoc/Blocks.hs +5/−4
- Text/Pandoc/CharacterReferences.hs +2/−2
- Text/Pandoc/DefaultHeaders.hs +69/−0
- Text/Pandoc/Definition.hs +33/−13
- Text/Pandoc/Highlighting.hs +64/−0
- Text/Pandoc/LaTeXMathML.hs +14/−0
- Text/Pandoc/ODT.hs +88/−0
- Text/Pandoc/Readers/HTML.hs +122/−33
- Text/Pandoc/Readers/LaTeX.hs +215/−108
- Text/Pandoc/Readers/Markdown.hs +377/−97
- Text/Pandoc/Readers/RST.hs +99/−29
- Text/Pandoc/Readers/TeXMath.hs +14/−3
- Text/Pandoc/Shared.hs +63/−24
- Text/Pandoc/TH.hs +65/−0
- Text/Pandoc/UTF8.hs +0/−45
- Text/Pandoc/Writers/ConTeXt.hs +42/−48
- Text/Pandoc/Writers/DefaultHeaders.hs +0/−59
- Text/Pandoc/Writers/Docbook.hs +46/−85
- Text/Pandoc/Writers/HTML.hs +128/−72
- Text/Pandoc/Writers/LaTeX.hs +29/−19
- Text/Pandoc/Writers/Man.hs +35/−29
- Text/Pandoc/Writers/Markdown.hs +39/−31
- Text/Pandoc/Writers/MediaWiki.hs +396/−0
- Text/Pandoc/Writers/OpenDocument.hs +568/−0
- Text/Pandoc/Writers/RST.hs +29/−34
- Text/Pandoc/Writers/RTF.hs +44/−41
- Text/Pandoc/Writers/S5.hs +40/−23
- Text/Pandoc/Writers/Texinfo.hs +474/−0
- Text/Pandoc/XML.hs +88/−0
- changelog +1679/−0
- data/LaTeXMathML.js.comment +16/−0
- data/LaTeXMathML.js.packed +191/−0
- data/headers/ConTeXt.header +70/−0
- data/headers/Docbook.header +3/−0
- data/headers/LaTeX.header +6/−0
- data/headers/OpenDocument.header +1/−0
- data/headers/RTF.header +4/−0
- data/headers/S5.header +3/−0
- data/ui/default/framing.css +23/−0
- data/ui/default/opera.css +7/−0
- data/ui/default/outline.css +15/−0
- data/ui/default/pretty.css +86/−0
- data/ui/default/print.css +24/−0
- data/ui/default/s5-core.css +9/−0
- data/ui/default/slides.js.comment +4/−0
- data/ui/default/slides.js.packed +74/−0
- debian/changelog +0/−1366
- debian/compat +0/−1
- debian/control +0/−88
- debian/copyright +0/−82
- debian/pandoc-doc.doc-base +0/−11
- debian/pandoc-doc.docs +0/−1
- debian/pandoc.dirs +0/−1
- debian/rules +0/−126
- freebsd/Makefile.in +0/−44
- freebsd/pkg-descr +0/−19
- macports/Portfile.in +0/−59
- man/man1/hsmarkdown.1.md +2/−2
- man/man1/html2markdown.1.md +6/−10
- man/man1/markdown2pdf.1.md +3/−3
- man/man1/pandoc.1.md +28/−19
- odt-styles/META-INF/manifest.xml +22/−0
- odt-styles/Thumbnails/thumbnail.png binary
- odt-styles/meta.xml +1/−0
- odt-styles/mimetype +1/−0
- odt-styles/settings.xml +2/−0
- odt-styles/styles.xml +2/−0
- pandoc.cabal +147/−18
- pandoc.cabal.ghc66 +0/−63
- templates/ASCIIMathML.hs +0/−7
- templates/ASCIIMathML.js +0/−3363
- templates/DefaultHeaders.hs +0/−52
- templates/Makefile +0/−20
- templates/S5.hs +0/−133
- templates/fillTemplates.pl +0/−131
- templates/headers/ConTeXtHeader +0/−67
- templates/headers/DocbookHeader +0/−3
- templates/headers/LaTeXHeader +0/−5
- templates/headers/RTFHeader +0/−4
- templates/headers/S5Header +0/−3
- templates/ui/default/blank.gif binary
- templates/ui/default/bodybg.gif binary
- templates/ui/default/framing.css +0/−23
- templates/ui/default/iepngfix.htc +0/−42
- templates/ui/default/opera.css +0/−7
- templates/ui/default/outline.css +0/−15
- templates/ui/default/pretty.css +0/−86
- templates/ui/default/print.css +0/−24
- templates/ui/default/s5-core.css +0/−9
- templates/ui/default/slides.css +0/−3
- templates/ui/default/slides.js +0/−553
- tests/Diff.hs +76/−0
- tests/MarkdownTest_1.0.3/MarkdownTest.pl +0/−176
- tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html +0/−17
- tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text +0/−21
- tests/MarkdownTest_1.0.3/Tests/Auto links.html +0/−18
- tests/MarkdownTest_1.0.3/Tests/Auto links.text +0/−13
- tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html +0/−118
- tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text +0/−120
- tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html +0/−15
- tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text +0/−11
- tests/MarkdownTest_1.0.3/Tests/Code Blocks.html +0/−18
- tests/MarkdownTest_1.0.3/Tests/Code Blocks.text +0/−14
- tests/MarkdownTest_1.0.3/Tests/Code Spans.html +0/−6
- tests/MarkdownTest_1.0.3/Tests/Code Spans.text +0/−6
- tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html +0/−8
- tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text +0/−8
- tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html +0/−71
- tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text +0/−67
- tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html +0/−15
- tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text +0/−15
- tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html +0/−72
- tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text +0/−69
- tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html +0/−13
- tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text +0/−13
- tests/MarkdownTest_1.0.3/Tests/Links, inline style.html +0/−11
- tests/MarkdownTest_1.0.3/Tests/Links, inline style.text +0/−12
- tests/MarkdownTest_1.0.3/Tests/Links, reference style.html +0/−52
- tests/MarkdownTest_1.0.3/Tests/Links, reference style.text +0/−71
- tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html +0/−9
- tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text +0/−20
- tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html +0/−3
- tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text +0/−7
- tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html +0/−314
- tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text +0/−306
- tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html +0/−942
- tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text +0/−888
- tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html +0/−9
- tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text +0/−5
- tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html +0/−148
- tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text +0/−131
- tests/MarkdownTest_1.0.3/Tests/Strong and em together.html +0/−7
- tests/MarkdownTest_1.0.3/Tests/Strong and em together.text +0/−7
- tests/MarkdownTest_1.0.3/Tests/Tabs.html +0/−25
- tests/MarkdownTest_1.0.3/Tests/Tabs.text +0/−21
- tests/MarkdownTest_1.0.3/Tests/Tidyness.html +0/−8
- tests/MarkdownTest_1.0.3/Tests/Tidyness.text +0/−5
- tests/RunTests.hs +123/−0
- tests/generate.sh +0/−12
- tests/html-reader.native +11/−11
- tests/latex-reader.native +20/−20
- tests/markdown-reader-more.native +8/−0
- tests/markdown-reader-more.txt +24/−0
- tests/rst-reader.native +5/−5
- tests/runtests.pl +0/−110
- tests/s5.basic.html +77/−550
- tests/s5.fancy.html +468/−3964
- tests/s5.native +1/−1
- tests/tables.mediawiki +123/−0
- tests/tables.opendocument +466/−0
- tests/tables.texinfo +124/−0
- tests/testsuite.native +23/−23
- tests/testsuite.txt +3/−2
- tests/writer.context +130/−80
- tests/writer.docbook +140/−8
- tests/writer.html +25/−34
- tests/writer.latex +98/−96
- tests/writer.man +11/−7
- tests/writer.markdown +7/−6
- tests/writer.mediawiki +604/−0
- tests/writer.native +23/−23
- tests/writer.opendocument +1563/−0
- tests/writer.rst +7/−6
- tests/writer.rtf +35/−35
- tests/writer.texinfo +960/−0
- web/Makefile +0/−37
- web/S5DEMO +0/−19
- web/config.xsl +0/−9
- web/css +0/−8
- web/demos +0/−85
- web/docbook.css +0/−29
- web/footer.html +0/−4
- web/html2x.txt +0/−55
- web/index.txt.in +0/−169
- web/math.txt +0/−17
- web/mkdemos.pl +0/−34
- web/myheader.tex +0/−5
- web/pandoc.css +0/−75
- wrappers/common.sh +0/−43
- wrappers/hsmarkdown.in +0/−5
- wrappers/html2markdown.in +0/−162
- wrappers/markdown2pdf.in +0/−81
- wrappers/tempdir.sh +0/−18
− BUGS
@@ -1,2 +0,0 @@-To view a list of known bugs, or to enter a bug report, please use-Pandoc's issue tracker: <http://code.google.com/p/pandoc/issues/list>
+ COPYRIGHT view
@@ -0,0 +1,97 @@+Pandoc+Copyright (C) 2006-8 John MacFarlane <jgm at berkeley dot edu>++This code is released under the [GPL], version 2 or later:++ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA++The GNU General Public License is available in the file COPYING in+the source distribution. On Debian systems, the complete text of the+GPL can be found in `/usr/share/common-licenses/GPL`.++[GPL]: http://www.gnu.org/copyleft/gpl.html++Pandoc's complete source code is available from the [Pandoc home page].++[Pandoc home page]: http://johnmacfarlane.net/pandoc/++Pandoc includes some code from other authors. The copyright and license+statements for these sources are included below. All are GPL-compatible+licenses.++----------------------------------------------------------------------+Text/Pandoc/Writers/Texinfo.hs+Copyright (C) 2008 John MacFarlane and Peter Wang++Released under the GPL.++----------------------------------------------------------------------+Text/Pandoc/Writers/OpenDocument.hs+Copyright (C) 2008 Andrea Rossato++Released under the GPL.++----------------------------------------------------------------------+ASCIIMathML.js+Copyright 2005, Peter Jipsen, Chapman University+<http://www1.chapman.edu/~jipsen/mathml/asciimath.html>++Released under the GPL.++----------------------------------------------------------------------+S5 slides.js and css files +by Eric A. Meyer+<http://meyerweb.com/eric/tools/s5++Released under an explicit Public Domain License++------------------------------------------------------------------------+Diff.hs in tests/+from the Diff package v 0.1.2 (Data.Algorithm.Diff)+Copyright (c) Stering Clover 2008++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+SUCH DAMAGE.++------------------------------------------------------------------------+windows/modpath.iss+Copyright (c) 2007 Jared Breland+http://legroom.net/software++Released under the GPL.+
INSTALL view
@@ -1,42 +1,85 @@ % Installing pandoc -Installing from Source-======================--This method will work on all architectures, but requires that you first-install the GHC compiler and some build tools: [GNU `make`], `sed`,-`bash`, and `perl`. These are standard on unix systems (including MacOS-X). If you're using Windows, you can install [Cygwin].+Installing pandoc from Source+============================= -[Cygwin]: http://www.cygwin.com/-[GNU `make`]: http://www.gnu.org/software/make/+This method will work on all architectures for which the GHC compiler+is available. Installing GHC -------------- -To compile Pandoc, you'll need [GHC] version 6.6 or greater. If-you don't have GHC already, you can get it from the [GHC Download]-page. If you're running MacOS X, you can also install GHC using-[MacPorts] or [Fink].+To compile Pandoc, you'll need [GHC] version 6.8 or greater. If you+don't have GHC already, you can get it from the [GHC Download] page.+If you're compiling GHC from source, be sure to get the `extralibs`+in addition to the base tarball. Pandoc requires Cabal version 1.2 or+greater. If your GHC comes with an older version of Cabal, you'll need+to to [install Cabal] separately. You can check your Cabal version using+`ghc-pkg list`. +If you're running MacOS X, you can also install GHC using [MacPorts] or [Fink].++If you're on a [debian]-based linux system (such as [Ubuntu]), you can get+GHC and some required libraries using `apt-get`:+ + sudo apt-get install ghc6 libghc6-xhtml-dev libghc6-mtl-dev libghc6-network-dev+ [GHC]: http://www.haskell.org/ghc/ [GHC Download]: http://www.haskell.org/ghc/download.html+[Cabal]: http://www.haskell.org/cabal/+[install Cabal]: http://www.haskell.org/cabal/download.html [MacPorts]: http://macports.org [Fink]: http://finkproject.org+[Ubuntu]: http://www.ubuntu.com+[debian]: http://www.debian.org/ +Installing prerequisites+------------------------++Pandoc needs the `utf8-string` and `zip-archive` to compile.+Check your packaging system to see if they are included.+If not, you will need to compile them from source.++On \*nix systems, the easiest way to do this is to install+the [cabal-install] tool. See the section [Quick Installation+on Unix] for instructions. If you use [MacPorts], you can+just install the `hs-cabal` port.++[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall+[Quick Installation on Unix]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall#QuickInstallationonUnix++Once you've got `cabal-install` installed, you can install the+needed libraries by doing++ cabal install utf8-string+ cabal install zip-archive++Alternatively, you can install these libraries using the [standard+Cabal method], but you will have to install their dependencies manually.++[standard Cabal method]: http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package+ Getting the source ------------------ -Download the source tarball from pandoc's [pandoc's google code site].+Download the source tarball from [pandoc's google code site]. Extract the contents into a subdirectory: - tar xvzf pandoc-0.xy.tar.gz+ tar xvzf pandoc-x.y.tar.gz [pandoc's google code site]: http://pandoc.googlecode.com -Installing Pandoc------------------+Now choose one of the following methods for compiling and installing+pandoc. If you are on a linux or unix-based system, you can [install+pandoc using Make]. If not, you should [install pandoc using Cabal]. +[install pandoc using Make]: #installing-pandoc-using-make+[install pandoc using Cabal]: #installing-pandoc-using-cabal+[build options]: #build-options++Installing Pandoc using Make+----------------------------+ 1. Change to the directory containing the Pandoc distribution. 2. Compile:@@ -46,18 +89,17 @@ If you get "Unknown modifier" errors, it is probably because `make` on your system is not [GNU `make`]. Try using `gmake` instead. -3. See if it worked (optional, but recommended): + If you get a message saying that the `zip-archive` or `utf8-string`+ libraries cannot be found, and you have installed these using+ `cabal-install`, it is probably because by default `cabal-install`+ installs libraries to the user's directory rather than globally.+ Try again with - make test+ CABALOPTS=--user make - Note: if you see errors like the following, they're due to differences- between different versions of the xhtml library, and can safely be- disregarded:+3. See if it worked (optional, but recommended): - 2c2- < <html xmlns="http://www.w3.org/1999/xhtml"- ---- > <html+ make test 4. Install: @@ -84,19 +126,90 @@ Note that building the library documentation requires [haddock]. +6. If you decide you don't want pandoc on your system, each of the+ installation steps described above can be reversed:++ sudo make uninstall++ PREFIX=~ make uninstall-exec++ sudo make uninstall-all+ [haddock]: http://www.haskell.org/haddock/ -Removing Pandoc----------------+Installing pandoc using Cabal+----------------------------- -Each of the installation steps described above can be reversed:+Change to the directory containing the pandoc source, and type: - sudo make uninstall+ runhaskell Setup configure # add --user if you have installed prerequisites+ # locally using cabal-install+ runhaskell Setup build+ runhaskell Setup haddock # optional, to build library documentation+ runhaskell Setup test # optional, to run test suite+ runhaskell Setup install # this one as root or sudo, or add --user - PREFIX=~ make uninstall-exec+This will install the pandoc executable and the Haskell libraries,+but not the shell scripts, man pages, or other documentation. - sudo make uninstall-all+You may just want the executable, or just the libraries. This+can be controlled with configuration flags (the `-` negates the+flag): + runhaskell Setup configure -f-library # just the executable+ runhaskell Setup configure -f-executable # just the libraries++You can also specify the directory tree into which pandoc will be+installed using the `--prefix=` option to `configure`. For more details,+see the [Cabal User's Guide].++[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths++Optional syntax highlighting support+------------------------------------++Pandoc can optionally be compiled with support for syntax highlighting of+delimited code blocks. This feature requires the [`highlighting-kate` library].+If you are using Cabal to compile pandoc, specify the `highlighting` flag in+the configure step:++ runhaskell Setup configure -fhighlighting++If you are using the Makefile:++ CABALOPTS=-fhighlighting make++If you have already built pandoc, you may need to do a `make clean` or+`runhaskell Setup clean` first.++[`highlighting-kate` library]: http://johnmacfarlane.net/highlighting-kate++Optional citeproc support+-------------------------++Pandoc can optionally be compiled with support for bibliographic citations+using Andrea Rossato's [`citeproc-hs` library]. This allows you+to specify citations in markdown using an intuitive syntax (for example,+`[jones2005@p. 3; smith2006]`). These are automatically changed into+appropriately styled citations in the output, and a bibliography is+added. The bibliography data and style information are taken from XML+files that must be specified on the command line. (Note: `citeproc-hs`+support is experimental, and the interface may change in the future.)++If you are using Cabal to compile pandoc, specify the `citeproc` flag in+the configure step:++ runhaskell Setup configure -fciteproc++If you are using the Makefile:++ CABALOPTS=-fciteproc make++If you have already built pandoc, you may need to do a `make clean` or+`runhaskell Setup clean` first.++[`citeproc-hs` library]: http://code.haskell.org/citeproc-hs/+ Other targets ------------- @@ -105,17 +218,12 @@ ### Building and installing -* `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`.+* `configure`: - 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`.+ command). * `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@@ -129,7 +237,7 @@ * `test`: Runs Pandoc's test suite. (All tests should pass.) * `test-markdown`: Runs the Markdown regression test suite, using- `pandoc --strict`. (Three of the tests will fail.)+ `pandoc --strict`. (One test will fail.) ### Cleaning @@ -139,34 +247,12 @@ ### Packaging * `tarball`: Creates a source tarball for distribution.-* `deb`: Creates debian packages in `..` directory. * `macport`: Creates MacPorts Portfile in `macports` directory. * `freebsd`: Creates freebsd Makefile and distinfo in `freebsd` directory. * `win-pkg`: Creates a Windows binary package (presupposes `pandoc.exe`, which must be created by building Pandoc on a Windows machine). * `website`: Creates Pandoc's website in `web/pandoc` directory. -Installing pandoc using Cabal-=============================--Pandoc can also be installed using the standard Haskell packaging tool,-[Cabal](http://www.haskell.org/cabal/). You'll need GHC 6.6 or greater-(see [Installing GHC](#installing-ghc), above). Just download the source-tarball, unpack, and type:-- runhaskell Setup.hs configure- runhaskell Setup.hs build- runhaskell Setup.hs install # this one as root--This will install the pandoc executable and the Haskell libraries,-but not the shell scripts, man pages, or other documentation.--Note: If you are using GHC 6.6.*, you will need to start by-replacing `pandoc.cabal` with a version suitable for GHC 6.6:-- cp pandoc.cabal pandoc.cabal.orig- cp pandoc.cabal.ghc66 pandoc.cabal - Installing pandoc using MacPorts ================================ @@ -183,22 +269,22 @@ Since pandoc depends on GHC, the process may take a long time. +Note that the version of pandoc in MacPorts may not be the most recent.+ Installing the Windows binary ============================= -Simply download the zip file from [pandoc's google code site].-Extract the files from the archive, and put `pandoc.exe` somewhere-in your PATH.+Simply download the Windows installer [pandoc's google code site]+and run it. It will install `pandoc.exe` and ensure that it is+in your system PATH. Note that the Windows binary distribution does not include the shell-scripts `markdown2pdf`, `html2markdown`, or `hsmarkdown`. If you need-these, compile from source.+scripts `markdown2pdf`, `html2markdown`, or `hsmarkdown`. Installing pandoc on Debian =========================== -Pandoc is now in the debian unstable archive, and can be installed-using `apt-get` (as root):+Pandoc is now in the debian archives, and can be installed using `apt-get` (as root): apt-get install pandoc # the program, shell scripts, and docs apt-get install libghc6-pandoc-dev # the libraries@@ -206,6 +292,8 @@ Thanks to Recai Oktaş for setting up the debian packages. +Note that the version of pandoc in Debian may not be the most recent.+ Installing pandoc on FreeBSD ============================ @@ -221,4 +309,12 @@ Note that the version of pandoc in FreeBSD's official repository may be somewhat older than the most recent version.++Installing pandoc on Arch linux+===============================++Abhishek Dasgupta has created a binary package for `pandoc` in the+Arch linux repository. Arch users can install `pandoc` by typing++ pacman -Sy pandoc
Main.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {- Copyright (C) 2006-8 John MacFarlane <jgm@berkeley.edu> @@ -19,10 +20,10 @@ {- | Module : Main Copyright : Copyright (C) 2006-8 John MacFarlane- License : GNU GPL, version 2 or above + License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley@edu>- Stability : alpha + Stability : alpha Portability : portable Parses command-line options and calls the appropriate readers and@@ -30,24 +31,53 @@ -} module Main where import Text.Pandoc-import Text.Pandoc.UTF8-import Text.Pandoc.Shared ( joinWithSep, HTMLMathMethod (..) )-import Text.Regex ( mkRegex, matchRegex )+import Text.Pandoc.ODT+import Text.Pandoc.Shared ( HTMLMathMethod (..) )+import Text.Pandoc.Highlighting ( languages ) import System.Environment ( getArgs, getProgName, getEnvironment ) import System.Exit ( exitWith, ExitCode (..) )+import System.FilePath ( takeExtension, takeDirectory ) import System.Console.GetOpt-import System.IO import Data.Maybe ( fromMaybe )-import Data.List ( isPrefixOf ) import Data.Char ( toLower )-import Control.Monad ( (>>=) )+import Data.List ( intercalate )+import Prelude hiding ( putStrLn, writeFile, readFile, getContents )+import System.IO ( stdout, stderr )+import System.IO.UTF8+#ifdef _CITEPROC+import Text.CSL+import Text.Pandoc.Biblio+#endif copyrightMessage :: String-copyrightMessage = "\nCopyright (C) 2006-7 John MacFarlane\n\- \Web: http://johnmacfarlane.net/pandoc\n\- \This is free software; see the source for copying conditions. There is no\n\- \warranty, not even for merchantability or fitness for a particular purpose."+copyrightMessage = "\nCopyright (C) 2006-7 John MacFarlane\n" +++ "Web: http://johnmacfarlane.net/pandoc\n" +++ "This is free software; see the source for copying conditions. There is no\n" +++ "warranty, not even for merchantability or fitness for a particular purpose." +compileInfo :: String+compileInfo =+#ifdef _CITEPROC+ " +citeproc" +++#else+ " -citeproc" +++#endif+#ifdef _HIGHLIGHTING+ " +highlighting" +++#else+ " -highlighting" +++#endif+ if null languages+ then "\n"+ else "\nCompiled with syntax highlighting support for:\n" +++ (unlines $ map unwords $ chunk 5 $ map (\s -> s ++ replicate (15 - length s) ' ') languages)++-- | Splits a list into groups of at most n.+chunk :: Int -> [a] -> [[a]]+chunk size lst =+ let (next, rest) = splitAt size lst+ in if null rest then [next] else next : chunk size rest+ -- | Association list of formats and readers. readers :: [(String, ParserState -> String -> Pandoc)] readers = [("native" , readPandoc)@@ -59,25 +89,32 @@ -- | Reader for native Pandoc format. readPandoc :: ParserState -> String -> Pandoc-readPandoc state input = read input- +readPandoc _ input = read input+ -- | Association list of formats and pairs of writers and default headers. writers :: [ ( String, ( WriterOptions -> Pandoc -> String, String ) ) ]-writers = [("native" , (writeDoc, ""))- ,("html" , (writeHtmlString, ""))- ,("s5" , (writeS5String, defaultS5Header))- ,("docbook" , (writeDocbook, defaultDocbookHeader))- ,("latex" , (writeLaTeX, defaultLaTeXHeader))- ,("context" , (writeConTeXt, defaultConTeXtHeader))- ,("man" , (writeMan, ""))- ,("markdown" , (writeMarkdown, ""))- ,("rst" , (writeRST, ""))- ,("rtf" , (writeRTF, defaultRTFHeader))+writers = [("native" , (writeDoc, ""))+ ,("html" , (writeHtmlString, ""))+ ,("s5" , (writeS5String, defaultS5Header))+ ,("docbook" , (writeDocbook, defaultDocbookHeader))+ ,("opendocument" , (writeOpenDocument, defaultOpenDocumentHeader))+ ,("odt" , (writeOpenDocument, defaultOpenDocumentHeader))+ ,("latex" , (writeLaTeX, defaultLaTeXHeader))+ ,("context" , (writeConTeXt, defaultConTeXtHeader))+ ,("texinfo" , (writeTexinfo, ""))+ ,("man" , (writeMan, ""))+ ,("markdown" , (writeMarkdown, ""))+ ,("rst" , (writeRST, ""))+ ,("mediawiki" , (writeMediaWiki, ""))+ ,("rtf" , (writeRTF, defaultRTFHeader)) ] +isNonTextOutput :: String -> Bool+isNonTextOutput = (`elem` ["odt"])+ -- | Writer for Pandoc native format. writeDoc :: WriterOptions -> Pandoc -> String-writeDoc options = prettyPandoc +writeDoc _ = prettyPandoc -- | Data structure for command line options. data Opt = Opt@@ -87,7 +124,7 @@ , 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@@ -105,6 +142,10 @@ , optReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst , optWrapText :: Bool -- ^ Wrap text , optSanitizeHTML :: Bool -- ^ Sanitize HTML+#ifdef _CITEPROC+ , optModsFile :: String+ , optCslFile :: String+#endif } -- | Defaults for command-line options.@@ -116,7 +157,7 @@ , optReader = "" -- null for default reader , optWriter = "" -- null for default writer , optParseRaw = False- , optCSS = ""+ , optCSS = [] , optTableOfContents = False , optIncludeInHeader = "" , optIncludeBeforeBody = ""@@ -134,6 +175,10 @@ , optReferenceLinks = False , optWrapText = True , optSanitizeHTML = False+#ifdef _CITEPROC+ , optModsFile = []+ , optCslFile = []+#endif } -- | A list of functions, each transforming the options data structure@@ -144,14 +189,14 @@ (ReqArg (\arg opt -> return opt { optReader = map toLower arg }) "FORMAT")- "" -- ("(" ++ (joinWithSep ", " $ map fst readers) ++ ")")+ "" -- ("(" ++ (intercalate ", " $ map fst readers) ++ ")") , Option "tw" ["to","write"] (ReqArg (\arg opt -> return opt { optWriter = map toLower arg }) "FORMAT")- "" -- ("(" ++ (joinWithSep ", " $ map fst writers) ++ ")")- + "" -- ("(" ++ (intercalate ", " $ map fst writers) ++ ")")+ , Option "s" ["standalone"] (NoArg (\opt -> return opt { optStandalone = True }))@@ -194,12 +239,12 @@ (\opt -> return opt { optSmart = True })) "" -- "Use smart quotes, dashes, and ellipses" - , Option "m" ["asciimathml"]+ , Option "m" ["latexmathml", "asciimathml"] (OptArg- (\arg opt -> return opt { optHTMLMathMethod = - ASCIIMathML arg })+ (\arg opt -> return opt { optHTMLMathMethod =+ LaTeXMathML arg }) "URL")- "" -- "Use ASCIIMathML script in html output"+ "" -- "Use LaTeXMathML script in html output" , Option "" ["mimetex"] (OptArg@@ -236,12 +281,14 @@ , Option "" ["toc", "table-of-contents"] (NoArg (\opt -> return opt { optTableOfContents = True }))- "" -- "Include table of contents" + "" -- "Include table of contents" , 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" @@ -250,7 +297,7 @@ (\arg opt -> do let old = optIncludeInHeader opt text <- readFile arg- return opt { optIncludeInHeader = old ++ fromUTF8 text, + return opt { optIncludeInHeader = old ++ text, optStandalone = True }) "FILENAME") "" -- "File to include at end of header (implies -s)"@@ -260,7 +307,7 @@ (\arg opt -> do let old = optIncludeBeforeBody opt text <- readFile arg- return opt { optIncludeBeforeBody = old ++ fromUTF8 text })+ return opt { optIncludeBeforeBody = old ++ text }) "FILENAME") "" -- "File to include before document body" @@ -269,7 +316,7 @@ (\arg opt -> do let old = optIncludeAfterBody opt text <- readFile arg- return opt { optIncludeAfterBody = old ++ fromUTF8 text })+ return opt { optIncludeAfterBody = old ++ text }) "FILENAME") "" -- "File to include after document body" @@ -277,44 +324,55 @@ (ReqArg (\arg opt -> do text <- readFile arg- return opt { optCustomHeader = fromUTF8 text, + return opt { optCustomHeader = text, optStandalone = True }) "FILENAME") "" -- "File to use for custom header (implies -s)" , Option "T" ["title-prefix"] (ReqArg- (\arg opt -> return opt { optTitlePrefix = arg, + (\arg opt -> return opt { optTitlePrefix = arg, optStandalone = True }) "STRING") "" -- "String to prefix to HTML window title"- + , Option "D" ["print-default-header"] (ReqArg- (\arg opt -> do+ (\arg _ -> do let header = case (lookup arg writers) of- Just (writer, head) -> head- Nothing -> error ("Unknown reader: " ++ arg) + Just (_, h) -> h+ Nothing -> error ("Unknown reader: " ++ arg) hPutStr stdout header exitWith ExitSuccess) "FORMAT") "" -- "Print default header for FORMAT"-+#ifdef _CITEPROC+ , Option "" ["mods"]+ (ReqArg+ (\arg opt -> return opt { optModsFile = arg} )+ "FILENAME")+ ""+ , Option "" ["csl"]+ (ReqArg+ (\arg opt -> return opt { optCslFile = arg} )+ "FILENAME")+ ""+#endif , Option "" ["dump-args"] (NoArg (\opt -> return opt { optDumpArgs = True })) "" -- "Print output filename and arguments to stdout." - , Option "" ["ignore-args"]+ , Option "" ["ignore-args"] (NoArg (\opt -> return opt { optIgnoreArgs = True })) "" -- "Ignore command-line arguments."- + , Option "v" ["version"] (NoArg (\_ -> do prg <- getProgName- hPutStrLn stderr (prg ++ " " ++ pandocVersion ++ + hPutStrLn stderr (prg ++ " " ++ pandocVersion ++ compileInfo ++ copyrightMessage) exitWith $ ExitFailure 4)) "" -- "Print version"@@ -330,56 +388,54 @@ -- Returns usage message usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String-usageMessage programName options = usageInfo - (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " ++ - (joinWithSep ", " $ map fst readers) ++ "\nOutput formats: " ++ - (joinWithSep ", " $ map fst writers) ++ "\nOptions:")- options- +usageMessage programName opts = usageInfo+ (programName ++ " [OPTIONS] [FILES]" ++ "\nInput formats: " +++ (intercalate ", " $ map fst readers) ++ "\nOutput formats: " +++ (intercalate ", " $ map fst writers) ++ "\nOptions:")+ opts+ -- Determine default reader based on source file extensions-defaultReaderName :: [String] -> String+defaultReaderName :: [FilePath] -> String defaultReaderName [] = "markdown"-defaultReaderName (x:xs) = - let x' = map toLower x in- case (matchRegex (mkRegex ".*\\.(.*)") x') of- Nothing -> defaultReaderName xs -- no extension- Just ["xhtml"] -> "html"- Just ["html"] -> "html"- Just ["htm"] -> "html"- Just ["tex"] -> "latex"- Just ["latex"] -> "latex"- Just ["ltx"] -> "latex"- Just ["rst"] -> "rst"- Just ["native"] -> "native"- Just _ -> "markdown"+defaultReaderName (x:xs) =+ case takeExtension (map toLower x) of+ ".xhtml" -> "html"+ ".html" -> "html"+ ".htm" -> "html"+ ".tex" -> "latex"+ ".latex" -> "latex"+ ".ltx" -> "latex"+ ".rst" -> "rst"+ ".native" -> "native"+ _ -> defaultReaderName xs -- Determine default writer based on output file extension-defaultWriterName :: String -> String+defaultWriterName :: FilePath -> String defaultWriterName "-" = "html" -- no output file defaultWriterName x =- let x' = map toLower x in- case (matchRegex (mkRegex ".*\\.(.*)") x') of- Nothing -> "markdown" -- no extension- Just [""] -> "markdown" -- empty extension - Just ["tex"] -> "latex"- Just ["latex"] -> "latex"- Just ["ltx"] -> "latex"- Just ["context"] -> "context"- Just ["ctx"] -> "context"- Just ["rtf"] -> "rtf"- Just ["rst"] -> "rst"- Just ["s5"] -> "s5"- Just ["native"] -> "native"- Just ["txt"] -> "markdown"- Just ["text"] -> "markdown"- Just ["md"] -> "markdown"- Just ["markdown"] -> "markdown"- Just ["db"] -> "docbook"- Just ["xml"] -> "docbook"- Just ["sgml"] -> "docbook"- Just [[x]] | x `elem` ['1'..'9'] -> "man"- Just _ -> "html"+ case takeExtension (map toLower x) of+ "" -> "markdown" -- empty extension+ ".tex" -> "latex"+ ".latex" -> "latex"+ ".ltx" -> "latex"+ ".context" -> "context"+ ".ctx" -> "context"+ ".rtf" -> "rtf"+ ".rst" -> "rst"+ ".s5" -> "s5"+ ".native" -> "native"+ ".txt" -> "markdown"+ ".text" -> "markdown"+ ".md" -> "markdown"+ ".markdown" -> "markdown"+ ".texi" -> "texinfo"+ ".texinfo" -> "texinfo"+ ".db" -> "docbook"+ ".odt" -> "odt"+ ['.',y] | y `elem` ['1'..'9'] -> "man"+ _ -> "html" +main :: IO () main = do rawArgs <- getArgs@@ -399,7 +455,7 @@ else return () - let defaultOpts' = if compatMode + let defaultOpts' = if compatMode then defaultOpts { optReader = "markdown" , optWriter = "html" , optStrict = True }@@ -432,6 +488,10 @@ , optReferenceLinks = referenceLinks , optWrapText = wrap , optSanitizeHTML = sanitize+#ifdef _CITEPROC+ , optModsFile = modsFile+ , optCslFile = cslFile+#endif } = opts if dumpArgs@@ -444,11 +504,11 @@ let sources = if ignoreArgs then [] else args -- assign reader and writer based on options and filenames- let readerName' = if null readerName + let readerName' = if null readerName then defaultReaderName sources else readerName - let writerName' = if null writerName + let writerName' = if null writerName then defaultWriterName outputFile else writerName @@ -460,10 +520,6 @@ Just (w,h) -> return (w, h) Nothing -> error ("Unknown writer: " ++ writerName') - output <- if (outputFile == "-")- then return stdout - else openFile outputFile WriteMode- environment <- getEnvironment let columns = case lookup "COLUMNS" environment of Just cols -> read cols@@ -474,57 +530,84 @@ -- remove DOS line endings tabFilter _ ('\r':'\n':xs) = '\n':(tabFilter tabStop xs) tabFilter _ ('\r':xs) = '\n':(tabFilter tabStop xs)- tabFilter spsToNextStop ('\t':xs) = + tabFilter spsToNextStop ('\t':xs) = if preserveTabs- then '\t':(tabFilter tabStop xs) - else replicate spsToNextStop ' ' ++ tabFilter tabStop xs - tabFilter 1 (x:xs) = + then '\t':(tabFilter tabStop xs)+ else replicate spsToNextStop ' ' ++ tabFilter tabStop xs+ tabFilter 1 (x:xs) = x:(tabFilter tabStop xs)- tabFilter spsToNextStop (x:xs) = + tabFilter spsToNextStop (x:xs) = x:(tabFilter (spsToNextStop - 1) xs) - let startParserState = + let standalone' = (standalone && not strict) || isNonTextOutput writerName'++#ifdef _CITEPROC+ refs <- if null modsFile then return [] else readModsColletionFile modsFile+#endif++ let startParserState = defaultParserState { stateParseRaw = parseRaw,- stateTabStop = tabStop, + stateTabStop = tabStop, stateSanitizeHTML = sanitize,- stateStandalone = standalone && (not strict),- stateSmart = smart || writerName' `elem` + stateStandalone = standalone',+#ifdef _CITEPROC+ stateCitations = map citeKey refs,+#endif+ stateSmart = smart || writerName' `elem` ["latex", "context"], stateColumns = columns, stateStrict = strict }- let csslink = if (css == "")- then "" - else "<link rel=\"stylesheet\" href=\"" ++ css ++ - "\" type=\"text/css\" media=\"all\" />\n"- let header = (if (customHeader == "DEFAULT") + 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- let writerOptions = WriterOptions { writerStandalone = standalone &&- (not strict), - writerHeader = header, + let writerOptions = WriterOptions { writerStandalone = standalone',+ writerHeader = header, writerTitlePrefix = titlePrefix,- writerTabStop = tabStop, + writerTabStop = tabStop, writerTableOfContents = toc && (not strict) &&- writerName/="s5",+ writerName' /= "s5", writerHTMLMathMethod = mathMethod,- writerS5 = (writerName=="s5"),+ writerS5 = (writerName' == "s5"), writerIgnoreNotes = False,- writerIncremental = incremental, + writerIncremental = incremental, writerNumberSections = numberSections,- writerIncludeBefore = includeBefore, + writerIncludeBefore = includeBefore, writerIncludeAfter = includeAfter, writerStrictMarkdown = strict, writerReferenceLinks = referenceLinks, writerWrapText = wrap } - (readSources sources) >>= (hPutStrLn output . toUTF8 . - (writer writerOptions) . - (reader startParserState) . tabFilter tabStop .- fromUTF8 . (joinWithSep "\n")) >> - hClose output+ if isNonTextOutput writerName' && outputFile == "-"+ then do hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" +++ "Specify an output file using the -o option.")+ exitWith $ ExitFailure 5+ else return () - where + let sourceDirRelative = if null sources+ then ""+ else takeDirectory (head sources)++ let writeOutput = case writerName' of+ "odt" -> saveOpenDocumentAsODT outputFile sourceDirRelative+ _ -> if outputFile == "-"+ then putStrLn+ else writeFile outputFile . (++ "\n")++ fmap (reader startParserState . tabFilter tabStop . intercalate "\n")+ (readSources sources) >>=+#ifdef _CITEPROC+ processBiblio cslFile refs >>=+#endif+ writeOutput . writer writerOptions++ where readSources [] = mapM readSource ["-"] readSources sources = mapM readSource sources readSource "-" = getContents
Makefile view
@@ -11,6 +11,7 @@ BUILDCONF := $(BUILDDIR)/setup-config BUILDVARS := vars CONFIGURE := configure+ODTSTYLES := odt-styles #------------------------------------------------------------------------------- # Cabal constants@@ -23,7 +24,7 @@ #------------------------------------------------------------------------------- # Install targets #--------------------------------------------------------------------------------WRAPPERS := html2markdown markdown2pdf hsmarkdown+WRAPPERS := html2markdown hsmarkdown markdown2pdf # Add .exe extensions if we're running Windows/Cygwin. EXTENSION := $(shell uname | tr '[:upper:]' '[:lower:]' | \ sed -ne 's/^cygwin.*$$/\.exe/p')@@ -67,7 +68,6 @@ INSTALL_DATA := $(INSTALL) -m 644 STRIP := strip GHC ?= ghc-GHC_PKG ?= ghc-pkg GHC_VERSION := $(shell $(GHC) --version | sed -e 's/[^0-9]*//') #-------------------------------------------------------------------------------@@ -89,48 +89,20 @@ sh ./markdown2pdf $< || rm -f $@ %.txt: % perl -p -e 's/\n/\r\n/' $< > $@ || rm -f $@ # convert to DOS line endings-%.1: %.1.md $(MAIN)- ./$(MAIN) -s -S -w man $< >$@ || rm -f $@ -.PHONY: templates-templates: - $(MAKE) -C $(SRCDIR)/templates--define generate-shell-script-echo >&2 "Generating $@..."; \-awk ' \- /^[ \t]*###+ / { \- lead = $$0; sub(/[^ \t].*$$/, "", lead); \- t = "$(dir $<)/"$$2; \- while (getline line < t > 0) \- print lead line; \- next; \- } \- { print } \-' <$< >$@-chmod +x $@-endef--.PHONY: wrappers-wrappers: $(WRAPPERS)-cleanup_files+=$(WRAPPERS)-$(WRAPPERS): %: $(SRCDIR)/wrappers/%.in $(SRCDIR)/wrappers/*.sh- @$(generate-shell-script)--CABAL_BACKUP=$(CABAL).orig-$(CABAL_BACKUP):- cp $(CABAL) $(CABAL_BACKUP) ; \- if echo $(GHC_VERSION) | grep -q '^6.6'; then \- cp $(CABAL).ghc66 $(CABAL); \- fi- .PHONY: configure cleanup_files+=Setup.hi Setup.o $(BUILDCMD) $(BUILDVARS)-configure: $(BUILDCONF) templates+ifdef GHC_PKG+ hc_pkg = --with-hc-pkg=$(GHC_PKG)+else+ hc_pkg =+endif+templates=$(wildcard templates/*.* templates/headers/*.* templates/ui/default/*.*)+configure: $(BUILDCONF) $(BUILDCMD): Setup.hs $(GHC) -package Cabal Setup.hs -o $(BUILDCMD)-$(BUILDCONF): $(CABAL) $(CABAL_BACKUP) $(BUILDCMD)- $(BUILDCMD) configure --prefix=$(PREFIX) --with-compiler=$(GHC) --with-hc-pkg=$(GHC_PKG)+$(BUILDCONF): $(CABAL) $(CABAL_BACKUP) $(BUILDCMD) $(templates)+ $(BUILDCMD) configure --prefix=$(PREFIX) --with-compiler=$(GHC) $(hc_pkg) $(CABALOPTS) @# Make configuration time settings persistent (definitely a hack). @echo "PREFIX?=$(PREFIX)" >$(BUILDVARS) @echo "DESTDIR?=$(DESTDIR)" >>$(BUILDVARS)@@ -178,7 +150,7 @@ uninstall-doc: -for f in $(DOCS); do rm -f $(PKGDOCPATH)/$$f; done -for f in $(man_all); do rm -f $(MANPATH)/$$f; done- rmdir $(PKGDOCPATH) $(PKGDATAPATH) 2>/dev/null ||:+ rmdir $(PKGDOCPATH) 2>/dev/null ||: # Program only installation. .PHONY: install-exec uninstall-exec@@ -211,7 +183,7 @@ fi; \ $(BUILDCMD) copy $$opt; $(BUILDCMD) register # Cabal lacks an 'uninstall' command. We have to remove some cruft manually.-uninstall-all: uninstall-program+uninstall-all: uninstall-program configure @libdir=$$($(GHC_PKG) field $(PKGID) library-dirs 2>/dev/null | \ sed 's/^library-dirs: *//'); \ htmldir=$$($(GHC_PKG) field $(PKGID) haddock-html 2>/dev/null | \@@ -260,12 +232,12 @@ win_docs:=COPYING.txt COPYRIGHT.txt BUGS.txt README.txt README.html cleanup_files+=$(win_pkg_name) $(win_docs) win-pkg: $(win_pkg_name)-$(win_pkg_name): $(PKG).exe $(win_docs)+$(win_pkg_name): $(PKG).exe $(win_docs) zip -r $(win_pkg_name) $(PKG).exe $(win_docs) .PHONY: test test-markdown test: $(MAIN)- @cd $(TESTDIR) && perl runtests.pl -s $(PWD)/$(MAIN)+ $(BUILDCMD) test compat:=$(PWD)/hsmarkdown markdown_test_dirs:=$(wildcard $(TESTDIR)/MarkdownTest_*) test-markdown: $(MAIN) $(compat)@@ -291,35 +263,8 @@ cleanup_files+=$(tarball) tarball: $(tarball) $(tarball):- svn export . $(PKGID)- $(MAKE) -C $(PKGID) templates- $(MAKE) -C $(PKGID) wrappers- tar cvzf $(tarball) $(PKGID)- -rm -rf $(PKGID)--.PHONY: deb-deb_name:=$(shell grep ^Package debian/control | cut -d' ' -f2 | head -n 1)-deb_version:=$(shell head -n 1 debian/changelog | cut -f2 -d' ' | tr -d '()')-deb_arch:=i386-deb_main:=$(deb_name)_$(deb_version)_$(deb_arch).deb-deb: debian- @[ -x /usr/bin/fakeroot ] || { \- echo >&2 "*** Please install fakeroot package. ***"; \- exit 1; \- }- @[ -x /usr/bin/dpkg-buildpackage ] || { \- echo >&2 "*** Please install dpkg-dev package. ***"; \- exit 1; \- }- mv $(BUILDVARS) $(BUILDVARS).old 2>/dev/null ||: # backup settings- if [ -x /usr/bin/debuild ]; then \- debuild -uc -us -i.svn -I.svn -i_darcs -I_darcs --lintian-opts -i; \- else \- echo >&2 "*** Please install devscripts package. ***"; \- echo >&2 "*** Using dpkg-buildpackage for package building. ***"; \- dpkg-buildpackage -rfakeroot -uc -us -i.svn -I.svn -i_darcs -I_darcs; \- fi- mv $(BUILDVARS).old $(BUILDVARS) 2>/dev/null ||: # restore+ $(BUILDCMD) sdist+ cp $(BUILDDIR)/$(tarball) . .PHONY: website web_src:=web@@ -328,7 +273,7 @@ -A $(web_src)/footer.html \ -H $(web_src)/css cleanup_files+=$(web_dest)-$(web_dest) : html $(wildcard $(web_src)/*) debian/changelog \+$(web_dest) : html $(wildcard $(web_src)/*) changelog \ INSTALL $(MANPAGES) $(MANDIR)/man1/pandoc.1.md README rm -rf $(web_dest) && { \ mkdir $(web_dest); \@@ -336,11 +281,11 @@ cp $(web_src)/* $(web_dest)/; \ sed -e 's#@VERSION@#$(VERSION)#g' $(web_src)/index.txt.in > \ $(web_dest)/index.txt; \- cp debian/changelog $(web_dest)/changelog.txt ; \+ cp changelog $(web_dest)/changelog.txt ; \ cp README $(web_dest)/ ; \ cp INSTALL $(web_dest)/ ; \ cp $(MANDIR)/man1/pandoc.1.md $(web_dest)/ ; \- cp $(MANDIR)/man1/*.1 $(web_dest)/ ; \+ cp $(MANPAGES) $(web_dest)/ ; \ } || { rm -rf $(web_dest); exit 1; } website: $(MAIN) $(web_dest) PANDOC_PATH=$(shell pwd) make -C $(web_dest)@@ -352,6 +297,5 @@ fi clean:- make -C $(SRCDIR)/templates clean -if [ -f $(BUILDCONF) ]; then $(BUILDCMD) clean; fi -rm -rf $(cleanup_files)
− PROFILING
@@ -1,8 +0,0 @@-To use the GHC profiler:--make distclean-make templates-runhaskell Setup.hs configure --enable-library-profiling --enable-executable-profiling-runhaskell Setup.hs build-dist/build/pandoc/pandoc +RTS -p -RTS [file]...-less pandoc.prof
README view
@@ -1,16 +1,21 @@ % Pandoc User's Guide % John MacFarlane-% January 8, 2008+% March 24, 2008 Pandoc is a [Haskell] library for converting from one markup format to another, and a command-line tool that uses this library. It can read-[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX], and+[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX]; and it can write [markdown], [reStructuredText], [HTML], [LaTeX], [ConTeXt],-[RTF], [DocBook XML], [groff man] pages, and [S5] HTML slide shows.-Pandoc's version of markdown contains some enhancements, like footnotes-and embedded LaTeX.+[RTF], [DocBook XML], [OpenDocument XML], [ODT], [GNU Texinfo],+[MediaWiki markup], [groff man] pages, and [S5] HTML slide shows.+Pandoc's enhanced version of markdown includes syntax for footnotes,+tables, flexible ordered lists, definition lists, delimited code blocks,+superscript, subscript, strikeout, title blocks, automatic tables of+contents, embedded LaTeX math, and markdown inside HTML block elements.+(These enhancements can be disabled if a drop-in replacement for+`Markdown.pl` is desired.) -In contrast to existing tools for converting markdown to HTML, which+In contrast to most existing tools for converting markdown to HTML, which use regex substitutions, Pandoc has a modular design: it consists of a set of readers, which parse text in a given format and produce a native representation of the document, and a set of writers, which convert@@ -25,62 +30,34 @@ [ConTeXt]: http://www.pragma-ade.nl/ [RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format [DocBook XML]: http://www.docbook.org/+[OpenDocument XML]: http://opendocument.xml.org/ +[ODT]: http://en.wikipedia.org/wiki/OpenDocument+[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting [groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html [Haskell]: http://www.haskell.org/+[GNU Texinfo]: http://www.gnu.org/software/texinfo/ -© 2006-7 John MacFarlane (jgm at berkeley dot edu). Released under the+© 2006-8 John MacFarlane (jgm at berkeley dot edu). Released under the [GPL], version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.)-Recai Oktaş (roktas at debian dot org) deserves credit for the build-system, the debian package, and the robust wrapper scripts.+Contributors: Recai Oktaş (build system, debian package, wrapper+scripts), Peter Wang (Texinfo writer), Andrea Rossato (OpenDocument writer). [GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License" -Requirements-============--The `pandoc` program itself does not depend on any external libraries-or programs.--The wrapper script `html2markdown` requires-- - `pandoc` (which must be in the PATH)- - a POSIX-compliant shell (installed by default on all linux and unix- systems, including Mac OS X, and in [Cygwin] for Windows),- - `HTML Tidy`- - `iconv` (for character encoding conversion). (If `iconv` is absent,- `html2markdown` will still work, but it will treat everything as UTF-8.)--The wrapper script `markdown2pdf` requires-- - `pandoc` (which must be in the PATH)- - a POSIX-compliant shell- - `pdflatex`, which should be part of any [LaTeX] distribution- - the following LaTeX packages (available from [CTAN], if they- are not already included in your LaTeX distribution):- + `unicode`- + `fancyhdr` (if you have verbatim text in footnotes)- + `graphicx` (if you use images)- + `array` (if you use tables)- + `ulem` (if you use strikeout text)--The wrapper script `hsmarkdown` requires only a POSIX-compliant shell.--[Cygwin]: http://www.cygwin.com/ -[HTML Tidy]: http://tidy.sourceforge.net/-[`iconv`]: http://www.gnu.org/software/libiconv/-[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"- Using Pandoc ============ If you run `pandoc` without arguments, it will accept input from-STDIN. If you run it with file names as arguments, it will take input-from those files. By default, `pandoc` writes its output to STDOUT.+stdin. If you run it with file names as arguments, it will take input+from those files. By default, `pandoc` writes its output to stdout.[^1] If you want to write to a file, use the `-o` option: pandoc -o hello.html hello.txt +[^1]: The exception is for `odt`. Since this is a binary output format,+ an output file must be specified explicitly.+ Note that you can specify multiple input files on the command line. `pandoc` will concatenate them all (with blank lines between them) before parsing:@@ -104,18 +81,21 @@ pandoc -f html -t markdown hello.html Supported output formats include `markdown`, `latex`, `context`-(ConTeXt), `html`, `rtf` (rich text format), `rst` (reStructuredText),-`docbook` (DocBook XML), `man` (groff man), and `s5` (which produces an-HTML file that acts like powerpoint). Supported input formats include-`markdown`, `html`, `latex`, and `rst`. Note that the `rst` reader only-parses a subset of reStructuredText syntax. For example, it doesn't-handle tables, option lists, or footnotes. But for simple documents it-should be adequate. The `latex` and `html` readers are also limited in-what they can do. Because the `html` reader is picky about the HTML it-parses, it is recommended that you pipe HTML through [HTML Tidy] before-sending it to `pandoc`, or use the `html2markdown` script described-below.+(ConTeXt), `html`, `rtf` (rich text format), `rst`+(reStructuredText), `docbook` (DocBook XML), `opendocument`+(OpenDocument XML), `odt` (OpenOffice text document), `texinfo`, (GNU+Texinfo), `mediawiki` (MediaWiki markup), `man` (groff man), and `s5`+(which produces an HTML file that acts like powerpoint). +Supported input formats include `markdown`, `html`, `latex`, and `rst`.+Note that the `rst` reader only parses a subset of reStructuredText+syntax. For example, it doesn't handle tables, option lists, or+footnotes. But for simple documents it should be adequate. The `latex`+and `html` readers are also limited in what they can do. Because the+`html` reader is picky about the HTML it parses, it is recommended that+you pipe HTML through [HTML Tidy] before sending it to `pandoc`, or use+the `html2markdown` script described below.+ If you don't specify a reader or writer explicitly, `pandoc` will try to determine the input and output format from the extensions of the input and output filenames. Thus, for example, @@ -123,9 +103,9 @@ pandoc -o hello.tex hello.txt will convert `hello.txt` from markdown to LaTeX. If no output file-is specified (so that output goes to STDOUT), or if the output file's+is specified (so that output goes to stdout), or if the output file's extension is unknown, the output format will default to HTML.-If no input file is specified (so that input comes from STDIN), or+If no input file is specified (so that input comes from stdin), or if the input files' extensions are unknown, the input format will be assumed to be markdown unless explicitly specified. @@ -151,7 +131,7 @@ ============= Three shell scripts, `markdown2pdf`, `html2markdown`, and `hsmarkdown`,-are included in the standard Pandoc installation. (They are not included+are included in the standard Pandoc installation. (They are not included in the Windows binary package, as they require a POSIX shell, but they may be used in Windows under Cygwin.) @@ -161,17 +141,26 @@ base name as the first argument and the extension `pdf`; thus, for example, - markdown2pdf sample.txt endnotes.txt+ markdown2pdf sample.txt endnotes.txt will produce `sample.pdf`. (If `sample.pdf` exists already, it will be backed up before being overwritten.) An output file name can be specified explicitly using the `-o` option: - markdown2pdf -o book.pdf chap1 chap2+ markdown2pdf -o book.pdf chap1 chap2 - If no input file is specified, input will be taken from STDIN.+ If no input file is specified, input will be taken from stdin. All of `pandoc`'s options will work with `markdown2pdf` as well. + `markdown2pdf` assumes that `pdflatex` is in the path. It also+ assumes that the following LaTeX packages are available:+ `unicode`, `fancyhdr` (if you have verbatim text in footnotes),+ `graphicx` (if you use images), `array` (if you use tables),+ and `ulem` (if you use strikeout text). If they are not already+ included in your LaTeX distribution, you can get them from+ [CTAN]. A full [TeX Live] or [MacTeX] distribution will have all of+ these packages.+ 2. `html2markdown` grabs a web page from a file or URL and converts it to markdown-formatted text, using `tidy` and `pandoc`. @@ -184,7 +173,7 @@ The `-e` or `--encoding` option specifies the character encoding of the HTML input. If this option is not specified, and input- is not from STDIN, `html2markdown` will attempt to determine the+ is not from stdin, `html2markdown` will attempt to determine the page's character encoding from the "Content-type" meta tag. If this is not present, UTF-8 is assumed. @@ -197,6 +186,10 @@ available program (`wget`, `curl`, or a text-mode browser) to fetch the contents of a URL. + `html2markdown` requires [HTML Tidy], which must be in the path.+ It uses [`iconv`] for character encoding conversions; if `iconv`+ is absent, it will still work, but it will treat everything as UTF-8.+ 3. `hsmarkdown` is designed to be used as a drop-in replacement for `Markdown.pl`. It forces `pandoc` to convert from markdown to HTML, and to use the `--strict` flag for maximal compliance with@@ -213,6 +206,13 @@ under Cygwin, due to problems with its simulation of symbolic links. +[Cygwin]: http://www.cygwin.com/ +[HTML Tidy]: http://tidy.sourceforge.net/+[`iconv`]: http://www.gnu.org/software/libiconv/+[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"+[TeX Live]: http://www.tug.org/texlive/+[MacTeX]: http://www.tug.org/mactex/+ Command-line options ==================== @@ -227,7 +227,8 @@ `-t`, `--to`, `-w`, or `--write` *format* : specifies the output format -- the format Pandoc will be converting *to*. *format* can be `native`, `html`, `s5`,- `docbook`, `latex`, `context`, `markdown`, `man`, `rst`, and `rtf`.+ `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`,+ `rst`, and `rtf`. `-s` or `--standalone` : indicates that a standalone document is to be produced (with@@ -235,13 +236,15 @@ `-o` or `--output` *filename* : sends output to *filename*. If this option is not specified,- or if its argument is `-`, output will be sent to STDOUT.+ or if its argument is `-`, output will be sent to stdout.+ (Exception: if the output format is `odt`, output to stdout+ is disabled.) `-p` or `--preserve-tabs` : causes tabs in the source text to be preserved, rather than converted to spaces (the default). -`--tabstop` *tabstop*+`--tab-stop` *tabstop* : sets the number of spaces per tab to *tabstop* (defaults to 4). `--strict`@@ -277,23 +280,30 @@ `-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@@ -304,32 +314,33 @@ `-S` or `--smart` : causes `pandoc` to produce typographically correct output, along the lines of John Gruber's [Smartypants]. Straight quotes are converted- to curly quotes, `---` to dashes, and `...` to ellipses. (Note: This- option is only significant when the input format is `markdown`.- It is selected automatically when the output format is `latex` or- `context`.)+ to curly quotes, `---` to dashes, and `...` to ellipses. Nonbreaking+ spaces are inserted after certain abbreviations, such as "Mr."+ (Note: This option is only significant when the input format is+ `markdown`. It is selected automatically when the output format is+ `latex` or `context`.) -`-m`*[url]* or `--asciimathml`*[=url]*-: causes `pandoc` to use Peter Jipsen's [ASCIIMathML] script to display- TeX math in HTML or S5. If a local copy of `ASCIIMathML.js` is+`-m`*[url]* or `--latexmathml`*[=url]*+: causes `pandoc` to use the [LaTeXMathML] script to display+ TeX math in HTML or S5. If a local copy of `LaTeXMathML.js` is available on the webserver where the page will be viewed, provide a *url* and a link will be inserted in the generated HTML or S5. If no *url* is provided, the contents of the script will be inserted directly; this provides portability at the price of efficiency. If you plan to use math on several pages, it is much better to link to- a copy of `ASCIIMathML.js`, which can be cached. (See `--gladtex`+ a copy of `LaTeXMathML.js`, which can be cached. (See `--gladtex` and `--mimetex` for alternative ways of dealing with math in HTML.) `--gladtex`*[=url]* : causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output. This output can then be processed by [gladTeX] to produce links to- images with the typeset formulas. (See `--asciimathml` and+ images with the typeset formulas. (See `--latexmathml` and `--mimetex` for alternative ways of dealing with math in HTML.) `--mimetex`*[=url]* : causes TeX formulas to be replaced by `<img>` tags linking to the [mimeTeX] CGI script, which will produce images with the typeset- formulas. (See `--asciimathml` and `--mimetex` for alternative+ formulas. (See `--latexmathml` and `--mimetex` for alternative ways of dealing with math in HTML.) `-i` or `--incremental`@@ -348,14 +359,15 @@ `--sanitize-html` : sanitizes HTML (in markdown or HTML input) using a whitelist. Unsafe tags are replaced by HTML comments; unsafe attributes- are omitted.+ are omitted. URIs in links and images are also checked against a+ whitelist of URI schemes. `--dump-args` : is intended to make it easier to create wrapper scripts that use Pandoc. It causes Pandoc to dump information about the arguments- with which it was called to STDOUT, then exit. The first line+ with which it was called to stdout, then exit. The first line printed is the name of the output file specified using the `-o`- or `--output` option, or `-` if output would go to STDOUT. The+ or `--output` option, or `-` if output would go to stdout. The remaining lines, if any, list command-line arguments. These will include the names of input files and any special options passed after ` -- ` on the command line. So, for example,@@ -363,7 +375,7 @@ : pandoc --dump-args -o foo.html -s foo.txt \ appendix.txt -- -e latin1 -: will cause the following to be printed to STDOUT:+: will cause the following to be printed to stdout: : foo.html foo.txt appendix.txt -e latin1 @@ -384,7 +396,7 @@ : prints a usage message to STDERR. [Smartypants]: http://daringfireball.net/projects/smartypants/-[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html+[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/ [gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html [mimeTeX]: http://www.forkosh.com/mimetex.html @@ -422,6 +434,9 @@ \`*_{}[]()>#+-.! +A backslash-escaped space is parsed as a nonbreaking space. It will+appear in TeX output as '~' and in HTML and XML as '\ ' or '\ '.+ Subscripts and superscripts --------------------------- @@ -445,8 +460,8 @@ This ~~is deleted text.~~ -Lists------+Nested Lists+------------ Pandoc behaves differently from standard markdown on some "edge cases" involving lists. Consider this source: @@ -470,6 +485,9 @@ behavior is consistent with the official markdown syntax description, even though it is different from that of `Markdown.pl`.) +Ordered Lists+-------------+ Unlike standard markdown, Pandoc allows ordered list items to be marked with uppercase and lowercase letters and roman numerals, in addition to arabic numerals. (This behavior can be turned off using the `--strict`@@ -507,12 +525,13 @@ ii. subtwo iii. subthree -Note that Pandoc pays attention only to the *starting* number in a list.+Note that Pandoc pays attention only to the *starting* marker in a list. So, the following yields a list numbered sequentially starting from 2: (2) Two (5) Three- (2) Four+ 1. Four+ * Five If default list markers are desired, use '`#.`': @@ -520,24 +539,6 @@ #. two #. three -If you change list style in mid-list, Pandoc will notice and assume you-are starting a sublist. So,-- 1. One- 2. Two- A. Sub- B. Sub- 3. Three--gets treated as if it were-- 1. One- 2. Two- A. Sub- B. Sub- 3. Three-- Definition lists ---------------- @@ -650,7 +651,7 @@ The headers and table rows must each fit on one line. Column alignments are determined by the position of the header text relative-to the dashed line below it:[^1]+to the dashed line below it:[^3] - If the dashed line is flush with the header text on the right side but extends beyond it on the left, the column is right-aligned.@@ -661,9 +662,8 @@ - If the dashed line is flush with the header text on both sides, the default alignment is used (in most cases, this will be left). -[^1]: This scheme is due to Michel Fortin, who proposed it on the- Markdown discussion list: - <http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html>.+[^3]: This scheme is due to Michel Fortin, who proposed it on the+ [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html). The table must end with a blank line. Optionally, a caption may be provided (as illustrated in the example above). A caption is a paragraph@@ -698,6 +698,53 @@ - They must end with a row of dashes, then a blank line. - The rows must be separated by blank lines. +Delimited Code blocks+---------------------++In addition to standard indented code blocks, Pandoc supports+*delimited* code blocks. These begin with a row of three or more+tildes (`~`) and end with a row of tildes that must be at least+as long as the starting row. Everything between the tilde-lines+is treated as code. No indentation is necessary:++ ~~~~~~~+ {code here}+ ~~~~~~~++If the code itself contains a row of tildes, just use a longer+row of tildes at the start and end:++ ~~~~~~~~~~~~~~~~+ ~~~~~~~~~~+ code including tildes+ ~~~~~~~~~~+ ~~~~~~~~~~~~~~~~++Optionally, you may specify the language of the code block using+this syntax:++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines}+ qsort [] = []+ qsort (x:xs) = qsort (filter (< x) xs) ++ [x] +++ qsort (filter (>= x) xs) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~++Some output formats can use this information to do syntax highlighting.+Currently, the only output format that uses this information is HTML.++If pandoc has been compiled with syntax highlighting support, then the+code block above will appear highlighted, with numbered lines. (To see+which languages are supported, do `pandoc --version`.)++If pandoc has not been compiled with syntax highlighting support, the+code block above will appear as follows:++ <pre class="haskell">+ <code>+ ...+ </code>+ </pre>+ Title blocks ------------ @@ -856,27 +903,31 @@ text role `:math:`, as described [here](http://www.american.edu/econ/itex2mml/mathhack.rst). +In Texinfo output, it will be rendered inside a `@math` command.+ In groff man output, it will be rendered verbatim without $'s. -In RTF and Docbook output, it will be rendered, as far as possible,-using unicode characters, and will otherwise appear verbatim. Unknown-commands and symbols, and commands that cannot be dealt with this way-(like `\frac`), will be rendered verbatim. So the results may be a mix-of raw TeX code and properly rendered unicode math.+In MediaWiki output, it will be rendered inside `<math>` tags. +In RTF, Docbook, and OpenDocument output, it will be rendered, as far as+possible, using unicode characters, and will otherwise appear verbatim.+Unknown commands and symbols, and commands that cannot be dealt with+this way (like `\frac`), will be rendered verbatim. So the results may+be a mix of raw TeX code and properly rendered unicode math.+ In HTML and S5 output, the way math is rendered will depend on the command-line options selected: 1. The default is to render TeX math as far as possible using unicode- characters, as with RTF and Docbook output. Formulas are put inside- a `span` with `class="math"`, so that they may be styled differently- from the surrounding text if needed.+ characters, as with RTF, Docbook, and OpenDocument output. Formulas+ are put inside a `span` with `class="math"`, so that they may be+ styled differently from the surrounding text if needed. -2. If the `--asciimathml` option is used, TeX math will be displayed- between $ characters, as in LaTeX, and the [ASCIIMathML] script will+2. If the `--latexmathml` option is used, TeX math will be displayed+ between $ characters, as in LaTeX, and the [LaTeXMathML] script will be used to render it as formulas. (This trick does not work in all browsers, but it works in Firefox. In browsers that do not support- ASCIIMathML, TeX math will appear verbatim between $ characters.)+ LaTeXMathML, TeX math will appear verbatim between $ characters.) 3. If the `--mimetex` option is used, the [mimeTeX] CGI script will be called to generate images for each TeX formula. This should@@ -963,8 +1014,7 @@ pandoc -w s5 -s eating.txt > eating.html -and open up `eating.html` in a browser. The HTML file embeds-all the required javascript and CSS, so no other files are necessary.+and open up `eating.html` in a browser. Note that by default, the S5 writer produces lists that display "all at once." If you want your lists to display incrementally@@ -978,4 +1028,18 @@ In this way incremental and nonincremental lists can be mixed in a single document.++Note: the S5 file produced by pandoc with the `-s/--standalone` option+embeds the javascript and CSS required to show the slides. Thus it+does not depend on any additional files: you can send the HTML file to+others, and they will be able to view the slide show just by opening+it. However, if you intend to produce several S5 slide shows, and you+are displaying them on your own website, it is better to keep the S5+javascript and CSS files separate from the slide shows themselves, so+that they may be cached. The best approach in this case is to use pandoc+without the `-s` option to produce the body of the S5 document, which+can then be inserted into an HTML template that links to the javascript+and CSS files required by S5. (See the instructions on the S5 website.)+Alternatively, you may use `-s` together with the `-H/--custom-header`+option.
− RELEASE-CHECKLIST
@@ -1,39 +0,0 @@-_ Test: make build-all, make install-all, make uninstall-all, - make deb, run website demos, test on windows, test on mac--_ Finalize debian changelog--_ Tag release- svn copy https://pandoc.googlecode.com/svn/trunk https://pandoc.googlecode.com/svn/tags/pandoc-x.yy--_ Generate tarball (make tarball)--_ Generate Windows package and copy to directory--_ Upload to Google Code- googlecode-upload.py -s "Source tarball" -p pandoc -u fiddlosopher --labels=Featured,Type-Source,OpSys-All pandoc-x.yy.tar.gz- googlecode-upload.py -s "Windows binary package" -p pandoc -u fiddlosopher --labels=Featured,Type-Archive,OpSys-Windows pandoc-x.yy.zip--_ Go to Google code and deprecate the old versions--_ Upload to HackageDB--_ email roktas to upload to debian--_ make macport, test on a mac--_ submit change request to MacPorts launchpad- http://guide.macports.org/#project.update-policies--_ make FreeBSD port, test on FreeBSD--_ submit change request to FreeBSD - http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/port-upgrading.html- http://www.freebsd.org/send-pr.html--_ Update website, including short description of changes--_ Announce on pandoc-announce, pandoc-discuss--_ Update freshmeat page-
Setup.hs view
@@ -1,2 +1,59 @@ import Distribution.Simple-main = defaultMain+import Distribution.PackageDescription ( emptyHookedBuildInfo )+import Control.Exception ( bracket_ )+import System.Process ( runCommand, runProcess, waitForProcess )+import System.FilePath ( (</>), (<.>) )+import System.Directory+import System.IO ( stderr )+import System.Exit+import System.Time+import System.IO.Error ( isDoesNotExistError )+import Data.Maybe ( fromJust, isNothing, catMaybes )++main = defaultMainWithHooks $+ simpleUserHooks { runTests = runTestSuite+ , postBuild = makeManPages }++-- | Run test suite.+runTestSuite _ _ _ _ = do+ inDirectory "tests" $ runCommand "runhaskell -i.. RunTests.hs" >>= waitForProcess+ return ()++-- | Build man pages from markdown sources in man/man1/.+makeManPages _ _ _ _ = do+ mapM makeManPage ["pandoc.1", "hsmarkdown.1", "html2markdown.1", "markdown2pdf.1"]+ return ()++-- | Build a man page from markdown source in man/man1.+makeManPage manpage = do+ let manDir = "man" </> "man1"+ let pandoc = "dist" </> "build" </> "pandoc" </> "pandoc"+ let page = manDir </> manpage+ let source = manDir </> manpage <.> "md"+ modifiedDeps <- modifiedDependencies page [source]+ if null modifiedDeps+ then return ()+ else do+ ec <- runProcess pandoc ["-s", "-S", "-r", "markdown", "-w", "man", "-o", page, source]+ Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess+ case ec of+ ExitSuccess -> putStrLn $ "Created " ++ manDir </> manpage+ _ -> error $ "Error creating " ++ manDir </> manpage++-- | Returns a list of 'dependencies' that have been modified after 'file'.+modifiedDependencies :: FilePath -> [FilePath] -> IO [FilePath]+modifiedDependencies file dependencies = do+ fileModTime <- catch (getModificationTime file) $+ \e -> if isDoesNotExistError e+ then return (TOD 0 0) -- the minimum ClockTime+ else ioError e+ depModTimes <- mapM getModificationTime dependencies+ let modified = zipWith (\dep time -> if time > fileModTime then Just dep else Nothing) dependencies depModTimes+ return $ catMaybes modified++-- | Perform an IO action in a directory.+inDirectory :: FilePath -> IO a -> IO a+inDirectory dir action = do+ oldDir <- getCurrentDirectory+ bracket_ (setCurrentDirectory dir) (setCurrentDirectory oldDir) action+
Text/Pandoc.hs view
@@ -36,13 +36,14 @@ > module Main where > import Text.Pandoc-> +> import qualified System.IO.UTF8 as U+> > markdownToRST :: String -> String-> markdownToRST = toUTF8 .+> markdownToRST = > (writeRST defaultWriterOptions {writerReferenceLinks = True}) .-> (readMarkdown defaultParserState) . fromUTF8+> readMarkdown defaultParserState > -> main = interact markdownToRST+> main = U.getContents >>= U.putStrLn . markdownToRST -} @@ -68,21 +69,22 @@ , writeRST , writeLaTeX , writeConTeXt+ , writeTexinfo , writeHtml , writeHtmlString , writeS5 , writeS5String , writeDocbook+ , writeOpenDocument , writeMan+ , writeMediaWiki , writeRTF , prettyPandoc -- * Writer options used in writers , WriterOptions (..) , defaultWriterOptions -- * Default headers for various output formats- , module Text.Pandoc.Writers.DefaultHeaders- -- * Functions for converting to and from UTF-8- , module Text.Pandoc.UTF8+ , module Text.Pandoc.DefaultHeaders -- * Version , pandocVersion ) where@@ -96,15 +98,17 @@ import Text.Pandoc.Writers.RST import Text.Pandoc.Writers.LaTeX import Text.Pandoc.Writers.ConTeXt+import Text.Pandoc.Writers.Texinfo import Text.Pandoc.Writers.HTML import Text.Pandoc.Writers.S5 import Text.Pandoc.Writers.Docbook+import Text.Pandoc.Writers.OpenDocument import Text.Pandoc.Writers.Man import Text.Pandoc.Writers.RTF -import Text.Pandoc.Writers.DefaultHeaders-import Text.Pandoc.UTF8+import Text.Pandoc.Writers.MediaWiki+import Text.Pandoc.DefaultHeaders import Text.Pandoc.Shared -- | Version number of pandoc library. pandocVersion :: String-pandocVersion = "0.46"+pandocVersion = "1.0"
− Text/Pandoc/ASCIIMathML.hs
@@ -1,14 +0,0 @@-------------------------------------------------------- Do not edit this file by hand. Edit --- 'templates/ASCIIMathML.hs'--- and run ./fillTemplates.pl Text/Pandoc/ASCIIMathML.hs--------------------------------------------------------- | 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 - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n\nvar mathcolor = \"\"; // change it to \"\" (to inherit) or another color\nvar mathfontsize = \"1em\"; // change to e.g. 1.2em for larger math\nvar mathfontfamily = \"serif\"; // change to \"\" to inherit (works in IE) \n // or another family (e.g. \"arial\")\nvar automathrecognize = false; // writing \"amath\" on page makes this true\nvar checkForMathML = true; // check if browser can display MathML\nvar notifyIfNoMathML = true; // display note at top if no MathML capability\nvar alertIfNoMathML = false; // show alert box if no MathML capability\nvar translateOnLoad = true; // set to false to do call translators from js \nvar translateLaTeX = true; // false to preserve $..$, $$..$$\nvar translateLaTeXformatting = true; // false to preserve \\emph,\\begin{},\\end{}\nvar translateASCIIMath = true; // false to preserve `..`\nvar translateASCIIsvg = true; // false to preserve agraph.., \\begin{graph}..\nvar avoidinnerHTML = false; // set true if assigning to innerHTML gives error\nvar displaystyle = true; // puts limits above and below large operators\nvar showasciiformulaonhover = true; // helps students learn ASCIIMath\nvar decimalsign = \".\"; // change to \",\" if you like, beware of `(1,2)`!\nvar AMdelimiter1 = \"`\", AMescape1 = \"\\\\\\\\`\"; // can use other characters\nvar AMdocumentId = \"wikitext\" // PmWiki element containing math (default=body)\nvar checkforprocessasciimathinmoodle = false; // true for systems like Moodle\nvar dsvglocation = \"\"; // path to d.svg (blank if same as ASCIIMathML.js loc)\n\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n\nvar isIE = document.createElementNS==null;\nvar noMathML = false, translated = false;\n\nif (isIE) { // avoid adding MathPlayer info explicitly to each webpage\n document.write(\"<object id=\\\"mathplayer\\\"\\\n classid=\\\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\\\"></object>\");\n document.write(\"<?import namespace=\\\"m\\\" implementation=\\\"#mathplayer\\\"?>\");\n}\n\n// Add a stylesheet, replacing any previous custom stylesheet (adapted from TW)\nfunction setStylesheet(s) {\n\tvar id = \"AMMLcustomStyleSheet\";\n\tvar n = document.getElementById(id);\n\tif(document.createStyleSheet) {\n\t\t// Test for IE's non-standard createStyleSheet method\n\t\tif(n)\n\t\t\tn.parentNode.removeChild(n);\n\t\t// This failed without the \n\t\tdocument.getElementsByTagName(\"head\")[0].insertAdjacentHTML(\"beforeEnd\",\" <style id='\" + id + \"'>\" + s + \"</style>\");\n\t} else {\n\t\tif(n) {\n\t\t\tn.replaceChild(document.createTextNode(s),n.firstChild);\n\t\t} else {\n\t\t\tn = document.createElement(\"style\");\n\t\t\tn.type = \"text/css\";\n\t\t\tn.id = id;\n\t\t\tn.appendChild(document.createTextNode(s));\n\t\t\tdocument.getElementsByTagName(\"head\")[0].appendChild(n);\n\t\t}\n\t}\n}\n\nsetStylesheet(\"#AMMLcloseDiv \\{font-size:0.8em; padding-top:1em; color:#014\\}\\n#AMMLwarningBox \\{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\\}\");\n\nfunction init(){\n\tvar msg, warnings = new Array();\n\tif (document.getElementById==null){\n\t\talert(\"This webpage requires a recent browser such as Mozilla Firefox/Netscape 7+ or Internet Explorer 6+ with MathPlayer and Adobe SVGviewer\");\n\t\treturn null;\n\t}\n\tif (checkForMathML && (msg = checkMathML())) warnings.push(msg);\n\tif (checkIfSVGavailable && (msg = checkSVG())) warnings.push(msg);\n\tif (warnings.length>0) displayWarnings(warnings);\n\tif (!noMathML) initSymbols();\n\treturn true;\n}\n\nfunction checkMathML(){\n if (navigator.appName.slice(0,8)==\"Netscape\") \n if (navigator.appVersion.slice(0,1)>=\"5\") noMathML = null;\n else noMathML = true;\n else if (navigator.appName.slice(0,9)==\"Microsoft\")\n try {\n var ActiveX = new ActiveXObject(\"MathPlayer.Factory.1\");\n noMathML = null;\n } catch (e) {\n noMathML = true;\n }\n else noMathML = true;\n//noMathML = true; //uncomment to check\n if (noMathML && notifyIfNoMathML) {\n var msg = \"To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later.\";\n if (alertIfNoMathML)\n alert(msg);\n else return msg;\n }\n}\n\nfunction hideWarning(){\n\tvar body = document.getElementsByTagName(\"body\")[0];\n\tbody.removeChild(document.getElementById('AMMLwarningBox'));\n\tbody.onclick = null;\n}\n\nfunction displayWarnings(warnings) {\n var i, frag, nd = createElementXHTML(\"div\");\n var body = document.getElementsByTagName(\"body\")[0];\n body.onclick=hideWarning;\n nd.id = 'AMMLwarningBox';\n for (i=0; i<warnings.length; i++) {\n\tfrag = createElementXHTML(\"div\");\n\tfrag.appendChild(document.createTextNode(warnings[i]));\n\tfrag.style.paddingBottom = \"1.0em\";\n\tnd.appendChild(frag);\n }\n nd.appendChild(createElementXHTML(\"p\"));\n nd.appendChild(document.createTextNode(\"For instructions see the \"));\n var an = createElementXHTML(\"a\");\n an.appendChild(document.createTextNode(\"ASCIIMathML\"));\n an.setAttribute(\"href\",\"http://www.chapman.edu/~jipsen/asciimath.html\");\n nd.appendChild(an);\n nd.appendChild(document.createTextNode(\" homepage\"));\n an = createElementXHTML(\"div\");\n an.id = 'AMMLcloseDiv';\n an.appendChild(document.createTextNode('(click anywhere to close this warning)'));\n nd.appendChild(an);\n var body = document.getElementsByTagName(\"body\")[0];\n body.insertBefore(nd,body.childNodes[0]);\n}\n\nfunction translate(spanclassAM) {\n if (!translated) { // run this only once\n translated = true;\n var body = document.getElementsByTagName(\"body\")[0];\n var processN = document.getElementById(AMdocumentId);\n if (translateLaTeX) LMprocessNode((processN!=null?processN:body));\n if (translateASCIIMath) AMprocessNode((processN!=null?processN:body), false, spanclassAM);\n }\n}\n\nfunction createElementXHTML(t) {\n if (isIE) return document.createElement(t);\n else return document.createElementNS(\"http://www.w3.org/1999/xhtml\",t);\n}\n\nfunction createMmlNode(t,frag) {\n if (isIE) var node = document.createElement(\"m:\"+t);\n else var node = document.createElementNS(\"http://www.w3.org/1998/Math/MathML\",t);\n if (frag) node.appendChild(frag);\n return node;\n}\n\n// character lists for Mozilla/Netscape fonts\nvar AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];\nvar AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];\nvar AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];\n\nvar CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,\n RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,\n LEFTRIGHT = 9, TEXT = 10, BIG = 11, LONG = 12, STRETCHY = 13,\n MATRIX = 14;; // token types\n\nvar AMquote = {input:\"\\\"\", tag:\"mtext\", output:\"mbox\", tex:null, ttype:TEXT};\n\nvar AMsymbols = [\n//some greek symbols\n{input:\"alpha\", tag:\"mi\", output:\"\\u03B1\", tex:null, ttype:CONST},\n{input:\"beta\", tag:\"mi\", output:\"\\u03B2\", tex:null, ttype:CONST},\n{input:\"chi\", tag:\"mi\", output:\"\\u03C7\", tex:null, ttype:CONST},\n{input:\"delta\", tag:\"mi\", output:\"\\u03B4\", tex:null, ttype:CONST},\n{input:\"Delta\", tag:\"mo\", output:\"\\u0394\", tex:null, ttype:CONST},\n{input:\"epsi\", tag:\"mi\", output:\"\\u03B5\", tex:\"epsilon\", ttype:CONST},\n{input:\"varepsilon\", tag:\"mi\", output:\"\\u025B\", tex:null, ttype:CONST},\n{input:\"eta\", tag:\"mi\", output:\"\\u03B7\", tex:null, ttype:CONST},\n{input:\"gamma\", tag:\"mi\", output:\"\\u03B3\", tex:null, ttype:CONST},\n{input:\"Gamma\", tag:\"mo\", output:\"\\u0393\", tex:null, ttype:CONST},\n{input:\"iota\", tag:\"mi\", output:\"\\u03B9\", tex:null, ttype:CONST},\n{input:\"kappa\", tag:\"mi\", output:\"\\u03BA\", tex:null, ttype:CONST},\n{input:\"lambda\", tag:\"mi\", output:\"\\u03BB\", tex:null, ttype:CONST},\n{input:\"Lambda\", tag:\"mo\", output:\"\\u039B\", tex:null, ttype:CONST},\n{input:\"mu\", tag:\"mi\", output:\"\\u03BC\", tex:null, ttype:CONST},\n{input:\"nu\", tag:\"mi\", output:\"\\u03BD\", tex:null, ttype:CONST},\n{input:\"omega\", tag:\"mi\", output:\"\\u03C9\", tex:null, ttype:CONST},\n{input:\"Omega\", tag:\"mo\", output:\"\\u03A9\", tex:null, ttype:CONST},\n{input:\"phi\", tag:\"mi\", output:\"\\u03C6\", tex:null, ttype:CONST},\n{input:\"varphi\", tag:\"mi\", output:\"\\u03D5\", tex:null, ttype:CONST},\n{input:\"Phi\", tag:\"mo\", output:\"\\u03A6\", tex:null, ttype:CONST},\n{input:\"pi\", tag:\"mi\", output:\"\\u03C0\", tex:null, ttype:CONST},\n{input:\"Pi\", tag:\"mo\", output:\"\\u03A0\", tex:null, ttype:CONST},\n{input:\"psi\", tag:\"mi\", output:\"\\u03C8\", tex:null, ttype:CONST},\n{input:\"Psi\", tag:\"mi\", output:\"\\u03A8\", tex:null, ttype:CONST},\n{input:\"rho\", tag:\"mi\", output:\"\\u03C1\", tex:null, ttype:CONST},\n{input:\"sigma\", tag:\"mi\", output:\"\\u03C3\", tex:null, ttype:CONST},\n{input:\"Sigma\", tag:\"mo\", output:\"\\u03A3\", tex:null, ttype:CONST},\n{input:\"tau\", tag:\"mi\", output:\"\\u03C4\", tex:null, ttype:CONST},\n{input:\"theta\", tag:\"mi\", output:\"\\u03B8\", tex:null, ttype:CONST},\n{input:\"vartheta\", tag:\"mi\", output:\"\\u03D1\", tex:null, ttype:CONST},\n{input:\"Theta\", tag:\"mo\", output:\"\\u0398\", tex:null, ttype:CONST},\n{input:\"upsilon\", tag:\"mi\", output:\"\\u03C5\", tex:null, ttype:CONST},\n{input:\"xi\", tag:\"mi\", output:\"\\u03BE\", tex:null, ttype:CONST},\n{input:\"Xi\", tag:\"mo\", output:\"\\u039E\", tex:null, ttype:CONST},\n{input:\"zeta\", tag:\"mi\", output:\"\\u03B6\", tex:null, ttype:CONST},\n\n//binary operation symbols\n//{input:\"-\", tag:\"mo\", output:\"\\u0096\", tex:null, ttype:CONST},\n{input:\"*\", tag:\"mo\", output:\"\\u22C5\", tex:\"cdot\", ttype:CONST},\n{input:\"**\", tag:\"mo\", output:\"\\u22C6\", tex:\"star\", ttype:CONST},\n{input:\"//\", tag:\"mo\", output:\"/\", tex:null, ttype:CONST},\n{input:\"\\\\\\\\\", tag:\"mo\", output:\"\\\\\", tex:\"backslash\", ttype:CONST},\n{input:\"setminus\", tag:\"mo\", output:\"\\\\\", tex:null, ttype:CONST},\n{input:\"xx\", tag:\"mo\", output:\"\\u00D7\", tex:\"times\", ttype:CONST},\n{input:\"-:\", tag:\"mo\", output:\"\\u00F7\", tex:\"divide\", ttype:CONST},\n{input:\"@\", tag:\"mo\", output:\"\\u2218\", tex:\"circ\", ttype:CONST},\n{input:\"o+\", tag:\"mo\", output:\"\\u2295\", tex:\"oplus\", ttype:CONST},\n{input:\"ox\", tag:\"mo\", output:\"\\u2297\", tex:\"otimes\", ttype:CONST},\n{input:\"o.\", tag:\"mo\", output:\"\\u2299\", tex:\"odot\", ttype:CONST},\n{input:\"sum\", tag:\"mo\", output:\"\\u2211\", tex:null, ttype:UNDEROVER},\n{input:\"prod\", tag:\"mo\", output:\"\\u220F\", tex:null, ttype:UNDEROVER},\n{input:\"^^\", tag:\"mo\", output:\"\\u2227\", tex:\"wedge\", ttype:CONST},\n{input:\"^^^\", tag:\"mo\", output:\"\\u22C0\", tex:\"bigwedge\", ttype:UNDEROVER},\n{input:\"vv\", tag:\"mo\", output:\"\\u2228\", tex:\"vee\", ttype:CONST},\n{input:\"vvv\", tag:\"mo\", output:\"\\u22C1\", tex:\"bigvee\", ttype:UNDEROVER},\n{input:\"nn\", tag:\"mo\", output:\"\\u2229\", tex:\"cap\", ttype:CONST},\n{input:\"nnn\", tag:\"mo\", output:\"\\u22C2\", tex:\"bigcap\", ttype:UNDEROVER},\n{input:\"uu\", tag:\"mo\", output:\"\\u222A\", tex:\"cup\", ttype:CONST},\n{input:\"uuu\", tag:\"mo\", output:\"\\u22C3\", tex:\"bigcup\", ttype:UNDEROVER},\n\n//binary relation symbols\n{input:\"!=\", tag:\"mo\", output:\"\\u2260\", tex:\"ne\", ttype:CONST},\n{input:\":=\", tag:\"mo\", output:\":=\", tex:null, ttype:CONST},\n{input:\"lt\", tag:\"mo\", output:\"<\", tex:null, ttype:CONST},\n{input:\"<=\", tag:\"mo\", output:\"\\u2264\", tex:\"le\", ttype:CONST},\n{input:\"lt=\", tag:\"mo\", output:\"\\u2264\", tex:\"leq\", ttype:CONST},\n{input:\">=\", tag:\"mo\", output:\"\\u2265\", tex:\"ge\", ttype:CONST},\n{input:\"geq\", tag:\"mo\", output:\"\\u2265\", tex:null, ttype:CONST},\n{input:\"-<\", tag:\"mo\", output:\"\\u227A\", tex:\"prec\", ttype:CONST},\n{input:\"-lt\", tag:\"mo\", output:\"\\u227A\", tex:null, ttype:CONST},\n{input:\">-\", tag:\"mo\", output:\"\\u227B\", tex:\"succ\", ttype:CONST},\n{input:\"-<=\", tag:\"mo\", output:\"\\u2AAF\", tex:\"preceq\", ttype:CONST},\n{input:\">-=\", tag:\"mo\", output:\"\\u2AB0\", tex:\"succeq\", ttype:CONST},\n{input:\"in\", tag:\"mo\", output:\"\\u2208\", tex:null, ttype:CONST},\n{input:\"!in\", tag:\"mo\", output:\"\\u2209\", tex:\"notin\", ttype:CONST},\n{input:\"sub\", tag:\"mo\", output:\"\\u2282\", tex:\"subset\", ttype:CONST},\n{input:\"sup\", tag:\"mo\", output:\"\\u2283\", tex:\"supset\", ttype:CONST},\n{input:\"sube\", tag:\"mo\", output:\"\\u2286\", tex:\"subseteq\", ttype:CONST},\n{input:\"supe\", tag:\"mo\", output:\"\\u2287\", tex:\"supseteq\", ttype:CONST},\n{input:\"-=\", tag:\"mo\", output:\"\\u2261\", tex:\"equiv\", ttype:CONST},\n{input:\"~=\", tag:\"mo\", output:\"\\u2245\", tex:\"cong\", ttype:CONST},\n{input:\"~~\", tag:\"mo\", output:\"\\u2248\", tex:\"approx\", ttype:CONST},\n{input:\"prop\", tag:\"mo\", output:\"\\u221D\", tex:\"propto\", ttype:CONST},\n\n//logical symbols\n{input:\"and\", tag:\"mtext\", output:\"and\", tex:null, ttype:SPACE},\n{input:\"or\", tag:\"mtext\", output:\"or\", tex:null, ttype:SPACE},\n{input:\"not\", tag:\"mo\", output:\"\\u00AC\", tex:\"neg\", ttype:CONST},\n{input:\"=>\", tag:\"mo\", output:\"\\u21D2\", tex:\"implies\", ttype:CONST},\n{input:\"if\", tag:\"mo\", output:\"if\", tex:null, ttype:SPACE},\n{input:\"<=>\", tag:\"mo\", output:\"\\u21D4\", tex:\"iff\", ttype:CONST},\n{input:\"AA\", tag:\"mo\", output:\"\\u2200\", tex:\"forall\", ttype:CONST},\n{input:\"EE\", tag:\"mo\", output:\"\\u2203\", tex:\"exists\", ttype:CONST},\n{input:\"_|_\", tag:\"mo\", output:\"\\u22A5\", tex:\"bot\", ttype:CONST},\n{input:\"TT\", tag:\"mo\", output:\"\\u22A4\", tex:\"top\", ttype:CONST},\n{input:\"|--\", tag:\"mo\", output:\"\\u22A2\", tex:\"vdash\", ttype:CONST},\n{input:\"|==\", tag:\"mo\", output:\"\\u22A8\", tex:\"models\", ttype:CONST},\n\n//grouping brackets\n{input:\"(\", tag:\"mo\", output:\"(\", tex:null, ttype:LEFTBRACKET},\n{input:\")\", tag:\"mo\", output:\")\", tex:null, ttype:RIGHTBRACKET},\n{input:\"[\", tag:\"mo\", output:\"[\", tex:null, ttype:LEFTBRACKET},\n{input:\"]\", tag:\"mo\", output:\"]\", tex:null, ttype:RIGHTBRACKET},\n{input:\"{\", tag:\"mo\", output:\"{\", tex:null, ttype:LEFTBRACKET},\n{input:\"}\", tag:\"mo\", output:\"}\", tex:null, ttype:RIGHTBRACKET},\n{input:\"|\", tag:\"mo\", output:\"|\", tex:null, ttype:LEFTRIGHT},\n//{input:\"||\", tag:\"mo\", output:\"||\", tex:null, ttype:LEFTRIGHT},\n{input:\"(:\", tag:\"mo\", output:\"\\u2329\", tex:\"langle\", ttype:LEFTBRACKET},\n{input:\":)\", tag:\"mo\", output:\"\\u232A\", tex:\"rangle\", ttype:RIGHTBRACKET},\n{input:\"<<\", tag:\"mo\", output:\"\\u2329\", tex:null, ttype:LEFTBRACKET},\n{input:\">>\", tag:\"mo\", output:\"\\u232A\", tex:null, ttype:RIGHTBRACKET},\n{input:\"{:\", tag:\"mo\", output:\"{:\", tex:null, ttype:LEFTBRACKET, invisible:true},\n{input:\":}\", tag:\"mo\", output:\":}\", tex:null, ttype:RIGHTBRACKET, invisible:true},\n\n//miscellaneous symbols\n{input:\"int\", tag:\"mo\", output:\"\\u222B\", tex:null, ttype:CONST},\n{input:\"dx\", tag:\"mi\", output:\"{:d x:}\", tex:null, ttype:DEFINITION},\n{input:\"dy\", tag:\"mi\", output:\"{:d y:}\", tex:null, ttype:DEFINITION},\n{input:\"dz\", tag:\"mi\", output:\"{:d z:}\", tex:null, ttype:DEFINITION},\n{input:\"dt\", tag:\"mi\", output:\"{:d t:}\", tex:null, ttype:DEFINITION},\n{input:\"oint\", tag:\"mo\", output:\"\\u222E\", tex:null, ttype:CONST},\n{input:\"del\", tag:\"mo\", output:\"\\u2202\", tex:\"partial\", ttype:CONST},\n{input:\"grad\", tag:\"mo\", output:\"\\u2207\", tex:\"nabla\", ttype:CONST},\n{input:\"+-\", tag:\"mo\", output:\"\\u00B1\", tex:\"pm\", ttype:CONST},\n{input:\"O/\", tag:\"mo\", output:\"\\u2205\", tex:\"emptyset\", ttype:CONST},\n{input:\"oo\", tag:\"mo\", output:\"\\u221E\", tex:\"infty\", ttype:CONST},\n{input:\"aleph\", tag:\"mo\", output:\"\\u2135\", tex:null, ttype:CONST},\n{input:\"...\", tag:\"mo\", output:\"...\", tex:\"ldots\", ttype:CONST},\n{input:\":.\", tag:\"mo\", output:\"\\u2234\", tex:\"therefore\", ttype:CONST},\n{input:\"/_\", tag:\"mo\", output:\"\\u2220\", tex:\"angle\", ttype:CONST},\n{input:\"\\\\ \", tag:\"mo\", output:\"\\u00A0\", tex:null, ttype:CONST},\n{input:\"quad\", tag:\"mo\", output:\"\\u00A0\\u00A0\", tex:null, ttype:CONST},\n{input:\"qquad\", tag:\"mo\", output:\"\\u00A0\\u00A0\\u00A0\\u00A0\", tex:null, ttype:CONST},\n{input:\"cdots\", tag:\"mo\", output:\"\\u22EF\", tex:null, ttype:CONST},\n{input:\"vdots\", tag:\"mo\", output:\"\\u22EE\", tex:null, ttype:CONST},\n{input:\"ddots\", tag:\"mo\", output:\"\\u22F1\", tex:null, ttype:CONST},\n{input:\"diamond\", tag:\"mo\", output:\"\\u22C4\", tex:null, ttype:CONST},\n{input:\"square\", tag:\"mo\", output:\"\\u25A1\", tex:null, ttype:CONST},\n{input:\"|__\", tag:\"mo\", output:\"\\u230A\", tex:\"lfloor\", ttype:CONST},\n{input:\"__|\", tag:\"mo\", output:\"\\u230B\", tex:\"rfloor\", ttype:CONST},\n{input:\"|~\", tag:\"mo\", output:\"\\u2308\", tex:\"lceiling\", ttype:CONST},\n{input:\"~|\", tag:\"mo\", output:\"\\u2309\", tex:\"rceiling\", ttype:CONST},\n{input:\"CC\", tag:\"mo\", output:\"\\u2102\", tex:null, ttype:CONST},\n{input:\"NN\", tag:\"mo\", output:\"\\u2115\", tex:null, ttype:CONST},\n{input:\"QQ\", tag:\"mo\", output:\"\\u211A\", tex:null, ttype:CONST},\n{input:\"RR\", tag:\"mo\", output:\"\\u211D\", tex:null, ttype:CONST},\n{input:\"ZZ\", tag:\"mo\", output:\"\\u2124\", tex:null, ttype:CONST},\n{input:\"f\", tag:\"mi\", output:\"f\", tex:null, ttype:UNARY, func:true},\n{input:\"g\", tag:\"mi\", output:\"g\", tex:null, ttype:UNARY, func:true},\n\n//standard functions\n{input:\"lim\", tag:\"mo\", output:\"lim\", tex:null, ttype:UNDEROVER},\n{input:\"Lim\", tag:\"mo\", output:\"Lim\", tex:null, ttype:UNDEROVER},\n{input:\"sin\", tag:\"mo\", output:\"sin\", tex:null, ttype:UNARY, func:true},\n{input:\"cos\", tag:\"mo\", output:\"cos\", tex:null, ttype:UNARY, func:true},\n{input:\"tan\", tag:\"mo\", output:\"tan\", tex:null, ttype:UNARY, func:true},\n{input:\"sinh\", tag:\"mo\", output:\"sinh\", tex:null, ttype:UNARY, func:true},\n{input:\"cosh\", tag:\"mo\", output:\"cosh\", tex:null, ttype:UNARY, func:true},\n{input:\"tanh\", tag:\"mo\", output:\"tanh\", tex:null, ttype:UNARY, func:true},\n{input:\"cot\", tag:\"mo\", output:\"cot\", tex:null, ttype:UNARY, func:true},\n{input:\"sec\", tag:\"mo\", output:\"sec\", tex:null, ttype:UNARY, func:true},\n{input:\"csc\", tag:\"mo\", output:\"csc\", tex:null, ttype:UNARY, func:true},\n{input:\"log\", tag:\"mo\", output:\"log\", tex:null, ttype:UNARY, func:true},\n{input:\"ln\", tag:\"mo\", output:\"ln\", tex:null, ttype:UNARY, func:true},\n{input:\"det\", tag:\"mo\", output:\"det\", tex:null, ttype:UNARY, func:true},\n{input:\"dim\", tag:\"mo\", output:\"dim\", tex:null, ttype:CONST},\n{input:\"mod\", tag:\"mo\", output:\"mod\", tex:null, ttype:CONST},\n{input:\"gcd\", tag:\"mo\", output:\"gcd\", tex:null, ttype:UNARY, func:true},\n{input:\"lcm\", tag:\"mo\", output:\"lcm\", tex:null, ttype:UNARY, func:true},\n{input:\"lub\", tag:\"mo\", output:\"lub\", tex:null, ttype:CONST},\n{input:\"glb\", tag:\"mo\", output:\"glb\", tex:null, ttype:CONST},\n{input:\"min\", tag:\"mo\", output:\"min\", tex:null, ttype:UNDEROVER},\n{input:\"max\", tag:\"mo\", output:\"max\", tex:null, ttype:UNDEROVER},\n\n//arrows\n{input:\"uarr\", tag:\"mo\", output:\"\\u2191\", tex:\"uparrow\", ttype:CONST},\n{input:\"darr\", tag:\"mo\", output:\"\\u2193\", tex:\"downarrow\", ttype:CONST},\n{input:\"rarr\", tag:\"mo\", output:\"\\u2192\", tex:\"rightarrow\", ttype:CONST},\n{input:\"->\", tag:\"mo\", output:\"\\u2192\", tex:\"to\", ttype:CONST},\n{input:\">->\", tag:\"mo\", output:\"\\u21A3\", tex:\"rightarrowtail\", ttype:CONST},\n{input:\"->>\", tag:\"mo\", output:\"\\u21A0\", tex:\"twoheadrightarrow\", ttype:CONST},\n{input:\">->>\", tag:\"mo\", output:\"\\u2916\", tex:\"twoheadrightarrowtail\", ttype:CONST},\n{input:\"|->\", tag:\"mo\", output:\"\\u21A6\", tex:\"mapsto\", ttype:CONST},\n{input:\"larr\", tag:\"mo\", output:\"\\u2190\", tex:\"leftarrow\", ttype:CONST},\n{input:\"harr\", tag:\"mo\", output:\"\\u2194\", tex:\"leftrightarrow\", ttype:CONST},\n{input:\"rArr\", tag:\"mo\", output:\"\\u21D2\", tex:\"Rightarrow\", ttype:CONST},\n{input:\"lArr\", tag:\"mo\", output:\"\\u21D0\", tex:\"Leftarrow\", ttype:CONST},\n{input:\"hArr\", tag:\"mo\", output:\"\\u21D4\", tex:\"Leftrightarrow\", ttype:CONST},\n//commands with argument\n{input:\"sqrt\", tag:\"msqrt\", output:\"sqrt\", tex:null, ttype:UNARY},\n{input:\"root\", tag:\"mroot\", output:\"root\", tex:null, ttype:BINARY},\n{input:\"frac\", tag:\"mfrac\", output:\"/\", tex:null, ttype:BINARY},\n{input:\"/\", tag:\"mfrac\", output:\"/\", tex:null, ttype:INFIX},\n{input:\"stackrel\", tag:\"mover\", output:\"stackrel\", tex:null, ttype:BINARY},\n{input:\"_\", tag:\"msub\", output:\"_\", tex:null, ttype:INFIX},\n{input:\"^\", tag:\"msup\", output:\"^\", tex:null, ttype:INFIX},\n{input:\"hat\", tag:\"mover\", output:\"\\u005E\", tex:null, ttype:UNARY, acc:true},\n{input:\"bar\", tag:\"mover\", output:\"\\u00AF\", tex:\"overline\", ttype:UNARY, acc:true},\n{input:\"vec\", tag:\"mover\", output:\"\\u2192\", tex:null, ttype:UNARY, acc:true},\n{input:\"dot\", tag:\"mover\", output:\".\", tex:null, ttype:UNARY, acc:true},\n{input:\"ddot\", tag:\"mover\", output:\"..\", tex:null, ttype:UNARY, acc:true},\n{input:\"ul\", tag:\"munder\", output:\"\\u0332\", tex:\"underline\", ttype:UNARY, acc:true},\n{input:\"text\", tag:\"mtext\", output:\"text\", tex:null, ttype:TEXT},\n{input:\"mbox\", tag:\"mtext\", output:\"mbox\", tex:null, ttype:TEXT},\nAMquote,\n{input:\"bb\", tag:\"mstyle\", atname:\"fontweight\", atval:\"bold\", output:\"bb\", tex:null, ttype:UNARY},\n{input:\"mathbf\", tag:\"mstyle\", atname:\"fontweight\", atval:\"bold\", output:\"mathbf\", tex:null, ttype:UNARY},\n{input:\"sf\", tag:\"mstyle\", atname:\"fontfamily\", atval:\"sans-serif\", output:\"sf\", tex:null, ttype:UNARY},\n{input:\"mathsf\", tag:\"mstyle\", atname:\"fontfamily\", atval:\"sans-serif\", output:\"mathsf\", tex:null, ttype:UNARY},\n{input:\"bbb\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"double-struck\", output:\"bbb\", tex:null, ttype:UNARY, codes:AMbbb},\n{input:\"mathbb\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"double-struck\", output:\"mathbb\", tex:null, ttype:UNARY, codes:AMbbb},\n{input:\"cc\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"script\", output:\"cc\", tex:null, ttype:UNARY, codes:AMcal},\n{input:\"mathcal\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"script\", output:\"mathcal\", tex:null, ttype:UNARY, codes:AMcal},\n{input:\"tt\", tag:\"mstyle\", atname:\"fontfamily\", atval:\"monospace\", output:\"tt\", tex:null, ttype:UNARY},\n{input:\"mathtt\", tag:\"mstyle\", atname:\"fontfamily\", atval:\"monospace\", output:\"mathtt\", tex:null, ttype:UNARY},\n{input:\"fr\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"fraktur\", output:\"fr\", tex:null, ttype:UNARY, codes:AMfrk},\n{input:\"mathfrak\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"fraktur\", output:\"mathfrak\", tex:null, ttype:UNARY, codes:AMfrk}\n];\n\nfunction compareNames(s1,s2) {\n if (s1.input > s2.input) return 1\n else return -1;\n}\n\nvar AMnames = []; //list of input symbols\n\nfunction initSymbols() {\n var texsymbols = [], i;\n for (i=0; i<AMsymbols.length; i++)\n if (AMsymbols[i].tex) \n texsymbols[texsymbols.length] = {input:AMsymbols[i].tex, \n tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};\n AMsymbols = AMsymbols.concat(texsymbols);\n refreshSymbols();\n}\n\nfunction refreshSymbols(){\n var i;\n AMsymbols.sort(compareNames);\n for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;\n LMsymbols.sort(compareNames);\n for (i=0; i<LMsymbols.length; i++) LMnames[i] = LMsymbols[i].input;\n}\n\nfunction define(oldstr,newstr) {\n if(oldstr.substr(0,1)==\"\\\\\")\n LMsymbols = LMsymbols.concat([{input:oldstr, tag:\"mo\", output:newstr,\n ttype:DEFINITION}]);\n else\n AMsymbols = AMsymbols.concat([{input:oldstr, tag:\"mo\", output:newstr, \n tex:null, ttype:DEFINITION}]);\n refreshSymbols(); // this may be a problem if many symbols are defined!\n}\n\nfunction AMremoveCharsAndBlanks(str,n) {\n//remove n characters and any following blanks\n var st;\n if (str.charAt(n)==\"\\\\\" && str.charAt(n+1)!=\"\\\\\" && str.charAt(n+1)!=\" \") \n st = str.slice(n+1);\n else st = str.slice(n);\n for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);\n return st.slice(i);\n}\n\nfunction position(arr, str, n) { \n// return position >=n where str appears or would be inserted\n// assumes arr is sorted\n if (n==0) {\n var h,m;\n n = -1;\n h = arr.length;\n while (n+1<h) {\n m = (n+h) >> 1;\n if (arr[m]<str) n = m; else h = m;\n }\n return h;\n } else\n for (var i=n; i<arr.length && arr[i]<str; i++);\n return i; // i=arr.length || arr[i]>=str\n}\n\nfunction AMgetSymbol(str) {\n//return maximal initial substring of str that appears in names\n//return null if there is none\n var k = 0; //new pos\n var j = 0; //old pos\n var mk; //match pos\n var st;\n var tagst;\n var match = \"\";\n var more = true;\n for (var i=1; i<=str.length && more; i++) {\n st = str.slice(0,i); //initial substring of length i\n j = k;\n k = position(AMnames, st, j);\n if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){\n match = AMnames[k];\n mk = k;\n i = match.length;\n }\n more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];\n }\n AMpreviousSymbol=AMcurrentSymbol;\n if (match!=\"\"){\n AMcurrentSymbol=AMsymbols[mk].ttype;\n return AMsymbols[mk]; \n }\n// if str[0] is a digit or - return maxsubstring of digits.digits\n AMcurrentSymbol=CONST;\n k = 1;\n st = str.slice(0,1);\n var integ = true;\n while (\"0\"<=st && st<=\"9\" && k<=str.length) {\n st = str.slice(k,k+1);\n k++;\n }\n if (st == decimalsign) {\n st = str.slice(k,k+1);\n if (\"0\"<=st && st<=\"9\") {\n integ = false;\n k++;\n while (\"0\"<=st && st<=\"9\" && k<=str.length) {\n st = str.slice(k,k+1);\n k++;\n }\n }\n }\n if ((integ && k>1) || k>2) {\n st = str.slice(0,k-1);\n tagst = \"mn\";\n } else {\n k = 2;\n st = str.slice(0,1); //take 1 character\n tagst = ((\"A\">st || st>\"Z\") && (\"a\">st || st>\"z\")?\"mo\":\"mi\");\n }\n if (st==\"-\" && AMpreviousSymbol==INFIX) {\n AMcurrentSymbol = INFIX; //trick \"/\" into recognizing \"-\" on second parse\n return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};\n }\n return {input:st, tag:tagst, output:st, ttype:CONST};\n}\n\nfunction AMremoveBrackets(node) {\n var st;\n if (node.nodeName==\"mrow\") {\n st = node.firstChild.firstChild.nodeValue;\n if (st==\"(\" || st==\"[\" || st==\"{\") node.removeChild(node.firstChild);\n }\n if (node.nodeName==\"mrow\") {\n st = node.lastChild.firstChild.nodeValue;\n if (st==\")\" || st==\"]\" || st==\"}\") node.removeChild(node.lastChild);\n }\n}\n\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n\nvar AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;\n\nfunction AMparseSexpr(str) { //parses str and returns [node,tailstr]\n var symbol, node, result, i, st,// rightvert = false,\n newFrag = document.createDocumentFragment();\n str = AMremoveCharsAndBlanks(str,0);\n symbol = AMgetSymbol(str); //either a token or a bracket or empty\n if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {\n return [null,str];\n }\n if (symbol.ttype == DEFINITION) {\n str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); \n symbol = AMgetSymbol(str);\n }\n switch (symbol.ttype) { case UNDEROVER:\n case CONST:\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n return [createMmlNode(symbol.tag, //its a constant\n document.createTextNode(symbol.output)),str];\n case LEFTBRACKET: //read (expr+)\n AMnestingDepth++;\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n result = AMparseExpr(str,true);\n AMnestingDepth--;\n if (typeof symbol.invisible == \"boolean\" && symbol.invisible) \n node = createMmlNode(\"mrow\",result[0]);\n else {\n node = createMmlNode(\"mo\",document.createTextNode(symbol.output));\n node = createMmlNode(\"mrow\",node);\n node.appendChild(result[0]);\n }\n return [node,result[1]];\n case TEXT:\n if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);\n if (str.charAt(0)==\"{\") i=str.indexOf(\"}\");\n else if (str.charAt(0)==\"(\") i=str.indexOf(\")\");\n else if (str.charAt(0)==\"[\") i=str.indexOf(\"]\");\n else if (symbol==AMquote) i=str.slice(1).indexOf(\"\\\"\")+1;\n else i = 0;\n if (i==-1) i = str.length;\n st = str.slice(1,i);\n if (st.charAt(0) == \" \") {\n node = createMmlNode(\"mspace\");\n node.setAttribute(\"width\",\"1ex\");\n newFrag.appendChild(node);\n }\n newFrag.appendChild(\n createMmlNode(symbol.tag,document.createTextNode(st)));\n if (st.charAt(st.length-1) == \" \") {\n node = createMmlNode(\"mspace\");\n node.setAttribute(\"width\",\"1ex\");\n newFrag.appendChild(node);\n }\n str = AMremoveCharsAndBlanks(str,i+1);\n return [createMmlNode(\"mrow\",newFrag),str];\n case UNARY:\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n result = AMparseSexpr(str);\n if (result[0]==null) return [createMmlNode(symbol.tag,\n document.createTextNode(symbol.output)),str];\n if (typeof symbol.func == \"boolean\" && symbol.func) { // functions hack\n st = str.charAt(0);\n if (st==\"^\" || st==\"_\" || st==\"/\" || st==\"|\" || st==\",\") {\n return [createMmlNode(symbol.tag,\n document.createTextNode(symbol.output)),str];\n } else {\n node = createMmlNode(\"mrow\",\n createMmlNode(symbol.tag,document.createTextNode(symbol.output)));\n node.appendChild(result[0]);\n return [node,result[1]];\n }\n }\n AMremoveBrackets(result[0]);\n if (symbol.input == \"sqrt\") { // sqrt\n return [createMmlNode(symbol.tag,result[0]),result[1]];\n } else if (typeof symbol.acc == \"boolean\" && symbol.acc) { // accent\n node = createMmlNode(symbol.tag,result[0]);\n node.appendChild(createMmlNode(\"mo\",document.createTextNode(symbol.output)));\n return [node,result[1]];\n } else { // font change command\n if (!isIE && typeof symbol.codes != \"undefined\") {\n for (i=0; i<result[0].childNodes.length; i++)\n if (result[0].childNodes[i].nodeName==\"mi\" || result[0].nodeName==\"mi\") {\n st = (result[0].nodeName==\"mi\"?result[0].firstChild.nodeValue:\n result[0].childNodes[i].firstChild.nodeValue);\n var newst = [];\n for (var j=0; j<st.length; j++)\n if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +\n String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);\n else newst = newst + st.charAt(j);\n if (result[0].nodeName==\"mi\")\n result[0]=createMmlNode(\"mo\").\n appendChild(document.createTextNode(newst));\n else result[0].replaceChild(createMmlNode(\"mo\").\n appendChild(document.createTextNode(newst)),\n result[0].childNodes[i]);\n }\n }\n node = createMmlNode(symbol.tag,result[0]);\n node.setAttribute(symbol.atname,symbol.atval);\n return [node,result[1]];\n }\n case BINARY:\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n result = AMparseSexpr(str);\n if (result[0]==null) return [createMmlNode(\"mo\",\n document.createTextNode(symbol.input)),str];\n AMremoveBrackets(result[0]);\n var result2 = AMparseSexpr(result[1]);\n if (result2[0]==null) return [createMmlNode(\"mo\",\n document.createTextNode(symbol.input)),str];\n AMremoveBrackets(result2[0]);\n if (symbol.input==\"root\" || symbol.input==\"stackrel\") \n newFrag.appendChild(result2[0]);\n newFrag.appendChild(result[0]);\n if (symbol.input==\"frac\") newFrag.appendChild(result2[0]);\n return [createMmlNode(symbol.tag,newFrag),result2[1]];\n case INFIX:\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n return [createMmlNode(\"mo\",document.createTextNode(symbol.output)),str];\n case SPACE:\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n node = createMmlNode(\"mspace\");\n node.setAttribute(\"width\",\"1ex\");\n newFrag.appendChild(node);\n newFrag.appendChild(\n createMmlNode(symbol.tag,document.createTextNode(symbol.output)));\n node = createMmlNode(\"mspace\");\n node.setAttribute(\"width\",\"1ex\");\n newFrag.appendChild(node);\n return [createMmlNode(\"mrow\",newFrag),str];\n case LEFTRIGHT:\n// if (rightvert) return [null,str]; else rightvert = true;\n AMnestingDepth++;\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n result = AMparseExpr(str,false);\n AMnestingDepth--;\n var st = \"\";\n if (result[0].lastChild!=null)\n st = result[0].lastChild.firstChild.nodeValue;\n if (st == \"|\") { // its an absolute value subterm\n node = createMmlNode(\"mo\",document.createTextNode(symbol.output));\n node = createMmlNode(\"mrow\",node);\n node.appendChild(result[0]);\n return [node,result[1]];\n } else { // the \"|\" is a \\mid so use unicode 2223 (divides) for spacing\n node = createMmlNode(\"mo\",document.createTextNode(\"\\u2223\"));\n node = createMmlNode(\"mrow\",node);\n return [node,str];\n }\n default:\n//alert(\"default\");\n str = AMremoveCharsAndBlanks(str,symbol.input.length); \n return [createMmlNode(symbol.tag, //its a constant\n document.createTextNode(symbol.output)),str];\n }\n}\n\nfunction AMparseIexpr(str) {\n var symbol, sym1, sym2, node, result, underover;\n str = AMremoveCharsAndBlanks(str,0);\n sym1 = AMgetSymbol(str);\n result = AMparseSexpr(str);\n node = result[0];\n str = result[1];\n symbol = AMgetSymbol(str);\n if (symbol.ttype == INFIX && symbol.input != \"/\") {\n str = AMremoveCharsAndBlanks(str,symbol.input.length);\n// if (symbol.input == \"/\") result = AMparseIexpr(str); else ...\n result = AMparseSexpr(str);\n if (result[0] == null) // show box in place of missing argument\n result[0] = createMmlNode(\"mo\",document.createTextNode(\"\\u25A1\"));\n else AMremoveBrackets(result[0]);\n str = result[1];\n// if (symbol.input == \"/\") AMremoveBrackets(node);\n if (symbol.input == \"_\") {\n sym2 = AMgetSymbol(str);\n underover = (sym1.ttype == UNDEROVER);\n if (sym2.input == \"^\") {\n str = AMremoveCharsAndBlanks(str,sym2.input.length);\n var res2 = AMparseSexpr(str);\n AMremoveBrackets(res2[0]);\n str = res2[1];\n node = createMmlNode((underover?\"munderover\":\"msubsup\"),node);\n node.appendChild(result[0]);\n node.appendChild(res2[0]);\n node = createMmlNode(\"mrow\",node); // so sum does not stretch\n } else {\n node = createMmlNode((underover?\"munder\":\"msub\"),node);\n node.appendChild(result[0]);\n }\n } else {\n node = createMmlNode(symbol.tag,node);\n node.appendChild(result[0]);\n }\n }\n return [node,str];\n}\n\nfunction AMparseExpr(str,rightbracket) {\n var symbol, node, result, i, nodeList = [],\n newFrag = document.createDocumentFragment();\n do {\n str = AMremoveCharsAndBlanks(str,0);\n result = AMparseIexpr(str);\n node = result[0];\n str = result[1];\n symbol = AMgetSymbol(str);\n if (symbol.ttype == INFIX && symbol.input == \"/\") {\n str = AMremoveCharsAndBlanks(str,symbol.input.length);\n result = AMparseIexpr(str);\n if (result[0] == null) // show box in place of missing argument\n result[0] = createMmlNode(\"mo\",document.createTextNode(\"\\u25A1\"));\n else AMremoveBrackets(result[0]);\n str = result[1];\n AMremoveBrackets(node);\n node = createMmlNode(symbol.tag,node);\n node.appendChild(result[0]);\n newFrag.appendChild(node);\n symbol = AMgetSymbol(str);\n } \n else if (node!=undefined) newFrag.appendChild(node);\n } while ((symbol.ttype != RIGHTBRACKET && \n (symbol.ttype != LEFTRIGHT || rightbracket)\n || AMnestingDepth == 0) && symbol!=null && symbol.output!=\"\");\n if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {\n// if (AMnestingDepth > 0) AMnestingDepth--;\n var len = newFrag.childNodes.length;\n if (len>0 && newFrag.childNodes[len-1].nodeName == \"mrow\" && len>1 &&\n newFrag.childNodes[len-2].nodeName == \"mo\" &&\n newFrag.childNodes[len-2].firstChild.nodeValue == \",\") { //matrix\n var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;\n if (right==\")\" || right==\"]\") {\n var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;\n if (left==\"(\" && right==\")\" && symbol.output != \"}\" || \n left==\"[\" && right==\"]\") {\n var pos = []; // positions of commas\n var matrix = true;\n var m = newFrag.childNodes.length;\n for (i=0; matrix && i<m; i=i+2) {\n pos[i] = [];\n node = newFrag.childNodes[i];\n if (matrix) matrix = node.nodeName==\"mrow\" && \n (i==m-1 || node.nextSibling.nodeName==\"mo\" && \n node.nextSibling.firstChild.nodeValue==\",\")&&\n node.firstChild.firstChild.nodeValue==left &&\n node.lastChild.firstChild.nodeValue==right;\n if (matrix) \n for (var j=0; j<node.childNodes.length; j++)\n if (node.childNodes[j].firstChild.nodeValue==\",\")\n pos[i][pos[i].length]=j;\n if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;\n }\n if (matrix) {\n var row, frag, n, k, table = document.createDocumentFragment();\n for (i=0; i<m; i=i+2) {\n row = document.createDocumentFragment();\n frag = document.createDocumentFragment();\n node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>\n n = node.childNodes.length;\n k = 0;\n node.removeChild(node.firstChild); //remove (\n for (j=1; j<n-1; j++) {\n if (typeof pos[i][k] != \"undefined\" && j==pos[i][k]){\n node.removeChild(node.firstChild); //remove ,\n row.appendChild(createMmlNode(\"mtd\",frag));\n k++;\n } else frag.appendChild(node.firstChild);\n }\n row.appendChild(createMmlNode(\"mtd\",frag));\n if (newFrag.childNodes.length>2) {\n newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>\n newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>\n }\n table.appendChild(createMmlNode(\"mtr\",row));\n }\n node = createMmlNode(\"mtable\",table);\n if (typeof symbol.invisible == \"boolean\" && symbol.invisible) node.setAttribute(\"columnalign\",\"left\");\n newFrag.replaceChild(node,newFrag.firstChild);\n }\n }\n }\n }\n str = AMremoveCharsAndBlanks(str,symbol.input.length);\n if (typeof symbol.invisible != \"boolean\" || !symbol.invisible) {\n node = createMmlNode(\"mo\",document.createTextNode(symbol.output));\n newFrag.appendChild(node);\n }\n }\n return [newFrag,str];\n}\n\nfunction parseMath(str,latex) {\n var frag, node;\n AMnestingDepth = 0;\n frag = latex ? LMparseExpr(str.replace(/^\\s+/g,\"\"),false,false)[0] : AMparseExpr(str.replace(/^\\s+/g,\"\"),false)[0];\n node = createMmlNode(\"mstyle\",frag);\n node.setAttribute(\"mathcolor\",mathcolor);\n node.setAttribute(\"fontfamily\",mathfontfamily);\n node.setAttribute(\"mathsize\",mathfontsize);\n if (displaystyle) node.setAttribute(\"displaystyle\",\"true\");\n node = createMmlNode(\"math\",node);\n if (showasciiformulaonhover) //fixed by djhsu so newline\n node.setAttribute(\"title\",str.replace(/\\s+/g,\" \"));//does not show in Gecko\n return node;\n}\n\nfunction strarr2docFrag(arr, linebreaks, latex) {\n var newFrag=document.createDocumentFragment();\n var expr = false;\n for (var i=0; i<arr.length; i++) {\n if (expr) newFrag.appendChild(parseMath(arr[i],latex));\n else {\n var arri = (linebreaks ? arr[i].split(\"\\n\\n\") : [arr[i]]);\n newFrag.appendChild(createElementXHTML(\"span\").\n appendChild(document.createTextNode(arri[0])));\n for (var j=1; j<arri.length; j++) {\n newFrag.appendChild(createElementXHTML(\"p\"));\n newFrag.appendChild(createElementXHTML(\"span\").\n appendChild(document.createTextNode(arri[j])));\n }\n }\n expr = !expr;\n }\n return newFrag;\n}\n\nfunction AMautomathrec(str) {\n//formula is a space (or start of str) followed by a maximal sequence of *two* or more tokens, possibly separated by runs of digits and/or space.\n//tokens are single letters (except a, A, I) and ASCIIMathML tokens\n var texcommand = \"\\\\\\\\[a-zA-Z]+|\\\\\\\\\\\\s|\";\n var ambigAMtoken = \"\\\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|\";\n var englishAMtoken = \"\\\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|\";\n var secondenglishAMtoken = \"|\\\\bI\\\\b|\\\\bin\\\\b|\\\\btext\\\\b\"; // took if and or not out\n var simpleAMtoken = \"NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta\"; // uuu nnn?\n var letter = \"[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|\"+ambigAMtoken+englishAMtoken+simpleAMtoken+\"))|\";\n var token = letter+texcommand+\"\\\\d+|[-()[\\\\]{}+=*&^_%\\\\\\@/<>,\\\\|!:;'~]|\\\\.(?!(?:\\x20|$))|\"+ambigAMtoken+englishAMtoken+simpleAMtoken;\n var re = new RegExp(\"(^|\\\\s)(((\"+token+\")\\\\s?)((\"+token+secondenglishAMtoken+\")\\\\s?)+)([,.?]?(?=\\\\s|$))\",\"g\");\n str = str.replace(re,\" `$2`$7\");\n var arr = str.split(AMdelimiter1);\n var re1 = new RegExp(\"(^|\\\\s)([b-zB-HJ-Z+*<>]|\"+texcommand+ambigAMtoken+simpleAMtoken+\")(\\\\s|\\\\n|$)\",\"g\");\n var re2 = new RegExp(\"(^|\\\\s)([a-z]|\"+texcommand+ambigAMtoken+simpleAMtoken+\")([,.])\",\"g\"); // removed |\\d+ for now\n for (i=0; i<arr.length; i++) //single nonenglish tokens\n if (i%2==0) {\n arr[i] = arr[i].replace(re1,\" `$2`$3\");\n arr[i] = arr[i].replace(re2,\" `$2`$3\");\n arr[i] = arr[i].replace(/([{}[\\]])/,\"`$1`\");\n }\n str = arr.join(AMdelimiter1);\n str = str.replace(/((^|\\s)\\([a-zA-Z]{2,}.*?)\\)`/g,\"$1`)\"); //fix parentheses\n str = str.replace(/`(\\((a\\s|in\\s))(.*?[a-zA-Z]{2,}\\))/g,\"$1`$3\"); //fix parentheses\n str = str.replace(/\\sin`/g,\"` in\");\n str = str.replace(/`(\\(\\w\\)[,.]?(\\s|\\n|$))/g,\"$1`\");\n str = str.replace(/`([0-9.]+|e.g|i.e)`(\\.?)/gi,\"$1$2\");\n str = str.replace(/`([0-9.]+:)`/g,\"$1\");\n return str;\n}\n\nfunction processNodeR(n, linebreaks,latex) {\n var mtch, str, arr, frg, i;\n if (n.childNodes.length == 0) {\n if ((n.nodeType!=8 || linebreaks) &&\n n.parentNode.nodeName!=\"form\" && n.parentNode.nodeName!=\"FORM\" &&\n n.parentNode.nodeName!=\"textarea\" && n.parentNode.nodeName!=\"TEXTAREA\" /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */) {\n str = n.nodeValue;\n if (!(str == null)) {\n str = str.replace(/\\r\\n\\r\\n/g,\"\\n\\n\");\n str = str.replace(/\\x20+/g,\" \");\n str = str.replace(/\\s*\\r\\n/g,\" \");\n if(latex) {\n// DELIMITERS:\n mtch = (str.indexOf(\"\\$\")==-1 ? false : true);\n str = str.replace(/([^\\\\])\\$/g,\"$1 \\$\");\n str = str.replace(/^\\$/,\" \\$\");\t// in case \\$ at start of string\n arr = str.split(\" \\$\");\n for (i=0; i<arr.length; i++)\n\t arr[i]=arr[i].replace(/\\\\\\$/g,\"\\$\");\n } else {\n mtch = false;\n str = str.replace(new RegExp(AMescape1, \"g\"),\n function(){mtch = true; return \"AMescape1\"});\n str = str.replace(/\\\\?end{?a?math}?/i,\n function(){automathrecognize = false; mtch = true; return \"\"});\n str = str.replace(/amath\\b|\\\\begin{a?math}/i,\n function(){automathrecognize = true; mtch = true; return \"\"});\n arr = str.split(AMdelimiter1);\n if (automathrecognize)\n for (i=0; i<arr.length; i++)\n if (i%2==0) arr[i] = AMautomathrec(arr[i]);\n str = arr.join(AMdelimiter1);\n arr = str.split(AMdelimiter1);\n for (i=0; i<arr.length; i++) // this is a problem ************\n arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);\n }\n if (arr.length>1 || mtch) {\n if (!noMathML) {\n frg = strarr2docFrag(arr,n.nodeType==8,latex);\n var len = frg.childNodes.length;\n n.parentNode.replaceChild(frg,n);\n return len-1;\n } else return 0;\n }\n }\n } else return 0;\n } else if (n.nodeName!=\"math\") {\n for (i=0; i<n.childNodes.length; i++)\n i += processNodeR(n.childNodes[i], linebreaks,latex);\n }\n return 0;\n}\n\nfunction AMprocessNode(n, linebreaks, spanclassAM) {\n var frag,st;\n if (spanclassAM!=null) {\n frag = document.getElementsByTagName(\"span\")\n for (var i=0;i<frag.length;i++)\n if (frag[i].className == \"AM\") \n processNodeR(frag[i],linebreaks,false);\n } else {\n try {\n st = n.innerHTML; // look for AMdelimiter on page\n } catch(err) {}\n//alert(st)\n if (st==null || /amath\\b|\\\\begin{a?math}/i.test(st) ||\n st.indexOf(AMdelimiter1+\" \")!=-1 || st.slice(-1)==AMdelimiter1 ||\n st.indexOf(AMdelimiter1+\"<\")!=-1 || st.indexOf(AMdelimiter1+\"\\n\")!=-1) {\n processNodeR(n,linebreaks,false);\n }\n }\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n}\n\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n\n// all further global variables start with \"LM\"\n\n// Commented out by DRW to prevent 1/2 turning into a 2-line fraction\n// LMdiv = {input:\"/\",\t tag:\"mfrac\", output:\"/\", ttype:INFIX},\n// Commented out by DRW so that \" prints literally in equations\n// LMquote = {input:\"\\\"\",\t tag:\"mtext\", output:\"mbox\", ttype:TEXT};\n\nvar LMsymbols = [\n//Greek letters\n{input:\"\\\\alpha\",\ttag:\"mi\", output:\"\\u03B1\", ttype:CONST},\n{input:\"\\\\beta\",\ttag:\"mi\", output:\"\\u03B2\", ttype:CONST},\n{input:\"\\\\gamma\",\ttag:\"mi\", output:\"\\u03B3\", ttype:CONST},\n{input:\"\\\\delta\",\ttag:\"mi\", output:\"\\u03B4\", ttype:CONST},\n{input:\"\\\\epsilon\",\ttag:\"mi\", output:\"\\u03B5\", ttype:CONST},\n{input:\"\\\\varepsilon\", tag:\"mi\", output:\"\\u025B\", ttype:CONST},\n{input:\"\\\\zeta\",\ttag:\"mi\", output:\"\\u03B6\", ttype:CONST},\n{input:\"\\\\eta\",\t\ttag:\"mi\", output:\"\\u03B7\", ttype:CONST},\n{input:\"\\\\theta\",\ttag:\"mi\", output:\"\\u03B8\", ttype:CONST},\n{input:\"\\\\vartheta\",\ttag:\"mi\", output:\"\\u03D1\", ttype:CONST},\n{input:\"\\\\iota\",\ttag:\"mi\", output:\"\\u03B9\", ttype:CONST},\n{input:\"\\\\kappa\",\ttag:\"mi\", output:\"\\u03BA\", ttype:CONST},\n{input:\"\\\\lambda\",\ttag:\"mi\", output:\"\\u03BB\", ttype:CONST},\n{input:\"\\\\mu\",\t\ttag:\"mi\", output:\"\\u03BC\", ttype:CONST},\n{input:\"\\\\nu\",\t\ttag:\"mi\", output:\"\\u03BD\", ttype:CONST},\n{input:\"\\\\xi\",\t\ttag:\"mi\", output:\"\\u03BE\", ttype:CONST},\n{input:\"\\\\pi\",\t\ttag:\"mi\", output:\"\\u03C0\", ttype:CONST},\n{input:\"\\\\varpi\",\ttag:\"mi\", output:\"\\u03D6\", ttype:CONST},\n{input:\"\\\\rho\",\t\ttag:\"mi\", output:\"\\u03C1\", ttype:CONST},\n{input:\"\\\\varrho\",\ttag:\"mi\", output:\"\\u03F1\", ttype:CONST},\n{input:\"\\\\varsigma\",\ttag:\"mi\", output:\"\\u03C2\", ttype:CONST},\n{input:\"\\\\sigma\",\ttag:\"mi\", output:\"\\u03C3\", ttype:CONST},\n{input:\"\\\\tau\",\t\ttag:\"mi\", output:\"\\u03C4\", ttype:CONST},\n{input:\"\\\\upsilon\",\ttag:\"mi\", output:\"\\u03C5\", ttype:CONST},\n{input:\"\\\\phi\",\t\ttag:\"mi\", output:\"\\u03C6\", ttype:CONST},\n{input:\"\\\\varphi\",\ttag:\"mi\", output:\"\\u03D5\", ttype:CONST},\n{input:\"\\\\chi\",\t\ttag:\"mi\", output:\"\\u03C7\", ttype:CONST},\n{input:\"\\\\psi\",\t\ttag:\"mi\", output:\"\\u03C8\", ttype:CONST},\n{input:\"\\\\omega\",\ttag:\"mi\", output:\"\\u03C9\", ttype:CONST},\n{input:\"\\\\Gamma\",\ttag:\"mo\", output:\"\\u0393\", ttype:CONST},\n{input:\"\\\\Delta\",\ttag:\"mo\", output:\"\\u0394\", ttype:CONST},\n{input:\"\\\\Theta\",\ttag:\"mo\", output:\"\\u0398\", ttype:CONST},\n{input:\"\\\\Lambda\",\ttag:\"mo\", output:\"\\u039B\", ttype:CONST},\n{input:\"\\\\Xi\",\t\ttag:\"mo\", output:\"\\u039E\", ttype:CONST},\n{input:\"\\\\Pi\",\t\ttag:\"mo\", output:\"\\u03A0\", ttype:CONST},\n{input:\"\\\\Sigma\",\ttag:\"mo\", output:\"\\u03A3\", ttype:CONST},\n{input:\"\\\\Upsilon\",\ttag:\"mo\", output:\"\\u03A5\", ttype:CONST},\n{input:\"\\\\Phi\",\t\ttag:\"mo\", output:\"\\u03A6\", ttype:CONST},\n{input:\"\\\\Psi\",\t\ttag:\"mo\", output:\"\\u03A8\", ttype:CONST},\n{input:\"\\\\Omega\",\ttag:\"mo\", output:\"\\u03A9\", ttype:CONST},\n\n//fractions\n{input:\"\\\\frac12\",\ttag:\"mo\", output:\"\\u00BD\", ttype:CONST},\n{input:\"\\\\frac14\",\ttag:\"mo\", output:\"\\u00BC\", ttype:CONST},\n{input:\"\\\\frac34\",\ttag:\"mo\", output:\"\\u00BE\", ttype:CONST},\n{input:\"\\\\frac13\",\ttag:\"mo\", output:\"\\u2153\", ttype:CONST},\n{input:\"\\\\frac23\",\ttag:\"mo\", output:\"\\u2154\", ttype:CONST},\n{input:\"\\\\frac15\",\ttag:\"mo\", output:\"\\u2155\", ttype:CONST},\n{input:\"\\\\frac25\",\ttag:\"mo\", output:\"\\u2156\", ttype:CONST},\n{input:\"\\\\frac35\",\ttag:\"mo\", output:\"\\u2157\", ttype:CONST},\n{input:\"\\\\frac45\",\ttag:\"mo\", output:\"\\u2158\", ttype:CONST},\n{input:\"\\\\frac16\",\ttag:\"mo\", output:\"\\u2159\", ttype:CONST},\n{input:\"\\\\frac56\",\ttag:\"mo\", output:\"\\u215A\", ttype:CONST},\n{input:\"\\\\frac18\",\ttag:\"mo\", output:\"\\u215B\", ttype:CONST},\n{input:\"\\\\frac38\",\ttag:\"mo\", output:\"\\u215C\", ttype:CONST},\n{input:\"\\\\frac58\",\ttag:\"mo\", output:\"\\u215D\", ttype:CONST},\n{input:\"\\\\frac78\",\ttag:\"mo\", output:\"\\u215E\", ttype:CONST},\n\n//binary operation symbols\n{input:\"\\\\pm\",\t\ttag:\"mo\", output:\"\\u00B1\", ttype:CONST},\n{input:\"\\\\mp\",\t\ttag:\"mo\", output:\"\\u2213\", ttype:CONST},\n{input:\"\\\\triangleleft\",tag:\"mo\", output:\"\\u22B2\", ttype:CONST},\n{input:\"\\\\triangleright\",tag:\"mo\",output:\"\\u22B3\", ttype:CONST},\n{input:\"\\\\cdot\",\ttag:\"mo\", output:\"\\u22C5\", ttype:CONST},\n{input:\"\\\\star\",\ttag:\"mo\", output:\"\\u22C6\", ttype:CONST},\n{input:\"\\\\ast\",\t\ttag:\"mo\", output:\"\\u002A\", ttype:CONST},\n{input:\"\\\\times\",\ttag:\"mo\", output:\"\\u00D7\", ttype:CONST},\n{input:\"\\\\div\",\t\ttag:\"mo\", output:\"\\u00F7\", ttype:CONST},\n{input:\"\\\\circ\",\ttag:\"mo\", output:\"\\u2218\", ttype:CONST},\n//{input:\"\\\\bullet\",\t tag:\"mo\", output:\"\\u2219\", ttype:CONST},\n{input:\"\\\\bullet\",\ttag:\"mo\", output:\"\\u2022\", ttype:CONST},\n{input:\"\\\\oplus\",\ttag:\"mo\", output:\"\\u2295\", ttype:CONST},\n{input:\"\\\\ominus\",\ttag:\"mo\", output:\"\\u2296\", ttype:CONST},\n{input:\"\\\\otimes\",\ttag:\"mo\", output:\"\\u2297\", ttype:CONST},\n{input:\"\\\\bigcirc\",\ttag:\"mo\", output:\"\\u25CB\", ttype:CONST},\n{input:\"\\\\oslash\",\ttag:\"mo\", output:\"\\u2298\", ttype:CONST},\n{input:\"\\\\odot\",\ttag:\"mo\", output:\"\\u2299\", ttype:CONST},\n{input:\"\\\\land\",\ttag:\"mo\", output:\"\\u2227\", ttype:CONST},\n{input:\"\\\\wedge\",\ttag:\"mo\", output:\"\\u2227\", ttype:CONST},\n{input:\"\\\\lor\",\t\ttag:\"mo\", output:\"\\u2228\", ttype:CONST},\n{input:\"\\\\vee\",\t\ttag:\"mo\", output:\"\\u2228\", ttype:CONST},\n{input:\"\\\\cap\",\t\ttag:\"mo\", output:\"\\u2229\", ttype:CONST},\n{input:\"\\\\cup\",\t\ttag:\"mo\", output:\"\\u222A\", ttype:CONST},\n{input:\"\\\\sqcap\",\ttag:\"mo\", output:\"\\u2293\", ttype:CONST},\n{input:\"\\\\sqcup\",\ttag:\"mo\", output:\"\\u2294\", ttype:CONST},\n{input:\"\\\\uplus\",\ttag:\"mo\", output:\"\\u228E\", ttype:CONST},\n{input:\"\\\\amalg\",\ttag:\"mo\", output:\"\\u2210\", ttype:CONST},\n{input:\"\\\\bigtriangleup\",tag:\"mo\",output:\"\\u25B3\", ttype:CONST},\n{input:\"\\\\bigtriangledown\",tag:\"mo\",output:\"\\u25BD\", ttype:CONST},\n{input:\"\\\\dag\",\t\ttag:\"mo\", output:\"\\u2020\", ttype:CONST},\n{input:\"\\\\dagger\",\ttag:\"mo\", output:\"\\u2020\", ttype:CONST},\n{input:\"\\\\ddag\",\ttag:\"mo\", output:\"\\u2021\", ttype:CONST},\n{input:\"\\\\ddagger\",\ttag:\"mo\", output:\"\\u2021\", ttype:CONST},\n{input:\"\\\\lhd\",\t\ttag:\"mo\", output:\"\\u22B2\", ttype:CONST},\n{input:\"\\\\rhd\",\t\ttag:\"mo\", output:\"\\u22B3\", ttype:CONST},\n{input:\"\\\\unlhd\",\ttag:\"mo\", output:\"\\u22B4\", ttype:CONST},\n{input:\"\\\\unrhd\",\ttag:\"mo\", output:\"\\u22B5\", ttype:CONST},\n\n\n//BIG Operators\n{input:\"\\\\sum\",\t\ttag:\"mo\", output:\"\\u2211\", ttype:UNDEROVER},\n{input:\"\\\\prod\",\ttag:\"mo\", output:\"\\u220F\", ttype:UNDEROVER},\n{input:\"\\\\bigcap\",\ttag:\"mo\", output:\"\\u22C2\", ttype:UNDEROVER},\n{input:\"\\\\bigcup\",\ttag:\"mo\", output:\"\\u22C3\", ttype:UNDEROVER},\n{input:\"\\\\bigwedge\",\ttag:\"mo\", output:\"\\u22C0\", ttype:UNDEROVER},\n{input:\"\\\\bigvee\",\ttag:\"mo\", output:\"\\u22C1\", ttype:UNDEROVER},\n{input:\"\\\\bigsqcap\",\ttag:\"mo\", output:\"\\u2A05\", ttype:UNDEROVER},\n{input:\"\\\\bigsqcup\",\ttag:\"mo\", output:\"\\u2A06\", ttype:UNDEROVER},\n{input:\"\\\\coprod\",\ttag:\"mo\", output:\"\\u2210\", ttype:UNDEROVER},\n{input:\"\\\\bigoplus\",\ttag:\"mo\", output:\"\\u2A01\", ttype:UNDEROVER},\n{input:\"\\\\bigotimes\",\ttag:\"mo\", output:\"\\u2A02\", ttype:UNDEROVER},\n{input:\"\\\\bigodot\",\ttag:\"mo\", output:\"\\u2A00\", ttype:UNDEROVER},\n{input:\"\\\\biguplus\",\ttag:\"mo\", output:\"\\u2A04\", ttype:UNDEROVER},\n{input:\"\\\\int\",\t\ttag:\"mo\", output:\"\\u222B\", ttype:CONST},\n{input:\"\\\\oint\",\ttag:\"mo\", output:\"\\u222E\", ttype:CONST},\n\n//binary relation symbols\n{input:\":=\",\t\ttag:\"mo\", output:\":=\",\t ttype:CONST},\n{input:\"\\\\lt\",\t\ttag:\"mo\", output:\"<\",\t ttype:CONST},\n{input:\"\\\\gt\",\t\ttag:\"mo\", output:\">\",\t ttype:CONST},\n{input:\"\\\\ne\",\t\ttag:\"mo\", output:\"\\u2260\", ttype:CONST},\n{input:\"\\\\neq\",\t\ttag:\"mo\", output:\"\\u2260\", ttype:CONST},\n{input:\"\\\\le\",\t\ttag:\"mo\", output:\"\\u2264\", ttype:CONST},\n{input:\"\\\\leq\",\t\ttag:\"mo\", output:\"\\u2264\", ttype:CONST},\n{input:\"\\\\leqslant\",\ttag:\"mo\", output:\"\\u2264\", ttype:CONST},\n{input:\"\\\\ge\",\t\ttag:\"mo\", output:\"\\u2265\", ttype:CONST},\n{input:\"\\\\geq\",\t\ttag:\"mo\", output:\"\\u2265\", ttype:CONST},\n{input:\"\\\\geqslant\",\ttag:\"mo\", output:\"\\u2265\", ttype:CONST},\n{input:\"\\\\equiv\",\ttag:\"mo\", output:\"\\u2261\", ttype:CONST},\n{input:\"\\\\ll\",\t\ttag:\"mo\", output:\"\\u226A\", ttype:CONST},\n{input:\"\\\\gg\",\t\ttag:\"mo\", output:\"\\u226B\", ttype:CONST},\n{input:\"\\\\doteq\",\ttag:\"mo\", output:\"\\u2250\", ttype:CONST},\n{input:\"\\\\prec\",\ttag:\"mo\", output:\"\\u227A\", ttype:CONST},\n{input:\"\\\\succ\",\ttag:\"mo\", output:\"\\u227B\", ttype:CONST},\n{input:\"\\\\preceq\",\ttag:\"mo\", output:\"\\u227C\", ttype:CONST},\n{input:\"\\\\succeq\",\ttag:\"mo\", output:\"\\u227D\", ttype:CONST},\n{input:\"\\\\subset\",\ttag:\"mo\", output:\"\\u2282\", ttype:CONST},\n{input:\"\\\\supset\",\ttag:\"mo\", output:\"\\u2283\", ttype:CONST},\n{input:\"\\\\subseteq\",\ttag:\"mo\", output:\"\\u2286\", ttype:CONST},\n{input:\"\\\\supseteq\",\ttag:\"mo\", output:\"\\u2287\", ttype:CONST},\n{input:\"\\\\sqsubset\",\ttag:\"mo\", output:\"\\u228F\", ttype:CONST},\n{input:\"\\\\sqsupset\",\ttag:\"mo\", output:\"\\u2290\", ttype:CONST},\n{input:\"\\\\sqsubseteq\", tag:\"mo\", output:\"\\u2291\", ttype:CONST},\n{input:\"\\\\sqsupseteq\", tag:\"mo\", output:\"\\u2292\", ttype:CONST},\n{input:\"\\\\sim\",\t\ttag:\"mo\", output:\"\\u223C\", ttype:CONST},\n{input:\"\\\\simeq\",\ttag:\"mo\", output:\"\\u2243\", ttype:CONST},\n{input:\"\\\\approx\",\ttag:\"mo\", output:\"\\u2248\", ttype:CONST},\n{input:\"\\\\cong\",\ttag:\"mo\", output:\"\\u2245\", ttype:CONST},\n{input:\"\\\\Join\",\ttag:\"mo\", output:\"\\u22C8\", ttype:CONST},\n{input:\"\\\\bowtie\",\ttag:\"mo\", output:\"\\u22C8\", ttype:CONST},\n{input:\"\\\\in\",\t\ttag:\"mo\", output:\"\\u2208\", ttype:CONST},\n{input:\"\\\\ni\",\t\ttag:\"mo\", output:\"\\u220B\", ttype:CONST},\n{input:\"\\\\owns\",\ttag:\"mo\", output:\"\\u220B\", ttype:CONST},\n{input:\"\\\\propto\",\ttag:\"mo\", output:\"\\u221D\", ttype:CONST},\n{input:\"\\\\vdash\",\ttag:\"mo\", output:\"\\u22A2\", ttype:CONST},\n{input:\"\\\\dashv\",\ttag:\"mo\", output:\"\\u22A3\", ttype:CONST},\n{input:\"\\\\models\",\ttag:\"mo\", output:\"\\u22A8\", ttype:CONST},\n{input:\"\\\\perp\",\ttag:\"mo\", output:\"\\u22A5\", ttype:CONST},\n{input:\"\\\\smile\",\ttag:\"mo\", output:\"\\u2323\", ttype:CONST},\n{input:\"\\\\frown\",\ttag:\"mo\", output:\"\\u2322\", ttype:CONST},\n{input:\"\\\\asymp\",\ttag:\"mo\", output:\"\\u224D\", ttype:CONST},\n{input:\"\\\\notin\",\ttag:\"mo\", output:\"\\u2209\", ttype:CONST},\n\n//matrices\n{input:\"\\\\begin{eqnarray}\",\toutput:\"X\",\tttype:MATRIX, invisible:true},\n{input:\"\\\\begin{array}\",\toutput:\"X\",\tttype:MATRIX, invisible:true},\n{input:\"\\\\\\\\\",\t\t\toutput:\"}&{\",\tttype:DEFINITION},\n{input:\"\\\\end{eqnarray}\",\toutput:\"}}\",\tttype:DEFINITION},\n{input:\"\\\\end{array}\",\t\toutput:\"}}\",\tttype:DEFINITION},\n\n//grouping and literal brackets -- ieval is for IE\n{input:\"\\\\big\",\t tag:\"mo\", output:\"X\", atval:\"1.2\", ieval:\"2.2\", ttype:BIG},\n{input:\"\\\\Big\",\t tag:\"mo\", output:\"X\", atval:\"1.6\", ieval:\"2.6\", ttype:BIG},\n{input:\"\\\\bigg\", tag:\"mo\", output:\"X\", atval:\"2.2\", ieval:\"3.2\", ttype:BIG},\n{input:\"\\\\Bigg\", tag:\"mo\", output:\"X\", atval:\"2.9\", ieval:\"3.9\", ttype:BIG},\n{input:\"\\\\left\", tag:\"mo\", output:\"X\", ttype:LEFTBRACKET},\n{input:\"\\\\right\", tag:\"mo\", output:\"X\", ttype:RIGHTBRACKET},\n{input:\"{\",\t output:\"{\", ttype:LEFTBRACKET, invisible:true},\n{input:\"}\",\t output:\"}\", ttype:RIGHTBRACKET, invisible:true},\n\n{input:\"(\",\t tag:\"mo\", output:\"(\", atval:\"1\", ttype:STRETCHY},\n{input:\"[\",\t tag:\"mo\", output:\"[\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\lbrack\", tag:\"mo\", output:\"[\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\{\",\t tag:\"mo\", output:\"{\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\lbrace\", tag:\"mo\", output:\"{\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\langle\", tag:\"mo\", output:\"\\u2329\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\lfloor\", tag:\"mo\", output:\"\\u230A\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\lceil\", tag:\"mo\", output:\"\\u2308\", atval:\"1\", ttype:STRETCHY},\n\n// rtag:\"mi\" causes space to be inserted before a following sin, cos, etc.\n// (see function LMparseExpr() )\n{input:\")\",\t tag:\"mo\",output:\")\",\t rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n{input:\"]\",\t tag:\"mo\",output:\"]\",\t rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n{input:\"\\\\rbrack\",tag:\"mo\",output:\"]\",\t rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n{input:\"\\\\}\",\t tag:\"mo\",output:\"}\",\t rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n{input:\"\\\\rbrace\",tag:\"mo\",output:\"}\",\t rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n{input:\"\\\\rangle\",tag:\"mo\",output:\"\\u232A\", rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n{input:\"\\\\rfloor\",tag:\"mo\",output:\"\\u230B\", rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n{input:\"\\\\rceil\", tag:\"mo\",output:\"\\u2309\", rtag:\"mi\",atval:\"1\",ttype:STRETCHY},\n\n// \"|\", \"\\\\|\", \"\\\\vert\" and \"\\\\Vert\" modified later: lspace = rspace = 0em\n{input:\"|\",\t\ttag:\"mo\", output:\"\\u2223\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\|\",\t\ttag:\"mo\", output:\"\\u2225\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\vert\",\ttag:\"mo\", output:\"\\u2223\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\Vert\",\ttag:\"mo\", output:\"\\u2225\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\mid\",\t\ttag:\"mo\", output:\"\\u2223\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\parallel\",\ttag:\"mo\", output:\"\\u2225\", atval:\"1\", ttype:STRETCHY},\n{input:\"/\",\t\ttag:\"mo\", output:\"/\",\tatval:\"1.01\", ttype:STRETCHY},\n{input:\"\\\\backslash\",\ttag:\"mo\", output:\"\\u2216\", atval:\"1\", ttype:STRETCHY},\n{input:\"\\\\setminus\",\ttag:\"mo\", output:\"\\\\\",\t ttype:CONST},\n\n//miscellaneous symbols\n{input:\"\\\\!\",\t tag:\"mspace\", atname:\"width\", atval:\"-0.167em\", ttype:SPACE},\n{input:\"\\\\,\",\t tag:\"mspace\", atname:\"width\", atval:\"0.167em\", ttype:SPACE},\n{input:\"\\\\>\",\t tag:\"mspace\", atname:\"width\", atval:\"0.222em\", ttype:SPACE},\n{input:\"\\\\:\",\t tag:\"mspace\", atname:\"width\", atval:\"0.222em\", ttype:SPACE},\n{input:\"\\\\;\",\t tag:\"mspace\", atname:\"width\", atval:\"0.278em\", ttype:SPACE},\n{input:\"~\",\t tag:\"mspace\", atname:\"width\", atval:\"0.333em\", ttype:SPACE},\n{input:\"\\\\quad\", tag:\"mspace\", atname:\"width\", atval:\"1em\", ttype:SPACE},\n{input:\"\\\\qquad\", tag:\"mspace\", atname:\"width\", atval:\"2em\", ttype:SPACE},\n//{input:\"{}\",\t\t tag:\"mo\", output:\"\\u200B\", ttype:CONST}, // zero-width\n{input:\"\\\\prime\",\ttag:\"mo\", output:\"\\u2032\", ttype:CONST},\n{input:\"'\",\t\ttag:\"mo\", output:\"\\u02B9\", ttype:CONST},\n{input:\"''\",\t\ttag:\"mo\", output:\"\\u02BA\", ttype:CONST},\n{input:\"'''\",\t\ttag:\"mo\", output:\"\\u2034\", ttype:CONST},\n{input:\"''''\",\t\ttag:\"mo\", output:\"\\u2057\", ttype:CONST},\n{input:\"\\\\ldots\",\ttag:\"mo\", output:\"\\u2026\", ttype:CONST},\n{input:\"\\\\cdots\",\ttag:\"mo\", output:\"\\u22EF\", ttype:CONST},\n{input:\"\\\\vdots\",\ttag:\"mo\", output:\"\\u22EE\", ttype:CONST},\n{input:\"\\\\ddots\",\ttag:\"mo\", output:\"\\u22F1\", ttype:CONST},\n{input:\"\\\\forall\",\ttag:\"mo\", output:\"\\u2200\", ttype:CONST},\n{input:\"\\\\exists\",\ttag:\"mo\", output:\"\\u2203\", ttype:CONST},\n{input:\"\\\\Re\",\t\ttag:\"mo\", output:\"\\u211C\", ttype:CONST},\n{input:\"\\\\Im\",\t\ttag:\"mo\", output:\"\\u2111\", ttype:CONST},\n{input:\"\\\\aleph\",\ttag:\"mo\", output:\"\\u2135\", ttype:CONST},\n{input:\"\\\\hbar\",\ttag:\"mo\", output:\"\\u210F\", ttype:CONST},\n{input:\"\\\\ell\",\t\ttag:\"mo\", output:\"\\u2113\", ttype:CONST},\n{input:\"\\\\wp\",\t\ttag:\"mo\", output:\"\\u2118\", ttype:CONST},\n{input:\"\\\\emptyset\",\ttag:\"mo\", output:\"\\u2205\", ttype:CONST},\n{input:\"\\\\infty\",\ttag:\"mo\", output:\"\\u221E\", ttype:CONST},\n{input:\"\\\\surd\",\ttag:\"mo\", output:\"\\\\sqrt{}\", ttype:DEFINITION},\n{input:\"\\\\partial\",\ttag:\"mo\", output:\"\\u2202\", ttype:CONST},\n{input:\"\\\\nabla\",\ttag:\"mo\", output:\"\\u2207\", ttype:CONST},\n{input:\"\\\\triangle\",\ttag:\"mo\", output:\"\\u25B3\", ttype:CONST},\n{input:\"\\\\therefore\",\ttag:\"mo\", output:\"\\u2234\", ttype:CONST},\n{input:\"\\\\angle\",\ttag:\"mo\", output:\"\\u2220\", ttype:CONST},\n//{input:\"\\\\\\\\ \",\t tag:\"mo\", output:\"\\u00A0\", ttype:CONST},\n{input:\"\\\\diamond\",\ttag:\"mo\", output:\"\\u22C4\", ttype:CONST},\n//{input:\"\\\\Diamond\",\t tag:\"mo\", output:\"\\u25CA\", ttype:CONST},\n{input:\"\\\\Diamond\",\ttag:\"mo\", output:\"\\u25C7\", ttype:CONST},\n{input:\"\\\\neg\",\t\ttag:\"mo\", output:\"\\u00AC\", ttype:CONST},\n{input:\"\\\\lnot\",\ttag:\"mo\", output:\"\\u00AC\", ttype:CONST},\n{input:\"\\\\bot\",\t\ttag:\"mo\", output:\"\\u22A5\", ttype:CONST},\n{input:\"\\\\top\",\t\ttag:\"mo\", output:\"\\u22A4\", ttype:CONST},\n{input:\"\\\\square\",\ttag:\"mo\", output:\"\\u25AB\", ttype:CONST},\n{input:\"\\\\Box\",\t\ttag:\"mo\", output:\"\\u25A1\", ttype:CONST},\n{input:\"\\\\wr\",\t\ttag:\"mo\", output:\"\\u2240\", ttype:CONST},\n\n//standard functions\n//Note UNDEROVER *must* have tag:\"mo\" to work properly\n{input:\"\\\\arccos\", tag:\"mi\", output:\"arccos\", ttype:UNARY, func:true},\n{input:\"\\\\arcsin\", tag:\"mi\", output:\"arcsin\", ttype:UNARY, func:true},\n{input:\"\\\\arctan\", tag:\"mi\", output:\"arctan\", ttype:UNARY, func:true},\n{input:\"\\\\arg\",\t tag:\"mi\", output:\"arg\", ttype:UNARY, func:true},\n{input:\"\\\\cos\",\t tag:\"mi\", output:\"cos\", ttype:UNARY, func:true},\n{input:\"\\\\cosh\", tag:\"mi\", output:\"cosh\", ttype:UNARY, func:true},\n{input:\"\\\\cot\",\t tag:\"mi\", output:\"cot\", ttype:UNARY, func:true},\n{input:\"\\\\coth\", tag:\"mi\", output:\"coth\", ttype:UNARY, func:true},\n{input:\"\\\\csc\",\t tag:\"mi\", output:\"csc\", ttype:UNARY, func:true},\n{input:\"\\\\deg\",\t tag:\"mi\", output:\"deg\", ttype:UNARY, func:true},\n{input:\"\\\\det\",\t tag:\"mi\", output:\"det\", ttype:UNARY, func:true},\n{input:\"\\\\dim\",\t tag:\"mi\", output:\"dim\", ttype:UNARY, func:true}, //CONST?\n{input:\"\\\\exp\",\t tag:\"mi\", output:\"exp\", ttype:UNARY, func:true},\n{input:\"\\\\gcd\",\t tag:\"mi\", output:\"gcd\", ttype:UNARY, func:true}, //CONST?\n{input:\"\\\\hom\",\t tag:\"mi\", output:\"hom\", ttype:UNARY, func:true},\n{input:\"\\\\inf\",\t tag:\"mo\", output:\"inf\",\t ttype:UNDEROVER},\n{input:\"\\\\ker\",\t tag:\"mi\", output:\"ker\", ttype:UNARY, func:true},\n{input:\"\\\\lg\",\t tag:\"mi\", output:\"lg\", ttype:UNARY, func:true},\n{input:\"\\\\lim\",\t tag:\"mo\", output:\"lim\",\t ttype:UNDEROVER},\n{input:\"\\\\liminf\", tag:\"mo\", output:\"liminf\", ttype:UNDEROVER},\n{input:\"\\\\limsup\", tag:\"mo\", output:\"limsup\", ttype:UNDEROVER},\n{input:\"\\\\ln\",\t tag:\"mi\", output:\"ln\", ttype:UNARY, func:true},\n{input:\"\\\\log\",\t tag:\"mi\", output:\"log\", ttype:UNARY, func:true},\n{input:\"\\\\max\",\t tag:\"mo\", output:\"max\",\t ttype:UNDEROVER},\n{input:\"\\\\min\",\t tag:\"mo\", output:\"min\",\t ttype:UNDEROVER},\n{input:\"\\\\Pr\",\t tag:\"mi\", output:\"Pr\", ttype:UNARY, func:true},\n{input:\"\\\\sec\",\t tag:\"mi\", output:\"sec\", ttype:UNARY, func:true},\n{input:\"\\\\sin\",\t tag:\"mi\", output:\"sin\", ttype:UNARY, func:true},\n{input:\"\\\\sinh\", tag:\"mi\", output:\"sinh\", ttype:UNARY, func:true},\n{input:\"\\\\sup\",\t tag:\"mo\", output:\"sup\",\t ttype:UNDEROVER},\n{input:\"\\\\tan\",\t tag:\"mi\", output:\"tan\", ttype:UNARY, func:true},\n{input:\"\\\\tanh\", tag:\"mi\", output:\"tanh\", ttype:UNARY, func:true},\n\n//arrows\n{input:\"\\\\gets\",\t\ttag:\"mo\", output:\"\\u2190\", ttype:CONST},\n{input:\"\\\\leftarrow\",\t\ttag:\"mo\", output:\"\\u2190\", ttype:CONST},\n{input:\"\\\\to\",\t\t\ttag:\"mo\", output:\"\\u2192\", ttype:CONST},\n{input:\"\\\\rightarrow\",\t\ttag:\"mo\", output:\"\\u2192\", ttype:CONST},\n{input:\"\\\\leftrightarrow\",\ttag:\"mo\", output:\"\\u2194\", ttype:CONST},\n{input:\"\\\\uparrow\",\t\ttag:\"mo\", output:\"\\u2191\", ttype:CONST},\n{input:\"\\\\downarrow\",\t\ttag:\"mo\", output:\"\\u2193\", ttype:CONST},\n{input:\"\\\\updownarrow\",\t\ttag:\"mo\", output:\"\\u2195\", ttype:CONST},\n{input:\"\\\\Leftarrow\",\t\ttag:\"mo\", output:\"\\u21D0\", ttype:CONST},\n{input:\"\\\\Rightarrow\",\t\ttag:\"mo\", output:\"\\u21D2\", ttype:CONST},\n{input:\"\\\\Leftrightarrow\",\ttag:\"mo\", output:\"\\u21D4\", ttype:CONST},\n{input:\"\\\\iff\", tag:\"mo\", output:\"~\\\\Longleftrightarrow~\", ttype:DEFINITION},\n{input:\"\\\\Uparrow\",\t\ttag:\"mo\", output:\"\\u21D1\", ttype:CONST},\n{input:\"\\\\Downarrow\",\t\ttag:\"mo\", output:\"\\u21D3\", ttype:CONST},\n{input:\"\\\\Updownarrow\",\t\ttag:\"mo\", output:\"\\u21D5\", ttype:CONST},\n{input:\"\\\\mapsto\",\t\ttag:\"mo\", output:\"\\u21A6\", ttype:CONST},\n{input:\"\\\\longleftarrow\",\ttag:\"mo\", output:\"\\u2190\", ttype:LONG},\n{input:\"\\\\longrightarrow\",\ttag:\"mo\", output:\"\\u2192\", ttype:LONG},\n{input:\"\\\\longleftrightarrow\",\ttag:\"mo\", output:\"\\u2194\", ttype:LONG},\n{input:\"\\\\Longleftarrow\",\ttag:\"mo\", output:\"\\u21D0\", ttype:LONG},\n{input:\"\\\\Longrightarrow\",\ttag:\"mo\", output:\"\\u21D2\", ttype:LONG},\n{input:\"\\\\implies\",\t\ttag:\"mo\", output:\"\\u21D2\", ttype:LONG},\n{input:\"\\\\Longleftrightarrow\", tag:\"mo\", output:\"\\u21D4\", ttype:LONG},\n{input:\"\\\\longmapsto\",\t\ttag:\"mo\", output:\"\\u21A6\", ttype:CONST},\n\t\t\t\t\t\t\t// disaster if LONG\n\n//commands with argument\n\n{input:\"\\\\sqrt\",\ttag:\"msqrt\", output:\"sqrt\",\tttype:UNARY},\n{input:\"\\\\root\",\ttag:\"mroot\", output:\"root\",\tttype:BINARY},\n{input:\"\\\\frac\",\ttag:\"mfrac\", output:\"/\",\tttype:BINARY},\n{input:\"\\\\stackrel\", tag:\"mover\", output:\"stackrel\", ttype:BINARY},\n{input:\"\\\\atop\",\ttag:\"mfrac\", output:\"\",\t\tttype:INFIX},\n{input:\"\\\\choose\", tag:\"mfrac\", output:\"\",\t\tttype:INFIX},\n{input:\"_\",\t\ttag:\"msub\", output:\"_\",\tttype:INFIX},\n{input:\"^\",\t\ttag:\"msup\", output:\"^\",\tttype:INFIX},\n{input:\"\\\\mathrm\",\ttag:\"mtext\", output:\"text\",\tttype:TEXT},\n{input:\"\\\\mbox\",\ttag:\"mtext\", output:\"mbox\",\tttype:TEXT},\n\n//diacritical marks\n{input:\"\\\\acute\",\ttag:\"mover\", output:\"\\u00B4\", ttype:UNARY, acc:true},\n//{input:\"\\\\acute\",\t tag:\"mover\", output:\"\\u0317\", ttype:UNARY, acc:true},\n//{input:\"\\\\acute\",\t tag:\"mover\", output:\"\\u0301\", ttype:UNARY, acc:true},\n//{input:\"\\\\grave\",\t tag:\"mover\", output:\"\\u0300\", ttype:UNARY, acc:true},\n//{input:\"\\\\grave\",\t tag:\"mover\", output:\"\\u0316\", ttype:UNARY, acc:true},\n{input:\"\\\\grave\",\ttag:\"mover\", output:\"\\u0060\", ttype:UNARY, acc:true},\n{input:\"\\\\breve\",\ttag:\"mover\", output:\"\\u02D8\", ttype:UNARY, acc:true},\n{input:\"\\\\check\",\ttag:\"mover\", output:\"\\u02C7\", ttype:UNARY, acc:true},\n{input:\"\\\\dot\",\t\ttag:\"mover\", output:\".\", ttype:UNARY, acc:true},\n{input:\"\\\\ddot\",\ttag:\"mover\", output:\"..\", ttype:UNARY, acc:true},\n//{input:\"\\\\ddot\",\t tag:\"mover\", output:\"\\u00A8\", ttype:UNARY, acc:true},\n{input:\"\\\\mathring\",\ttag:\"mover\", output:\"\\u00B0\", ttype:UNARY, acc:true},\n{input:\"\\\\vec\",\t\ttag:\"mover\", output:\"\\u20D7\", ttype:UNARY, acc:true},\n{input:\"\\\\overrightarrow\",tag:\"mover\",output:\"\\u20D7\", ttype:UNARY, acc:true},\n{input:\"\\\\overleftarrow\",tag:\"mover\", output:\"\\u20D6\", ttype:UNARY, acc:true},\n{input:\"\\\\hat\",\t\ttag:\"mover\", output:\"\\u005E\", ttype:UNARY, acc:true},\n{input:\"\\\\widehat\",\ttag:\"mover\", output:\"\\u0302\", ttype:UNARY, acc:true},\n{input:\"\\\\tilde\",\ttag:\"mover\", output:\"~\", ttype:UNARY, acc:true},\n//{input:\"\\\\tilde\",\t tag:\"mover\", output:\"\\u0303\", ttype:UNARY, acc:true},\n{input:\"\\\\widetilde\",\ttag:\"mover\", output:\"\\u02DC\", ttype:UNARY, acc:true},\n{input:\"\\\\bar\",\t\ttag:\"mover\", output:\"\\u203E\", ttype:UNARY, acc:true},\n{input:\"\\\\overbrace\",\ttag:\"mover\", output:\"\\u23B4\", ttype:UNARY, acc:true},\n{input:\"\\\\overline\",\ttag:\"mover\", output:\"\\u00AF\", ttype:UNARY, acc:true},\n{input:\"\\\\underbrace\", tag:\"munder\", output:\"\\u23B5\", ttype:UNARY, acc:true},\n{input:\"\\\\underline\",\ttag:\"munder\", output:\"\\u00AF\", ttype:UNARY, acc:true},\n//{input:\"underline\",\ttag:\"munder\", output:\"\\u0332\", ttype:UNARY, acc:true},\n\n//typestyles and fonts\n{input:\"\\\\displaystyle\",tag:\"mstyle\",atname:\"displaystyle\",atval:\"true\", ttype:UNARY},\n{input:\"\\\\textstyle\",tag:\"mstyle\",atname:\"displaystyle\",atval:\"false\", ttype:UNARY},\n{input:\"\\\\scriptstyle\",tag:\"mstyle\",atname:\"scriptlevel\",atval:\"1\", ttype:UNARY},\n{input:\"\\\\scriptscriptstyle\",tag:\"mstyle\",atname:\"scriptlevel\",atval:\"2\", ttype:UNARY},\n{input:\"\\\\textrm\", tag:\"mstyle\", output:\"\\\\mathrm\", ttype: DEFINITION},\n{input:\"\\\\mathbf\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"bold\", ttype:UNARY},\n{input:\"\\\\textbf\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"bold\", ttype:UNARY},\n{input:\"\\\\mathit\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"italic\", ttype:UNARY},\n{input:\"\\\\textit\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"italic\", ttype:UNARY},\n{input:\"\\\\mathtt\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"monospace\", ttype:UNARY},\n{input:\"\\\\texttt\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"monospace\", ttype:UNARY},\n{input:\"\\\\mathsf\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"sans-serif\", ttype:UNARY},\n{input:\"\\\\mathbb\", tag:\"mstyle\", atname:\"mathvariant\", atval:\"double-struck\", ttype:UNARY, codes:AMbbb},\n{input:\"\\\\mathcal\",tag:\"mstyle\", atname:\"mathvariant\", atval:\"script\", ttype:UNARY, codes:AMcal},\n{input:\"\\\\mathfrak\",tag:\"mstyle\",atname:\"mathvariant\", atval:\"fraktur\",ttype:UNARY, codes:AMfrk}\n];\n\nvar LMnames = []; //list of input symbols\n\nfunction LMremoveCharsAndBlanks(str,n) {\n//remove n characters and any following blanks\n var st;\n st = str.slice(n);\n for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);\n return st.slice(i);\n}\n\nfunction LMgetSymbol(str) {\n//return maximal initial substring of str that appears in names\n//return null if there is none\n var k = 0; //new pos\n var j = 0; //old pos\n var mk; //match pos\n var st;\n var tagst;\n var match = \"\";\n var more = true;\n for (var i=1; i<=str.length && more; i++) {\n st = str.slice(0,i); //initial substring of length i\n j = k;\n k = position(LMnames, st, j);\n if (k<LMnames.length && str.slice(0,LMnames[k].length)==LMnames[k]){\n match = LMnames[k];\n mk = k;\n i = match.length;\n }\n more = k<LMnames.length && str.slice(0,LMnames[k].length)>=LMnames[k];\n }\n LMpreviousSymbol=LMcurrentSymbol;\n if (match!=\"\"){\n LMcurrentSymbol=LMsymbols[mk].ttype;\n return LMsymbols[mk];\n }\n LMcurrentSymbol=CONST;\n k = 1;\n st = str.slice(0,1); //take 1 character\n if (\"0\"<=st && st<=\"9\") tagst = \"mn\";\n else tagst = ((\"A\">st || st>\"Z\") && (\"a\">st || st>\"z\")?\"mo\":\"mi\");\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n return {input:st, tag:tagst, output:st, ttype:CONST};\n}\n\n\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n\nvar LMpreviousSymbol,LMcurrentSymbol;\n\nfunction LMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag]\n var symbol, node, result, result2, i, st,// rightvert = false,\n newFrag = document.createDocumentFragment();\n str = LMremoveCharsAndBlanks(str,0);\n symbol = LMgetSymbol(str); //either a token or a bracket or empty\n if (symbol == null || symbol.ttype == RIGHTBRACKET)\n return [null,str,null];\n if (symbol.ttype == DEFINITION) {\n str = symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length);\n symbol = LMgetSymbol(str);\n if (symbol == null || symbol.ttype == RIGHTBRACKET)\n return [null,str,null];\n }\n str = LMremoveCharsAndBlanks(str,symbol.input.length);\n switch (symbol.ttype) {\n case SPACE:\n node = createMmlNode(symbol.tag);\n node.setAttribute(symbol.atname,symbol.atval);\n return [node,str,symbol.tag];\n case UNDEROVER:\n if (isIE) {\n if (symbol.input.substr(0,4) == \"\\\\big\") { // botch for missing symbols\n\tstr = \"\\\\\"+symbol.input.substr(4)+str;\t // make \\bigcup = \\cup etc.\n\tsymbol = LMgetSymbol(str);\n\tsymbol.ttype = UNDEROVER;\n\tstr = LMremoveCharsAndBlanks(str,symbol.input.length);\n }\n }\n return [createMmlNode(symbol.tag,\n\t\t\tdocument.createTextNode(symbol.output)),str,symbol.tag];\n case CONST:\n var output = symbol.output;\n if (isIE) {\n if (symbol.input == \"'\")\n\toutput = \"\\u2032\";\n else if (symbol.input == \"''\")\n\toutput = \"\\u2033\";\n else if (symbol.input == \"'''\")\n\toutput = \"\\u2033\\u2032\";\n else if (symbol.input == \"''''\")\n\toutput = \"\\u2033\\u2033\";\n else if (symbol.input == \"\\\\square\")\n\toutput = \"\\u25A1\";\t// same as \\Box\n else if (symbol.input.substr(0,5) == \"\\\\frac\") {\n\t\t\t\t\t\t// botch for missing fractions\n\tvar denom = symbol.input.substr(6,1);\n\tif (denom == \"5\" || denom == \"6\") {\n\t str = symbol.input.replace(/\\\\frac/,\"\\\\frac \")+str;\n\t return [node,str,symbol.tag];\n\t}\n }\n }\n node = createMmlNode(symbol.tag,document.createTextNode(output));\n return [node,str,symbol.tag];\n case LONG: // added by DRW\n node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));\n node.setAttribute(\"minsize\",\"1.5\");\n node.setAttribute(\"maxsize\",\"1.5\");\n node = createMmlNode(\"mover\",node);\n node.appendChild(createMmlNode(\"mspace\"));\n return [node,str,symbol.tag];\n case STRETCHY: // added by DRW\n if (isIE && symbol.input == \"\\\\backslash\")\n\tsymbol.output = \"\\\\\";\t// doesn't expand, but then nor does \"\\u2216\"\n node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));\n if (symbol.input == \"|\" || symbol.input == \"\\\\vert\" ||\n\tsymbol.input == \"\\\\|\" || symbol.input == \"\\\\Vert\") {\n\t node.setAttribute(\"lspace\",\"0em\");\n\t node.setAttribute(\"rspace\",\"0em\");\n }\n node.setAttribute(\"maxsize\",symbol.atval); // don't allow to stretch here\n if (symbol.rtag != null)\n return [node,str,symbol.rtag];\n else\n return [node,str,symbol.tag];\n case BIG: // added by DRW\n var atval = symbol.atval;\n if (isIE)\n atval = symbol.ieval;\n symbol = LMgetSymbol(str);\n if (symbol == null)\n\treturn [null,str,null];\n str = LMremoveCharsAndBlanks(str,symbol.input.length);\n node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));\n if (isIE) {\t\t// to get brackets to expand\n var space = createMmlNode(\"mspace\");\n space.setAttribute(\"height\",atval+\"ex\");\n node = createMmlNode(\"mrow\",node);\n node.appendChild(space);\n } else {\t\t// ignored in IE\n node.setAttribute(\"minsize\",atval);\n node.setAttribute(\"maxsize\",atval);\n }\n return [node,str,symbol.tag];\n case LEFTBRACKET: //read (expr+)\n if (symbol.input == \"\\\\left\") { // left what?\n symbol = LMgetSymbol(str);\n if (symbol != null) {\n\tif (symbol.input == \".\")\n\t symbol.invisible = true;\n\tstr = LMremoveCharsAndBlanks(str,symbol.input.length);\n }\n }\n result = LMparseExpr(str,true,false);\n if (symbol==null ||\n\t(typeof symbol.invisible == \"boolean\" && symbol.invisible))\n node = createMmlNode(\"mrow\",result[0]);\n else {\n node = createMmlNode(\"mo\",document.createTextNode(symbol.output));\n node = createMmlNode(\"mrow\",node);\n node.appendChild(result[0]);\n }\n return [node,result[1],result[2]];\n case MATRIX:\t //read (expr+)\n if (symbol.input == \"\\\\begin{array}\") {\n var mask = \"\";\n symbol = LMgetSymbol(str);\n str = LMremoveCharsAndBlanks(str,0);\n if (symbol == null)\n\tmask = \"l\";\n else {\n\tstr = LMremoveCharsAndBlanks(str,symbol.input.length);\n\tif (symbol.input != \"{\")\n\t mask = \"l\";\n\telse do {\n\t symbol = LMgetSymbol(str);\n\t if (symbol != null) {\n\t str = LMremoveCharsAndBlanks(str,symbol.input.length);\n\t if (symbol.input != \"}\")\n\t mask = mask+symbol.input;\n\t }\n\t} while (symbol != null && symbol.input != \"\" && symbol.input != \"}\");\n }\n result = LMparseExpr(\"{\"+str,true,true);\n// if (result[0]==null) return [createMmlNode(\"mo\",\n//\t\t\t document.createTextNode(symbol.input)),str];\n node = createMmlNode(\"mtable\",result[0]);\n mask = mask.replace(/l/g,\"left \");\n mask = mask.replace(/r/g,\"right \");\n mask = mask.replace(/c/g,\"center \");\n node.setAttribute(\"columnalign\",mask);\n node.setAttribute(\"displaystyle\",\"false\");\n if (isIE)\n\treturn [node,result[1],null];\n// trying to get a *little* bit of space around the array\n// (IE already includes it)\n var lspace = createMmlNode(\"mspace\");\n lspace.setAttribute(\"width\",\"0.167em\");\n var rspace = createMmlNode(\"mspace\");\n rspace.setAttribute(\"width\",\"0.167em\");\n var node1 = createMmlNode(\"mrow\",lspace);\n node1.appendChild(node);\n node1.appendChild(rspace);\n return [node1,result[1],null];\n } else {\t// eqnarray\n result = LMparseExpr(\"{\"+str,true,true);\n node = createMmlNode(\"mtable\",result[0]);\n if (isIE)\n\tnode.setAttribute(\"columnspacing\",\"0.25em\"); // best in practice?\n else\n\tnode.setAttribute(\"columnspacing\",\"0.167em\"); // correct (but ignored?)\n node.setAttribute(\"columnalign\",\"right center left\");\n node.setAttribute(\"displaystyle\",\"true\");\n node = createMmlNode(\"mrow\",node);\n return [node,result[1],null];\n }\n case TEXT:\n if (str.charAt(0)==\"{\") i=str.indexOf(\"}\");\n else i = 0;\n if (i==-1)\n\t\t i = str.length;\n st = str.slice(1,i);\n if (st.charAt(0) == \" \") {\n\tnode = createMmlNode(\"mspace\");\n\tnode.setAttribute(\"width\",\"0.33em\");\t// was 1ex\n\tnewFrag.appendChild(node);\n }\n newFrag.appendChild(\n createMmlNode(symbol.tag,document.createTextNode(st)));\n if (st.charAt(st.length-1) == \" \") {\n\tnode = createMmlNode(\"mspace\");\n\tnode.setAttribute(\"width\",\"0.33em\");\t// was 1ex\n\tnewFrag.appendChild(node);\n }\n str = LMremoveCharsAndBlanks(str,i+1);\n return [createMmlNode(\"mrow\",newFrag),str,null];\n case UNARY:\n result = LMparseSexpr(str);\n if (result[0]==null) return [createMmlNode(symbol.tag,\n document.createTextNode(symbol.output)),str];\n if (typeof symbol.func == \"boolean\" && symbol.func) { // functions hack\n\tst = str.charAt(0);\n//\tif (st==\"^\" || st==\"_\" || st==\"/\" || st==\"|\" || st==\",\") {\n\tif (st==\"^\" || st==\"_\" || st==\",\") {\n\t return [createMmlNode(symbol.tag,\n\t\t document.createTextNode(symbol.output)),str,symbol.tag];\n } else {\n\t node = createMmlNode(\"mrow\",\n\t createMmlNode(symbol.tag,document.createTextNode(symbol.output)));\n\t if (isIE) {\n\t var space = createMmlNode(\"mspace\");\n\t space.setAttribute(\"width\",\"0.167em\");\n\t node.appendChild(space);\n\t }\n\t node.appendChild(result[0]);\n\t return [node,result[1],symbol.tag];\n }\n }\n if (symbol.input == \"\\\\sqrt\") {\t\t// sqrt\n\tif (isIE) {\t// set minsize, for \\surd\n\t var space = createMmlNode(\"mspace\");\n\t space.setAttribute(\"height\",\"1.2ex\");\n\t space.setAttribute(\"width\",\"0em\");\t// probably no effect\n\t node = createMmlNode(symbol.tag,result[0])\n//\t node.setAttribute(\"minsize\",\"1\");\t// ignored\n//\t node = createMmlNode(\"mrow\",node); // hopefully unnecessary\n\t node.appendChild(space);\n\t return [node,result[1],symbol.tag];\n\t} else\n\t return [createMmlNode(symbol.tag,result[0]),result[1],symbol.tag];\n } else if (typeof symbol.acc == \"boolean\" && symbol.acc) { // accent\n node = createMmlNode(symbol.tag,result[0]);\n\tvar output = symbol.output;\n\tif (isIE) {\n\t\tif (symbol.input == \"\\\\hat\")\n\t\t\toutput = \"\\u0302\";\n\t\telse if (symbol.input == \"\\\\widehat\")\n\t\t\toutput = \"\\u005E\";\n\t\telse if (symbol.input == \"\\\\bar\")\n\t\t\toutput = \"\\u00AF\";\n\t\telse if (symbol.input == \"\\\\grave\")\n\t\t\toutput = \"\\u0300\";\n\t\telse if (symbol.input == \"\\\\tilde\")\n\t\t\toutput = \"\\u0303\";\n\t}\n\tvar node1 = createMmlNode(\"mo\",document.createTextNode(output));\n\tif (symbol.input == \"\\\\vec\" || symbol.input == \"\\\\check\")\n\t\t\t\t\t\t// don't allow to stretch\n\t node1.setAttribute(\"maxsize\",\"1.2\");\n\t\t // why doesn't \"1\" work? \\vec nearly disappears in firefox\n\tif (isIE && symbol.input == \"\\\\bar\")\n\t node1.setAttribute(\"maxsize\",\"0.5\");\n\tif (symbol.input == \"\\\\underbrace\" || symbol.input == \"\\\\underline\")\n\t node1.setAttribute(\"accentunder\",\"true\");\n\telse\n\t node1.setAttribute(\"accent\",\"true\");\n\tnode.appendChild(node1);\n\tif (symbol.input == \"\\\\overbrace\" || symbol.input == \"\\\\underbrace\")\n\t node.ttype = UNDEROVER;\n\treturn [node,result[1],symbol.tag];\n } else {\t\t\t // font change or displaystyle command\n if (!isIE && typeof symbol.codes != \"undefined\") {\n for (i=0; i<result[0].childNodes.length; i++)\n if (result[0].childNodes[i].nodeName==\"mi\" || result[0].nodeName==\"mi\") {\n st = (result[0].nodeName==\"mi\"?result[0].firstChild.nodeValue:\n result[0].childNodes[i].firstChild.nodeValue);\n var newst = [];\n for (var j=0; j<st.length; j++)\n if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +\n String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);\n else newst = newst + st.charAt(j);\n if (result[0].nodeName==\"mi\")\n result[0]=createMmlNode(\"mo\").\n appendChild(document.createTextNode(newst));\n else result[0].replaceChild(createMmlNode(\"mo\").\n appendChild(document.createTextNode(newst)),result[0].childNodes[i]);\n }\n }\n node = createMmlNode(symbol.tag,result[0]);\n node.setAttribute(symbol.atname,symbol.atval);\n\tif (symbol.input == \"\\\\scriptstyle\" ||\n\t symbol.input == \"\\\\scriptscriptstyle\")\n\t\tnode.setAttribute(\"displaystyle\",\"false\");\n\treturn [node,result[1],symbol.tag];\n }\n case BINARY:\n result = LMparseSexpr(str);\n if (result[0]==null) return [createMmlNode(\"mo\",\n\t\t\t document.createTextNode(symbol.input)),str,null];\n result2 = LMparseSexpr(result[1]);\n if (result2[0]==null) return [createMmlNode(\"mo\",\n\t\t\t document.createTextNode(symbol.input)),str,null];\n if (symbol.input==\"\\\\root\" || symbol.input==\"\\\\stackrel\")\n newFrag.appendChild(result2[0]);\n newFrag.appendChild(result[0]);\n if (symbol.input==\"\\\\frac\") newFrag.appendChild(result2[0]);\n return [createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];\n case INFIX:\n str = LMremoveCharsAndBlanks(str,symbol.input.length);\n return [createMmlNode(\"mo\",document.createTextNode(symbol.output)),\n\tstr,symbol.tag];\n default:\n return [createMmlNode(symbol.tag, //its a constant\n\tdocument.createTextNode(symbol.output)),str,symbol.tag];\n }\n}\n\nfunction LMparseIexpr(str) {\n var symbol, sym1, sym2, node, result, tag, underover;\n str = LMremoveCharsAndBlanks(str,0);\n sym1 = LMgetSymbol(str);\n result = LMparseSexpr(str);\n node = result[0];\n str = result[1];\n tag = result[2];\n symbol = LMgetSymbol(str);\n if (symbol.ttype == INFIX) {\n str = LMremoveCharsAndBlanks(str,symbol.input.length);\n result = LMparseSexpr(str);\n if (result[0] == null) // show box in place of missing argument\n result[0] = createMmlNode(\"mo\",document.createTextNode(\"\\u25A1\"));\n str = result[1];\n tag = result[2];\n if (symbol.input == \"_\" || symbol.input == \"^\") {\n sym2 = LMgetSymbol(str);\n tag = null;\t// no space between x^2 and a following sin, cos, etc.\n// This is for \\underbrace and \\overbrace\n underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER));\n// underover = (sym1.ttype == UNDEROVER);\n if (symbol.input == \"_\" && sym2.input == \"^\") {\n str = LMremoveCharsAndBlanks(str,sym2.input.length);\n var res2 = LMparseSexpr(str);\n\tstr = res2[1];\n\ttag = res2[2]; // leave space between x_1^2 and a following sin etc.\n node = createMmlNode((underover?\"munderover\":\"msubsup\"),node);\n node.appendChild(result[0]);\n node.appendChild(res2[0]);\n } else if (symbol.input == \"_\") {\n\tnode = createMmlNode((underover?\"munder\":\"msub\"),node);\n node.appendChild(result[0]);\n } else {\n\tnode = createMmlNode((underover?\"mover\":\"msup\"),node);\n node.appendChild(result[0]);\n }\n node = createMmlNode(\"mrow\",node); // so sum does not stretch\n } else {\n node = createMmlNode(symbol.tag,node);\n if (symbol.input == \"\\\\atop\" || symbol.input == \"\\\\choose\")\n\tnode.setAttribute(\"linethickness\",\"0ex\");\n node.appendChild(result[0]);\n if (symbol.input == \"\\\\choose\")\n\tnode = createMmlNode(\"mfenced\",node);\n }\n }\n return [node,str,tag];\n}\n\nfunction LMparseExpr(str,rightbracket,matrix) {\n var symbol, node, result, i, tag,\n newFrag = document.createDocumentFragment();\n do {\n str = LMremoveCharsAndBlanks(str,0);\n result = LMparseIexpr(str);\n node = result[0];\n str = result[1];\n tag = result[2];\n symbol = LMgetSymbol(str);\n if (node!=undefined) {\n if ((tag == \"mn\" || tag == \"mi\") && symbol!=null &&\n\ttypeof symbol.func == \"boolean\" && symbol.func) {\n\t\t\t// Add space before \\sin in 2\\sin x or x\\sin x\n\t var space = createMmlNode(\"mspace\");\n\t space.setAttribute(\"width\",\"0.167em\");\n\t node = createMmlNode(\"mrow\",node);\n\t node.appendChild(space);\n }\n newFrag.appendChild(node);\n }\n } while ((symbol.ttype != RIGHTBRACKET)\n && symbol!=null && symbol.output!=\"\");\n tag = null;\n if (symbol.ttype == RIGHTBRACKET) {\n if (symbol.input == \"\\\\right\") { // right what?\n str = LMremoveCharsAndBlanks(str,symbol.input.length);\n symbol = LMgetSymbol(str);\n if (symbol != null && symbol.input == \".\")\n\tsymbol.invisible = true;\n if (symbol != null)\n\ttag = symbol.rtag;\n }\n if (symbol!=null)\n str = LMremoveCharsAndBlanks(str,symbol.input.length); // ready to return\n var len = newFrag.childNodes.length;\n if (matrix &&\n len>0 && newFrag.childNodes[len-1].nodeName == \"mrow\" && len>1 &&\n newFrag.childNodes[len-2].nodeName == \"mo\" &&\n newFrag.childNodes[len-2].firstChild.nodeValue == \"&\") { //matrix\n\tvar pos = []; // positions of ampersands\n var m = newFrag.childNodes.length;\n for (i=0; matrix && i<m; i=i+2) {\n pos[i] = [];\n node = newFrag.childNodes[i];\n\t for (var j=0; j<node.childNodes.length; j++)\n\t if (node.childNodes[j].firstChild.nodeValue==\"&\")\n\t pos[i][pos[i].length]=j;\n }\n\tvar row, frag, n, k, table = document.createDocumentFragment();\n\tfor (i=0; i<m; i=i+2) {\n\t row = document.createDocumentFragment();\n\t frag = document.createDocumentFragment();\n\t node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow>\n\t n = node.childNodes.length;\n\t k = 0;\n\t for (j=0; j<n; j++) {\n\t if (typeof pos[i][k] != \"undefined\" && j==pos[i][k]){\n\t node.removeChild(node.firstChild); //remove &\n\t row.appendChild(createMmlNode(\"mtd\",frag));\n\t k++;\n\t } else frag.appendChild(node.firstChild);\n\t }\n\t row.appendChild(createMmlNode(\"mtd\",frag));\n\t if (newFrag.childNodes.length>2) {\n\t newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow>\n\t newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo>\n\t }\n\t table.appendChild(createMmlNode(\"mtr\",row));\n\t}\n\treturn [table,str];\n }\n if (typeof symbol.invisible != \"boolean\" || !symbol.invisible) {\n node = createMmlNode(\"mo\",document.createTextNode(symbol.output));\n newFrag.appendChild(node);\n }\n }\n return [newFrag,str,tag];\n}\n\nvar tcnt = 0, dcnt = 0; //theorem and definition counters\n\nfunction simpleLaTeXformatting(st) {\n st = st.replace(/\\$\\$((.|\\n)*?)\\$\\$/g,\"<p align=\\\"center\\\">$\\\\displaystyle{$1}$</p>\");\n st = st.replace(/\\\\begin{(theorem|lemma|proposition|corollary)}((.|\\n)*?)\\\\end{\\1}/g,function(r,s,t){tcnt++; return \"<b>\"+s.charAt(0).toUpperCase()+s.slice(1)+\" \"+tcnt+\".</b> <i>\"+t.replace(/^\\s*<\\/?\\w+\\/?>|\\s*<\\/?\\w+\\/?>$/g,\"\")+\"</i>\"});\n st = st.replace(/\\\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\\n)*?)\\\\end{\\1}/g,function(r,s,t){dcnt++; return \"<b>\"+s.charAt(0).toUpperCase()+s.slice(1)+\" \"+dcnt+\".</b> \"+t.replace(/^\\s*<\\/?\\w+\\/?>|\\s*<\\/?\\w+\\/?>$/g,\"\")});\n st = st.replace(/\\\\begin{proof}((.|\\n)*?)\\\\end{proof}/g,function(s,t){return \"<i>Proof:</i> \"+t.replace(/^\\s*<\\/?\\w+\\/?>|\\s*<\\/?\\w+\\/?>$/g,\"\")+\" □\"});\n st = st.replace(/\\\\emph{(.*?)}/g,\"<em>$1</em>\");\n st = st.replace(/\\\\textbf{(.*?)}/g,\"<b>$1</b>\");\n st = st.replace(/\\\\cite{(.*?)}/g,\"[$1]\");\n st = st.replace(/\\\\chapter{(.*?)}/g,\"<h2>$1</h2>\");\n st = st.replace(/\\\\section{(.*?)}(\\s*<\\/?(br|p)\\s?\\/?>)?/g,\"<h3>$1</h3>\");\n st = st.replace(/\\\\subsection{((.|\\n)*?)}/g,\"<h4>$1</h4>\");\n st = st.replace(/\\\\begin{itemize}(\\s*<\\/?(br|p)\\s?\\/?>)?/g,\"<ul>\");\n st = st.replace(/\\\\item\\s((.|\\n)*?)(?=(\\\\item|\\\\end))/g,\"<li>$1</li>\");\n st = st.replace(/\\\\end{itemize}(\\s*<\\/?(br|p)\\s?\\/?>)?/g,\"</ul>\");\n st = st.replace(/\\\\begin{enumerate}(\\s*<\\/?(br|p)\\s?\\/?>)?/g,\"<ol>\");\n st = st.replace(/\\\\end{enumerate}(\\s*<\\/?(br|p)\\s?\\/?>)?/g,\"</ol>\");\n st = st.replace(/\\\\item\\[(.*?)]{(.*?)}/g,\"<dt>$1</dt><dd>$2</dd>\");\n st = st.replace(/\\\\begin{description}/g,\"<dl>\");\n st = st.replace(/\\\\end{description}/g,\"</dl>\");\n st = st.replace(/\\\\newline\\b/g,\"<br/>\");\n st = st.replace(/\\\\newpage\\b/g,\"<br style=\\\"page-break-after:always;\\\">\");\n st = st.replace(/\\\\par\\b/g,\"<p> </p>\");\n st = st.replace(/\\\\bigskip/g,\"<p style=\\\"margin-bottom:0.5in\\\"> </p>\");\n st = st.replace(/\\\\medskip/g,\"<p style=\\\"margin-bottom:0.3in\\\"> </p>\");\n st = st.replace(/\\\\smallskip/g,\"<p style=\\\"margin-bottom:0.15in\\\"> </p>\");\n st = st.replace(/\\\\begin{center}((.|\\n)*?)\\\\end{center}/g,\"<center>$1</center>\");\n return st\n}\n\nfunction ASCIIandgraphformatting(st) {\n st = st.replace(/<sup>(.*?)<\\/sup>(\\s|(\\S))/gi,\"^{$1} $3\");\n//st = st.replace(/<\\/?font.*?>/gi,\"\"); // do this only in amath...endamath\n st = st.replace(/(Proof:)/g,\"<i>$1</i>\");\n st = st.replace(/QED/g,\" □\");\n st = st.replace(/(\\\\?end{?a?math}?)/ig,\"<span></span>$1\");\n st = st.replace(/(\\bamath\\b|\\\\begin{a?math})/ig,\"<span></span>$1\");\n st = st.replace(/([>\\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\\W\\W?(\\w|\\s|-|\\.)*?\\W?:)/g,\"$1<b>$2$3</b>\");\n st = st.replace(/<embed\\s+class\\s?=\\s?\"?ASCIIsvg\"?/gi,\"<embed class=\\\"ASCIIsvg\\\" src=\\\"\"+dsvglocation+\"d.svg\\\" wmode=\\\"transparent\\\"\");\n st = st.replace(/(?:\\\\begin{a?graph}|\\bagraph|\\(:graph\\s)((.|\\n)*?)(?:\\\\end{a?graph}|enda?graph|:\\))/g,function(s,t){return \"<table><tr><td><div class=\\\"ASCIIsvg\\\"><embed class=\\\"ASCIIsvg\\\" src=\\\"\"+dsvglocation+\"d.svg\\\" wmode=\\\"transparent\\\" script=\\'\"+t.replace(/<\\/?(br|p|pre)\\s?\\/?>/gi,\"\\n\")+\"\\'/></div></td></tr></table>\"});\n st = st.replace(/insertASCIIMathCalculator/g,\"<div class=\\\"ASCIIMathCalculator\\\"></div>\");\n//alert(dsvglocation)\n return st\n}\n\nfunction LMprocessNode(n) {\n var frag,st;\n try {\n st = n.innerHTML;\n } catch(err) {}\n var am = /amath\\b|graph/i.test(st);\n if ((st==null || st.indexOf(\"\\$ \")!=-1 || st.indexOf(\"\\$<\")!=-1 || \n st.indexOf(\"\\\\begin\")!=-1 || am || st.slice(-1)==\"$\" ||\n st.indexOf(\"\\$\\n\")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){\n if (!avoidinnerHTML && translateLaTeXformatting) \n st = simpleLaTeXformatting(st);\n if (st!=null && am && !avoidinnerHTML) {\n st = ASCIIandgraphformatting(st);\n }\n st = st.replace(/%7E/g,\"~\"); // else PmWiki has url issues\n//alert(st)\n if (!avoidinnerHTML) n.innerHTML = st;\n processNodeR(n,false,true);\n }\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n}\n\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n\n// you can change these\nvar checkIfSVGavailable = true;\nvar notifyIfNoSVG = true;\nvar alertIfNoSVG = false;\nvar noSVG = false;\n\n// global defaults used if not specified by graph (you can change these)\nvar defaultwidth = 300; defaultheight = 200; // in pixels\nvar defaultxmin = -5.5; defaultxmax = 5.5; // in usercoords\nvar defaultborder = 0; border = defaultborder; // in pixel\nvar defaultstrokewidth = \"1\"; // default line width in pixel\nvar defaultstroke = \"blue\"; // default line color\nvar defaultstrokeopacity = 1; // transparent = 0, solid =1\nvar defaultstrokedasharray = null; // \"10,10\" gives 10px long dashes\nvar defaultfill = \"none\"; // default fill color\nvar defaultfillopacity = 1; // transparent = 0, solid =1\nvar defaultfontstyle = \"normal\"; // default text shape normal|italic|inherit\nvar defaultfontfamily = \"times\"; // default font times|ariel|helvetica|...\nvar defaultfontsize = \"16\"; // default size (scaled automatically)\nvar defaultfontweight = \"normal\";// normal|bold|bolder|lighter|100|...|900\nvar defaultfontstroke = \"none\"; // default font outline color\nvar defaultfontfill = \"none\"; // default font color\nvar defaultmarker = \"none\"; // \"dot\" | \"arrow\" | \"+\" | \"-\" | \"|\"\nvar defaultendpoints = \"\"; // \"c-d\" where c is <|o|* and d is >|o|*\n\n// global values used for all pictures (you can change these)\nvar showcoordinates = true;\nvar markerstrokewidth = \"1\";\nvar markerstroke = \"black\";\nvar markerfill = \"yellow\";\nvar markersize = 4;\nvar arrowfill = stroke;\nvar dotradius = 4;\nvar ticklength = 4;\nvar axesstroke = \"black\";\nvar gridstroke = \"grey\";\nvar backgroundstyle = \"fill-opacity:0; fill:white\";\nvar singlelettersitalic = true;\n\n// internal variables (probably no need to change these)\nvar picturepos = null; // position of picture relative to top of HTML page\nvar xunitlength; // in pixels, used to convert to user coordinates\nvar yunitlength; // in pixels\nvar origin = [0,0]; // in pixels (default is bottom left corner)\nvar above = \"above\"; // shorthands (to avoid typing quotes)\nvar below = \"below\";\nvar left = \"left\";\nvar right = \"right\";\nvar aboveleft = \"aboveleft\";\nvar aboveright = \"aboveright\";\nvar belowleft = \"belowleft\";\nvar belowright = \"belowright\";\nvar xmin, xmax, ymin, ymax, xscl, yscl, \n xgrid, ygrid, xtick, ytick, initialized;\nvar strokewidth, strokedasharray, stroke, fill, strokeopacity, fillopacity;\nvar fontstyle, fontfamily, fontsize, fontweight, fontstroke, fontfill;\nvar marker, endpoints, dynamic = {};\nvar picture, svgpicture, doc, width, height;\nvar isIE = document.createElementNS==null;\n\n//this is not used! var cpi = \"\\u03C0\", ctheta = \"\\u03B8\"; // character for pi, theta\nvar log = function(x) { return ln(x)/ln(10) };\nvar pi = Math.PI, e = Math.E, ln = Math.log, sqrt = Math.sqrt;\nvar floor = Math.floor, ceil = Math.ceil, abs = Math.abs;\nvar sin = Math.sin, cos = Math.cos, tan = Math.tan;\nvar arcsin = Math.asin, arccos = Math.acos, arctan = Math.atan;\nvar sec = function(x) { return 1/Math.cos(x) };\nvar csc = function(x) { return 1/Math.sin(x) };\nvar cot = function(x) { return 1/Math.tan(x) };\nvar arcsec = function(x) { return arccos(1/x) };\nvar arccsc = function(x) { return arcsin(1/x) };\nvar arccot = function(x) { return arctan(1/x) };\nvar sinh = function(x) { return (Math.exp(x)-Math.exp(-x))/2 };\nvar cosh = function(x) { return (Math.exp(x)+Math.exp(-x))/2 };\nvar tanh = \n function(x) { return (Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)) };\nvar sech = function(x) { return 1/cosh(x) };\nvar csch = function(x) { return 1/sinh(x) };\nvar coth = function(x) { return 1/tanh(x) };\nvar arcsinh = function(x) { return ln(x+Math.sqrt(x*x+1)) };\nvar arccosh = function(x) { return ln(x+Math.sqrt(x*x-1)) };\nvar arctanh = function(x) { return ln((1+x)/(1-x))/2 };\nvar sech = function(x) { return 1/cosh(x) };\nvar csch = function(x) { return 1/sinh(x) };\nvar coth = function(x) { return 1/tanh(x) };\nvar arcsech = function(x) { return arccosh(1/x) };\nvar arccsch = function(x) { return arcsinh(1/x) };\nvar arccoth = function(x) { return arctanh(1/x) };\nvar sign = function(x) { return (x==0?0:(x<0?-1:1)) };\n\nfunction factorial(x,n) { // Factorial function\n if (n==null) n=1;\n if (Math.abs(x-Math.round(x*1000000)/1000000)<1e-15)\n x = Math.round(x*1000000)/1000000;\n if (x-Math.floor(x)!=0) return NaN;\n for (var i=x-n; i>0; i-=n) x*=i;\n return (x<0?NaN:(x==0?1:x));\n}\n\nfunction C(x,k) { // Binomial coefficient function\n var res=1;\n for (var i=0; i<k; i++) res*=(x-i)/(k-i);\n return res;\n}\n\nfunction chop(x,n) { // Truncate decimal number to n places after decimal point\n if (n==null) n=0;\n return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);\n}\n\nfunction ran(a,b,n) { // Generate random number in [a,b] with n digits after .\n if (n==null) n=0;\n return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);\n}\n\nfunction myCreateElementSVG(t) {\n if (isIE) return doc.createElement(t);\n else return doc.createElementNS(\"http://www.w3.org/2000/svg\",t);\n}\n\nfunction getElementsByClass(container, tagName, clsName){\n var list = new Array(0);\n var collection = container.getElementsByTagName(tagName);\n for(var i = 0; i < collection.length; i++)\n if(collection[i].className.slice(0,clsName.length)==clsName)\n list[list.length] = collection[i];\n return list;\n}\n\nfunction showobj(obj) {\n var st=\"\", i;\n for (i in obj) \n st += (obj.getAttribute(i)==null?\"\":\" \"+i+\":\"+obj.getAttribute(i));\n return st;\n}\n\nfunction findPos(obj) { // top-left corner of obj on HTML page in pixel\n var curleft = curtop = 0;\n if (obj.offsetParent) {\n curleft = obj.offsetLeft\n curtop = obj.offsetTop\n while (obj = obj.offsetParent) {\n curleft += obj.offsetLeft\n curtop += obj.offsetTop\n//alert(showobj(obj)+[curleft,curtop])\n }\n }\n return [curleft,curtop];\n}\n\nfunction checkSVG(){\n if (navigator.appName.slice(0,8)==\"Netscape\") \n if (window['SVGElement']) noSVG = null;\n else noSVG = true;\n else if (navigator.appName.slice(0,9)==\"Microsoft\")\n try {\n var oSVG=eval(\"new ActiveXObject('Adobe.SVGCtl.3');\");\n noSVG = null;\n } catch (e) {\n noSVG = true;\n }\n else if (navigator.appName.slice(0,5)==\"Opera\") // works only for 9.50b1\n noSVG = null;\n else noSVG = true;\n//noSVG = true; //uncomment to check\n if (noSVG && notifyIfNoSVG) {\n var msg = \"To view the ASCIIsvg images use Internet Explorer + Adobe SVGviewer or Mozilla Firefox 2.0 or later.\"\n if (alertIfNoSVG)\n alert(msg);\n else return msg;\n }\n}\n\nfunction setText(st,id) { // add text to an existing node with given id\n var node = document.getElementById(id);\n if (node!=null)\n if (node.childNodes.length!=0) node.childNodes[0].nodeValue = st;\n else node.appendChild(document.createTextNode(st));\n}\n\nfunction getX(evt) { // return mouse x-coord in user coordinate system\n var svgroot = evt.target.parentNode;\n pos = findPos(svgroot.parentNode);\n return (evt.clientX+(isIE?0:window.pageXOffset)-pos[0]-svgroot.getAttribute(\"ox\"))/parseFloat(svgroot.getAttribute(\"xunitlength\"));\n}\n\nfunction getY(evt) { // return mouse y-coord in user coordinate system\n var svgroot = evt.target.parentNode;\n pos = findPos(svgroot.parentNode);\n//alert(showobj(svgroot)+svgroot.getAttribute(\"mytop\"))\n return (svgroot.getAttribute(\"height\")-svgroot.getAttribute(\"oy\")-(evt.clientY+(isIE?0:window.pageYOffset)-pos[1]))/parseFloat(svgroot.getAttribute(\"yunitlength\"));\n}\n\nfunction translateandeval(src) { //modify user input to JavaScript syntax\n var errstr;\n // replace plot(f(x),...) with plot(\"f(x)\",...) \n src = src.replace(/plot\\(\\x20*([^\\\"f\\[][^\\n\\r;]+?)\\,/g,\"plot\\(\\\"$1\\\",\");\n src = src.replace(/plot\\(\\x20*([^\\\"f\\[][^\\n\\r;]+)\\)/g,\"plot(\\\"$1\\\")\");\n\n // replace (expr,expr) by [expr,expr] where expr has no (,) in it\n src = src.replace(/([=[(,]\\x20*)\\(([-a-z0-9./+*]+?),([-a-z0-9./+*]+?)\\)/g,\"$1[$2,$3]\");\n//alert(src)\n // insert * between digit and letter e.g. 2x --> 2*x\n src = src.replace(/([0-9])([a-df-zA-Z]|e^)/g,\"$1*$2\");\n src = src.replace(/\\)([\\(0-9a-zA-Z])/g,\"\\)*$1\");\n\n try {\n with (Math) eval(src); // here the svgpicture object is created\n } catch(err) {\n if (err!=\"wait\") {\n//alert(dsvglocation)\n if (typeof err==\"object\") \n errstr = err.name+\" \"+err.message+\" \"+err.number+\" \"+err.description;\n else errstr = err;\n alert(errstr+\"\\n\"+src)\n }\n }\n}\n\nvar lastSlot = 0;\n\nfunction drawPictures() { // main routine; called after webpage has loaded\n var src, id, dsvg, nd, node, ht, index, cols, arr, i, node2;\n var ASbody = document.getElementsByTagName(\"body\")[0];\n pictures = getElementsByClass(ASbody,\"embed\",\"ASCIIsvg\");\n var len = pictures.length;\n if(len==0) return;\n for (index = lastSlot; index < len+lastSlot; index++) {\n width = null; height = null; \n xmin = null; xmax = null; ymin = null; ymax = null;\n xscl = null; xgrid = null; yscl = null; ygrid = null;\n initialized = false;\n picture = pictures[index-lastSlot]; // current picture object\n src = picture.getAttribute(\"script\"); // get the ASCIIsvg code\n if (src==null) src = \"\";\n // insert \"axes()\" if not present ******** experimental\n if (!/axes\\b|initPicture/.test(src)) {\n var i = 0;\n while (/((yscl|ymax|ymin|xscl|xmax|xmin|\\bwidth|\\bheight)\\s*=\\s*-?\\d*(\\d\\.|\\.\\d|\\d)\\d*\\s*;?)/.test(src.slice(i))) i++;\n src = (i==0?\"axes(); \"+src: src.slice(0,i)+src.slice(i).replace(/((scl|max|min|idth|eight)\\s*=\\s*-?\\d*(\\d\\.|\\.\\d|\\d)\\d*\\s*;?)/,\"$1\\naxes();\"));\n }\n ht = picture.getAttribute(\"height\");\n if (isIE) {\n picture.setAttribute(\"wmode\",\"transparent\");\n//alert(\"*\"+picture.getAttribute(\"src\")+dsvglocation);\n//adding d.svg dynamically greates problems in IE...\n// if (picture.getAttribute(\"src\")==\"\") picture.setAttribute(\"src\",dsvglocation+\"d.svg\");\n }\n if (document.getElementById(\"picture\"+(index+1)+\"mml\")==null) {\n picture.parentNode.style.position = \"relative\";\n node = createElementXHTML(\"div\");\n node.style.position = \"absolute\";\n node.style.top = \"0px\";\n node.style.left = \"0px\";\n node.setAttribute(\"id\",\"picture\"+(index+1)+\"mml\");\n picture.parentNode.insertBefore(node,picture.nextSibling);\n }\n if (ht==null) ht =\"\";\n// if (ht!=\"\") defaultborder = 25;\n if (ht==\"\" || src==\"\") \n if (document.getElementById(\"picture\"+(index+1)+\"input\")==null) {\n node = createElementXHTML(\"textarea\");\n arr = src.split(\"\\n\");\n cols = 0;\n for (i=0;i<arr.length;i++) cols = Math.max(cols,arr[i].length);\n node.setAttribute(\"rows\",Math.min(10,arr.length)+1);\n node.setAttribute(\"cols\",Math.max(Math.min(60,cols),20)+5);\n// node.setAttribute(\"style\",\"display:block\");\n if (isIE) src = src.replace(/([^\\r])\\n/g,\"$1\\r\");\n node.appendChild(document.createTextNode(src));\n if (src.indexOf(\"showcode()\")==-1) node.style.display = \"none\";\n node.setAttribute(\"id\",\"picture\"+(index+1)+\"input\");\n picture.parentNode.insertBefore(node,picture.nextSibling);\n picture.parentNode.insertBefore(createElementXHTML(\"br\"),node);\n node2 = createElementXHTML(\"button\");\n node2.setAttribute(\"id\",\"picture\"+(index+1)+\"button\");\n if (isIE) node2.onclick = function() {updatePicture(this)};\n else node2.setAttribute(\"onclick\",\"updatePicture(this)\");\n node2.appendChild(document.createTextNode(\"Update\"));\n if (src.indexOf(\"showcode()\")==-1) node2.style.display = \"none\";\n picture.parentNode.insertBefore(node2,node);\n// picture.parentNode.insertBefore(document.createTextNode(\"ASCII\"),node);\n picture.parentNode.insertBefore(createElementXHTML(\"br\"),node);\n } else src = document.getElementById(\"picture\"+(index+1)+\"input\").value;\n id = picture.getAttribute(\"id\");\n dsvg = picture.getAttribute(\"src\");\n if (id == null || id == \"\") {\n id = \"picture\"+(index+1);\n picture.setAttribute(\"id\",id);\n }\n translateandeval(src);\n }\n lastSlot+=len;\n}\n\nfunction setdefaults() { //called before each graph is evaluated\n strokewidth = defaultstrokewidth;\n stroke = defaultstroke;\n strokeopacity = defaultstrokeopacity;\n strokedasharray = defaultstrokedasharray;\n fill = defaultfill;\n fillopacity = defaultfillopacity;\n fontstyle = defaultfontstyle;\n fontfamily = defaultfontfamily;\n fontsize = defaultfontsize;\n fontweight = defaultfontweight;\n fontstroke = defaultfontstroke;\n fontfill = defaultfontfill;\n marker = defaultmarker;\n endpoints = defaultendpoints;\n}\n\nfunction switchTo(id) { // used by dynamic code to select appropriate graph\n if (id==undefined) return;\n var name = id;\n if (typeof name!=\"string\") name = id.target.parentNode.getAttribute(\"name\");\n picture = document.getElementById(name);\n width = picture.getAttribute(\"width\")-0;\n height = picture.getAttribute(\"height\")-0;\n setdefaults();\n if ((picture.nodeName == \"EMBED\" || picture.nodeName == \"embed\") && isIE) {\n svgpicture = picture.getSVGDocument().getElementById(\"root\");\n doc = picture.getSVGDocument();\n } else {\n svgpicture = picture;\n doc = document;\n }\n xunitlength = parseFloat(svgpicture.getAttribute(\"xunitlength\"));\n yunitlength = parseFloat(svgpicture.getAttribute(\"yunitlength\"));\n xmin = parseFloat(svgpicture.getAttribute(\"xmin\"));\n xmax = parseFloat(svgpicture.getAttribute(\"xmax\"));\n ymin = parseFloat(svgpicture.getAttribute(\"ymin\"));\n ymax = parseFloat(svgpicture.getAttribute(\"ymax\"));\n origin = [svgpicture.getAttribute(\"ox\")-0,svgpicture.getAttribute(\"oy\")-0];\n}\n\nfunction updatePicture(obj) {\n var node, src, id, top, left;\n if (typeof obj==\"object\") id = obj.id.slice(0,-6);\n else id = (typeof obj==\"string\"?obj:\"picture\"+(obj+1));\n src = document.getElementById(id+\"input\").value;\n xmin = null; xmax = null; ymin = null; ymax = null;\n xscl = null; xgrid = null; yscl = null; ygrid = null;\n initialized = false;\n picture = document.getElementById(id);\n translateandeval(src)\n}\n\nfunction changepicturesize(evt,factor) {\n var obj = evt.target;\n var name = obj.parentNode.getAttribute(\"name\");\n var pic = document.getElementById(name);\n var src = document.getElementById(name+\"input\").value;\n if (!/height/.test(src)) src = \"height=0; \"+src;\n if (!/width/.test(src)) src = \"width=0; \"+src;\n src = src.replace(/width\\s*=\\s*\\d+/,\"width=\"+(factor*(pic.getAttribute(\"width\")-0)));\n src = src.replace(/height\\s*=\\s*\\d+/,\"height=\"+(factor*(pic.getAttribute(\"height\")-0)));\n document.getElementById(name+\"input\").value = src;\n//alert(getKey(evt.keycode))\n updatePicture(name);\n}\n\nfunction zoom(evt,factor) {\n switchTo(evt);\n var obj = evt.target;\n var name = obj.parentNode.getAttribute(\"name\");\n var pic = document.getElementById(name);\n var src = document.getElementById(name+\"input\").value;\n var xlen = (xmax-xmin)/2;\n var ylen = (ymax-ymin)/2;\n var xcen = getX(evt), ycen = getY(evt);\n if (!/ymax/.test(src)) src = \"ymax=0; \"+src;\n if (!/ymin/.test(src)) src = \"ymin=0; \"+src;\n if (!/xmax/.test(src)) src = \"xmax=0; \"+src;\n if (!/xmin/.test(src)) src = \"xmin=0; \"+src;\n src = src.replace(/xmin\\s*=\\s*[-\\d.e]+/,\"xmin=\"+(xcen-factor*xlen));\n src = src.replace(/xmax\\s*=\\s*[-\\d.e]+/,\"xmax=\"+(xcen+factor*xlen));\n src = src.replace(/ymin\\s*=\\s*[-\\d.e]+/,\"ymin=\"+(ycen-factor*ylen));\n src = src.replace(/ymax\\s*=\\s*[-\\d.e]+/,\"ymax=\"+(ycen+factor*ylen));\n document.getElementById(name+\"input\").value = src;\n updatePicture(name);\n}\n\nvar sinceFirstClick = 0; // ondblclick simulation from \nvar dblClkTimer; // http://www.enja.org/david/?cat=13 Thanks!\nfunction timer() {\n if(sinceFirstClick<60) {\n sinceFirstClick++;\n setTimeout(\"timer()\",10);\n } else {\n clearTimeout(dblClkTimer);\n dblClkTimer = \"\";\n }\n}\nfunction mClick(evt) {\n if(sinceFirstClick!=0) {\n if(sinceFirstClick <= 40) {\n if (evt.shiftKey) {\n if (evt.altKey) changepicturesize(evt,2);\n else zoom(evt,.5);\n } else if (evt.altKey) zoom(evt,2);//changepicturesize(evt,.5);\n else showHideCode(evt); // do this on dblclick\n clearTimeout(dblClkTimer);\n dblClkTimer = \"\";\n } else {\n clearTimeout(dblClkTimer);\n sinceFirstClick = 0;\n dblClkTimer = setTimeout(\"timer()\",10);\n }\t \n } else {\n sinceFirstClick = 0;\n dblClkTimer = setTimeout(\"timer()\",10);\n }\n}\n\nfunction showHideCode(evt) { // called by onclick event\n// if (evt.getDetail()==2) {//getDetail unfortunately not in Firefox\n var obj=evt.target;\n var name = obj.parentNode.getAttribute(\"name\");\n var node = document.getElementById(name+\"input\");\n node.style.display = (node.style.display == \"none\"?\"\":\"none\");\n var node = document.getElementById(name+\"button\");\n node.style.display = (node.style.display == \"none\"?\"\":\"none\");\n// }\n}\n\nfunction showcode() {} // do nothing\n\nfunction setBorder(x) { border = x } //deprecate\n\nfunction initPicture(x_min,x_max,y_min,y_max) { // set up the graph\n// usually called by axes() or noaxes(), but can be used directly\n if (!initialized) {\n setdefaults();\n initialized = true;\n if (x_min!=null) xmin = x_min;\n if (x_max!=null) xmax = x_max;\n if (y_min!=null) ymin = y_min;\n if (y_max!=null) ymax = y_max;\n if (xmin==null) xmin = defaultxmin;\n if (xmax==null) xmax = defaultxmax;\n if (typeof xmin != \"number\" || typeof xmax != \"number\" || xmin >= xmax) \n alert(\"Picture requires at least two numbers: xmin < xmax\");\n else if (y_max != null && (typeof y_min != \"number\" || \n typeof y_max != \"number\" || y_min >= y_max))\n alert(\"initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax\");\n else {\n if (width==null) {\n width = picture.getAttribute(\"width\");\n if (width==null || width==\"\") width=defaultwidth;\n }\n picture.setAttribute(\"width\",width);\n if (height==null) { \n height = picture.getAttribute(\"height\");\n if (height==null || height==\"\") height=defaultheight;\n }\n picture.setAttribute(\"height\",height);\n xunitlength = (width-2*border)/(xmax-xmin);\n yunitlength = xunitlength;\n//alert(xmin+\" \"+xmax+\" \"+ymin+\" \"+ymax)\n if (ymin==null) {\n origin = [-xmin*xunitlength+border,height/2];\n ymin = -(height-2*border)/(2*yunitlength);\n ymax = -ymin;\n } else {\n if (ymax!=null) yunitlength = (height-2*border)/(ymax-ymin);\n else ymax = (height-2*border)/yunitlength + ymin;\n origin = [-xmin*xunitlength+border,-ymin*yunitlength+border];\n }\n if (isIE) {\n if (picture.FULLSCREEN==undefined) {\n setTimeout('drawPictures()',50);\n throw \"wait\";\n }\n svgpicture = picture.getSVGDocument().getElementById(\"root\");\n if (svgpicture==null) {\n setTimeout('drawPictures()',50);\n throw \"wait\";\n }\n svgpicture = picture.getSVGDocument().getElementById(\"root\");\n while (svgpicture.childNodes.length>0) \n svgpicture.removeChild(svgpicture.lastChild); \n svgpicture.setAttribute(\"width\",width);\n svgpicture.setAttribute(\"height\",height);\n svgpicture.setAttribute(\"name\",picture.getAttribute(\"id\"));\n doc = picture.getSVGDocument();\n } else {\n var qnode = document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\");\n qnode.setAttribute(\"id\",picture.getAttribute(\"id\"));\n qnode.setAttribute(\"name\",picture.getAttribute(\"id\"));\n// qnode.setAttribute(\"style\",\"display:inline\");\n qnode.setAttribute(\"width\",picture.getAttribute(\"width\"));\n qnode.setAttribute(\"height\",picture.getAttribute(\"height\"));\n picturepos = findPos(picture);\n// qnode.setAttribute(\"xmlns:xlink\",\"http://www.w3.org/1999/xlink\");\n if (picture.parentNode!=null) {\n picture.parentNode.replaceChild(qnode,picture);\n } else {\n svgpicture.parentNode.replaceChild(qnode,svgpicture);\n }\n svgpicture = qnode;\n doc = document;\n }\n var nd = document.getElementById(picture.getAttribute(\"id\")+\"mml\");\n if (nd!=null) // clear out MathML layer\n while (nd.childNodes.length>0) nd.removeChild(nd.lastChild); \n svgpicture.setAttribute(\"xunitlength\",xunitlength);\n svgpicture.setAttribute(\"yunitlength\",yunitlength);\n svgpicture.setAttribute(\"xmin\",xmin);\n svgpicture.setAttribute(\"xmax\",xmax);\n svgpicture.setAttribute(\"ymin\",ymin);\n svgpicture.setAttribute(\"ymax\",ymax);\n svgpicture.setAttribute(\"ox\",origin[0]);\n svgpicture.setAttribute(\"oy\",origin[1]);\n var node = myCreateElementSVG(\"rect\");\n node.setAttribute(\"x\",\"0\");\n node.setAttribute(\"y\",\"0\");\n node.setAttribute(\"width\",width);\n node.setAttribute(\"height\",height);\n node.setAttribute(\"style\",backgroundstyle);\n svgpicture.appendChild(node);\n svgpicture.setAttribute(\"onmousemove\",\"displayCoord(evt)\");\n svgpicture.setAttribute(\"onmouseout\",\"removeCoord(evt)\");\n svgpicture.setAttribute(\"onclick\",\"mClick(evt)\");\n node = myCreateElementSVG(\"text\"); // used for displayCoord\n node.appendChild(doc.createTextNode(\" \"));\n node.setAttribute(\"id\",\"coords\");\n svgpicture.appendChild(node);\n node = myCreateElementSVG(\"text\"); // used for text display\n node.appendChild(doc.createTextNode(\" \"));\n node.setAttribute(\"id\",\"coords\");\n svgpicture.appendChild(node);\n border = defaultborder;\n }\n }\n}\n\n//////////////////////////user graphics commands start/////////////////////////\n\nfunction line(p,q,id,endpts) { // segment connecting points p,q (coordinates in units)\n var node;\n if (id!=null) node = doc.getElementById(id);\n if (node==null) {\n node = myCreateElementSVG(\"path\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n node.setAttribute(\"d\",\"M\"+(p[0]*xunitlength+origin[0])+\",\"+\n (height-p[1]*yunitlength-origin[1])+\" \"+\n (q[0]*xunitlength+origin[0])+\",\"+(height-q[1]*yunitlength-origin[1]));\n node.setAttribute(\"stroke-width\", strokewidth);\n if (strokedasharray!=null) \n node.setAttribute(\"stroke-dasharray\", strokedasharray);\n node.setAttribute(\"stroke\", stroke);\n node.setAttribute(\"fill\", fill);\n node.setAttribute(\"stroke-opacity\", strokeopacity);\n node.setAttribute(\"fill-opacity\", fillopacity);\n if (marker==\"dot\" || marker==\"arrowdot\") {\n ASdot(p,markersize,markerstroke,markerfill);\n if (marker==\"arrowdot\") arrowhead(p,q);\n ASdot(q,markersize,markerstroke,markerfill);\n } else if (marker==\"arrow\") arrowhead(p,q);\n if (endpts==null && endpoints!=\"\") endpts = endpoints;\n if (endpts!=null) {\n if (endpts.indexOf(\"<-\") != -1) arrowhead(q,p);\n if (endpts.indexOf(\"o-\") != -1) dot(p, \"open\");\n if (endpts.indexOf(\"*-\") != -1) dot(p, \"closed\");\n if (endpts.indexOf(\"->\") != -1) arrowhead(p,q);\n if (endpts.indexOf(\"-o\") != -1) dot(q, \"open\");\n if (endpts.indexOf(\"-*\") != -1) dot(q, \"closed\");\n }\n}\n\nfunction path(plist,id,c,endpts) {\n if (c==null) c=\"\";\n var node, st, i;\n if (id!=null) node = doc.getElementById(id);\n if (node==null) {\n node = myCreateElementSVG(\"path\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n if (typeof plist == \"string\") st = plist;\n else {\n st = \"M\";\n st += (plist[0][0]*xunitlength+origin[0])+\",\"+\n (height-plist[0][1]*yunitlength-origin[1])+\" \"+c;\n for (i=1; i<plist.length; i++)\n st += (plist[i][0]*xunitlength+origin[0])+\",\"+\n (height-plist[i][1]*yunitlength-origin[1])+\" \";\n }\n node.setAttribute(\"d\", st);\n node.setAttribute(\"stroke-width\", strokewidth);\n if (strokedasharray!=null) \n node.setAttribute(\"stroke-dasharray\", strokedasharray);\n node.setAttribute(\"stroke\", stroke);\n node.setAttribute(\"fill\", fill);\n node.setAttribute(\"stroke-opacity\", strokeopacity);\n node.setAttribute(\"fill-opacity\", fillopacity);\n if (marker==\"dot\" || marker==\"arrowdot\")\n for (i=0; i<plist.length; i++)\n if (c!=\"C\" && c!=\"T\" || i!=1 && i!=2)\n ASdot(plist[i],markersize,markerstroke,markerfill);\n if (endpts==null && endpoints!=\"\") endpts = endpoints;\n if (endpts!=null) {\n if (endpts.indexOf(\"<-\") != -1) arrowhead(plist[1],plist[0]);\n if (endpts.indexOf(\"o-\") != -1) dot(plist[0], \"open\");\n if (endpts.indexOf(\"*-\") != -1) dot(plist[0], \"closed\");\n if (endpts.indexOf(\"->\") != -1) arrowhead(plist[plist.length-2],plist[plist.length-1]);\n if (endpts.indexOf(\"-o\") != -1) dot(plist[plist.length-1], \"open\");\n if (endpts.indexOf(\"-*\") != -1) dot(plist[plist.length-1], \"closed\");\n }\n}\n\nfunction curve(plist,id,endpts) {\n path(plist,id,\"T\",endpts);\n}\n\nfunction vector(p,q,id) {\n line(p,q,id,\"\",\"->\");\n}\n\nfunction circle(center,radius,id) { // coordinates in units\n var node;\n if (id!=null) node = doc.getElementById(id);\n if (node==null) {\n node = myCreateElementSVG(\"circle\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n node.setAttribute(\"cx\",center[0]*xunitlength+origin[0]);\n node.setAttribute(\"cy\",height-center[1]*yunitlength-origin[1]);\n node.setAttribute(\"r\",radius*xunitlength);\n node.setAttribute(\"stroke-width\", strokewidth);\n node.setAttribute(\"stroke\", stroke);\n node.setAttribute(\"fill\", fill);\n node.setAttribute(\"stroke-opacity\", strokeopacity);\n node.setAttribute(\"fill-opacity\", fillopacity);\n}\n\nfunction loop(p,d,id) { \n// d is a direction vector e.g. [1,0] means loop starts in that direction\n if (d==null) d=[1,0];\n path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,\"C\");\n if (marker==\"arrow\" || marker==\"arrowdot\") \n arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],\n p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);\n}\n\nfunction arc(start,end,radius,id,largearc) { // coordinates in units\n var node, v;\n//alert([fill, stroke, origin, xunitlength, yunitlength, height])\n if (id!=null) node = doc.getElementById(id);\n if (largearc==null) largearc=0;\n if (radius==null) {\n v=[end[0]-start[0],end[1]-start[1]];\n radius = Math.sqrt(v[0]*v[0]+v[1]*v[1]);\n }\n if (node==null) {\n node = myCreateElementSVG(\"path\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n node.setAttribute(\"d\",\"M\"+(start[0]*xunitlength+origin[0])+\",\"+\n (height-start[1]*yunitlength-origin[1])+\" A\"+radius*xunitlength+\",\"+\n radius*yunitlength+\" 0 \"+largearc+\",0 \"+(end[0]*xunitlength+origin[0])+\",\"+\n (height-end[1]*yunitlength-origin[1]));\n node.setAttribute(\"stroke-width\", strokewidth);\n node.setAttribute(\"stroke\", stroke);\n node.setAttribute(\"fill\", fill);\n node.setAttribute(\"stroke-opacity\", strokeopacity);\n node.setAttribute(\"fill-opacity\", fillopacity);\n if (marker==\"arrow\" || marker==\"arrowdot\") {\n u = [(end[1]-start[1])/4,(start[0]-end[0])/4];\n v = [(end[0]-start[0])/2,(end[1]-start[1])/2];\n//alert([u,v])\n v = [start[0]+v[0]+u[0],start[1]+v[1]+u[1]];\n } else v=[start[0],start[1]];\n if (marker==\"dot\" || marker==\"arrowdot\") {\n ASdot(start,markersize,markerstroke,markerfill);\n if (marker==\"arrowdot\") arrowhead(v,end);\n ASdot(end,markersize,markerstroke,markerfill);\n } else if (marker==\"arrow\") arrowhead(v,end);\n}\n\nfunction sector(center,start,end,id) { // center,start,end should be isoceles\n var rx = start[0]-center[0], ry = start[1]-center[1];\n arc(start,end,Math.sqrt(rx*rx+ry*ry),id+\"arc\");\n path([end,center,start],id+\"path\");\n}\n\nfunction ellipse(center,rx,ry,id) { // coordinates in units\n var node;\n if (id!=null) node = doc.getElementById(id);\n if (node==null) {\n node = myCreateElementSVG(\"ellipse\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n node.setAttribute(\"cx\",center[0]*xunitlength+origin[0]);\n node.setAttribute(\"cy\",height-center[1]*yunitlength-origin[1]);\n node.setAttribute(\"rx\",rx*xunitlength);\n node.setAttribute(\"ry\",ry*yunitlength);\n node.setAttribute(\"stroke-width\", strokewidth);\n node.setAttribute(\"stroke\", stroke);\n node.setAttribute(\"fill\", fill);\n node.setAttribute(\"stroke-opacity\", strokeopacity);\n node.setAttribute(\"fill-opacity\", fillopacity);\n}\n\nfunction triangle(p,q,r,id) {\n path([p,q,r,p],id)\n}\n\nfunction rect(p,q,id,rx,ry) { // opposite corners in units, rounded by radii\n var node;\n if (id!=null) node = doc.getElementById(id);\n if (node==null) {\n node = myCreateElementSVG(\"rect\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n node.setAttribute(\"x\",p[0]*xunitlength+origin[0]);\n node.setAttribute(\"y\",height-q[1]*yunitlength-origin[1]);\n node.setAttribute(\"width\",(q[0]-p[0])*xunitlength);\n node.setAttribute(\"height\",(q[1]-p[1])*yunitlength);\n if (rx!=null) node.setAttribute(\"rx\",rx*xunitlength);\n if (ry!=null) node.setAttribute(\"ry\",ry*yunitlength);\n node.setAttribute(\"stroke-width\", strokewidth);\n node.setAttribute(\"stroke\", stroke);\n node.setAttribute(\"fill\", fill);\n node.setAttribute(\"stroke-opacity\", strokeopacity);\n node.setAttribute(\"fill-opacity\", fillopacity);\n}\n\nfunction text(p,st,pos,id,fontsty) {\n var dnode, node, dx = 0, dy = fontsize/3, str = st.toString();\n if (/(`|\\$)/.test(str)) { // layer for ASCIIMathML and LaTeXMathML\n dnode = document.getElementById(svgpicture.getAttribute(\"name\")+\"mml\");\n if (dnode!=null) {\n if (id!=null) node = document.getElementById(id);\n if (node==null) {\n//alert(dnode.childNodes.length)\n node = createElementXHTML(\"div\");\n node.setAttribute(\"id\", id);\n node.style.position = \"absolute\";\n dnode.appendChild(node);\n }\n while (node.childNodes.length>0) node.removeChild(node.lastChild); \n node.appendChild(document.createTextNode(str));\n if (/`/.test(str)) AMprocessNode(node); else LMprocessNode(node);\n dx = -node.offsetWidth/2;\n dy = -node.offsetHeight/2;\n if (pos!=null) {\n if (/above/.test(pos)) dy = -node.offsetHeight;\n if (/below/.test(pos)) dy = 0;\n if (/right/.test(pos)) dx = 0;\n if ( /left/.test(pos)) dx = -node.offsetWidth;\n }\n node.style.left = \"\"+(p[0]*xunitlength+origin[0]+dx)+\"px\";\n node.style.top = \"\"+(height-p[1]*yunitlength-origin[1]+dy)+\"px\";\n }\n return p;\n }\n var textanchor = \"middle\"; // regular text goes into SVG\n if (pos!=null) {\n if (/above/.test(pos)) dy = -fontsize/2;\n if (/below/.test(pos)) dy = fontsize-0;\n if (/right/.test(pos)) {textanchor = \"start\"; dx = fontsize/4;}\n if ( /left/.test(pos)) {textanchor = \"end\"; dx = -fontsize/4;}\n }\n if (id!=null) node = doc.getElementById(id);\n if (node==null) {\n node = myCreateElementSVG(\"text\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n node.appendChild(doc.createTextNode(str));\n }\n while (node.childNodes.length>1) node.removeChild(node.lastChild); \n node.lastChild.nodeValue = \"\\xA0\"+str+\"\\xA0\";\n node.setAttribute(\"x\",p[0]*xunitlength+origin[0]+dx);\n node.setAttribute(\"y\",height-p[1]*yunitlength-origin[1]+dy);\n node.setAttribute(\"font-style\",(fontsty!=null?fontsty:\n (str.search(/^[a-zA-Z]$/)!=-1?\"italic\":fontstyle)));\n node.setAttribute(\"font-family\",fontfamily);\n node.setAttribute(\"font-size\",fontsize);\n node.setAttribute(\"font-weight\",fontweight);\n node.setAttribute(\"text-anchor\",textanchor);\n if (fontstroke!=\"none\") node.setAttribute(\"stroke\",fontstroke);\n if (fontfill!=\"none\") node.setAttribute(\"fill\",fontfill);\n return p;\n}\n\nfunction mtext(p,st,pos,fontsty,fontsz) { // method for updating text on an svg\n// \"this\" is the text object or the svgpicture object\n var textanchor = \"middle\";\n var dx = 0; var dy = fontsize/3;\n if (pos!=null) {\n if (pos.slice(0,5)==\"above\") dy = -fontsize/2;\n if (pos.slice(0,5)==\"below\") dy = fontsize-0;\n if (pos.slice(0,5)==\"right\" || pos.slice(5,10)==\"right\") {\n textanchor = \"start\";\n dx = fontsize/2;\n }\n if (pos.slice(0,4)==\"left\" || pos.slice(5,9)==\"left\") {\n textanchor = \"end\";\n dx = -fontsize/2;\n }\n }\n var node = this;\n if (this.nodeName==\"svg\") {\n node = myCreateElementSVG(\"text\");\n this.appendChild(node);\n node.appendChild(doc.createTextNode(st));\n }\n node.lastChild.nodeValue = st;\n node.setAttribute(\"x\",p[0]+dx);\n node.setAttribute(\"y\",p[1]+dy);\n node.setAttribute(\"font-style\",(fontsty!=null?fontsty:fontstyle));\n node.setAttribute(\"font-family\",fontfamily);\n node.setAttribute(\"font-size\",(fontsz!=null?fontsz:fontsize));\n node.setAttribute(\"font-weight\",fontweight);\n node.setAttribute(\"text-anchor\",textanchor);\n if (fontstroke!=\"none\") node.setAttribute(\"stroke\",fontstroke);\n if (fontfill!=\"none\") node.setAttribute(\"fill\",fontfill);\n}\n\nfunction image(imgurl,p,w,h,id) { // not working yet\n var node;\n if (id!=null) node = doc.getElementById(id);\n if (node==null) {\n node = myCreateElementSVG(\"image\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n node.setAttribute(\"x\",p[0]*xunitlength+origin[0]);\n node.setAttribute(\"y\",height-p[1]*yunitlength-origin[1]);\n node.setAttribute(\"width\",w);\n node.setAttribute(\"height\",h);\n node.setAttribute(\"xlink:href\", imgurl);\n}\n\nfunction ASdot(center,radius,s,f) { // coordinates in units, radius in pixel\n if (s==null) s = stroke; if (f==null) f = fill;\n var node = myCreateElementSVG(\"circle\");\n node.setAttribute(\"cx\",center[0]*xunitlength+origin[0]);\n node.setAttribute(\"cy\",height-center[1]*yunitlength-origin[1]);\n node.setAttribute(\"r\",radius);\n node.setAttribute(\"stroke-width\", strokewidth);\n node.setAttribute(\"stroke\", s);\n node.setAttribute(\"fill\", f);\n svgpicture.appendChild(node);\n}\n\nfunction dot(center, typ, label, pos, id) {\n var node;\n var cx = center[0]*xunitlength+origin[0];\n var cy = height-center[1]*yunitlength-origin[1];\n if (id!=null) node = doc.getElementById(id);\n if (typ==\"+\" || typ==\"-\" || typ==\"|\") {\n if (node==null) {\n node = myCreateElementSVG(\"path\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n if (typ==\"+\") {\n node.setAttribute(\"d\",\n \" M \"+(cx-ticklength)+\" \"+cy+\" L \"+(cx+ticklength)+\" \"+cy+\n \" M \"+cx+\" \"+(cy-ticklength)+\" L \"+cx+\" \"+(cy+ticklength));\n node.setAttribute(\"stroke-width\", .5);\n node.setAttribute(\"stroke\", axesstroke);\n } else {\n if (typ==\"-\") node.setAttribute(\"d\",\n \" M \"+(cx-ticklength)+\" \"+cy+\" L \"+(cx+ticklength)+\" \"+cy);\n else node.setAttribute(\"d\",\n \" M \"+cx+\" \"+(cy-ticklength)+\" L \"+cx+\" \"+(cy+ticklength));\n node.setAttribute(\"stroke-width\", strokewidth);\n node.setAttribute(\"stroke\", stroke);\n }\n } else {\n if (node==null) {\n node = myCreateElementSVG(\"circle\");\n node.setAttribute(\"id\", id);\n svgpicture.appendChild(node);\n }\n node.setAttribute(\"cx\",cx);\n node.setAttribute(\"cy\",cy);\n node.setAttribute(\"r\",dotradius);\n node.setAttribute(\"stroke-width\", strokewidth);\n node.setAttribute(\"stroke\", stroke);\n node.setAttribute(\"fill\", (typ==\"open\"?\"white\":\n (typ==\"closed\"?stroke:markerfill)));\n }\n if (label!=null) \n text(center,label,(pos==null?\"below\":pos),(id==null?id:id+\"label\"))\n}\n\npoint = dot; //alternative name\n\nfunction arrowhead(p,q) { // draw arrowhead at q (in units) add size param\n var up;\n var v = [p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]];\n var w = [q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]];\n var u = [w[0]-v[0],w[1]-v[1]];\n var d = Math.sqrt(u[0]*u[0]+u[1]*u[1]);\n if (d > 0.00000001) {\n u = [u[0]/d, u[1]/d];\n up = [-u[1],u[0]];\n var node = myCreateElementSVG(\"path\");\n node.setAttribute(\"d\",\"M \"+(w[0]-15*u[0]-4*up[0])+\" \"+\n (w[1]-15*u[1]-4*up[1])+\" L \"+(w[0]-3*u[0])+\" \"+(w[1]-3*u[1])+\" L \"+\n (w[0]-15*u[0]+4*up[0])+\" \"+(w[1]-15*u[1]+4*up[1])+\" z\");\n node.setAttribute(\"stroke-width\", markerstrokewidth);\n node.setAttribute(\"stroke\", stroke); /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n node.setAttribute(\"fill\", stroke); /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */\n node.setAttribute(\"stroke-opacity\", strokeopacity);\n node.setAttribute(\"fill-opacity\", fillopacity);\n svgpicture.appendChild(node); \n }\n}\n\nfunction chopZ(st) {\n var k = st.indexOf(\".\");\n if (k==-1) return st;\n for (var i=st.length-1; i>k && st.charAt(i)==\"0\"; i--);\n if (i==k) i--;\n return st.slice(0,i+1);\n}\n\nfunction grid(dx,dy) { // for backward compatibility\n axes(dx,dy,null,dx,dy)\n}\n\nfunction noaxes() {\n if (!initialized) initPicture();\n}\n\nfunction axes(dx,dy,labels,gdx,gdy) {\n//xscl=x is equivalent to xtick=x; xgrid=x; labels=true;\n var x, y, ldx, ldy, lx, ly, lxp, lyp, pnode, st;\n if (!initialized) initPicture();\n if (typeof dx==\"string\") { labels = dx; dx = null; }\n if (typeof dy==\"string\") { gdx = dy; dy = null; }\n if (xscl!=null) {dx = xscl; gdx = xscl; labels = dx}\n if (yscl!=null) {dy = yscl; gdy = yscl}\n if (xtick!=null) {dx = xtick}\n if (ytick!=null) {dy = ytick}\n dx = (dx==null?xunitlength:dx*xunitlength);\n dy = (dy==null?dx:dy*yunitlength);\n fontsize = Math.min(dx/2,dy/2,16); //alert(fontsize)\n ticklength = fontsize/4;\n if (xgrid!=null) gdx = xgrid;\n if (ygrid!=null) gdy = ygrid;\n if (gdx!=null) {\n gdx = (typeof gdx==\"string\"?dx:gdx*xunitlength);\n gdy = (gdy==null?dy:gdy*yunitlength);\n pnode = myCreateElementSVG(\"path\");\n st=\"\";\n for (x = origin[0]; x<width; x = x+gdx)\n st += \" M\"+x+\",0\"+\" \"+x+\",\"+height;\n for (x = origin[0]-gdx; x>0; x = x-gdx)\n st += \" M\"+x+\",0\"+\" \"+x+\",\"+height;\n for (y = height-origin[1]; y<height; y = y+gdy)\n st += \" M0,\"+y+\" \"+width+\",\"+y;\n for (y = height-origin[1]-gdy; y>0; y = y-gdy)\n st += \" M0,\"+y+\" \"+width+\",\"+y;\n pnode.setAttribute(\"d\",st);\n pnode.setAttribute(\"stroke-width\", .5);\n pnode.setAttribute(\"stroke\", gridstroke);\n pnode.setAttribute(\"fill\", fill);\n svgpicture.appendChild(pnode);\n }\n pnode = myCreateElementSVG(\"path\");\n st=\"M0,\"+(height-origin[1])+\" \"+width+\",\"+\n (height-origin[1])+\" M\"+origin[0]+\",0 \"+origin[0]+\",\"+height;\n for (x = origin[0]+dx; x<width; x = x+dx)\n st += \" M\"+x+\",\"+(height-origin[1]+ticklength)+\" \"+x+\",\"+\n (height-origin[1]-ticklength);\n for (x = origin[0]-dx; x>0; x = x-dx)\n st += \" M\"+x+\",\"+(height-origin[1]+ticklength)+\" \"+x+\",\"+\n (height-origin[1]-ticklength);\n for (y = height-origin[1]+dy; y<height; y = y+dy)\n st += \" M\"+(origin[0]+ticklength)+\",\"+y+\" \"+(origin[0]-ticklength)+\",\"+y;\n for (y = height-origin[1]-dy; y>0; y = y-dy)\n st += \" M\"+(origin[0]+ticklength)+\",\"+y+\" \"+(origin[0]-ticklength)+\",\"+y;\n if (labels!=null) with (Math) {\n ldx = dx/xunitlength;\n ldy = dy/yunitlength;\n lx = (xmin>0 || xmax<0?xmin:0);\n ly = (ymin>0 || ymax<0?ymin:0);\n lxp = (ly==0?\"below\":\"above\");\n lyp = (lx==0?\"left\":\"right\");\n var ddx = floor(1.1-log(ldx)/log(10))+1;\n var ddy = floor(1.1-log(ldy)/log(10))+1;\n for (x = ldx; x<=xmax; x = x+ldx)\n text([x,ly],chopZ(x.toFixed(ddx)),lxp);\n for (x = -ldx; xmin<=x; x = x-ldx)\n text([x,ly],chopZ(x.toFixed(ddx)),lxp);\n for (y = ldy; y<=ymax; y = y+ldy)\n text([lx,y],chopZ(y.toFixed(ddy)),lyp);\n for (y = -ldy; ymin<=y; y = y-ldy)\n text([lx,y],chopZ(y.toFixed(ddy)),lyp);\n }\n fontsize = defaultfontsize;\n pnode.setAttribute(\"d\",st);\n pnode.setAttribute(\"stroke-width\", .5);\n pnode.setAttribute(\"stroke\", axesstroke);\n pnode.setAttribute(\"fill\", fill);\n pnode.setAttribute(\"stroke-opacity\", strokeopacity);\n pnode.setAttribute(\"fill-opacity\", fillopacity);\n svgpicture.appendChild(pnode);\n}\n\nfunction mathjs(st) {\n //translate a math formula to js function notation\n // a^b --> pow(a,b)\n // na --> n*a\n // (...)d --> (...)*d\n // n! --> factorial(n)\n // sin^-1 --> arcsin etc.\n //while ^ in string, find term on left and right\n //slice and concat new formula string\n st = st.replace(/\\s/g,\"\");\n if (st.indexOf(\"^-1\")!=-1) {\n st = st.replace(/sin\\^-1/g,\"arcsin\");\n st = st.replace(/cos\\^-1/g,\"arccos\");\n st = st.replace(/tan\\^-1/g,\"arctan\");\n st = st.replace(/sec\\^-1/g,\"arcsec\");\n st = st.replace(/csc\\^-1/g,\"arccsc\");\n st = st.replace(/cot\\^-1/g,\"arccot\");\n st = st.replace(/sinh\\^-1/g,\"arcsinh\");\n st = st.replace(/cosh\\^-1/g,\"arccosh\");\n st = st.replace(/tanh\\^-1/g,\"arctanh\");\n st = st.replace(/sech\\^-1/g,\"arcsech\");\n st = st.replace(/csch\\^-1/g,\"arccsch\");\n st = st.replace(/coth\\^-1/g,\"arccoth\");\n }\n st = st.replace(/^e$/g,\"(Math.E)\");\n st = st.replace(/^e([^a-zA-Z])/g,\"(Math.E)$1\");\n st = st.replace(/([^a-zA-Z])e/g,\"$1(Math.E)\");\n// st = st.replace(/([^a-zA-Z])e([^a-zA-Z])/g,\"$1(Math.E)$2\");\n st = st.replace(/([0-9])([\\(a-zA-Z])/g,\"$1*$2\");\n st = st.replace(/\\)([\\(0-9a-zA-Z])/g,\"\\)*$1\");\n var i,j,k, ch, nested;\n while ((i=st.indexOf(\"^\"))!=-1) {\n //find left argument\n if (i==0) return \"Error: missing argument\";\n j = i-1;\n ch = st.charAt(j);\n if (ch>=\"0\" && ch<=\"9\") {// look for (decimal) number\n j--;\n while (j>=0 && (ch=st.charAt(j))>=\"0\" && ch<=\"9\") j--;\n if (ch==\".\") {\n j--;\n while (j>=0 && (ch=st.charAt(j))>=\"0\" && ch<=\"9\") j--;\n }\n } else if (ch==\")\") {// look for matching opening bracket and function name\n nested = 1;\n j--;\n while (j>=0 && nested>0) {\n ch = st.charAt(j);\n if (ch==\"(\") nested--;\n else if (ch==\")\") nested++;\n j--;\n }\n while (j>=0 && (ch=st.charAt(j))>=\"a\" && ch<=\"z\" || ch>=\"A\" && ch<=\"Z\")\n j--;\n } else if (ch>=\"a\" && ch<=\"z\" || ch>=\"A\" && ch<=\"Z\") {// look for variable\n j--;\n while (j>=0 && (ch=st.charAt(j))>=\"a\" && ch<=\"z\" || ch>=\"A\" && ch<=\"Z\")\n j--;\n } else { \n return \"Error: incorrect syntax in \"+st+\" at position \"+j;\n }\n //find right argument\n if (i==st.length-1) return \"Error: missing argument\";\n k = i+1;\n ch = st.charAt(k);\n if (ch>=\"0\" && ch<=\"9\" || ch==\"-\") {// look for signed (decimal) number\n k++;\n while (k<st.length && (ch=st.charAt(k))>=\"0\" && ch<=\"9\") k++;\n if (ch==\".\") {\n k++;\n while (k<st.length && (ch=st.charAt(k))>=\"0\" && ch<=\"9\") k++;\n }\n } else if (ch==\"(\") {// look for matching closing bracket and function name\n nested = 1;\n k++;\n while (k<st.length && nested>0) {\n ch = st.charAt(k);\n if (ch==\"(\") nested++;\n else if (ch==\")\") nested--;\n k++;\n }\n } else if (ch>=\"a\" && ch<=\"z\" || ch>=\"A\" && ch<=\"Z\") {// look for variable\n k++;\n while (k<st.length && (ch=st.charAt(k))>=\"a\" && ch<=\"z\" ||\n ch>=\"A\" && ch<=\"Z\") k++;\n } else { \n return \"Error: incorrect syntax in \"+st+\" at position \"+k;\n }\n st = st.slice(0,j+1)+\"Math.pow(\"+st.slice(j+1,i)+\",\"+st.slice(i+1,k)+\")\"+\n st.slice(k);\n }\n while ((i=st.indexOf(\"!\"))!=-1) {\n //find left argument\n if (i==0) return \"Error: missing argument\";\n j = i-1;\n ch = st.charAt(j);\n if (ch>=\"0\" && ch<=\"9\") {// look for (decimal) number\n j--;\n while (j>=0 && (ch=st.charAt(j))>=\"0\" && ch<=\"9\") j--;\n if (ch==\".\") {\n j--;\n while (j>=0 && (ch=st.charAt(j))>=\"0\" && ch<=\"9\") j--;\n }\n } else if (ch==\")\") {// look for matching opening bracket and function name\n nested = 1;\n j--;\n while (j>=0 && nested>0) {\n ch = st.charAt(j);\n if (ch==\"(\") nested--;\n else if (ch==\")\") nested++;\n j--;\n }\n while (j>=0 && (ch=st.charAt(j))>=\"a\" && ch<=\"z\" || ch>=\"A\" && ch<=\"Z\")\n j--;\n } else if (ch>=\"a\" && ch<=\"z\" || ch>=\"A\" && ch<=\"Z\") {// look for variable\n j--;\n while (j>=0 && (ch=st.charAt(j))>=\"a\" && ch<=\"z\" || ch>=\"A\" && ch<=\"Z\")\n j--;\n } else { \n return \"Error: incorrect syntax in \"+st+\" at position \"+j;\n }\n st = st.slice(0,j+1)+\"factorial(\"+st.slice(j+1,i)+\")\"+st.slice(i+1);\n }\n return st;\n}\n\nfunction plot(fun,x_min,x_max,points,id,endpts) {\n var pth = [];\n var f = function(x) { return x }, g = fun;\n var name = null;\n if (typeof fun==\"string\") \n eval(\"g = function(x){ with(Math) return \"+mathjs(fun)+\" }\");\n else if (typeof fun==\"object\") {\n eval(\"f = function(t){ with(Math) return \"+mathjs(fun[0])+\" }\");\n eval(\"g = function(t){ with(Math) return \"+mathjs(fun[1])+\" }\");\n }\n if (typeof x_min==\"string\") { name = x_min; x_min = xmin }\n else name = id;\n var min = (x_min==null?xmin:x_min);\n var max = (x_max==null?xmax:x_max);\n var inc = max-min-0.000001*(max-min);\n inc = (points==null?inc/200:inc/points);\n var gt;\n//alert(typeof g(min))\n for (var t = min; t <= max; t += inc) {\n gt = g(t);\n if (!(isNaN(gt)||Math.abs(gt)==\"Infinity\")) pth[pth.length] = [f(t), gt];\n }\n path(pth,name,null,endpts);\n return pth;\n}\n\n// make polar plot\n\n// make Riemann sums\n\nfunction slopefield(fun,dx,dy) {\n var g = fun;\n if (typeof fun==\"string\") \n eval(\"g = function(x,y){ with(Math) return \"+mathjs(fun)+\" }\");\n var gxy,x,y,u,v,dz;\n if (dx==null) dx=1;\n if (dy==null) dy=1;\n dz = Math.sqrt(dx*dx+dy*dy)/6;\n var x_min = Math.ceil(xmin/dx);\n var y_min = Math.ceil(ymin/dy);\n for (x = x_min; x <= xmax; x += dx)\n for (y = y_min; y <= ymax; y += dy) {\n gxy = g(x,y);\n if (!isNaN(gxy)) {\n if (Math.abs(gxy)==\"Infinity\") {u = 0; v = dz;}\n else {u = dz/Math.sqrt(1+gxy*gxy); v = gxy*u;}\n line([x-u,y-v],[x+u,y+v]);\n }\n }\n}\n\n///////////////////////user graphics commands end here/////////////////////////\n\nfunction show_props(obj) {\n var result = \"\";\n for (var i=0; i< obj.childNodes.length; i++)\n result += obj.childNodes.item(i) + \"\\n\";\n return result;\n}\n\nfunction displayCoord(evt) {\n if (showcoordinates) {\n var svgroot = evt.target.parentNode;\n var nl = svgroot.childNodes;\n for (var i=0; i<nl.length && nl.item(i).nodeName!=\"text\"; i++);\n var cnode = nl.item(i);\n cnode.mtext = mtext;\n cnode.mtext([svgroot.getAttribute(\"width\")-(-7),svgroot.getAttribute(\"height\")-7],\"(\"+getX(evt).toFixed(2)+\", \"+getY(evt).toFixed(2)+\")\", \"left\", \"\", \"11\");\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */ }\n}\n\nfunction removeCoord(evt) {\n var svgroot = evt.target.parentNode;\n var nl = svgroot.childNodes;\n for (var i=0; i<nl.length && nl.item(i).nodeName!=\"text\"; i++);\n var cnode = nl.item(i);\n cnode.mtext = mtext;\n cnode.mtext([svgroot.getAttribute(\"width\")-0,svgroot.getAttribute(\"height\")-0],\"\", \"aboveleft\", \"\");\n/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL\nSee http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */}\n\nfunction initASCIIMathCalculators(li) {\n var i;\n for (i=0; i<li.length; i++) {\n li[i].innerHTML = calcstr;\n AMprocessNode(li[i]);\n }\n li = document.getElementsByTagName(\"textarea\");\n var st;\n for (i=0; i<li.length; i++) {\n st = li[i].getAttribute(\"onkeyup\");\n if (st!=null) eval(String(st).replace(/function anonymous\\(\\)/,\"\"));\n }\n}\n\nfunction calculate(inputId,outputId) {\n var str = document.getElementById(inputId).value;\n var err = \"\";\n var ind = str.lastIndexOf(\"\\n\");\n if (ind==str.length-1) str = str.slice(0,ind);\n str = str.slice(str.lastIndexOf(\"\\n\")+1);\n try {\n var res = eval(mathjs(str));\n } catch(e) {\n err = \"syntax incomplete\";\n }\n if (!isNaN(res) && res!=\"Infinity\") \n str = \"`\"+str+\" =` \"+(Math.abs(res-Math.round(res*1000000)/1000000)<1e-15?Math.round(res*1000000)/1000000:res)+err; \n else if (str!=\"\") str = \"`\"+str+\"` = undefined\"; //debug:+mathjs(str);\n var outnode = document.getElementById(outputId);\n var n = outnode.childNodes.length;\n for (var i=0; i<n; i++)\n outnode.removeChild(outnode.firstChild);\n outnode.appendChild(document.createTextNode(str));\n AMprocessNode(outnode);\n}\n\nfunction append(st){\n document.getElementById('in').value+=st;\n calculate('in','out');\n document.getElementById('in').scrollTop = 1000;\n document.getElementById('in').focus();\n}\n\nfunction clearTextArea(){\n document.getElementById('in').value=\"\";\n calculate('in','out');\n document.getElementById('in').focus();\n}\n\nvar calcstr = \"<table align=\\\"center\\\">\\n<tr><th>\\nASCIIMath Scientific Calculator\\n</th></tr>\\n<tr><td>\\nClick in the box to use your keyboard or use the buttons\\n</td></tr>\\n<tr><td>\\n<textarea id=\\\"in\\\" rows=\\\"3\\\" cols=\\\"40\\\" onkeyup=\\\"calculate('in','out')\\\"></textarea></td></tr>\\n<tr><td height=\\\"50\\\">Result: <span id=\\\"out\\\"></span></td></tr>\\n</table>\\n<table align=\\\"center\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\\n<tbody align=\\\"center\\\">\\n<tr>\\n<td colspan=\\\"4\\\">\\n<button onclick=\\\"append('sin^-1(')\\\"><font size=2>`sin^-1`</font></button><button onclick=\\\"append('cos^-1(')\\\"><font size=2>`cos^-1`</font></button><button onclick=\\\"append('tan^-1(')\\\"><font size=2>`tan^-1`</font></button></td>\\n<td><button onclick=\\\"clearTextArea()\\\"> `C` </button></td>\\n\\n</tr>\\n<tr>\\n<td><button onclick=\\\"append('pi')\\\"> `pi` </button></td>\\n<td><button onclick=\\\"append('sin(')\\\"> `sin`</button></td>\\n<td><button onclick=\\\"append('cos(')\\\"> `cos`</button></td>\\n<td><button onclick=\\\"append('tan(')\\\"> `tan`</button></td>\\n<td><button onclick=\\\"append('^')\\\">`x^y`</button></td>\\n</tr>\\n<tr>\\n<td><button onclick=\\\"append('!')\\\"> `!` </button></td>\\n\\n<td><button onclick=\\\"append('(')\\\"><font size=2> `(` </font></button></td>\\n<td><button onclick=\\\"append(')')\\\"><font size=2> `)` </font></button></td>\\n<td><button onclick=\\\"append('sqrt(')\\\"><font size=2>`sqrt({::}^\\ )`</font></button></td>\\n<td><button onclick=\\\"append('/')\\\"> `-:\\ `</button></td>\\n</tr>\\n<tr>\\n<td><button onclick=\\\"append('log(')\\\">`log`</button></td>\\n<td><button onclick=\\\"append('7')\\\"> `7` </button></td>\\n<td><button onclick=\\\"append('8')\\\"> `8` </button></td>\\n\\n<td><button onclick=\\\"append('9')\\\"> `9` </button></td>\\n<td><button onclick=\\\"append('*')\\\"> `times` </button></td>\\n</tr>\\n<tr>\\n<td><button onclick=\\\"append('ln(')\\\"> `ln` </button></td>\\n<td><button onclick=\\\"append('4')\\\"> `4` </button></td>\\n<td><button onclick=\\\"append('5')\\\"> `5` </button></td>\\n<td><button onclick=\\\"append('6')\\\"> `6` </button></td>\\n\\n<td><button onclick=\\\"append('-')\\\"> `-{::}` </button></td>\\n</tr>\\n<tr>\\n<td><button onclick=\\\"append('e')\\\"> `e` </button></td>\\n<td><button onclick=\\\"append('1')\\\"> `1` </button></td>\\n<td><button onclick=\\\"append('2')\\\"> `2` </button></td>\\n<td><button onclick=\\\"append('3')\\\"> `3` </button></td>\\n<td><button onclick=\\\"append('+')\\\"> `+{::}` </button></td>\\n\\n</tr>\\n<tr>\\n<td> <!--button onclick=\\\"append('pi')\\\"> `pi` </button--></td>\\n<td><button onclick=\\\"append('0')\\\"> `0` </button></td>\\n<td><button onclick=\\\"append('.')\\\"> `.` </button></td>\\n<td><button onclick=\\\"append('\\\\n')\\\"> `\\\"ent\\\"`</button></td>\\n</tr>\\n</tbody>\\n</table>\";\n\n// GO1.1 Generic onload by Brothercake\n// http://www.brothercake.com/\n//onload function (replaces the onload=\"translate()\" in the <body> tag)\nfunction generic()\n{\n if(!init()) return;\n if (translateOnLoad) {\n var nd = document.getElementById(\"processasciimathinmoodle\");\n if (nd!=null) dsvglocation = nd.className;\n if (nd!=null || !checkforprocessasciimathinmoodle) {\n translate();\n if (!noSVG && translateASCIIsvg) drawPictures();\n }\n var li = getElementsByClass(document,\"div\",\"ASCIIMathCalculator\");\n if (!noMathML && li.length>0) initASCIIMathCalculators(li);\n }\n};\n//setup onload function\nif(typeof window.addEventListener != 'undefined')\n{\n //.. gecko, safari, konqueror and standard\n window.addEventListener('load', generic, false);\n}\nelse if(typeof document.addEventListener != 'undefined')\n{\n //.. opera 7\n document.addEventListener('load', generic, false);\n}\nelse if(typeof window.attachEvent != 'undefined')\n{\n //.. win/ie\n window.attachEvent('onload', generic);\n}\n//** remove this condition to degrade older browsers\nelse\n{\n //.. mac/ie5 and anything else that gets this far\n //if there's an existing onload function\n if(typeof window.onload == 'function')\n {\n //store it\n var existing = onload;\n //add new onload handler\n window.onload = function()\n {\n //call existing onload function\n existing();\n //call generic onload function\n generic();\n };\n }\n else\n {\n //setup onload function\n window.onload = generic;\n }\n}\n</script>\n"-
+ Text/Pandoc/Biblio.hs view
@@ -0,0 +1,66 @@+{-# LANGUAGE PatternGuards #-}+{-+Copyright (C) 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>++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.Biblio+ Copyright : Copyright (C) 2008 Andrea Rossato+ License : GNU GPL, version 2 or above++ Maintainer : Andrea Rossato <andrea.rossato@ing.unitn.it>+ Stability : alpha+ Portability : portable+-}++module Text.Pandoc.Biblio ( processBiblio ) where++import Control.Monad ( when )+import Data.List+import Text.CSL+import Text.Pandoc.Definition++-- | Process a 'Pandoc' document by adding citations formatted+-- according to a CSL style, using 'citeproc' from citeproc-hs.+processBiblio :: String -> [Reference] -> Pandoc -> IO Pandoc+processBiblio cf r p+ = if null r then return p+ else do+ when (null cf) $ error "Missing the needed citation style file"+ csl <- readCSLFile cf+ let groups = queryPandoc getCite p+ result = citeproc csl r groups+ cits_map = zip groups (citations result)+ biblioList = map (read . renderPandoc' csl) (bibliography result)+ Pandoc m b = processPandoc (processCite csl cits_map) p+ return $ Pandoc m $ b ++ biblioList++-- | Substitute 'Cite' elements with formatted citations.+processCite :: Style -> [([Target],[FormattedOutput])] -> Inline -> Inline+processCite s cs il+ | Cite t _ <- il = Cite t (process t)+ | otherwise = il+ where+ process t = case elemIndex t (map fst cs) of+ Just i -> read . renderPandoc s $ snd (cs !! i)+ Nothing -> [Str ("Error processing " ++ show t)]++-- | Retrieve all citations from a 'Pandoc' docuument. To be used with+-- 'queryPandoc'.+getCite :: Inline -> [[(String,String)]]+getCite i | Cite t _ <- i = [t]+ | otherwise = []
Text/Pandoc/Blocks.hs view
@@ -57,7 +57,7 @@ breakLines :: Int -- ^ Maximum length of lines. -> [String] -- ^ List of lines. -> [String]-breakLines width [] = []+breakLines _ [] = [] breakLines width (l:ls) = if length l > width then (take width l):(breakLines width ((drop width l):ls))@@ -93,9 +93,9 @@ -> String -- ^ String to pad. -> String hPad width line = - let lineLength = length line- in if lineLength <= width - then line ++ replicate (width - lineLength) ' '+ let linelen = length line+ in if linelen <= width+ then line ++ replicate (width - linelen) ' ' else take width line -- | Concatenates a list of @TextBlock@s into a new @TextBlock@ in@@ -116,6 +116,7 @@ hsepBlocks :: [TextBlock] -> TextBlock hsepBlocks = hcatBlocks . (intersperse (TextBlock 1 1 [" "])) +isWhitespace :: Char -> Bool isWhitespace x = x `elem` " \t" -- | Left-aligns the contents of a @TextBlock@ within the block.
Text/Pandoc/CharacterReferences.hs view
@@ -38,9 +38,9 @@ -- | Parse character entity. characterReference :: GenParser Char st Char characterReference = try $ do- st <- char '&'+ char '&' character <- numRef <|> entity- end <- char ';'+ char ';' return character numRef :: GenParser Char st Char
+ Text/Pandoc/DefaultHeaders.hs view
@@ -0,0 +1,69 @@+{-# LANGUAGE CPP, TemplateHaskell #-}+{-+Copyright (C) 2006-7 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.DefaultHeaders+ Copyright : Copyright (C) 2006-7 John MacFarlane+ License : GNU GPL, version 2 or above ++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Default headers for Pandoc writers.+-}+module Text.Pandoc.DefaultHeaders (+ defaultLaTeXHeader,+ defaultConTeXtHeader,+ defaultDocbookHeader,+ defaultOpenDocumentHeader,+ defaultS5Header,+ defaultRTFHeader+ ) where+import Text.Pandoc.Writers.S5+import System.FilePath ( (</>) )+import Text.Pandoc.TH ( contentsOf )++defaultLaTeXHeader :: String+#ifndef __HADDOCK__+defaultLaTeXHeader = $(contentsOf $ "data" </> "headers" </> "LaTeX.header")+#endif++defaultConTeXtHeader :: String+#ifndef __HADDOCK__+defaultConTeXtHeader = $(contentsOf $ "data" </> "headers" </> "ConTeXt.header")+#endif++defaultDocbookHeader :: String+#ifndef __HADDOCK__+defaultDocbookHeader = $(contentsOf $ "data" </> "headers" </> "Docbook.header")+#endif++defaultOpenDocumentHeader :: String+#ifndef __HADDOCK__+defaultOpenDocumentHeader = $(contentsOf $ "data" </> "headers" </> "OpenDocument.header")+#endif++defaultS5Header :: String+defaultS5Header = s5Meta ++ s5CSS ++ s5Javascript++defaultRTFHeader :: String+#ifndef __HADDOCK__+defaultRTFHeader = $(contentsOf $ "data" </> "headers" </> "RTF.header")+#endif
Text/Pandoc/Definition.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fglasgow-exts #-} -- for deriving Typeable {- Copyright (C) 2006-7 John MacFarlane <jgm@berkeley.edu> @@ -30,20 +31,22 @@ -} module Text.Pandoc.Definition where -data Pandoc = Pandoc Meta [Block] deriving (Eq, Read, Show)+import Data.Generics +data Pandoc = Pandoc Meta [Block] deriving (Eq, Read, Show, Typeable, Data)+ -- | Bibliographic information for the document: title (list of 'Inline'), -- authors (list of strings), date (string). data Meta = Meta [Inline] -- title [String] -- authors String -- date- deriving (Eq, Show, Read)+ deriving (Eq, Show, Read, Typeable, Data) -- | Alignment of a table column. data Alignment = AlignLeft | AlignRight | AlignCenter - | AlignDefault deriving (Eq, Show, Read)+ | AlignDefault deriving (Eq, Show, Read, Typeable, Data) -- | List attributes. type ListAttributes = (Int, ListNumberStyle, ListNumberDelim)@@ -54,19 +57,22 @@ | LowerRoman | UpperRoman | LowerAlpha - | UpperAlpha deriving (Eq, Show, Read)+ | UpperAlpha deriving (Eq, Show, Read, Typeable, Data) -- | Delimiter of list numbers. data ListNumberDelim = DefaultDelim | Period | OneParen - | TwoParens deriving (Eq, Show, Read)- + | TwoParens deriving (Eq, Show, Read, Typeable, Data)++-- | Attributes: identifier, classes, key-value pairs+type Attr = (String, [String], [(String, String)])+ -- | Block element. data Block = Plain [Inline] -- ^ Plain text, not a paragraph | Para [Inline] -- ^ Paragraph- | CodeBlock String -- ^ Code block (literal)+ | CodeBlock Attr String -- ^ Code block (literal) with attributes | RawHtml String -- ^ Raw HTML block (literal) | BlockQuote [Block] -- ^ Block quote (list of blocks) | OrderedList ListAttributes [[Block]] -- ^ Ordered list (attributes@@ -78,19 +84,23 @@ -- the term, and a block list) | Header Int [Inline] -- ^ Header - level (integer) and text (inlines) | HorizontalRule -- ^ Horizontal rule- | Table [Inline] [Alignment] [Float] [[Block]] [[[Block]]] -- ^ Table,+ | Table [Inline] [Alignment] [Double] [[Block]] [[[Block]]] -- ^ Table, -- with caption, column alignments, -- relative column widths, column headers -- (each a list of blocks), and rows -- (each a list of lists of blocks) | Null -- ^ Nothing- deriving (Eq, Read, Show)+ deriving (Eq, Read, Show, Typeable, Data) -- | Type of quotation marks to use in Quoted inline.-data QuoteType = SingleQuote | DoubleQuote deriving (Show, Eq, Read)+data QuoteType = SingleQuote | DoubleQuote deriving (Show, Eq, Read, Typeable, Data) -type Target = (String, String) -- ^ Link target (URL, title)+-- | Link target (URL, title).+type Target = (String, String) +-- | Type of math element (display or inline).+data MathType = DisplayMath | InlineMath deriving (Show, Eq, Read, Typeable, Data)+ -- | Inline elements. data Inline = Str String -- ^ Text (string)@@ -99,7 +109,9 @@ | Strikeout [Inline] -- ^ Strikeout text (list of inlines) | Superscript [Inline] -- ^ Superscripted text (list of inlines) | Subscript [Inline] -- ^ Subscripted text (list of inlines)+ | SmallCaps [Inline] -- ^ Small caps text (list of inlines) | Quoted QuoteType [Inline] -- ^ Quoted text (list of inlines)+ | Cite [Target] [Inline] -- ^ Citation (list of inlines) | Code String -- ^ Inline code (literal) | Space -- ^ Inter-word space | EmDash -- ^ Em dash@@ -107,11 +119,19 @@ | Apostrophe -- ^ Apostrophe | Ellipses -- ^ Ellipses | LineBreak -- ^ Hard line break- | Math String -- ^ TeX math (literal)+ | Math MathType String -- ^ TeX math (literal) | TeX String -- ^ LaTeX code (literal) | HtmlInline String -- ^ HTML code (literal) | Link [Inline] Target -- ^ Hyperlink: text (list of inlines), target | Image [Inline] Target -- ^ Image: alt text (list of inlines), target -- and target | Note [Block] -- ^ Footnote or endnote - deriving (Show, Eq, Read)+ deriving (Show, Eq, Read, Typeable, Data)++-- | Applies a transformation to matching elements in a Pandoc document.+processPandoc :: Typeable a => (a -> a) -> Pandoc -> Pandoc+processPandoc f = everywhere (mkT f)++-- | Runs a query on matching elements in a Pandoc document. +queryPandoc :: Typeable a => (a -> [b]) -> Pandoc -> [b]+queryPandoc f = everything (++) ([] `mkQ` f)
+ Text/Pandoc/Highlighting.hs view
@@ -0,0 +1,64 @@+{-# LANGUAGE CPP #-}+{-+Copyright (C) 2008 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.Highlighting+ Copyright : Copyright (C) 2008 John MacFarlane+ License : GNU GPL, version 2 or above ++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Exports functions for syntax highlighting.+-}++module Text.Pandoc.Highlighting ( languages, highlightHtml, defaultHighlightingCss ) where+import Text.XHtml+import Text.Pandoc.Definition+#ifdef _HIGHLIGHTING+import Text.Highlighting.Kate ( languages, highlightAs, formatAsXHtml, FormatOption (..), defaultHighlightingCss )+import Data.List (find, lookup)+import Data.Maybe (fromMaybe)+import Data.Char (toLower)++highlightHtml :: Attr -> String -> Either String Html+highlightHtml (_, classes, keyvals) rawCode =+ let firstNum = read $ fromMaybe "1" $ lookup "startFrom" keyvals+ fmtOpts = [OptNumberFrom firstNum] +++ case find (`elem` ["number","numberLines","number-lines"]) classes of+ Nothing -> []+ Just _ -> [OptNumberLines]+ lcLanguages = map (map toLower) languages+ in case find (\c -> (map toLower c) `elem` lcLanguages) classes of+ Nothing -> Left "Unknown or unsupported language"+ Just language -> case highlightAs language rawCode of+ Left err -> Left err+ Right hl -> Right $ formatAsXHtml fmtOpts language hl++#else+defaultHighlightingCss :: String+defaultHighlightingCss = ""++languages :: [String]+languages = []++highlightHtml :: Attr -> String -> Either String Html+highlightHtml _ _ = Left "Pandoc was not compiled with support for highlighting"+#endif
+ Text/Pandoc/LaTeXMathML.hs view
@@ -0,0 +1,14 @@+{-# LANGUAGE CPP, TemplateHaskell #-}+-- | Definitions for use of LaTeXMathML in HTML. +-- (See <http://math.etsu.edu/LaTeXMathML/>)+module Text.Pandoc.LaTeXMathML ( latexMathMLScript ) where+import Text.Pandoc.TH ( contentsOf )+import System.FilePath ( (</>) )++-- | String containing LaTeXMathML javascript.+latexMathMLScript :: String+#ifndef __HADDOCK__+latexMathMLScript = "<script type=\"text/javascript\">\n" +++ $(contentsOf $ "data" </> "LaTeXMathML.js.comment") +++ $(contentsOf $ "data" </> "LaTeXMathML.js.packed") ++ "</script>\n"+#endif
+ Text/Pandoc/ODT.hs view
@@ -0,0 +1,88 @@+{-# LANGUAGE TemplateHaskell #-}+{-+Copyright (C) 2008 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.ODT+ Copyright : Copyright (C) 2006-7 John MacFarlane+ License : GNU GPL, version 2 or above++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Functions for producing an ODT file from OpenDocument XML.+-}+module Text.Pandoc.ODT ( saveOpenDocumentAsODT ) where+import Text.Pandoc.TH ( makeZip )+import Data.List ( find )+import System.FilePath ( (</>), takeFileName )+import qualified Data.ByteString.Lazy as B+import Data.ByteString.Lazy.UTF8 ( fromString )+import Prelude hiding ( writeFile, readFile )+import Codec.Archive.Zip+import Control.Applicative ( (<$>) )+import Text.ParserCombinators.Parsec+import System.Time++-- | Produce an ODT file from OpenDocument XML.+saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.+ -> FilePath -- ^ Relative directory of source file.+ -> String -- ^ OpenDocument XML contents.+ -> IO ()+saveOpenDocumentAsODT destinationODTPath sourceDirRelative xml = do+ let refArchive = read $(makeZip "odt-styles")+ -- handle pictures+ let (newContents, pics) = + case runParser pPictures [] "OpenDocument XML contents" xml of+ Left err -> error $ show err+ Right x -> x+ picEntries <- mapM (makePictureEntry sourceDirRelative) pics + (TOD epochTime _) <- getClockTime+ let contentEntry = toEntry "content.xml" epochTime $ fromString newContents+ let archive = foldr addEntryToArchive refArchive (contentEntry : picEntries)+ B.writeFile destinationODTPath $ fromArchive archive++makePictureEntry :: FilePath -- ^ Relative directory of source file+ -> (FilePath, String) -- ^ Path and new path of picture+ -> IO Entry+makePictureEntry sourceDirRelative (path, newPath) = do+ entry <- readEntry [] $ sourceDirRelative </> path+ return (entry { eRelativePath = newPath })++pPictures :: GenParser Char [(FilePath, String)] ([Char], [(FilePath, String)])+pPictures = do+ contents <- concat <$> many (pPicture <|> many1 (noneOf "<") <|> string "<")+ pics <- getState+ return (contents, pics)++pPicture :: GenParser Char [(FilePath, String)] [Char]+pPicture = try $ do+ string "<draw:image xlink:href=\""+ path <- manyTill anyChar (char '"')+ let filename = takeFileName path+ pics <- getState+ newPath <- case find (\(o, _) -> o == path) pics of+ Just (_, new) -> return new+ Nothing -> do + -- get a unique name+ let dups = length $ (filter (\(o, _) -> takeFileName o == filename)) pics + let new = "Pictures/" ++ replicate dups '0' ++ filename+ updateState ((path, new) :)+ return new+ return $ "<draw:image xlink:href=\"" ++ newPath ++ "\""
Text/Pandoc/Readers/HTML.hs view
@@ -37,17 +37,18 @@ anyHtmlEndTag, htmlEndTag, extractTagType,- htmlBlockElement + htmlBlockElement,+ unsanitaryURI ) where import Text.ParserCombinators.Parsec import Text.Pandoc.Definition import Text.Pandoc.Shared -import Text.Pandoc.CharacterReferences ( characterReference, - decodeCharacterReferences )+import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Data.Maybe ( fromMaybe )-import Data.List ( takeWhile, dropWhile, isPrefixOf, isSuffixOf )-import Data.Char ( toUpper, toLower, isAlphaNum )+import Data.List ( takeWhile, dropWhile, isPrefixOf, isSuffixOf, intercalate )+import Data.Char ( toLower, isAlphaNum )+import Network.URI ( parseURIReference, URI (..) ) -- | Convert HTML-formatted string to 'Pandoc' document. readHtml :: ParserState -- ^ Parser state@@ -59,22 +60,28 @@ -- Constants -- +eitherBlockOrInline :: [[Char]] eitherBlockOrInline = ["applet", "button", "del", "iframe", "ins", "map", "area", "object"] +{-+inlineHtmlTags :: [[Char]] inlineHtmlTags = ["a", "abbr", "acronym", "b", "basefont", "bdo", "big", "br", "cite", "code", "dfn", "em", "font", "i", "img", "input", "kbd", "label", "q", "s", "samp", "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", "tt", "u", "var"] ++ eitherBlockOrInline+-} -blockHtmlTags = ["address", "blockquote", "center", "dir", "div",+blockHtmlTags :: [[Char]]+blockHtmlTags = ["address", "blockquote", "body", "center", "dir", "div", "dl", "fieldset", "form", "h1", "h2", "h3", "h4",- "h5", "h6", "hr", "isindex", "menu", "noframes",+ "h5", "h6", "hr", "html", "isindex", "menu", "noframes", "noscript", "ol", "p", "pre", "table", "ul", "dd", "dt", "frameset", "li", "tbody", "td", "tfoot", "th", "thead", "tr", "script"] ++ eitherBlockOrInline +sanitaryTags :: [[Char]] sanitaryTags = ["a", "abbr", "acronym", "address", "area", "b", "big", "blockquote", "br", "button", "caption", "center", "cite", "code", "col", "colgroup", "dd", "del", "dfn",@@ -87,6 +94,7 @@ "td", "textarea", "tfoot", "th", "thead", "tr", "tt", "u", "ul", "var"] +sanitaryAttributes :: [[Char]] sanitaryAttributes = ["abbr", "accept", "accept-charset", "accesskey", "action", "align", "alt", "axis", "border", "cellpadding", "cellspacing", "char",@@ -109,32 +117,55 @@ -- | Returns @True@ if sanitization is specified and the specified tag is -- not on the sanitized tag list.+unsanitaryTag :: [Char]+ -> GenParser tok ParserState Bool unsanitaryTag tag = do st <- getState- if stateSanitizeHTML st && not (tag `elem` sanitaryTags)- then return True- else return False+ return $ stateSanitizeHTML st && tag `notElem` sanitaryTags -- | returns @True@ if sanitization is specified and the specified attribute -- is not on the sanitized attribute list.-unsanitaryAttribute (attr, _, _) = do+unsanitaryAttribute :: ([Char], String, t)+ -> GenParser tok ParserState Bool+unsanitaryAttribute (attr, val, _) = do st <- getState- if stateSanitizeHTML st && not (attr `elem` sanitaryAttributes)- then return True- else return False+ return $ stateSanitizeHTML st &&+ (attr `notElem` sanitaryAttributes ||+ (attr `elem` ["href","src"] && unsanitaryURI val)) +-- | Returns @True@ if the specified URI is potentially a security risk.+unsanitaryURI :: String -> Bool+unsanitaryURI u =+ let safeURISchemes = [ "", "http", "https", "ftp", "mailto", "file",+ "telnet", "gopher", "aaa", "aaas", "acap", "cap", "cid",+ "crid", "dav", "dict", "dns", "fax", "go", "h323", "im",+ "imap", "ldap", "mid", "news", "nfs", "nntp", "pop",+ "pres", "sip", "sips", "snmp", "tel", "urn", "wais",+ "xmpp", "z39.50r", "z39.50s", "aim", "callto", "cvs",+ "ed2k", "feed", "fish", "gg", "irc", "ircs", "lastfm",+ "ldaps", "magnet", "mms", "msnim", "notes", "rsync",+ "secondlife", "skype", "ssh", "sftp", "smb", "sms",+ "snews", "webcal", "ymsgr"]+ in case parseURIReference u of+ Just p -> (map toLower $ uriScheme p) `notElem` safeURISchemes+ Nothing -> True+ -- | Read blocks until end tag.+blocksTilEnd :: String -> GenParser Char ParserState [Block] blocksTilEnd tag = do blocks <- manyTill (block >>~ spaces) (htmlEndTag tag) return $ filter (/= Null) blocks -- | Read inlines until end tag.+inlinesTilEnd :: String -> GenParser Char ParserState [Inline] inlinesTilEnd tag = manyTill inline (htmlEndTag tag) -- | Parse blocks between open and close tag.+blocksIn :: String -> GenParser Char ParserState [Block] blocksIn tag = try $ htmlTag tag >> spaces >> blocksTilEnd tag -- | Parse inlines between open and close tag.+inlinesIn :: String -> GenParser Char ParserState [Inline] inlinesIn tag = try $ htmlTag tag >> spaces >> inlinesTilEnd tag -- | Extract type from a tag: e.g. @br@ from @\<br\>@@@ -145,6 +176,7 @@ extractTagType _ = "" -- | Parse any HTML tag (opening or self-closing) and return text of tag+anyHtmlTag :: GenParser Char ParserState [Char] anyHtmlTag = try $ do char '<' spaces@@ -162,6 +194,7 @@ then return $ "<!-- unsafe HTML removed -->" else return result +anyHtmlEndTag :: GenParser Char ParserState [Char] anyHtmlEndTag = try $ do char '<' spaces@@ -186,16 +219,19 @@ optional (string "/") spaces char '>'- return (tag, (map (\(name, content, raw) -> (name, content)) attribs))+ return (tag, (map (\(name, content, _) -> (name, content)) attribs)) -- parses a quoted html attribute value+quoted :: Char -> GenParser Char st (String, String) quoted quoteChar = do result <- between (char quoteChar) (char quoteChar) (many (noneOf [quoteChar])) return (result, [quoteChar]) +nullAttribute :: ([Char], [Char], [Char]) nullAttribute = ("", "", "") +htmlAttribute :: GenParser Char ParserState ([Char], [Char], [Char]) htmlAttribute = do attr <- htmlRegularAttribute <|> htmlMinimizedAttribute unsanitary <- unsanitaryAttribute attr@@ -204,11 +240,13 @@ else return attr -- minimized boolean attribute+htmlMinimizedAttribute :: GenParser Char st ([Char], [Char], [Char]) htmlMinimizedAttribute = try $ do many1 space name <- many1 (choice [letter, oneOf ".-_:"]) return (name, name, name) +htmlRegularAttribute :: GenParser Char st ([Char], [Char], [Char]) htmlRegularAttribute = try $ do many1 space name <- many1 (choice [letter, oneOf ".-_:"])@@ -224,6 +262,7 @@ (name ++ "=" ++ quoteStr ++ content ++ quoteStr)) -- | Parse an end tag of type 'tag'+htmlEndTag :: [Char] -> GenParser Char st [Char] htmlEndTag tag = try $ do char '<' spaces@@ -234,22 +273,29 @@ char '>' return $ "</" ++ tag ++ ">" +{- -- | Returns @True@ if the tag is (or can be) an inline tag.+isInline :: String -> Bool isInline tag = (extractTagType tag) `elem` inlineHtmlTags+-} -- | Returns @True@ if the tag is (or can be) a block tag.+isBlock :: String -> Bool isBlock tag = (extractTagType tag) `elem` blockHtmlTags +anyHtmlBlockTag :: GenParser Char ParserState [Char] anyHtmlBlockTag = try $ do tag <- anyHtmlTag <|> anyHtmlEndTag- if not (isInline tag) then return tag else fail "not a block tag"+ if isBlock tag then return tag else fail "not a block tag" +anyHtmlInlineTag :: GenParser Char ParserState [Char] anyHtmlInlineTag = try $ do tag <- anyHtmlTag <|> anyHtmlEndTag- if isInline tag then return tag else fail "not an inline tag"+ if not (isBlock tag) then return tag else fail "not an inline tag" -- | Parses material between script tags. -- Scripts must be treated differently, because they can contain '<>' etc.+htmlScript :: GenParser Char ParserState [Char] htmlScript = try $ do open <- string "<script" rest <- manyTill anyChar (htmlEndTag "script")@@ -260,6 +306,7 @@ -- | Parses material between style tags. -- Style tags must be treated differently, because they can contain CSS+htmlStyle :: GenParser Char ParserState [Char] htmlStyle = try $ do open <- string "<style" rest <- manyTill anyChar (htmlEndTag "style")@@ -268,8 +315,10 @@ then return "<!-- unsafe HTML removed -->" else return $ open ++ rest ++ "</style>" +htmlBlockElement :: GenParser Char ParserState [Char] htmlBlockElement = choice [ htmlScript, htmlStyle, htmlComment, xmlDec, definition ] +rawHtmlBlock :: GenParser Char ParserState Block rawHtmlBlock = try $ do body <- htmlBlockElement <|> anyHtmlBlockTag state <- getState@@ -277,10 +326,12 @@ -- We don't want to parse </body> or </html> as raw HTML, since these -- are handled in parseHtml.+rawHtmlBlock' :: GenParser Char ParserState Block rawHtmlBlock' = do notFollowedBy' (htmlTag "/body" <|> htmlTag "/html") rawHtmlBlock -- | Parses an HTML comment.+htmlComment :: GenParser Char st [Char] htmlComment = try $ do string "<!--" comment <- manyTill anyChar (try (string "-->"))@@ -290,21 +341,25 @@ -- parsing documents -- +xmlDec :: GenParser Char st [Char] xmlDec = try $ do string "<?" rest <- manyTill anyChar (char '>') return $ "<?" ++ rest ++ ">" +definition :: GenParser Char st [Char] definition = try $ do string "<!" rest <- manyTill anyChar (char '>') return $ "<!" ++ rest ++ ">" +nonTitleNonHead :: GenParser Char ParserState Char nonTitleNonHead = try $ do notFollowedBy $ (htmlTag "title" >> return ' ') <|> (htmlEndTag "head" >> return ' ') (rawHtmlBlock >> return ' ') <|> anyChar +parseTitle :: GenParser Char ParserState [Inline] parseTitle = try $ do (tag, _) <- htmlTag "title" contents <- inlinesTilEnd tag@@ -312,6 +367,7 @@ return contents -- parse header and return meta-information (for now, just title)+parseHead :: GenParser Char ParserState ([Inline], [a], [Char]) parseHead = try $ do htmlTag "head" spaces@@ -321,16 +377,19 @@ htmlEndTag "head" return (contents, [], "") +skipHtmlTag :: String -> GenParser Char ParserState () skipHtmlTag tag = optional (htmlTag tag) -- h1 class="title" representation of title in body+bodyTitle :: GenParser Char ParserState [Inline] bodyTitle = try $ do- (tag, attribs) <- htmlTag "h1" - cl <- case (extractAttribute "class" attribs) of- Just "title" -> return ""- otherwise -> fail "not title"+ (_, attribs) <- htmlTag "h1" + case (extractAttribute "class" attribs) of+ Just "title" -> return ""+ _ -> fail "not title" inlinesTilEnd "h1" +parseHtml :: GenParser Char ParserState Pandoc parseHtml = do sepEndBy (choice [xmlDec, definition, htmlComment]) spaces skipHtmlTag "html"@@ -352,8 +411,10 @@ -- parsing blocks -- +parseBlocks :: GenParser Char ParserState [Block] parseBlocks = spaces >> sepEndBy block spaces >>= (return . filter (/= Null)) +block :: GenParser Char ParserState Block block = choice [ codeBlock , header , hrule@@ -368,11 +429,13 @@ -- header blocks -- +header :: GenParser Char ParserState Block header = choice (map headerLevel (enumFromTo 1 5)) <?> "header" +headerLevel :: Int -> GenParser Char ParserState Block headerLevel n = try $ do let level = "h" ++ show n- (tag, attribs) <- htmlTag level+ htmlTag level contents <- inlinesTilEnd level return $ Header n (normalizeSpaces contents) @@ -380,8 +443,9 @@ -- hrule block -- +hrule :: GenParser Char ParserState Block hrule = try $ do- (tag, attribs) <- htmlTag "hr"+ (_, attribs) <- htmlTag "hr" state <- getState if not (null attribs) && stateParseRaw state then unexpected "attributes in hr" -- parse as raw in this case@@ -393,6 +457,7 @@ -- Note: HTML tags in code blocks (e.g. for syntax highlighting) are -- skipped, because they are not portable to output formats other than HTML.+codeBlock :: GenParser Char ParserState Block codeBlock = try $ do htmlTag "pre" result <- manyTill @@ -408,12 +473,13 @@ let result''' = if "\n" `isSuffixOf` result'' then init result'' else result''- return $ CodeBlock $ decodeCharacterReferences result'''+ return $ CodeBlock ("",[],[]) $ decodeCharacterReferences result''' -- -- block quotes -- +blockQuote :: GenParser Char ParserState Block blockQuote = try $ htmlTag "blockquote" >> spaces >> blocksTilEnd "blockquote" >>= (return . BlockQuote) @@ -421,8 +487,10 @@ -- list blocks -- +list :: GenParser Char ParserState Block list = choice [ bulletList, orderedList, definitionList ] <?> "list" +orderedList :: GenParser Char ParserState Block orderedList = try $ do (_, attribs) <- htmlTag "ol" (start, style) <- option (1, DefaultStyle) $@@ -445,6 +513,7 @@ htmlEndTag "ol" return $ OrderedList (start, style, DefaultDelim) items +bulletList :: GenParser Char ParserState Block bulletList = try $ do htmlTag "ul" spaces@@ -452,24 +521,27 @@ htmlEndTag "ul" return $ BulletList items +definitionList :: GenParser Char ParserState Block definitionList = try $ do failIfStrict -- def lists not part of standard markdown- tag <- htmlTag "dl"+ htmlTag "dl" spaces items <- sepEndBy1 definitionListItem spaces htmlEndTag "dl" return $ DefinitionList items +definitionListItem :: GenParser Char ParserState ([Inline], [Block]) definitionListItem = try $ do terms <- sepEndBy1 (inlinesIn "dt") spaces defs <- sepEndBy1 (blocksIn "dd") spaces- let term = joinWithSep [LineBreak] terms+ let term = intercalate [LineBreak] terms return (term, concat defs) -- -- paragraph block -- +para :: GenParser Char ParserState Block para = try $ htmlTag "p" >> inlinesTilEnd "p" >>= return . Para . normalizeSpaces @@ -477,12 +549,14 @@ -- plain block -- +plain :: GenParser Char ParserState Block plain = many1 inline >>= return . Plain . normalizeSpaces -- -- inline -- +inline :: GenParser Char ParserState Inline inline = choice [ charRef , strong , emph@@ -499,46 +573,58 @@ , rawHtmlInline ] <?> "inline" +code :: GenParser Char ParserState Inline code = try $ do htmlTag "code" result <- manyTill anyChar (htmlEndTag "code") -- remove internal line breaks, leading and trailing space, -- and decode character references return $ Code $ decodeCharacterReferences $ removeLeadingTrailingSpace $ - joinWithSep " " $ lines result + intercalate " " $ lines result +rawHtmlInline :: GenParser Char ParserState Inline rawHtmlInline = do result <- htmlScript <|> htmlStyle <|> htmlComment <|> anyHtmlInlineTag state <- getState if stateParseRaw state then return (HtmlInline result) else return (Str "") +betweenTags :: [Char] -> GenParser Char ParserState [Inline] betweenTags tag = try $ htmlTag tag >> inlinesTilEnd tag >>= return . normalizeSpaces +emph :: GenParser Char ParserState Inline emph = (betweenTags "em" <|> betweenTags "i") >>= return . Emph +strong :: GenParser Char ParserState Inline strong = (betweenTags "b" <|> betweenTags "strong") >>= return . Strong +superscript :: GenParser Char ParserState Inline superscript = failIfStrict >> betweenTags "sup" >>= return . Superscript +subscript :: GenParser Char ParserState Inline subscript = failIfStrict >> betweenTags "sub" >>= return . Subscript +strikeout :: GenParser Char ParserState Inline strikeout = failIfStrict >> (betweenTags "s" <|> betweenTags "strike") >>= return . Strikeout +spanStrikeout :: GenParser Char ParserState Inline spanStrikeout = try $ do failIfStrict -- strict markdown has no strikeout, so treat as raw HTML- (tag, attributes) <- htmlTag "span" + (_, attributes) <- htmlTag "span" result <- case (extractAttribute "class" attributes) of Just "strikeout" -> inlinesTilEnd "span" _ -> fail "not a strikeout" return $ Strikeout result +whitespace :: GenParser Char st Inline whitespace = many1 space >> return Space -- hard line break+linebreak :: GenParser Char ParserState Inline linebreak = htmlTag "br" >> optional newline >> return LineBreak +str :: GenParser Char st Inline str = many1 (noneOf "<& \t\n") >>= return . Str --@@ -546,7 +632,8 @@ -- -- extract contents of attribute (attribute names are case-insensitive)-extractAttribute name [] = Nothing+extractAttribute :: [Char] -> [([Char], String)] -> Maybe String+extractAttribute _ [] = Nothing extractAttribute name ((attrName, contents):rest) = let name' = map toLower name attrName' = map toLower attrName@@ -554,17 +641,19 @@ then Just (decodeCharacterReferences contents) else extractAttribute name rest +link :: GenParser Char ParserState Inline link = try $ do- (tag, attributes) <- htmlTag "a" + (_, attributes) <- htmlTag "a" url <- case (extractAttribute "href" attributes) of Just url -> return url Nothing -> fail "no href" let title = fromMaybe "" $ extractAttribute "title" attributes- label <- inlinesTilEnd "a"- return $ Link (normalizeSpaces label) (url, title)+ lab <- inlinesTilEnd "a"+ return $ Link (normalizeSpaces lab) (url, title) +image :: GenParser Char ParserState Inline image = try $ do- (tag, attributes) <- htmlTag "img" + (_, attributes) <- htmlTag "img" url <- case (extractAttribute "src" attributes) of Just url -> return url Nothing -> fail "no src"
Text/Pandoc/Readers/LaTeX.hs view
@@ -30,7 +30,7 @@ module Text.Pandoc.Readers.LaTeX ( readLaTeX, rawLaTeXInline,- rawLaTeXEnvironment+ rawLaTeXEnvironment' ) where import Text.ParserCombinators.Parsec@@ -47,6 +47,7 @@ readLaTeX = readWith parseLaTeX -- characters with special meaning+specialChars :: [Char] specialChars = "\\`$%^&_~#{}\n \t|<>'\"-" --@@ -54,21 +55,26 @@ -- -- | Returns text between brackets and its matching pair.+bracketedText :: Char -> Char -> GenParser Char st [Char] bracketedText openB closeB = do result <- charsInBalanced' openB closeB return $ [openB] ++ result ++ [closeB] -- | Returns an option or argument of a LaTeX command.+optOrArg :: GenParser Char st [Char] optOrArg = bracketedText '{' '}' <|> bracketedText '[' ']' -- | True if the string begins with '{'.-isArg ('{':rest) = True-isArg other = False+isArg :: [Char] -> Bool+isArg ('{':_) = True+isArg _ = False -- | Returns list of options and arguments of a LaTeX command.+commandArgs :: GenParser Char st [[Char]] commandArgs = many optOrArg -- | Parses LaTeX command, returns (name, star, list of options or arguments).+command :: GenParser Char st ([Char], [Char], [[Char]]) command = do char '\\' name <- many1 letter@@ -76,21 +82,24 @@ args <- commandArgs return (name, star, args) +begin :: [Char] -> GenParser Char st [Char] begin name = try $ do string $ "\\begin{" ++ name ++ "}" optional commandArgs spaces return name +end :: [Char] -> GenParser Char st [Char] end name = try $ do string $ "\\end{" ++ name ++ "}"- spaces return name -- | Returns a list of block elements containing the contents of an -- environment.-environment name = try $ begin name >> spaces >> manyTill block (end name)+environment :: [Char] -> GenParser Char ParserState [Block]+environment name = try $ begin name >> spaces >> manyTill block (end name) >>~ spaces +anyEnvironment :: GenParser Char ParserState Block anyEnvironment = try $ do string "\\begin{" name <- many letter@@ -99,6 +108,7 @@ optional commandArgs spaces contents <- manyTill block (end (name ++ star))+ spaces return $ BlockQuote contents --@@ -106,12 +116,14 @@ -- -- | Process LaTeX preamble, extracting metadata.+processLaTeXPreamble :: GenParser Char ParserState () processLaTeXPreamble = try $ manyTill (choice [bibliographic, comment, unknownCommand, nullBlock]) (try (string "\\begin{document}")) >> spaces -- | Parse LaTeX and return 'Pandoc'.+parseLaTeX :: GenParser Char ParserState Pandoc parseLaTeX = do optional processLaTeXPreamble -- preamble might not be present (fragment) spaces@@ -132,40 +144,43 @@ -- parsing blocks -- +parseBlocks :: GenParser Char ParserState [Block] parseBlocks = spaces >> many block +block :: GenParser Char ParserState Block block = choice [ hrule , codeBlock , header , list , blockQuote- , mathBlock , comment , bibliographic , para- , specialEnvironment , itemBlock , unknownEnvironment+ , ignore , unknownCommand ] <?> "block" -- -- header blocks -- +header :: GenParser Char ParserState Block header = try $ do char '\\' subs <- many (try (string "sub")) string "section" optional (char '*') char '{'- title <- manyTill inline (char '}')+ title' <- manyTill inline (char '}') spaces- return $ Header (length subs + 1) (normalizeSpaces title)+ return $ Header (length subs + 1) (normalizeSpaces title') -- -- hrule block -- +hrule :: GenParser Char st Block hrule = oneOfStrings [ "\\begin{center}\\rule{3in}{0.4pt}\\end{center}\n\n", "\\newpage" ] >> spaces >> return HorizontalRule @@ -173,67 +188,52 @@ -- code blocks -- -codeBlock = codeBlock1 <|> codeBlock2+codeBlock :: GenParser Char st Block+codeBlock = choice $ map codeBlockWith ["verbatim", "Verbatim", "code"]+-- Note: Verbatim is from fancyvrb. code is used by literate Haskell. -codeBlock1 = try $ do- string "\\begin{verbatim}" -- don't use begin function because it - -- gobbles whitespace+codeBlockWith :: String -> GenParser Char st Block+codeBlockWith env = try $ do+ string ("\\begin{" ++ env ++ "}") -- don't use begin function because it+ -- gobbles whitespace optional blanklines -- we want to gobble blank lines, but not -- leading space- contents <- manyTill anyChar (try (string "\\end{verbatim}"))- spaces- return $ CodeBlock (stripTrailingNewlines contents)--codeBlock2 = try $ do- string "\\begin{Verbatim}" -- used by fancyvrb package- option "" blanklines- contents <- manyTill anyChar (try (string "\\end{Verbatim}"))+ contents <- manyTill anyChar (try (string $ "\\end{" ++ env ++ "}")) spaces- return $ CodeBlock (stripTrailingNewlines contents)+ let classes = if env == "code" then ["haskell"] else []+ return $ CodeBlock ("",classes,[]) (stripTrailingNewlines contents) -- -- block quotes -- +blockQuote :: GenParser Char ParserState Block blockQuote = (environment "quote" <|> environment "quotation") >>~ spaces >>= return . BlockQuote ----- math block-----mathBlock = mathBlockWith (begin "equation") (end "equation") <|> - mathBlockWith (begin "displaymath") (end "displaymath") <|>- mathBlockWith (try $ string "\\[") (try $ string "\\]") <?> - "math block"--mathBlockWith start end = try $ do- start- spaces- result <- manyTill anyChar end- spaces- return $ BlockQuote [Para [Math result]]---- -- list blocks -- +list :: GenParser Char ParserState Block list = bulletList <|> orderedList <|> definitionList <?> "list" +listItem :: GenParser Char ParserState ([Inline], [Block]) listItem = try $ do ("item", _, args) <- command spaces state <- getState let oldParserContext = stateParserContext state- updateState (\state -> state {stateParserContext = ListItemState})+ updateState (\s -> s {stateParserContext = ListItemState}) blocks <- many block- updateState (\state -> state {stateParserContext = oldParserContext})+ updateState (\s -> s {stateParserContext = oldParserContext}) opt <- case args of ([x]) | "[" `isPrefixOf` x && "]" `isSuffixOf` x -> parseFromString (many inline) $ tail $ init x _ -> return [] return (opt, blocks) +orderedList :: GenParser Char ParserState Block orderedList = try $ do string "\\begin{enumerate}" (_, style, delim) <- option (1, DefaultStyle, DefaultDelim) $@@ -260,6 +260,7 @@ spaces return $ OrderedList (start, style, delim) $ map snd items +bulletList :: GenParser Char ParserState Block bulletList = try $ do begin "itemize" spaces@@ -268,6 +269,7 @@ spaces return (BulletList $ map snd items) +definitionList :: GenParser Char ParserState Block definitionList = try $ do begin "description" spaces@@ -280,16 +282,25 @@ -- paragraph block -- -para = many1 inline >>~ spaces >>= return . Para . normalizeSpaces+para :: GenParser Char ParserState Block+para = do+ res <- many1 inline+ spaces+ return $ if null (filter (`notElem` [Str "", Space]) res)+ then Null+ else Para $ normalizeSpaces res -- -- title authors date -- +bibliographic :: GenParser Char ParserState Block bibliographic = choice [ maketitle, title, authors, date ] +maketitle :: GenParser Char st Block maketitle = try (string "\\maketitle") >> spaces >> return Null +title :: GenParser Char ParserState Block title = try $ do string "\\title{" tit <- manyTill inline (char '}')@@ -297,15 +308,17 @@ updateState (\state -> state { stateTitle = tit }) return Null +authors :: GenParser Char ParserState Block authors = try $ do string "\\author{"- authors <- manyTill anyChar (char '}')+ authors' <- manyTill anyChar (char '}') spaces- let authors' = map removeLeadingTrailingSpace $ lines $- substitute "\\\\" "\n" authors- updateState (\state -> state { stateAuthors = authors' })+ let authors'' = map removeLeadingTrailingSpace $ lines $+ substitute "\\\\" "\n" authors'+ updateState (\s -> s { stateAuthors = authors'' }) return Null +date :: GenParser Char ParserState Block date = try $ do string "\\date{" date' <- manyTill anyChar (char '}')@@ -319,10 +332,11 @@ -- -- this forces items to be parsed in different blocks+itemBlock :: GenParser Char ParserState Block itemBlock = try $ do ("item", _, args) <- command state <- getState- if (stateParserContext state == ListItemState)+ if stateParserContext state == ListItemState then fail "item should be handled by list block" else if null args then return Null@@ -332,15 +346,18 @@ -- raw LaTeX -- -specialEnvironment = do -- these are always parsed as raw- lookAhead (choice (map (\name -> begin name) ["tabular", "figure",- "tabbing", "eqnarry", "picture", "table", "verse", "theorem"]))- rawLaTeXEnvironment- -- | Parse any LaTeX environment and return a Para block containing -- the whole literal environment as raw TeX. rawLaTeXEnvironment :: GenParser Char st Block-rawLaTeXEnvironment = try $ do+rawLaTeXEnvironment = do+ contents <- rawLaTeXEnvironment'+ spaces+ return $ Para [TeX contents]++-- | Parse any LaTeX environment and return a string containing+-- the whole literal environment as raw TeX.+rawLaTeXEnvironment' :: GenParser Char st String +rawLaTeXEnvironment' = try $ do string "\\begin{" name <- many1 letter star <- option "" (string "*") -- for starred variants@@ -349,15 +366,13 @@ args <- option [] commandArgs let argStr = concat args contents <- manyTill (choice [ (many1 (noneOf "\\")), - (do - (Para [TeX str]) <- rawLaTeXEnvironment- return str),+ rawLaTeXEnvironment', string "\\" ]) (end name')- spaces- return $ Para [TeX $ "\\begin{" ++ name' ++ "}" ++ argStr ++ - concat contents ++ "\\end{" ++ name' ++ "}"]+ return $ "\\begin{" ++ name' ++ "}" ++ argStr ++ + concat contents ++ "\\end{" ++ name' ++ "}" +unknownEnvironment :: GenParser Char ParserState Block unknownEnvironment = try $ do state <- getState result <- if stateParseRaw state -- check whether we should include raw TeX @@ -365,27 +380,44 @@ else anyEnvironment -- otherwise just the contents return result +-- \ignore{} is used conventionally in literate haskell for definitions+-- that are to be processed by the compiler but not printed.+ignore :: GenParser Char ParserState Block+ignore = try $ do+ ("ignore", _, _) <- command+ spaces+ return Null++unknownCommand :: GenParser Char ParserState Block unknownCommand = try $ do- notFollowedBy' $ choice $ map end ["itemize", "enumerate", "description", + notFollowedBy' $ choice $ map end ["itemize", "enumerate", "description", "document"]- (name, star, args) <- command- spaces- let argStr = concat args state <- getState- if name == "item" && (stateParserContext state) == ListItemState- then fail "should not be parsed as raw"- else return ""+ if stateParserContext state == ListItemState+ then notFollowedBy' $ string "\\item"+ else return () if stateParseRaw state- then return $ Plain [TeX ("\\" ++ name ++ star ++ argStr)]- else return $ Plain [Str (joinWithSep " " args)]+ then do+ (name, star, args) <- command+ spaces+ return $ Plain [TeX ("\\" ++ name ++ star ++ concat args)]+ else do -- skip unknown command, leaving arguments to be parsed+ char '\\'+ letter+ many (letter <|> digit)+ optional (try $ string "{}")+ spaces+ return Null -- latex comment+comment :: GenParser Char st Block comment = try $ char '%' >> manyTill anyChar newline >> spaces >> return Null -- -- inline -- +inline :: GenParser Char ParserState Inline inline = choice [ str , endline , whitespace@@ -417,8 +449,10 @@ , unescapedChar ] <?> "inline" +accentedChar :: GenParser Char st Inline accentedChar = normalAccentedChar <|> specialAccentedChar +normalAccentedChar :: GenParser Char st Inline normalAccentedChar = try $ do char '\\' accent <- oneOf "'`^\"~"@@ -431,6 +465,7 @@ -- an association list of letters and association list of accents -- and decimal character numbers.+accentTable :: [(Char, [(Char, Int)])] accentTable = [ ('A', [('`', 192), ('\'', 193), ('^', 194), ('~', 195), ('"', 196)]), ('E', [('`', 200), ('\'', 201), ('^', 202), ('"', 203)]),@@ -445,179 +480,247 @@ ('o', [('`', 242), ('\'', 243), ('^', 244), ('~', 245), ('"', 246)]), ('u', [('`', 249), ('\'', 250), ('^', 251), ('"', 252)]) ] +specialAccentedChar :: GenParser Char st Inline specialAccentedChar = choice [ ccedil, aring, iuml, szlig, aelig, oslash, pound, euro, copyright, sect ] +ccedil :: GenParser Char st Inline ccedil = try $ do char '\\'- letter <- oneOfStrings ["cc", "cC"]- let num = if letter == "cc" then 231 else 199+ letter' <- oneOfStrings ["cc", "cC"]+ let num = if letter' == "cc" then 231 else 199 return $ Str [chr num] +aring :: GenParser Char st Inline aring = try $ do char '\\'- letter <- oneOfStrings ["aa", "AA"]- let num = if letter == "aa" then 229 else 197+ letter' <- oneOfStrings ["aa", "AA"]+ let num = if letter' == "aa" then 229 else 197 return $ Str [chr num] +iuml :: GenParser Char st Inline iuml = try (string "\\\"") >> oneOfStrings ["\\i", "{\\i}"] >> return (Str [chr 239]) -icirc = try (string "\\^") >> oneOfStrings ["\\i", "{\\i}"] >>- return (Str [chr 238])-+szlig :: GenParser Char st Inline szlig = try (string "\\ss") >> return (Str [chr 223]) +oslash :: GenParser Char st Inline oslash = try $ do char '\\'- letter <- choice [char 'o', char 'O']- let num = if letter == 'o' then 248 else 216+ letter' <- choice [char 'o', char 'O']+ let num = if letter' == 'o' then 248 else 216 return $ Str [chr num] +aelig :: GenParser Char st Inline aelig = try $ do char '\\'- letter <- oneOfStrings ["ae", "AE"]- let num = if letter == "ae" then 230 else 198+ letter' <- oneOfStrings ["ae", "AE"]+ let num = if letter' == "ae" then 230 else 198 return $ Str [chr num] +pound :: GenParser Char st Inline pound = try (string "\\pounds") >> return (Str [chr 163]) +euro :: GenParser Char st Inline euro = try (string "\\euro") >> return (Str [chr 8364]) +copyright :: GenParser Char st Inline copyright = try (string "\\copyright") >> return (Str [chr 169]) +sect :: GenParser Char st Inline sect = try (string "\\S") >> return (Str [chr 167]) +escapedChar :: GenParser Char st Inline escapedChar = do result <- escaped (oneOf " $%&_#{}\n") return $ if result == Str "\n" then Str " " else result --- ignore standalone, nonescaped special characters-unescapedChar = oneOf "`$^&_#{}|<>" >> return (Str "")+-- nonescaped special characters+unescapedChar :: GenParser Char st Inline+unescapedChar = oneOf "`$^&_#{}|<>" >>= return . (\c -> Str [c]) +specialChar :: GenParser Char st Inline specialChar = choice [ backslash, tilde, caret, bar, lt, gt, doubleQuote ] -backslash = try (string "\\textbackslash") >> return (Str "\\")+backslash :: GenParser Char st Inline+backslash = try (string "\\textbackslash") >> optional (try $ string "{}") >> return (Str "\\") +tilde :: GenParser Char st Inline tilde = try (string "\\ensuremath{\\sim}") >> return (Str "~") +caret :: GenParser Char st Inline caret = try (string "\\^{}") >> return (Str "^") -bar = try (string "\\textbar") >> return (Str "\\")+bar :: GenParser Char st Inline+bar = try (string "\\textbar") >> optional (try $ string "{}") >> return (Str "\\") -lt = try (string "\\textless") >> return (Str "<")+lt :: GenParser Char st Inline+lt = try (string "\\textless") >> optional (try $ string "{}") >> return (Str "<") -gt = try (string "\\textgreater") >> return (Str ">")+gt :: GenParser Char st Inline+gt = try (string "\\textgreater") >> optional (try $ string "{}") >> return (Str ">") +doubleQuote :: GenParser Char st Inline doubleQuote = char '"' >> return (Str "\"") +code :: GenParser Char st Inline code = code1 <|> code2 +code1 :: GenParser Char st Inline code1 = try $ do string "\\verb" marker <- anyChar result <- manyTill anyChar (char marker) return $ Code $ removeLeadingTrailingSpace result +code2 :: GenParser Char st Inline code2 = try $ do string "\\texttt{" result <- manyTill (noneOf "\\\n~$%^&{}") (char '}') return $ Code result +emph :: GenParser Char ParserState Inline emph = try $ oneOfStrings [ "\\emph{", "\\textit{" ] >> manyTill inline (char '}') >>= return . Emph +strikeout :: GenParser Char ParserState Inline strikeout = try $ string "\\sout{" >> manyTill inline (char '}') >>= return . Strikeout +superscript :: GenParser Char ParserState Inline superscript = try $ string "\\textsuperscript{" >> manyTill inline (char '}') >>= return . Superscript -- note: \textsubscript isn't a standard latex command, but we use -- a defined version in pandoc.+subscript :: GenParser Char ParserState Inline subscript = try $ string "\\textsubscript{" >> manyTill inline (char '}') >>= return . Subscript +apostrophe :: GenParser Char ParserState Inline apostrophe = char '\'' >> return Apostrophe +quoted :: GenParser Char ParserState Inline quoted = doubleQuoted <|> singleQuoted +singleQuoted :: GenParser Char ParserState Inline singleQuoted = enclosed singleQuoteStart singleQuoteEnd inline >>= return . Quoted SingleQuote . normalizeSpaces +doubleQuoted :: GenParser Char ParserState Inline doubleQuoted = enclosed doubleQuoteStart doubleQuoteEnd inline >>= return . Quoted DoubleQuote . normalizeSpaces +singleQuoteStart :: GenParser Char st Char singleQuoteStart = char '`' +singleQuoteEnd :: GenParser Char st () singleQuoteEnd = try $ char '\'' >> notFollowedBy alphaNum +doubleQuoteStart :: CharParser st String doubleQuoteStart = string "``" +doubleQuoteEnd :: CharParser st String doubleQuoteEnd = try $ string "''" -ellipses = try $ string "\\ldots" >> optional (try (string "{}")) >>+ellipses :: GenParser Char st Inline+ellipses = try $ string "\\ldots" >> optional (try $ string "{}") >> return Ellipses +enDash :: GenParser Char st Inline enDash = try (string "--") >> return EnDash +emDash :: GenParser Char st Inline emDash = try (string "---") >> return EmDash +hyphen :: GenParser Char st Inline hyphen = char '-' >> return (Str "-") +lab :: GenParser Char st Inline lab = try $ do string "\\label{" result <- manyTill anyChar (char '}') return $ Str $ "(" ++ result ++ ")" +ref :: GenParser Char st Inline ref = try (string "\\ref{") >> manyTill anyChar (char '}') >>= return . Str +strong :: GenParser Char ParserState Inline strong = try (string "\\textbf{") >> manyTill inline (char '}') >>= return . Strong +whitespace :: GenParser Char st Inline whitespace = many1 (oneOf "~ \t") >> return Space -- hard line break+linebreak :: GenParser Char st Inline linebreak = try (string "\\\\") >> return LineBreak +spacer :: GenParser Char st Inline spacer = try (string "\\,") >> return (Str "") +str :: GenParser Char st Inline str = many1 (noneOf specialChars) >>= return . Str -- endline internal to paragraph+endline :: GenParser Char st Inline endline = try $ newline >> notFollowedBy blankline >> return Space -- math-math = math1 <|> math2 <?> "math"+math :: GenParser Char st Inline+math = (math3 >>= return . Math DisplayMath)+ <|> (math1 >>= return . Math InlineMath)+ <|> (math2 >>= return . Math InlineMath)+ <|> (math4 >>= return . Math DisplayMath)+ <|> (math5 >>= return . Math DisplayMath)+ <|> (math6 >>= return . Math DisplayMath)+ <?> "math" -math1 = try $ do- char '$'- result <- many (noneOf "$")- char '$'- return $ Math result+math1 :: GenParser Char st String +math1 = try $ char '$' >> manyTill anyChar (char '$') -math2 = try $ do- string "\\("- result <- many (noneOf "$")- string "\\)"- return $ Math result+math2 :: GenParser Char st String+math2 = try $ string "\\(" >> manyTill anyChar (try $ string "\\)") +math3 :: GenParser Char st String +math3 = try $ char '$' >> math1 >>~ char '$'++math4 :: GenParser Char st String+math4 = try $ do+ name <- begin "equation" <|> begin "equation*" <|> begin "displaymath" <|> begin "displaymath*"+ spaces+ manyTill anyChar (end name)++math5 :: GenParser Char st String+math5 = try $ (string "\\[") >> spaces >> manyTill anyChar (try $ string "\\]")++math6 :: GenParser Char st String+math6 = try $ do+ name <- begin "eqnarray" <|> begin "eqnarray*"+ spaces+ res <- manyTill anyChar (end name)+ return $ filter (/= '&') res -- remove eqnarray alignment codes+ -- -- links and images -- +url :: GenParser Char ParserState Inline url = try $ do string "\\url"- url <- charsInBalanced '{' '}'- return $ Link [Code url] (url, "")+ url' <- charsInBalanced '{' '}'+ return $ Link [Code url'] (url', "") +link :: GenParser Char ParserState Inline link = try $ do string "\\href{"- url <- manyTill anyChar (char '}')+ url' <- manyTill anyChar (char '}') char '{'- label <- manyTill inline (char '}') - return $ Link (normalizeSpaces label) (url, "")+ label' <- manyTill inline (char '}') + return $ Link (normalizeSpaces label') (url', "") +image :: GenParser Char ParserState Inline image = try $ do ("includegraphics", _, args) <- command let args' = filter isArg args -- filter out options@@ -627,6 +730,7 @@ (stripFirstAndLast (head args'), "") return $ Image [Str "image"] src +footnote :: GenParser Char ParserState Inline footnote = try $ do (name, _, (contents:[])) <- command if ((name == "footnote") || (name == "thanks"))@@ -643,12 +747,15 @@ -- | Parse any LaTeX command and return it in a raw TeX inline element. rawLaTeXInline :: GenParser Char ParserState Inline rawLaTeXInline = try $ do- (name, star, args) <- command+ notFollowedBy' $ oneOfStrings ["\\begin", "\\end", "\\item", "\\ignore"] state <- getState- if ((name == "begin") || (name == "end") || (name == "item"))- then fail "not an inline command" - else string "" if stateParseRaw state- then return $ TeX ("\\" ++ name ++ star ++ concat args)- else return $ Str (joinWithSep " " args)-+ then do+ (name, star, args) <- command+ return $ TeX ("\\" ++ name ++ star ++ concat args)+ else do -- skip unknown command, leaving arguments to be parsed+ char '\\'+ letter+ many (letter <|> digit)+ optional (try $ string "{}")+ return $ Str ""
Text/Pandoc/Readers/Markdown.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {- Copyright (C) 2006-8 John MacFarlane <jgm@berkeley.edu> @@ -31,46 +32,56 @@ readMarkdown ) where -import Data.List ( transpose, isPrefixOf, isSuffixOf, lookup, sortBy, findIndex )+import Data.List ( transpose, isPrefixOf, isSuffixOf, lookup, sortBy, findIndex, intercalate ) import Data.Ord ( comparing )-import Data.Char ( isAlphaNum )-import Data.Maybe ( fromMaybe )+import Data.Char ( isAlphaNum, isAlpha, isLower, isDigit, isUpper )+import Data.Maybe import Text.Pandoc.Definition import Text.Pandoc.Shared -import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXEnvironment )+import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXEnvironment' ) import Text.Pandoc.Readers.HTML ( rawHtmlBlock, anyHtmlBlockTag, anyHtmlInlineTag, anyHtmlTag, anyHtmlEndTag, htmlEndTag, extractTagType,- htmlBlockElement )+ htmlBlockElement, unsanitaryURI ) import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Text.ParserCombinators.Parsec -- | Read markdown from an input string and return a Pandoc document. readMarkdown :: ParserState -> String -> Pandoc-readMarkdown state str = (readWith parseMarkdown) state (str ++ "\n\n")+readMarkdown state s = (readWith parseMarkdown) state (s ++ "\n\n") -- -- Constants and data structure definitions -- +spaceChars :: [Char] spaceChars = " \t"++bulletListMarkers :: [Char] bulletListMarkers = "*+-"++hruleChars :: [Char] hruleChars = "*-_"++setextHChars :: [Char] setextHChars = "=-" -- treat these as potentially non-text when parsing inline:+specialChars :: [Char] specialChars = "\\[]*_~`<>$!^-.&'\"\8216\8217\8220\8221" -- -- auxiliary functions -- +indentSpaces :: GenParser Char ParserState [Char] indentSpaces = try $ do state <- getState let tabStop = stateTabStop state try (count tabStop (char ' ')) <|> (many (char ' ') >> string "\t") <?> "indentation" +nonindentSpaces :: GenParser Char ParserState [Char] nonindentSpaces = do state <- getState let tabStop = stateTabStop state@@ -80,11 +91,13 @@ else unexpected "indented line" -- | Fail unless we're at beginning of a line.+failUnlessBeginningOfLine :: GenParser tok st () failUnlessBeginningOfLine = do pos <- getPosition if sourceColumn pos == 1 then return () else fail "not beginning of line" -- | Fail unless we're in "smart typography" mode.+failUnlessSmart :: GenParser tok ParserState () failUnlessSmart = do state <- getState if stateSmart state then return () else fail "Smart typography feature"@@ -109,8 +122,10 @@ -- document structure -- +titleLine :: GenParser Char ParserState [Inline] titleLine = try $ char '%' >> skipSpaces >> manyTill inline newline +authorsLine :: GenParser Char st [String] authorsLine = try $ do char '%' skipSpaces@@ -118,6 +133,7 @@ newline return $ map (decodeCharacterReferences . removeLeadingTrailingSpace) authors +dateLine :: GenParser Char st String dateLine = try $ do char '%' skipSpaces@@ -125,6 +141,7 @@ newline return $ decodeCharacterReferences $ removeTrailingSpace date +titleBlock :: GenParser Char ParserState ([Inline], [String], [Char]) titleBlock = try $ do failIfStrict title <- option [] titleLine@@ -133,6 +150,7 @@ optional blanklines return (title, author, date) +parseMarkdown :: GenParser Char ParserState Pandoc parseMarkdown = do -- markdown allows raw HTML updateState (\state -> state { stateParseRaw = True })@@ -149,50 +167,52 @@ then return () else do docMinusNotes <- manyTill (noteBlock <|> lineClump) eof >>= return . concat- st <- getState- let reversedNotes = stateNotes st- updateState $ \st -> st { stateNotes = reverse reversedNotes }+ st' <- getState+ let reversedNotes = stateNotes st'+ updateState $ \s -> s { stateNotes = reverse reversedNotes } setInput docMinusNotes setPosition startPos -- now parse it for real... (title, author, date) <- option ([],[],"") titleBlock- blocks <- parseBlocks + blocks <- parseBlocks return $ Pandoc (Meta title author date) $ filter (/= Null) blocks -- -- initial pass for references and notes -- +referenceKey :: GenParser Char ParserState [Char] referenceKey = try $ do startPos <- getPosition nonindentSpaces- label <- reference+ lab <- reference char ':'- skipSpaces- optional (char '<')- src <- many (noneOf "> \n\t")- optional (char '>')+ skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[')+ src <- (char '<' >> many (noneOf "> \n\t") >>~ char '>')+ <|> many (noneOf " \n\t") tit <- option "" referenceTitle blanklines endPos <- getPosition- let newkey = (label, (removeTrailingSpace src, tit))+ let newkey = (lab, (removeTrailingSpace src, tit)) st <- getState let oldkeys = stateKeys st- updateState $ \st -> st { stateKeys = newkey : oldkeys }+ updateState $ \s -> s { stateKeys = newkey : oldkeys } -- return blanks so line count isn't affected return $ replicate (sourceLine endPos - sourceLine startPos) '\n' +referenceTitle :: GenParser Char st String referenceTitle = try $ do - (many1 spaceChar >> option '\n' newline) <|> newline- skipSpaces+ skipSpaces >> optional newline >> skipSpaces tit <- (charsInBalanced '(' ')' >>= return . unwords . words) <|> do delim <- char '\'' <|> char '"' manyTill anyChar (try (char delim >> skipSpaces >> notFollowedBy (noneOf ")\n"))) return $ decodeCharacterReferences tit +noteMarker :: GenParser Char st [Char] noteMarker = string "[^" >> manyTill (noneOf " \t\n") (char ']') +rawLine :: GenParser Char ParserState [Char] rawLine = do notFollowedBy blankline notFollowedBy' noteMarker@@ -200,8 +220,10 @@ end <- option "" (newline >> optional indentSpaces >> return "\n") return $ contents ++ end +rawLines :: GenParser Char ParserState [Char] rawLines = many1 rawLine >>= return . concat +noteBlock :: GenParser Char ParserState [Char] noteBlock = try $ do startPos <- getPosition ref <- noteMarker@@ -212,11 +234,11 @@ optional blanklines endPos <- getPosition -- parse the extracted text, which may contain various block elements:- contents <- parseFromString parseBlocks $ (joinWithSep "\n" raw) ++ "\n\n"+ contents <- parseFromString parseBlocks $ (intercalate "\n" raw) ++ "\n\n" let newnote = (ref, contents) st <- getState let oldnotes = stateNotes st- updateState $ \st -> st { stateNotes = newnote : oldnotes }+ updateState $ \s -> s { stateNotes = newnote : oldnotes } -- return blanks so line count isn't affected return $ replicate (sourceLine endPos - sourceLine startPos) '\n' @@ -224,13 +246,15 @@ -- parsing blocks -- +parseBlocks :: GenParser Char ParserState [Block] parseBlocks = manyTill block eof +block :: GenParser Char ParserState Block block = do st <- getState choice (if stateStrict st then [ header- , codeBlock+ , codeBlockIndented , blockQuote , hrule , bulletList@@ -239,15 +263,15 @@ , para , plain , nullBlock ]- else [ header + else [ codeBlockDelimited+ , header , table- , codeBlock+ , codeBlockIndented , blockQuote , hrule , bulletList , orderedList , definitionList- , rawLaTeXEnvironment , para , rawHtmlBlocks , plain@@ -257,8 +281,10 @@ -- header blocks -- -header = atxHeader <|> setextHeader <?> "header"+header :: GenParser Char ParserState Block+header = setextHeader <|> atxHeader <?> "header" +atxHeader :: GenParser Char ParserState Block atxHeader = try $ do level <- many1 (char '#') >>= return . length notFollowedBy (char '.' <|> char ')') -- this would be a list@@ -266,8 +292,10 @@ text <- manyTill inline atxClosing >>= return . normalizeSpaces return $ Header level text +atxClosing :: GenParser Char st [Char] atxClosing = try $ skipMany (char '#') >> blanklines +setextHeader :: GenParser Char ParserState Block setextHeader = try $ do text <- many1Till inline newline underlineChar <- oneOf setextHChars@@ -280,6 +308,7 @@ -- hrule block -- +hrule :: GenParser Char st Block hrule = try $ do skipSpaces start <- oneOf hruleChars@@ -293,22 +322,84 @@ -- code blocks -- +indentedLine :: GenParser Char ParserState [Char] indentedLine = indentSpaces >> manyTill anyChar newline >>= return . (++ "\n") -codeBlock = do+codeBlockDelimiter :: Maybe Int+ -> GenParser Char st (Int, ([Char], [[Char]], [([Char], [Char])]))+codeBlockDelimiter len = try $ do+ size <- case len of+ Just l -> count l (char '~') >> many (char '~') >> return l+ Nothing -> count 3 (char '~') >> many (char '~') >>= + return . (+ 3) . length + many spaceChar+ attr <- option ([],[],[]) attributes+ blankline+ return (size, attr) ++attributes :: GenParser Char st ([Char], [[Char]], [([Char], [Char])])+attributes = try $ do+ char '{'+ many spaceChar+ attrs <- many (attribute >>~ many spaceChar)+ char '}'+ let (ids, classes, keyvals) = unzip3 attrs+ let id' = if null ids then "" else head ids+ return (id', concat classes, concat keyvals) ++attribute :: GenParser Char st ([Char], [[Char]], [([Char], [Char])])+attribute = identifierAttr <|> classAttr <|> keyValAttr++identifier :: GenParser Char st [Char]+identifier = do+ first <- letter+ rest <- many alphaNum+ return (first:rest)++identifierAttr :: GenParser Char st ([Char], [a], [a1])+identifierAttr = try $ do+ char '#'+ result <- identifier+ return (result,[],[])++classAttr :: GenParser Char st ([Char], [[Char]], [a])+classAttr = try $ do+ char '.'+ result <- identifier+ return ("",[result],[])++keyValAttr :: GenParser Char st ([Char], [a], [([Char], [Char])])+keyValAttr = try $ do+ key <- identifier+ char '='+ char '"'+ val <- manyTill (noneOf "\n") (char '"')+ return ("",[],[(key,val)])++codeBlockDelimited :: GenParser Char st Block+codeBlockDelimited = try $ do+ (size, attr) <- codeBlockDelimiter Nothing+ contents <- manyTill anyLine (codeBlockDelimiter (Just size))+ blanklines+ return $ CodeBlock attr $ intercalate "\n" contents++codeBlockIndented :: GenParser Char ParserState Block+codeBlockIndented = do contents <- many1 (indentedLine <|> try (do b <- blanklines l <- indentedLine return $ b ++ l)) optional blanklines- return $ CodeBlock $ stripTrailingNewlines $ concat contents+ return $ CodeBlock ("",[],[]) $ stripTrailingNewlines $ concat contents -- -- block quotes -- +emailBlockQuoteStart :: GenParser Char ParserState Char emailBlockQuoteStart = try $ nonindentSpaces >> char '>' >>~ optional (char ' ') +emailBlockQuote :: GenParser Char ParserState [[Char]] emailBlockQuote = try $ do emailBlockQuoteStart raw <- sepBy (many (nonEndline <|> @@ -319,16 +410,18 @@ optional blanklines return raw +blockQuote :: GenParser Char ParserState Block blockQuote = do raw <- emailBlockQuote -- parse the extracted block, which may contain various block elements:- contents <- parseFromString parseBlocks $ (joinWithSep "\n" raw) ++ "\n\n"+ contents <- parseFromString parseBlocks $ (intercalate "\n" raw) ++ "\n\n" return $ BlockQuote contents -- -- list blocks -- +bulletListStart :: GenParser Char ParserState () bulletListStart = try $ do optional newline -- if preceded by a Plain block in a list context nonindentSpaces@@ -337,6 +430,7 @@ spaceChar skipSpaces +anyOrderedListStart :: GenParser Char ParserState (Int, ListNumberStyle, ListNumberDelim) anyOrderedListStart = try $ do optional newline -- if preceded by a Plain block in a list context nonindentSpaces@@ -347,59 +441,59 @@ char '.' spaceChar return (1, DefaultStyle, DefaultDelim)- else anyOrderedListMarker >>~ spaceChar+ else do (num, style, delim) <- anyOrderedListMarker+ -- if it could be an abbreviated first name, insist on more than one space+ if delim == Period && (style == UpperAlpha || (style == UpperRoman &&+ num `elem` [1, 5, 10, 50, 100, 500, 1000]))+ then char '\t' <|> (char ' ' >>~ notFollowedBy (satisfy isUpper))+ else spaceChar+ skipSpaces+ return (num, style, delim) -orderedListStart style delim = try $ do- optional newline -- if preceded by a Plain block in a list context- nonindentSpaces- state <- getState- num <- if stateStrict state- then do many1 digit- char '.'- return 1- else orderedListMarker style delim - if delim == Period && (style == UpperAlpha || (style == UpperRoman &&- num `elem` [1, 5, 10, 50, 100, 500, 1000]))- then char '\t' <|> (spaceChar >> spaceChar)- else spaceChar- skipSpaces+listStart :: GenParser Char ParserState ()+listStart = bulletListStart <|> (anyOrderedListStart >> return ()) -- parse a line of a list item (start = parser for beginning of list item)-listLine start = try $ do- notFollowedBy' start+listLine :: GenParser Char ParserState [Char]+listLine = try $ do+ notFollowedBy' listStart notFollowedBy blankline notFollowedBy' (do indentSpaces many (spaceChar)- bulletListStart <|> (anyOrderedListStart >> return ()))+ listStart) line <- manyTill anyChar newline return $ line ++ "\n" -- parse raw text for one list item, excluding start marker and continuations-rawListItem start = try $ do- start- result <- many1 (listLine start)+rawListItem :: GenParser Char ParserState [Char]+rawListItem = try $ do+ listStart+ result <- many1 listLine blanks <- many blankline return $ concat result ++ blanks -- continuation of a list item - indented and separated by blankline -- or (in compact lists) endline. -- note: nested lists are parsed as continuations-listContinuation start = try $ do+listContinuation :: GenParser Char ParserState [Char]+listContinuation = try $ do lookAhead indentSpaces- result <- many1 (listContinuationLine start)+ result <- many1 listContinuationLine blanks <- many blankline return $ concat result ++ blanks -listContinuationLine start = try $ do+listContinuationLine :: GenParser Char ParserState [Char]+listContinuationLine = try $ do notFollowedBy blankline- notFollowedBy' start+ notFollowedBy' listStart optional indentSpaces result <- manyTill anyChar newline return $ result ++ "\n" -listItem start = try $ do - first <- rawListItem start- continuations <- many (listContinuation start)+listItem :: GenParser Char ParserState [Block]+listItem = try $ do + first <- rawListItem+ continuations <- many listContinuation -- parsing with ListItemState forces markers at beginning of lines to -- count as list item markers, even if not separated by blank space. -- see definition of "endline"@@ -412,16 +506,20 @@ updateState (\st -> st {stateParserContext = oldContext}) return contents +orderedList :: GenParser Char ParserState Block orderedList = try $ do (start, style, delim) <- lookAhead anyOrderedListStart- items <- many1 (listItem (orderedListStart style delim))+ items <- many1 listItem return $ OrderedList (start, style, delim) $ compactify items -bulletList = many1 (listItem bulletListStart) >>= - return . BulletList . compactify+bulletList :: GenParser Char ParserState Block+bulletList = try $ do+ lookAhead bulletListStart+ many1 listItem >>= return . BulletList . compactify -- definition lists +definitionListItem :: GenParser Char ParserState ([Inline], [Block]) definitionListItem = try $ do notFollowedBy blankline notFollowedBy' indentSpaces@@ -436,6 +534,7 @@ updateState (\st -> st {stateParserContext = oldContext}) return ((normalizeSpaces term), contents) +defRawBlock :: GenParser Char ParserState [Char] defRawBlock = try $ do char ':' state <- getState@@ -446,6 +545,7 @@ trailing <- option "" blanklines return $ firstline ++ "\n" ++ unlines rawlines ++ trailing +definitionList :: GenParser Char ParserState Block definitionList = do items <- many1 definitionListItem let (terms, defs) = unzip items@@ -457,11 +557,13 @@ -- paragraph block -- +isHtmlOrBlank :: Inline -> Bool isHtmlOrBlank (HtmlInline _) = True-isHtmlOrBlank (Space) = True-isHtmlOrBlank (LineBreak) = True-isHtmlOrBlank _ = False+isHtmlOrBlank (Space) = True+isHtmlOrBlank (LineBreak) = True+isHtmlOrBlank _ = False +para :: GenParser Char ParserState Block para = try $ do result <- many1 inline if all isHtmlOrBlank result@@ -474,14 +576,17 @@ else pzero return $ Para $ normalizeSpaces result +plain :: GenParser Char ParserState Block plain = many1 inline >>= return . Plain . normalizeSpaces -- -- raw html -- +htmlElement :: GenParser Char ParserState [Char] htmlElement = strictHtmlBlock <|> htmlBlockElement <?> "html element" +htmlBlock :: GenParser Char ParserState Block htmlBlock = try $ do failUnlessBeginningOfLine first <- htmlElement@@ -490,9 +595,11 @@ return $ RawHtml $ first ++ finalSpace ++ finalNewlines -- True if tag is self-closing+isSelfClosing :: [Char] -> Bool isSelfClosing tag = isSuffixOf "/>" $ filter (not . (`elem` " \n\t")) tag +strictHtmlBlock :: GenParser Char ParserState [Char] strictHtmlBlock = try $ do tag <- anyHtmlBlockTag let tag' = extractTagType tag@@ -503,6 +610,7 @@ end <- htmlEndTag tag' return $ tag ++ concat contents ++ end +rawHtmlBlocks :: GenParser Char ParserState Block rawHtmlBlocks = do htmlBlocks <- many1 $ do (RawHtml blk) <- rawHtmlBlock sps <- do sp1 <- many spaceChar@@ -524,6 +632,8 @@ -- Parse a dashed line with optional trailing spaces; return its length -- and the length including trailing space.+dashedLine :: Char + -> GenParser Char st (Int, Int) dashedLine ch = do dashes <- many1 (char ch) sp <- many spaceChar@@ -531,24 +641,29 @@ -- Parse a table header with dashed lines of '-' preceded by -- one line of text.+simpleTableHeader :: GenParser Char ParserState ([[Char]], [Alignment], [Int]) simpleTableHeader = try $ do rawContent <- anyLine initSp <- nonindentSpaces dashes <- many1 (dashedLine '-') newline- let (lengths, lines) = unzip dashes- let indices = scanl (+) (length initSp) lines+ let (lengths, lines') = unzip dashes+ let indices = scanl (+) (length initSp) lines' let rawHeads = tail $ splitByIndices (init indices) rawContent let aligns = zipWith alignType (map (\a -> [a]) rawHeads) lengths return (rawHeads, aligns, indices) -- Parse a table footer - dashed lines followed by blank line.+tableFooter :: GenParser Char ParserState [Char] tableFooter = try $ nonindentSpaces >> many1 (dashedLine '-') >> blanklines -- Parse a table separator - dashed line.+tableSep :: GenParser Char ParserState String tableSep = try $ nonindentSpaces >> many1 (dashedLine '-') >> string "\n" -- Parse a raw line and split it into chunks by indices.+rawTableLine :: [Int]+ -> GenParser Char ParserState [String] rawTableLine indices = do notFollowedBy' (blanklines <|> tableFooter) line <- many1Till anyChar newline@@ -556,9 +671,13 @@ splitByIndices (init indices) line -- Parse a table line and return a list of lists of blocks (columns).+tableLine :: [Int]+ -> GenParser Char ParserState [[Block]] tableLine indices = rawTableLine indices >>= mapM (parseFromString (many plain)) -- Parse a multiline table row and return a list of blocks (columns).+multilineRow :: [Int]+ -> GenParser Char ParserState [[Block]] multilineRow indices = do colLines <- many1 (rawTableLine indices) optional blanklines@@ -566,9 +685,9 @@ mapM (parseFromString (many plain)) cols -- Calculate relative widths of table columns, based on indices-widthsFromIndices :: Int -- Number of columns on terminal- -> [Int] -- Indices- -> [Float] -- Fractional relative sizes of columns+widthsFromIndices :: Int -- Number of columns on terminal+ -> [Int] -- Indices+ -> [Double] -- Fractional relative sizes of columns widthsFromIndices _ [] = [] widthsFromIndices numColumns indices = let lengths = zipWith (-) indices (0:indices)@@ -581,6 +700,7 @@ -- Parses a table caption: inlines beginning with 'Table:' -- and followed by blank lines.+tableCaption :: GenParser Char ParserState [Inline] tableCaption = try $ do nonindentSpaces string "Table:"@@ -589,65 +709,78 @@ return $ normalizeSpaces result -- Parse a table using 'headerParser', 'lineParser', and 'footerParser'.+tableWith :: GenParser Char ParserState ([[Char]], [Alignment], [Int])+ -> ([Int] -> GenParser Char ParserState [[Block]])+ -> GenParser Char ParserState end+ -> GenParser Char ParserState Block tableWith headerParser lineParser footerParser = try $ do (rawHeads, aligns, indices) <- headerParser- lines <- many1Till (lineParser indices) footerParser+ lines' <- many1Till (lineParser indices) footerParser caption <- option [] tableCaption heads <- mapM (parseFromString (many plain)) rawHeads state <- getState let numColumns = stateColumns state let widths = widthsFromIndices numColumns indices- return $ Table caption aligns widths heads lines+ return $ Table caption aligns widths heads lines' -- Parse a simple table with '---' header and one line per row.+simpleTable :: GenParser Char ParserState Block simpleTable = tableWith simpleTableHeader tableLine blanklines -- Parse a multiline table: starts with row of '-' on top, then header -- (which may be multiline), then the rows, -- which may be multiline, separated by blank lines, and -- ending with a footer (dashed line followed by blank line).+multilineTable :: GenParser Char ParserState Block multilineTable = tableWith multilineTableHeader multilineRow tableFooter +multilineTableHeader :: GenParser Char ParserState ([String], [Alignment], [Int]) multilineTableHeader = try $ do tableSep rawContent <- many1 (notFollowedBy' tableSep >> many1Till anyChar newline) initSp <- nonindentSpaces dashes <- many1 (dashedLine '-') newline- let (lengths, lines) = unzip dashes- let indices = scanl (+) (length initSp) lines+ let (lengths, lines') = unzip dashes+ let indices = scanl (+) (length initSp) lines' let rawHeadsList = transpose $ map (\ln -> tail $ splitByIndices (init indices) ln) rawContent- let rawHeads = map (joinWithSep " ") rawHeadsList+ let rawHeads = map (intercalate " ") rawHeadsList let aligns = zipWith alignType rawHeadsList lengths return ((map removeLeadingTrailingSpace rawHeads), aligns, indices) -- Returns an alignment type for a table, based on a list of strings -- (the rows of the column header) and a number (the length of the -- dashed line under the rows.-alignType :: [String] -> Int -> Alignment-alignType [] len = AlignDefault+alignType :: [String]+ -> Int+ -> Alignment+alignType [] _ = AlignDefault alignType strLst len =- let str = head $ sortBy (comparing length) $ + let s = head $ sortBy (comparing length) $ map removeTrailingSpace strLst- leftSpace = if null str then False else (str !! 0) `elem` " \t"- rightSpace = length str < len || (str !! (len - 1)) `elem` " \t"+ leftSpace = if null s then False else (s !! 0) `elem` " \t"+ rightSpace = length s < len || (s !! (len - 1)) `elem` " \t" in case (leftSpace, rightSpace) of (True, False) -> AlignRight (False, True) -> AlignLeft (True, True) -> AlignCenter (False, False) -> AlignDefault +table :: GenParser Char ParserState Block table = simpleTable <|> multilineTable <?> "table" -- -- inline -- +inline :: GenParser Char ParserState Inline inline = choice inlineParsers <?> "inline" -inlineParsers = [ str+inlineParsers :: [GenParser Char ParserState Inline]+inlineParsers = [ abbrev+ , str , smartPunctuation , whitespace , endline@@ -658,6 +791,9 @@ , note , inlineNote , link+#ifdef _CITEPROC+ , inlineCitation+#endif , image , math , strikeout@@ -670,21 +806,28 @@ , symbol , ltSign ] +inlineNonLink :: GenParser Char ParserState Inline inlineNonLink = (choice $ map (\parser -> try (parser >>= failIfLink)) inlineParsers) <?> "inline (non-link)" +failIfLink :: Inline -> GenParser tok st Inline failIfLink (Link _ _) = pzero-failIfLink elt = return elt+failIfLink elt = return elt +escapedChar :: GenParser Char ParserState Inline escapedChar = do char '\\' state <- getState result <- option '\\' $ if stateStrict state then oneOf "\\`*_{}[]()>#+-.!~" else satisfy (not . isAlphaNum)- return $ Str [result]+ let result' = if result == ' '+ then '\160' -- '\ ' is a nonbreaking space+ else result+ return $ Str [result'] +ltSign :: GenParser Char ParserState Inline ltSign = do st <- getState if stateStrict st@@ -692,13 +835,16 @@ else notFollowedBy' rawHtmlBlocks >> char '<' -- unless it starts html return $ Str ['<'] +specialCharsMinusLt :: [Char] specialCharsMinusLt = filter (/= '<') specialChars +symbol :: GenParser Char ParserState Inline symbol = do result <- oneOf specialCharsMinusLt return $ Str [result] -- parses inline code, between n `s and n `s+code :: GenParser Char ParserState Inline code = try $ do starts <- many1 (char '`') skipSpaces@@ -708,44 +854,89 @@ notFollowedBy (char '`'))) return $ Code $ removeLeadingTrailingSpace $ concat result +mathWord :: GenParser Char st [Char] mathWord = many1 ((noneOf " \t\n\\$") <|> (try (char '\\') >>~ notFollowedBy (char '$'))) -math = try $ do+math :: GenParser Char ParserState Inline+math = (mathDisplay >>= return . Math DisplayMath)+ <|> (mathInline >>= return . Math InlineMath)++mathDisplay :: GenParser Char ParserState String +mathDisplay = try $ char '$' >> mathInline >>~ char '$' >>~ notFollowedBy digit++mathInline :: GenParser Char ParserState String+mathInline = try $ do failIfStrict char '$' notFollowedBy space- words <- sepBy1 mathWord (many1 space)+ words' <- sepBy1 mathWord (many1 (spaceChar <|> (newline >>~ notFollowedBy' blankline))) char '$'- return $ Math $ joinWithSep " " words+ notFollowedBy digit+ return $ intercalate " " words' +emph :: GenParser Char ParserState Inline emph = ((enclosed (char '*') (notFollowedBy' strong >> char '*') inline) <|> (enclosed (char '_') (notFollowedBy' strong >> char '_' >> notFollowedBy alphaNum) inline)) >>= return . Emph . normalizeSpaces +strong :: GenParser Char ParserState Inline strong = ((enclosed (string "**") (try $ string "**") inline) <|> (enclosed (string "__") (try $ string "__") inline)) >>= return . Strong . normalizeSpaces +strikeout :: GenParser Char ParserState Inline strikeout = failIfStrict >> enclosed (string "~~") (try $ string "~~") inline >>= return . Strikeout . normalizeSpaces +superscript :: GenParser Char ParserState Inline superscript = failIfStrict >> enclosed (char '^') (char '^') (notFollowedBy' whitespace >> inline) >>= -- may not contain Space return . Superscript +subscript :: GenParser Char ParserState Inline subscript = failIfStrict >> enclosed (char '~') (char '~') (notFollowedBy' whitespace >> inline) >>= -- may not contain Space return . Subscript +abbrev :: GenParser Char ParserState Inline+abbrev = failUnlessSmart >>+ (assumedAbbrev <|> knownAbbrev) >>= return . Str . (++ ".\160")++-- an string of letters followed by a period that does not end a sentence+-- is assumed to be an abbreviation. It is assumed that sentences don't+-- start with lowercase letters or numerals.+assumedAbbrev :: GenParser Char ParserState [Char]+assumedAbbrev = try $ do+ result <- many1 $ satisfy isAlpha+ string ". "+ lookAhead $ satisfy (\x -> isLower x || isDigit x)+ return result++-- these strings are treated as abbreviations even if they are followed+-- by a capital letter (such as a name).+knownAbbrev :: GenParser Char ParserState [Char]+knownAbbrev = try $ do+ result <- oneOfStrings [ "Mr", "Mrs", "Ms", "Capt", "Dr", "Prof", "Gen",+ "Gov", "e.g", "i.e", "Sgt", "St", "vol", "vs",+ "Sen", "Rep", "Pres", "Hon", "Rev" ]+ string ". "+ return result++smartPunctuation :: GenParser Char ParserState Inline smartPunctuation = failUnlessSmart >> choice [ quoted, apostrophe, dash, ellipses ] +apostrophe :: GenParser Char ParserState Inline apostrophe = (char '\'' <|> char '\8217') >> return Apostrophe +quoted :: GenParser Char ParserState Inline quoted = doubleQuoted <|> singleQuoted +withQuoteContext :: QuoteContext+ -> (GenParser Char ParserState Inline)+ -> GenParser Char ParserState Inline withQuoteContext context parser = do oldState <- getState let oldQuoteContext = stateQuoteContext oldState@@ -755,22 +946,26 @@ setState newState { stateQuoteContext = oldQuoteContext } return result +singleQuoted :: GenParser Char ParserState Inline singleQuoted = try $ do singleQuoteStart withQuoteContext InSingleQuote $ many1Till inline singleQuoteEnd >>= return . Quoted SingleQuote . normalizeSpaces +doubleQuoted :: GenParser Char ParserState Inline doubleQuoted = try $ do doubleQuoteStart withQuoteContext InDoubleQuote $ many1Till inline doubleQuoteEnd >>= return . Quoted DoubleQuote . normalizeSpaces +failIfInQuoteContext :: QuoteContext -> GenParser tok ParserState () failIfInQuoteContext context = do st <- getState if stateQuoteContext st == context then fail "already inside quotes" else return () +singleQuoteStart :: GenParser Char ParserState Char singleQuoteStart = do failIfInQuoteContext InSingleQuote char '\8216' <|> @@ -781,11 +976,13 @@ -- possess/contraction return '\'') +singleQuoteEnd :: GenParser Char st Char singleQuoteEnd = try $ do char '\8217' <|> char '\'' notFollowedBy alphaNum return '\'' +doubleQuoteStart :: GenParser Char ParserState Char doubleQuoteStart = do failIfInQuoteContext InDoubleQuote char '\8220' <|>@@ -793,30 +990,39 @@ notFollowedBy (oneOf " \t\n") return '"') +doubleQuoteEnd :: GenParser Char st Char doubleQuoteEnd = char '\8221' <|> char '"' +ellipses :: GenParser Char st Inline ellipses = oneOfStrings ["...", " . . . ", ". . .", " . . ."] >> return Ellipses +dash :: GenParser Char st Inline dash = enDash <|> emDash +enDash :: GenParser Char st Inline enDash = try $ char '-' >> notFollowedBy (noneOf "0123456789") >> return EnDash -emDash = try $ skipSpaces >> oneOfStrings ["---", "--"] >>- skipSpaces >> return EmDash+emDash :: GenParser Char st Inline+emDash = oneOfStrings ["---", "--"] >> return EmDash +whitespace :: GenParser Char ParserState Inline whitespace = do sps <- many1 (oneOf spaceChars) if length sps >= 2 then option Space (endline >> return LineBreak) else return Space <?> "whitespace" +nonEndline :: GenParser Char st Char nonEndline = satisfy (/='\n') +strChar :: GenParser Char st Char strChar = noneOf (specialChars ++ spaceChars ++ "\n") +str :: GenParser Char st Inline str = many1 strChar >>= return . Str -- an endline character that can be treated as a space, not a structural break+endline :: GenParser Char ParserState Inline endline = try $ do newline notFollowedBy blankline@@ -837,11 +1043,13 @@ -- -- a reference label for a link+reference :: GenParser Char ParserState [Inline] reference = do notFollowedBy' (string "[^") -- footnote reference result <- inlinesInBalancedBrackets inlineNonLink return $ normalizeSpaces result -- source for a link, with optional title+source :: GenParser Char st (String, [Char]) source = (try $ charsInBalanced '(' ')' >>= parseFromString source') <|> -- the following is needed for cases like: [ref](/url(a).@@ -849,6 +1057,7 @@ parseFromString source') -- auxiliary function for source+source' :: GenParser Char st (String, [Char]) source' = do skipSpaces src <- try (char '<' >>@@ -860,6 +1069,7 @@ eof return (removeTrailingSpace src, tit) +linkTitle :: GenParser Char st String linkTitle = try $ do (many1 spaceChar >> option '\n' newline) <|> newline skipSpaces@@ -868,21 +1078,28 @@ (try (char delim >> skipSpaces >> eof)) return $ decodeCharacterReferences tit +link :: GenParser Char ParserState Inline link = try $ do- label <- reference- src <- source <|> referenceLink label- return $ Link label src+ lab <- reference+ src <- source <|> referenceLink lab+ sanitize <- getState >>= return . stateSanitizeHTML+ if sanitize && unsanitaryURI (fst src)+ then fail "Unsanitary URI"+ else return $ Link lab src -- a link like [this][ref] or [this][] or [this]-referenceLink label = do+referenceLink :: [Inline]+ -> GenParser Char ParserState (String, [Char])+referenceLink lab = do ref <- option [] (try (optional (char ' ') >> optional (newline >> skipSpaces) >> reference))- let ref' = if null ref then label else ref+ let ref' = if null ref then lab else ref state <- getState case lookupKeySrc (stateKeys state) ref' of Nothing -> fail "no corresponding key" Just target -> return target +autoLink :: GenParser Char ParserState Inline autoLink = try $ do char '<' src <- uri <|> (emailAddress >>= (return . ("mailto:" ++)))@@ -891,15 +1108,20 @@ then drop 7 src else src st <- getState- return $ if stateStrict st- then Link [Str src'] (src, "")- else Link [Code src'] (src, "")+ let sanitize = stateSanitizeHTML st+ if sanitize && unsanitaryURI src+ then fail "Unsanitary URI"+ else return $ if stateStrict st+ then Link [Str src'] (src, "")+ else Link [Code src'] (src, "") +image :: GenParser Char ParserState Inline image = try $ do char '!'- (Link label src) <- link- return $ Image label src+ (Link lab src) <- link+ return $ Image lab src +note :: GenParser Char ParserState Inline note = try $ do failIfStrict ref <- noteMarker@@ -909,14 +1131,37 @@ Nothing -> fail "note not found" Just contents -> return $ Note contents +inlineNote :: GenParser Char ParserState Inline inlineNote = try $ do failIfStrict char '^' contents <- inlinesInBalancedBrackets inline return $ Note [Para contents] -rawLaTeXInline' = failIfStrict >> rawLaTeXInline+rawLaTeXInline' :: GenParser Char ParserState Inline+rawLaTeXInline' = do+ failIfStrict+ (rawConTeXtEnvironment' >>= return . TeX)+ <|> (rawLaTeXEnvironment' >>= return . TeX)+ <|> rawLaTeXInline +rawConTeXtEnvironment' :: GenParser Char st String+rawConTeXtEnvironment' = try $ do+ string "\\start"+ completion <- inBrackets (letter <|> digit <|> spaceChar)+ <|> (many1 letter)+ contents <- manyTill (rawConTeXtEnvironment' <|> (count 1 anyChar))+ (try $ string "\\stop" >> string completion)+ return $ "\\start" ++ completion ++ concat contents ++ "\\stop" ++ completion++inBrackets :: (GenParser Char st Char) -> GenParser Char st String+inBrackets parser = do+ char '['+ contents <- many parser+ char ']'+ return $ "[" ++ contents ++ "]"++rawHtmlInline' :: GenParser Char ParserState Inline rawHtmlInline' = do st <- getState result <- if stateStrict st@@ -924,3 +1169,38 @@ else anyHtmlInlineTag return $ HtmlInline result +#ifdef _CITEPROC+inlineCitation :: GenParser Char ParserState Inline+inlineCitation = try $ do+ failIfStrict+ cit <- citeMarker+ let citations = readWith parseCitation defaultParserState cit+ mr <- mapM chkCit citations+ if catMaybes mr /= []+ then return $ Cite citations []+ else fail "no citation found"++chkCit :: Target -> GenParser Char ParserState (Maybe Target)+chkCit t = do+ st <- getState+ case lookupKeySrc (stateKeys st) [Str $ fst t] of+ Just _ -> fail "This is a link"+ Nothing -> if elem (fst t) $ stateCitations st+ then return $ Just t+ else return $ Nothing++citeMarker :: GenParser Char ParserState String+citeMarker = char '[' >> manyTill ( noneOf "\n" <|> (newline >>~ notFollowedBy blankline) ) (char ']')++parseCitation :: GenParser Char ParserState [(String,String)]+parseCitation = try $ sepBy (parseLabel) (oneOf ";")++parseLabel :: GenParser Char ParserState (String,String)+parseLabel = try $ do+ res <- sepBy (skipSpaces >> optional newline >> skipSpaces >> many1 (noneOf "@;")) (oneOf "@")+ case res of+ [lab,loc] -> return (lab, loc)+ [lab] -> return (lab, "" )+ _ -> return ("" , "" )++#endif
Text/Pandoc/Readers/RST.hs view
@@ -33,31 +33,33 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.ParserCombinators.Parsec-import Data.List ( findIndex, delete )+import Data.List ( findIndex, delete, intercalate ) -- | Parse reStructuredText string and return Pandoc document. readRST :: ParserState -> String -> Pandoc-readRST state str = (readWith parseRST) state (str ++ "\n\n")+readRST state s = (readWith parseRST) state (s ++ "\n\n") -- -- Constants and data structure definitions --- +bulletListMarkers :: [Char] bulletListMarkers = "*+-"++underlineChars :: [Char] underlineChars = "!\"#$&'()*+,-./:;<=>?@[\\]^_`{|}~" -- treat these as potentially non-text when parsing inline:+specialChars :: [Char] specialChars = "\\`|*_<>$:[-" -- -- parsing documents -- -isAnonKey (ref, src) = ref == [Str "_"]- isHeader :: Int -> Block -> Bool isHeader n (Header x _) = x == n-isHeader _ _ = False+isHeader _ _ = False -- | Promote all headers in a list of blocks. (Part of -- title transformation for RST.)@@ -65,7 +67,7 @@ promoteHeaders num ((Header level text):rest) = (Header (level - num) text):(promoteHeaders num rest) promoteHeaders num (other:rest) = other:(promoteHeaders num rest)-promoteHeaders num [] = []+promoteHeaders _ [] = [] -- | If list of blocks starts with a header (or a header and subheader) -- of level that are not found elsewhere, return it as a title and@@ -82,6 +84,7 @@ else ((promoteHeaders 1 rest), head1) titleTransform blocks = (blocks, []) +parseRST :: GenParser Char ParserState Pandoc parseRST = do startPos <- getPosition -- go through once just to get list of reference keys@@ -91,7 +94,7 @@ setPosition startPos st <- getState let reversedKeys = stateKeys st- updateState $ \st -> st { stateKeys = reverse reversedKeys }+ updateState $ \s -> s { stateKeys = reverse reversedKeys } -- now parse it for real... blocks <- parseBlocks let blocks' = filter (/= Null) blocks@@ -108,8 +111,10 @@ -- parsing blocks -- +parseBlocks :: GenParser Char ParserState [Block] parseBlocks = manyTill block eof +block :: GenParser Char ParserState Block block = choice [ codeBlock , rawHtmlBlock , rawLaTeXBlock@@ -129,6 +134,7 @@ -- field list -- +fieldListItem :: String -> GenParser Char st ([Char], [Char]) fieldListItem indent = try $ do string indent char ':'@@ -138,15 +144,16 @@ first <- manyTill anyChar newline rest <- option "" $ try $ lookAhead (string indent >> oneOf " \t") >> indentedBlock- return (name, joinWithSep " " (first:(lines rest)))+ return (name, intercalate " " (first:(lines rest))) +fieldList :: GenParser Char ParserState Block fieldList = try $ do indent <- lookAhead $ many (oneOf " \t") items <- many1 $ fieldListItem indent blanklines let authors = case lookup "Authors" items of Just auth -> [auth]- Nothing -> map snd (filter (\(x,y) -> x == "Author") items)+ Nothing -> map snd (filter (\(x,_) -> x == "Author") items) if null authors then return () else updateState $ \st -> st {stateAuthors = authors}@@ -157,7 +164,7 @@ Just tit -> parseFromString (many inline) tit >>= \t -> updateState $ \st -> st {stateTitle = t} Nothing -> return ()- let remaining = filter (\(x,y) -> (x /= "Authors") && (x /= "Author") && + let remaining = filter (\(x,_) -> (x /= "Authors") && (x /= "Author") && (x /= "Date") && (x /= "Title")) items if null remaining then return Null@@ -170,26 +177,31 @@ -- line block -- +lineBlockLine :: GenParser Char ParserState [Inline] lineBlockLine = try $ do string "| " white <- many (oneOf " \t") line <- manyTill inline newline return $ (if null white then [] else [Str white]) ++ line ++ [LineBreak] +lineBlock :: GenParser Char ParserState Block lineBlock = try $ do- lines <- many1 lineBlockLine+ lines' <- many1 lineBlockLine blanklines- return $ Para (concat lines)+ return $ Para (concat lines') -- -- paragraph block -- +para :: GenParser Char ParserState Block para = paraBeforeCodeBlock <|> paraNormal <?> "paragraph" +codeBlockStart :: GenParser Char st Char codeBlockStart = string "::" >> blankline >> blankline -- paragraph that ends in a :: starting a code block+paraBeforeCodeBlock :: GenParser Char ParserState Block paraBeforeCodeBlock = try $ do result <- many1 (notFollowedBy' codeBlockStart >> inline) lookAhead (string "::")@@ -198,18 +210,21 @@ else (normalizeSpaces result) ++ [Str ":"] -- regular paragraph+paraNormal :: GenParser Char ParserState Block paraNormal = try $ do result <- many1 inline newline blanklines return $ Para $ normalizeSpaces result +plain :: GenParser Char ParserState Block plain = many1 inline >>= return . Plain . normalizeSpaces -- -- image block -- +imageBlock :: GenParser Char st Block imageBlock = try $ do string ".. image:: " src <- manyTill anyChar newline@@ -223,9 +238,11 @@ -- header blocks -- +header :: GenParser Char ParserState Block header = doubleHeader <|> singleHeader <?> "header" -- a header with lines on top and bottom+doubleHeader :: GenParser Char ParserState Block doubleHeader = try $ do c <- oneOf underlineChars rest <- many (char c) -- the top line@@ -250,6 +267,7 @@ return $ Header level (normalizeSpaces txt) -- a header with line on the bottom only+singleHeader :: GenParser Char ParserState Block singleHeader = try $ do notFollowedBy' whitespace txt <- many1 (do {notFollowedBy blankline; inline})@@ -257,7 +275,7 @@ let len = (sourceColumn pos) - 1 blankline c <- oneOf underlineChars- rest <- count (len - 1) (char c)+ count (len - 1) (char c) many (char c) blanklines state <- getState@@ -272,6 +290,7 @@ -- hrule block -- +hrule :: GenParser Char st Block hrule = try $ do chr <- oneOf underlineChars count 3 (char chr)@@ -285,6 +304,7 @@ -- -- read a line indented by a given string+indentedLine :: String -> GenParser Char st [Char] indentedLine indents = try $ do string indents result <- manyTill anyChar newline@@ -292,6 +312,7 @@ -- two or more indented lines, possibly separated by blank lines. -- any amount of indentation will work.+indentedBlock :: GenParser Char st [Char] indentedBlock = do indents <- lookAhead $ many1 (oneOf " \t") lns <- many $ choice $ [ indentedLine indents,@@ -301,15 +322,17 @@ optional blanklines return $ concat lns +codeBlock :: GenParser Char st Block codeBlock = try $ do codeBlockStart result <- indentedBlock- return $ CodeBlock $ stripTrailingNewlines result+ return $ CodeBlock ("",[],[]) $ stripTrailingNewlines result -- -- raw html -- +rawHtmlBlock :: GenParser Char st Block rawHtmlBlock = try $ string ".. raw:: html" >> blanklines >> indentedBlock >>= return . RawHtml @@ -317,6 +340,7 @@ -- raw latex -- +rawLaTeXBlock :: GenParser Char st Block rawLaTeXBlock = try $ do string ".. raw:: latex" blanklines@@ -327,6 +351,7 @@ -- block quotes -- +blockQuote :: GenParser Char ParserState Block blockQuote = do raw <- indentedBlock -- parse the extracted block, which may contain various block elements:@@ -337,8 +362,10 @@ -- list blocks -- +list :: GenParser Char ParserState Block list = choice [ bulletList, orderedList, definitionList ] <?> "list" +definitionListItem :: GenParser Char ParserState ([Inline], [Block]) definitionListItem = try $ do term <- many1Till inline endline raw <- indentedBlock@@ -346,9 +373,11 @@ contents <- parseFromString parseBlocks $ raw ++ "\n\n" return (normalizeSpaces term, contents) +definitionList :: GenParser Char ParserState Block definitionList = many1 definitionListItem >>= return . DefinitionList -- parses bullet list start and returns its length (inc. following whitespace)+bulletListStart :: GenParser Char st Int bulletListStart = try $ do notFollowedBy' hrule -- because hrules start out just like lists marker <- oneOf bulletListMarkers@@ -356,12 +385,16 @@ return $ length (marker:white) -- parses ordered list start and returns its length (inc following whitespace)+orderedListStart :: ListNumberStyle+ -> ListNumberDelim+ -> GenParser Char st Int orderedListStart style delim = try $ do (_, markerLen) <- withHorizDisplacement (orderedListMarker style delim) white <- many1 spaceChar return $ markerLen + length white -- parse a line of a list item+listLine :: Int -> GenParser Char ParserState [Char] listLine markerLength = try $ do notFollowedBy blankline indentWith markerLength@@ -369,6 +402,7 @@ return $ line ++ "\n" -- indent by specified number of spaces (or equiv. tabs)+indentWith :: Int -> GenParser Char ParserState [Char] indentWith num = do state <- getState let tabStop = stateTabStop state@@ -378,7 +412,9 @@ (try (char '\t' >> count (num - tabStop) (char ' '))) ] -- parse raw text for one list item, excluding start marker and continuations-rawListItem start = do+rawListItem :: GenParser Char ParserState Int+ -> GenParser Char ParserState (Int, [Char])+rawListItem start = try $ do markerLength <- start firstLine <- manyTill anyChar newline restLines <- many (listLine markerLength)@@ -387,11 +423,14 @@ -- continuation of a list item - indented and separated by blankline or -- (in compact lists) endline. -- Note: nested lists are parsed as continuations.+listContinuation :: Int -> GenParser Char ParserState [Char] listContinuation markerLength = try $ do blanks <- many1 blankline result <- many1 (listLine markerLength) return $ blanks ++ concat result +listItem :: GenParser Char ParserState Int+ -> GenParser Char ParserState [Block] listItem start = try $ do (markerLength, first) <- rawListItem start rest <- many (listContinuation markerLength)@@ -408,12 +447,14 @@ updateState (\st -> st {stateParserContext = oldContext}) return parsed -orderedList = do+orderedList :: GenParser Char ParserState Block+orderedList = try $ do (start, style, delim) <- lookAhead (anyOrderedListMarker >>~ spaceChar) items <- many1 (listItem (orderedListStart style delim)) let items' = compactify items return $ OrderedList (start, style, delim) items' +bulletList :: GenParser Char ParserState Block bulletList = many1 (listItem bulletListStart) >>= return . BulletList . compactify @@ -421,6 +462,7 @@ -- unknown directive (e.g. comment) -- +unknownDirective :: GenParser Char st Block unknownDirective = try $ do string ".. " manyTill anyChar newline@@ -433,37 +475,44 @@ -- reference key -- +quotedReferenceName :: GenParser Char ParserState [Inline] quotedReferenceName = try $ do char '`' >> notFollowedBy (char '`') -- `` means inline code!- label <- many1Till inline (char '`') - return label+ label' <- many1Till inline (char '`') + return label' +unquotedReferenceName :: GenParser Char ParserState [Inline] unquotedReferenceName = try $ do- label <- many1Till inline (lookAhead $ char ':')- return label+ label' <- many1Till inline (lookAhead $ char ':')+ return label' +isolated :: Char -> GenParser Char st Char isolated ch = try $ char ch >>~ notFollowedBy (char ch) +simpleReferenceName :: GenParser Char st [Inline] simpleReferenceName = do raw <- many1 (alphaNum <|> isolated '-' <|> isolated '.' <|> (try $ char '_' >>~ lookAhead alphaNum)) return [Str raw] +referenceName :: GenParser Char ParserState [Inline] referenceName = quotedReferenceName <|> (try $ simpleReferenceName >>~ lookAhead (char ':')) <|> unquotedReferenceName +referenceKey :: GenParser Char ParserState [Char] referenceKey = do startPos <- getPosition key <- choice [imageKey, anonymousKey, regularKey] st <- getState let oldkeys = stateKeys st- updateState $ \st -> st { stateKeys = key : oldkeys }+ updateState $ \s -> s { stateKeys = key : oldkeys } optional blanklines endPos <- getPosition -- return enough blanks to replace key return $ replicate (sourceLine endPos - sourceLine startPos) '\n' +targetURI :: GenParser Char st [Char] targetURI = do skipSpaces optional newline@@ -472,6 +521,7 @@ blanklines return contents +imageKey :: GenParser Char ParserState ([Inline], (String, [Char])) imageKey = try $ do string ".. |" ref <- manyTill inline (char '|')@@ -480,12 +530,13 @@ src <- targetURI return (normalizeSpaces ref, (removeLeadingTrailingSpace src, "")) +anonymousKey :: GenParser Char st ([Inline], (String, [Char])) anonymousKey = try $ do oneOfStrings [".. __:", "__"] src <- targetURI- state <- getState return ([Str "_"], (removeLeadingTrailingSpace src, "")) +regularKey :: GenParser Char ParserState ([Inline], (String, [Char])) regularKey = try $ do string ".. _" ref <- referenceName@@ -497,6 +548,7 @@ -- inline -- +inline :: GenParser Char ParserState Inline inline = choice [ link , str , whitespace@@ -511,46 +563,57 @@ , escapedChar , symbol ] <?> "inline" +hyphens :: GenParser Char ParserState Inline hyphens = do result <- many1 (char '-') option Space endline -- don't want to treat endline after hyphen or dash as a space return $ Str result +escapedChar :: GenParser Char st Inline escapedChar = escaped anyChar +symbol :: GenParser Char ParserState Inline symbol = do result <- oneOf specialChars return $ Str [result] -- parses inline code, between codeStart and codeEnd+code :: GenParser Char ParserState Inline code = try $ do string "``" result <- manyTill anyChar (try (string "``"))- return $ Code $ removeLeadingTrailingSpace $ joinWithSep " " $ lines result+ return $ Code $ removeLeadingTrailingSpace $ intercalate " " $ lines result +emph :: GenParser Char ParserState Inline emph = enclosed (char '*') (char '*') inline >>= return . Emph . normalizeSpaces +strong :: GenParser Char ParserState Inline strong = enclosed (string "**") (try $ string "**") inline >>= return . Strong . normalizeSpaces +interpreted :: [Char] -> GenParser Char st [Inline] interpreted role = try $ do optional $ try $ string "\\ " result <- enclosed (string $ ":" ++ role ++ ":`") (char '`') anyChar- nextChar <- lookAhead anyChar try (string "\\ ") <|> lookAhead (count 1 $ oneOf " \t\n") <|> (eof >> return "") return [Str result] +superscript :: GenParser Char ParserState Inline superscript = interpreted "sup" >>= (return . Superscript) +subscript :: GenParser Char ParserState Inline subscript = interpreted "sub" >>= (return . Subscript) +whitespace :: GenParser Char ParserState Inline whitespace = many1 spaceChar >> return Space <?> "whitespace" +str :: GenParser Char ParserState Inline str = many1 (noneOf (specialChars ++ "\t\n ")) >>= return . Str -- an endline character that can be treated as a space, not a structural break+endline :: GenParser Char ParserState Inline endline = try $ do newline notFollowedBy blankline@@ -566,21 +629,24 @@ -- links -- +link :: GenParser Char ParserState Inline link = choice [explicitLink, referenceLink, autoLink] <?> "link" +explicitLink :: GenParser Char ParserState Inline explicitLink = try $ do char '`' notFollowedBy (char '`') -- `` marks start of inline code- label <- manyTill (notFollowedBy (char '`') >> inline) + label' <- manyTill (notFollowedBy (char '`') >> inline) (try (spaces >> char '<')) src <- manyTill (noneOf ">\n ") (char '>') skipSpaces string "`_"- return $ Link (normalizeSpaces label) (removeLeadingTrailingSpace src, "")+ return $ Link (normalizeSpaces label') (removeLeadingTrailingSpace src, "") +referenceLink :: GenParser Char ParserState Inline referenceLink = try $ do- label <- (quotedReferenceName <|> simpleReferenceName) >>~ char '_'- key <- option label (do{char '_'; return [Str "_"]}) -- anonymous link+ label' <- (quotedReferenceName <|> simpleReferenceName) >>~ char '_'+ key <- option label' (do{char '_'; return [Str "_"]}) -- anonymous link state <- getState let keyTable = stateKeys state src <- case lookupKeySrc keyTable key of@@ -591,19 +657,23 @@ then delete ([Str "_"], src) keyTable -- remove first anon key else keyTable setState $ state { stateKeys = keyTable' }- return $ Link (normalizeSpaces label) src + return $ Link (normalizeSpaces label') src +autoURI :: GenParser Char ParserState Inline autoURI = do src <- uri return $ Link [Str src] (src, "") +autoEmail :: GenParser Char ParserState Inline autoEmail = do src <- emailAddress return $ Link [Str src] ("mailto:" ++ src, "") +autoLink :: GenParser Char ParserState Inline autoLink = autoURI <|> autoEmail -- For now, we assume that all substitution references are for images.+image :: GenParser Char ParserState Inline image = try $ do char '|' ref <- manyTill inline (char '|')
Text/Pandoc/Readers/TeXMath.hs view
@@ -32,23 +32,25 @@ ) where import Text.ParserCombinators.Parsec-import Text.Pandoc.UTF8 import Text.Pandoc.Definition-import Text.Pandoc.Shared -- | Converts a string of raw TeX math to a list of 'Pandoc' inlines. readTeXMath :: String -> [Inline] readTeXMath inp = case parse teXMath ("formula: " ++ inp) inp of- Left err -> [Str inp] -- if unparseable, just include original+ Left _ -> [Str inp] -- if unparseable, just include original Right res -> res +teXMath :: GenParser Char st [Inline] teXMath = manyTill mathPart eof >>= return . concat +mathPart :: GenParser Char st [Inline] mathPart = whitespace <|> superscript <|> subscript <|> symbol <|> argument <|> digits <|> letters <|> misc +whitespace :: GenParser Char st [Inline] whitespace = many1 space >> return [] +symbol :: GenParser Char st [Inline] symbol = try $ do char '\\' res <- many1 letter@@ -56,6 +58,7 @@ Just m -> return [Str m] Nothing -> return [Str $ "\\" ++ res] +argument :: GenParser Char st [Inline] argument = try $ do char '{' res <- many mathPart@@ -64,35 +67,43 @@ then [Str " "] else [Str "{"] ++ concat res ++ [Str "}"] +digits :: GenParser Char st [Inline] digits = do res <- many1 digit return [Str res] +letters :: GenParser Char st [Inline] letters = do res <- many1 letter return [Emph [Str res]] +misc :: GenParser Char st [Inline] misc = do res <- noneOf "}" return [Str [res]] +scriptArg :: GenParser Char st [Inline] scriptArg = try $ do (try (do{char '{'; r <- many mathPart; char '}'; return $ concat r})) <|> symbol <|> (do{c <- (letter <|> digit); return [Str [c]]}) +superscript :: GenParser Char st [Inline] superscript = try $ do char '^' arg <- scriptArg return [Superscript arg] +subscript :: GenParser Char st [Inline] subscript = try $ do char '_' arg <- scriptArg return [Subscript arg] +withThinSpace :: String -> String withThinSpace str = "\x2009" ++ str ++ "\x2009" +teXsymbols :: [(String, String)] teXsymbols = [("alpha","\x3B1") ,("beta", "\x3B2")
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {- Copyright (C) 2006-8 John MacFarlane <jgm@berkeley.edu> @@ -32,7 +33,6 @@ splitBy, splitByIndices, substitute,- joinWithSep, -- * Text processing backslashEscapes, escapeStringUsing,@@ -47,6 +47,8 @@ wrapIfNeeded, wrappedTeX, wrapTeXIfNeeded,+ BlockWrapper (..),+ wrappedBlocksToDoc, -- * Parsing (>>~), anyLine,@@ -96,18 +98,23 @@ -- * Writer options HTMLMathMethod (..), WriterOptions (..),- defaultWriterOptions+ defaultWriterOptions,+ -- * File handling+ inDirectory ) where import Text.Pandoc.Definition import Text.ParserCombinators.Parsec-import Text.PrettyPrint.HughesPJ ( Doc, fsep, ($$), (<>), empty )+import Text.PrettyPrint.HughesPJ ( Doc, fsep, ($$), (<>), empty, isEmpty, text ) import qualified Text.PrettyPrint.HughesPJ as PP import Text.Pandoc.CharacterReferences ( characterReference ) import Data.Char ( toLower, toUpper, ord, isLower, isUpper )-import Data.List ( find, isPrefixOf )+import Data.List ( find, isPrefixOf, intercalate ) import Control.Monad ( join ) import Network.URI ( parseURI, URI (..), isAllowedInURI )+import System.Directory+import Prelude hiding ( putStrLn, writeFile, readFile, getContents )+import System.IO.UTF8 -- -- List processing@@ -137,13 +144,6 @@ then replacement ++ (substitute target replacement $ drop (length target) lst) else (head lst):(substitute target replacement $ tail lst) --- | Joins a list of lists, separated by another list.-joinWithSep :: [a] -- ^ List to use as separator- -> [[a]] -- ^ Lists to join- -> [a]-joinWithSep _ [] = []-joinWithSep sep lst = foldr1 (\a b -> a ++ sep ++ b) lst- -- -- Text processing --@@ -226,6 +226,7 @@ else ($) -- auxiliary function for wrappedTeX+isNote :: Inline -> Bool isNote (Note _) = True isNote _ = False @@ -262,6 +263,16 @@ then wrappedTeX includePercent else ($) +-- | Indicates whether block should be surrounded by blank lines (@Pad@) or not (@Reg@).+data BlockWrapper = Pad Doc | Reg Doc++-- | Converts a list of wrapped blocks to a Doc, with appropriate spaces around blocks.+wrappedBlocksToDoc :: [BlockWrapper] -> Doc+wrappedBlocksToDoc = foldr addBlock empty+ where addBlock (Pad d) accum | isEmpty accum = d+ addBlock (Pad d) accum = d $$ text "" $$ accum+ addBlock (Reg d) accum = d $$ accum+ -- -- Parsing --@@ -374,7 +385,10 @@ -- Auxiliary functions for romanNumeral: +lowercaseRomanDigits :: [Char] lowercaseRomanDigits = ['i','v','x','l','c','d','m']++uppercaseRomanDigits :: [Char] uppercaseRomanDigits = map toUpper lowercaseRomanDigits -- | Parses a roman numeral (uppercase or lowercase), returns number.@@ -409,14 +423,17 @@ -- Parsers for email addresses and URIs +emailChar :: GenParser Char st Char emailChar = alphaNum <|> oneOf "-+_." +domainChar :: GenParser Char st Char domainChar = alphaNum <|> char '-' +domain :: GenParser Char st [Char] domain = do first <- many1 domainChar- dom <- many1 (try (do{ char '.'; many1 domainChar }))- return $ joinWithSep "." (first:dom)+ dom <- many1 $ try (char '.' >> many1 domainChar )+ return $ intercalate "." (first:dom) -- | Parses an email address; returns string. emailAddress :: GenParser Char st [Char]@@ -429,6 +446,7 @@ return $ addr ++ '@':dom -- | Parses a URI.+uri :: GenParser Char st String uri = try $ do str <- many1 $ satisfy isAllowedInURI case parseURI str of@@ -587,7 +605,7 @@ testStringWith :: (Show a) => GenParser Char ParserState a -> String -> IO ()-testStringWith parser str = putStrLn $ show $ +testStringWith parser str = putStrLn $ show $ readWith parser defaultParserState str -- | Parsing options.@@ -597,6 +615,9 @@ stateQuoteContext :: QuoteContext, -- ^ Inside quoted environment? stateSanitizeHTML :: Bool, -- ^ Sanitize HTML? stateKeys :: KeyTable, -- ^ List of reference keys+#ifdef _CITEPROC+ stateCitations :: [String], -- ^ List of available citations+#endif stateNotes :: NoteTable, -- ^ List of notes stateTabStop :: Int, -- ^ Tab stop stateStandalone :: Bool, -- ^ Parse bibliographic info?@@ -617,6 +638,9 @@ stateQuoteContext = NoQuote, stateSanitizeHTML = False, stateKeys = [],+#ifdef _CITEPROC+ stateCitations = [],+#endif stateNotes = [], stateTabStop = 4, stateStandalone = False,@@ -670,12 +694,14 @@ refsMatch x y && refsMatch restx resty refsMatch ((Subscript x):restx) ((Subscript y):resty) = refsMatch x y && refsMatch restx resty+refsMatch ((SmallCaps x):restx) ((SmallCaps y):resty) = + refsMatch x y && refsMatch restx resty refsMatch ((Quoted t x):restx) ((Quoted u y):resty) = t == u && refsMatch x y && refsMatch restx resty refsMatch ((Code x):restx) ((Code y):resty) = ((map toLower x) == (map toLower y)) && refsMatch restx resty-refsMatch ((Math x):restx) ((Math y):resty) = - ((map toLower x) == (map toLower y)) && refsMatch restx resty+refsMatch ((Math t x):restx) ((Math u y):resty) = + ((map toLower x) == (map toLower y)) && t == u && refsMatch restx resty refsMatch ((TeX x):restx) ((TeX y):resty) = ((map toLower x) == (map toLower y)) && refsMatch restx resty refsMatch ((HtmlInline x):restx) ((HtmlInline y):resty) = @@ -698,7 +724,7 @@ let (firstLine:restLines) = lines str firstLineIndent = num + first in (replicate firstLineIndent ' ') ++ firstLine ++ "\n" ++ - (joinWithSep "\n" $ map ((replicate num ' ') ++ ) restLines)+ (intercalate "\n" $ map ((replicate num ' ') ++ ) restLines) -- | Prettyprint list of Pandoc blocks elements. prettyBlockList :: Int -- ^ Number of spaces to indent list of blocks@@ -706,7 +732,7 @@ -> String prettyBlockList indent [] = indentBy indent 0 "[]" prettyBlockList indent blocks = indentBy indent (-2) $ "[ " ++ - (joinWithSep "\n, " (map prettyBlock blocks)) ++ " ]"+ (intercalate "\n, " (map prettyBlock blocks)) ++ " ]" -- | Prettyprint Pandoc block element. prettyBlock :: Block -> String@@ -714,20 +740,20 @@ (prettyBlockList 2 blocks) prettyBlock (OrderedList attribs blockLists) = "OrderedList " ++ show attribs ++ "\n" ++ indentBy 2 0 ("[ " ++ - (joinWithSep ", " $ map (\blocks -> prettyBlockList 2 blocks) + (intercalate ", " $ map (\blocks -> prettyBlockList 2 blocks) blockLists)) ++ " ]" prettyBlock (BulletList blockLists) = "BulletList\n" ++ - indentBy 2 0 ("[ " ++ (joinWithSep ", " + indentBy 2 0 ("[ " ++ (intercalate ", " (map (\blocks -> prettyBlockList 2 blocks) blockLists))) ++ " ]" prettyBlock (DefinitionList blockLists) = "DefinitionList\n" ++ - indentBy 2 0 ("[" ++ (joinWithSep ",\n" + indentBy 2 0 ("[" ++ (intercalate ",\n" (map (\(term, blocks) -> " (" ++ show term ++ ",\n" ++ indentBy 1 2 (prettyBlockList 2 blocks) ++ " )") blockLists))) ++ " ]" prettyBlock (Table caption aligns widths header rows) = "Table " ++ show caption ++ " " ++ show aligns ++ " " ++ show widths ++ "\n" ++ prettyRow header ++ " [\n" ++ - (joinWithSep ",\n" (map prettyRow rows)) ++ " ]"- where prettyRow cols = indentBy 2 0 ("[ " ++ (joinWithSep ", "+ (intercalate ",\n" (map prettyRow rows)) ++ " ]"+ where prettyRow cols = indentBy 2 0 ("[ " ++ (intercalate ", " (map (\blocks -> prettyBlockList 2 blocks) cols))) ++ " ]" prettyBlock block = show block@@ -835,7 +861,7 @@ -- data HTMLMathMethod = PlainMath - | ASCIIMathML (Maybe String) -- url of ASCIIMathML.js+ | LaTeXMathML (Maybe String) -- url of LaTeXMathML.js | GladTeX | MimeTeX String -- url of mimetex.cgi deriving (Show, Read, Eq)@@ -878,3 +904,16 @@ , writerReferenceLinks = False , writerWrapText = True }++--+-- File handling+--++-- | Perform an IO action in a directory, returning to starting directory.+inDirectory :: FilePath -> IO a -> IO a+inDirectory path action = do+ oldDir <- getCurrentDirectory+ setCurrentDirectory path+ result <- action+ setCurrentDirectory oldDir+ return result
+ Text/Pandoc/TH.hs view
@@ -0,0 +1,65 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-+Copyright (C) 2008 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.TH+ Copyright : Copyright (C) 2006-8 John MacFarlane+ License : GNU GPL, version 2 or above ++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Template haskell functions used by Pandoc modules.+-}+module Text.Pandoc.TH (+ contentsOf,+ binaryContentsOf,+ makeZip+ ) where++import Language.Haskell.TH+import Language.Haskell.TH.Syntax (Lift (..))+import qualified Data.ByteString as B+import Data.ByteString.Internal ( w2c )+import Prelude hiding ( readFile )+import System.IO.UTF8+import Codec.Archive.Zip+import Text.Pandoc.Shared ( inDirectory )++-- | Insert contents of text file into a template.+contentsOf :: FilePath -> ExpQ+contentsOf p = lift =<< (runIO $ readFile p)++-- | Insert contents of binary file into a template.+-- Note that @Data.ByteString.readFile@ uses binary mode on windows.+binaryContentsOf :: FilePath -> ExpQ+binaryContentsOf p = lift =<< (runIO $ B.readFile p)++instance Lift B.ByteString where+ lift x = return (LitE (StringL $ map w2c $ B.unpack x))++instance Lift Archive where+ lift x = return (LitE (StringL $ show x ))++-- | Construct zip file from files in a directory, and+-- insert into a template.+makeZip :: FilePath -> ExpQ+makeZip path = lift =<< (runIO $ inDirectory path $ addFilesToArchive [OptRecursive] emptyArchive ["."])+
− Text/Pandoc/UTF8.hs
@@ -1,45 +0,0 @@--- | Functions for converting Unicode strings to UTF-8 and vice versa.--- --- Taken from <http://www.cse.ogi.edu/~hallgren/Talks/LHiH/base/lib/UTF8.hs>.--- (c) 2003, OGI School of Science & Engineering, Oregon Health and--- Science University. ------ Modified by Martin Norbaeck--- to pass illegal UTF-8 sequences through unchanged.-module Text.Pandoc.UTF8 ( - fromUTF8, - toUTF8 - ) where---- From the Char module supplied with HBC.---- | Take a UTF-8 string and decode it into a Unicode string.-fromUTF8 :: String -> String-fromUTF8 "" = ""-fromUTF8 ('\xef':'\xbb':'\xbf':cs) = fromUTF8 cs -- skip BOM (byte order marker)-fromUTF8 (c:c':cs) | '\xc0' <= c && c <= '\xdf' && - '\x80' <= c' && c' <= '\xbf' =- toEnum ((fromEnum c `mod` 0x20) * 0x40 + fromEnum c' `mod` 0x40) : fromUTF8 cs-fromUTF8 (c:c':c'':cs) | '\xe0' <= c && c <= '\xef' && - '\x80' <= c' && c' <= '\xbf' &&- '\x80' <= c'' && c'' <= '\xbf' =- toEnum ((fromEnum c `mod` 0x10 * 0x1000) + (fromEnum c' `mod` 0x40) * 0x40 + fromEnum c'' `mod` 0x40) : fromUTF8 cs-fromUTF8 (c:cs) = c : fromUTF8 cs---- | Take a Unicode string and encode it as a UTF-8 string.-toUTF8 :: String -> String-toUTF8 "" = ""-toUTF8 (c:cs) =- if c > '\x0000' && c < '\x0080' then- c : toUTF8 cs- else if c < toEnum 0x0800 then- let i = fromEnum c- in toEnum (0xc0 + i `div` 0x40) : - toEnum (0x80 + i `mod` 0x40) : - toUTF8 cs- else- let i = fromEnum c- in toEnum (0xe0 + i `div` 0x1000) : - toEnum (0x80 + (i `mod` 0x1000) `div` 0x40) : - toEnum (0x80 + i `mod` 0x40) : - toUTF8 cs
Text/Pandoc/Writers/ConTeXt.hs view
@@ -31,7 +31,7 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.Printf ( printf )-import Data.List ( (\\), intersperse, isSuffixOf )+import Data.List ( isSuffixOf, intercalate ) import Control.Monad.State import Text.PrettyPrint.HughesPJ hiding ( Str ) @@ -41,8 +41,7 @@ , stOptions :: WriterOptions -- writer options } -data BlockWrapper = Pad Doc | Reg Doc -+orderedListStyles :: [[Char]] orderedListStyles = cycle ["[n]","[a]", "[r]", "[g]"] -- | Convert Pandoc to ConTeXt.@@ -65,16 +64,16 @@ then empty else text $ writerIncludeAfter options let body = before $$ main $$ after- head <- if writerStandalone options- then contextHeader options meta- else return empty+ head' <- if writerStandalone options+ then contextHeader options meta+ else return empty let toc = if writerTableOfContents options then text "\\placecontent\n" else empty let foot = if writerStandalone options then text "\\stoptext\n" else empty - return $ head $$ toc $$ body $$ foot+ return $ head' $$ toc $$ body $$ foot -- | Insert bibliographic information into ConTeXt header. contextHeader :: WriterOptions -- ^ Options, including ConTeXt header@@ -88,7 +87,7 @@ then "" else if length authors == 1 then stringToConTeXt $ head authors- else stringToConTeXt $ (joinWithSep ", " $+ else stringToConTeXt $ (intercalate ", " $ init authors) ++ " & " ++ last authors let datetext = if date == "" then "" @@ -104,20 +103,21 @@ escapeCharForConTeXt :: Char -> String escapeCharForConTeXt ch = case ch of- '{' -> "\\letteropenbrace{}"- '}' -> "\\letterclosebrace{}"- '\\' -> "\\letterbackslash{}"- '$' -> "\\$"- '|' -> "\\letterbar{}"- '^' -> "\\letterhat{}"- '%' -> "\\%"- '~' -> "\\lettertilde{}"- '&' -> "\\&"- '#' -> "\\#"- '<' -> "\\letterless{}"- '>' -> "\\lettermore{}"- '_' -> "\\letterunderscore{}"- x -> [x]+ '{' -> "\\letteropenbrace{}"+ '}' -> "\\letterclosebrace{}"+ '\\' -> "\\letterbackslash{}"+ '$' -> "\\$"+ '|' -> "\\letterbar{}"+ '^' -> "\\letterhat{}"+ '%' -> "\\%"+ '~' -> "\\lettertilde{}"+ '&' -> "\\&"+ '#' -> "\\#"+ '<' -> "\\letterless{}"+ '>' -> "\\lettermore{}"+ '_' -> "\\letterunderscore{}"+ '\160' -> "~"+ x -> [x] -- | Escape string for ConTeXt stringToConTeXt :: String -> String@@ -140,14 +140,14 @@ blockToConTeXt (BlockQuote lst) = do contents <- blockListToConTeXt lst return $ Pad $ text "\\startblockquote" $$ contents $$ text "\\stopblockquote"-blockToConTeXt (CodeBlock str) = +blockToConTeXt (CodeBlock _ str) = return $ Reg $ text $ "\\starttyping\n" ++ str ++ "\n\\stoptyping\n" -- \n because \stoptyping can't have anything after it, inc. }-blockToConTeXt (RawHtml str) = return $ Reg empty+blockToConTeXt (RawHtml _) = return $ Reg empty blockToConTeXt (BulletList lst) = do contents <- mapM listItemToConTeXt lst return $ Pad $ text "\\startitemize" $$ vcat contents $$ text "\\stopitemize"-blockToConTeXt (OrderedList (start, style, delim) lst) = do+blockToConTeXt (OrderedList (start, style', delim) lst) = do st <- get let level = stOrderedListLevel st put $ st {stOrderedListLevel = level + 1}@@ -160,23 +160,23 @@ OneParen -> "stopper=)" TwoParens -> "left=(,stopper=)" let width = maximum $ map length $ take (length contents) - (orderedListMarkers (start, style, delim))+ (orderedListMarkers (start, style', delim)) let width' = (toEnum width + 1) / 2- let width'' = if width' > 1.5 + let width'' = if width' > (1.5 :: Double) then "width=" ++ show width' ++ "em" else "" let specs2Items = filter (not . null) [start', delim', width''] let specs2 = if null specs2Items then ""- else "[" ++ joinWithSep "," specs2Items ++ "]"- let style' = case style of+ else "[" ++ intercalate "," specs2Items ++ "]"+ let style'' = case style' of DefaultStyle -> orderedListStyles !! level Decimal -> "[n]" LowerRoman -> "[r]" UpperRoman -> "[R]" LowerAlpha -> "[a]" UpperAlpha -> "[A]"- let specs = style' ++ specs2+ let specs = style'' ++ specs2 return $ Pad $ text ("\\startitemize" ++ specs) $$ vcat contents $$ text "\\stopitemize" blockToConTeXt (DefinitionList lst) =@@ -210,31 +210,25 @@ text "\\HL" $$ headers $$ text "\\HL" $$ vcat rows' $$ text "\\HL\n\\stoptable" -printDecimal :: Float -> String+printDecimal :: Double -> String printDecimal = printf "%.2f" +tableRowToConTeXt :: [[Block]] -> State WriterState Doc tableRowToConTeXt cols = do cols' <- mapM blockListToConTeXt cols return $ (vcat (map (text "\\NC " <>) cols')) $$ text "\\NC\\AR" +listItemToConTeXt :: [Block] -> State WriterState Doc listItemToConTeXt list = blockListToConTeXt list >>=- return . (text "\\item " $$) . (nest 2)--orderedListItemToConTeXt marker list = blockListToConTeXt list >>=- return . (text ("\\sym{" ++ marker ++ "} ") $$) . (nest 2)+ return . (text "\\item" $$) . (nest 2) +defListItemToConTeXt :: ([Inline], [Block]) -> State WriterState BlockWrapper defListItemToConTeXt (term, def) = do term' <- inlineListToConTeXt term def' <- blockListToConTeXt def return $ Pad $ text "\\startdescr{" <> term' <> char '}' $$ def' $$ text "\\stopdescr" -wrappedBlocksToDoc :: [BlockWrapper] -> Doc-wrappedBlocksToDoc = foldr addBlock empty - where addBlock (Pad d) accum | isEmpty accum = d- addBlock (Pad d) accum = d $$ text "" $$ accum- addBlock (Reg d) accum = d $$ accum- -- | Convert list of block elements to ConTeXt. blockListToConTeXt :: [Block] -> State WriterState Doc blockListToConTeXt lst = mapM blockToConTeXt lst >>= return . wrappedBlocksToDoc@@ -244,11 +238,6 @@ -> State WriterState Doc inlineListToConTeXt lst = mapM inlineToConTeXt lst >>= return . hcat -isQuoted :: Inline -> Bool-isQuoted (Quoted _ _) = True-isQuoted Apostrophe = True-isQuoted _ = False- -- | Convert inline element to ConTeXt inlineToConTeXt :: Inline -- ^ Inline to convert -> State WriterState Doc@@ -267,6 +256,9 @@ inlineToConTeXt (Subscript lst) = do contents <- inlineListToConTeXt lst return $ text "\\low{" <> contents <> char '}'+inlineToConTeXt (SmallCaps lst) = do+ contents <- inlineListToConTeXt lst+ return $ text "{\\sc " <> contents <> char '}' inlineToConTeXt (Code str) = return $ text $ "\\type{" ++ str ++ "}" inlineToConTeXt (Quoted SingleQuote lst) = do contents <- inlineListToConTeXt lst@@ -274,14 +266,16 @@ inlineToConTeXt (Quoted DoubleQuote lst) = do contents <- inlineListToConTeXt lst return $ text "\\quotation{" <> contents <> char '}'+inlineToConTeXt (Cite _ lst) = inlineListToConTeXt lst inlineToConTeXt Apostrophe = return $ char '\'' inlineToConTeXt EmDash = return $ text "---" inlineToConTeXt EnDash = return $ text "--" inlineToConTeXt Ellipses = return $ text "\\ldots{}" inlineToConTeXt (Str str) = return $ text $ stringToConTeXt str-inlineToConTeXt (Math str) = return $ char '$' <> text str <> char '$'+inlineToConTeXt (Math InlineMath str) = return $ char '$' <> text str <> char '$'+inlineToConTeXt (Math DisplayMath str) = return $ text "\\startformula " <> text str <> text " \\stopformula" inlineToConTeXt (TeX str) = return $ text str-inlineToConTeXt (HtmlInline str) = return empty+inlineToConTeXt (HtmlInline _) = return empty inlineToConTeXt (LineBreak) = return $ text "\\crlf\n" inlineToConTeXt Space = return $ char ' ' inlineToConTeXt (Link [Code str] (src, tit)) = -- since ConTeXt has its own
− Text/Pandoc/Writers/DefaultHeaders.hs
@@ -1,59 +0,0 @@-------------------------------------------------------- Do not edit this file by hand. Edit --- 'templates/DefaultHeaders.hs'--- and run ./fillTemplates.pl Text/Pandoc/Writers/DefaultHeaders.hs-------------------------------------------------------{--Copyright (C) 2006-7 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.Writers.DefaultHeaders- Copyright : Copyright (C) 2006-7 John MacFarlane- License : GNU GPL, version 2 or above -- Maintainer : John MacFarlane <jgm@berkeley.edu>- Stability : alpha- Portability : portable--Default headers for Pandoc writers.--}-module Text.Pandoc.Writers.DefaultHeaders (- defaultLaTeXHeader,- defaultConTeXtHeader,- defaultDocbookHeader,- defaultS5Header,- defaultRTFHeader- ) where-import Text.Pandoc.Writers.S5--defaultLaTeXHeader :: String-defaultLaTeXHeader = "\\documentclass{article}\n\\usepackage[mathletters]{ucs}\n\\usepackage[utf8x]{inputenc}\n\\setlength{\\parindent}{0pt}\n\\setlength{\\parskip}{6pt plus 2pt minus 1pt}\n"--defaultConTeXtHeader :: String-defaultConTeXtHeader = "\\enableregime[utf] % use UTF-8\n\n\\setupcolors[state=start]\n\\setupinteraction[state=start, color=middleblue] % needed for hyperlinks\n\n\\setuppapersize[letter][letter] % use letter paper\n\\setuplayout[width=middle, backspace=1.5in, cutspace=1.5in,\n height=middle, header=0.75in, footer=0.75in] % page layout\n\\setuppagenumbering[location={footer,center}] % number pages\n\\setupbodyfont[11pt] % 11pt font\n\\setupwhitespace[medium] % inter-paragraph spacing\n\n\\setuphead[section][style=\\tfc]\n\\setuphead[subsection][style=\\tfb]\n\\setuphead[subsubsection][style=\\bf]\n\n% define title block commands\n\\unprotect\n\\def\\doctitle#1{\\gdef\\@title{#1}}\n\\def\\author#1{\\gdef\\@author{#1}}\n\\def\\date#1{\\gdef\\@date{#1}}\n\\date{\\currentdate} % Default to today unless specified otherwise.\n\\def\\maketitle{%\n \\startalignment[center]\n \\blank[2*big]\n {\\tfd \\@title}\n \\blank[3*medium]\n {\\tfa \\@author}\n \\blank[2*medium]\n {\\tfa \\@date}\n \\blank[3*medium]\n \\stopalignment}\n\\protect\n\n% define descr (for definition lists)\n\\definedescription[descr][\n headstyle=bold,style=normal,align=left,location=hanging,\n width=broad,margin=1cm]\n\n% define defaults for bulleted lists \n\\setupitemize[1][symbol=1][indentnext=no]\n\\setupitemize[2][symbol=2][indentnext=no]\n\\setupitemize[3][symbol=3][indentnext=no]\n\\setupitemize[4][symbol=4][indentnext=no]\n\n\\setupthinrules[width=15em] % width of horizontal rules\n\n% for block quotations\n\\unprotect\n\n\\startvariables all\nblockquote: blockquote\n\\stopvariables\n\n\\definedelimitedtext\n[\\v!blockquote][\\v!quotation]\n\n\\setupdelimitedtext\n[\\v!blockquote]\n[\\c!left=,\n\\c!right=,\nbefore={\\blank[medium]},\nafter={\\blank[medium]},\n]\n\n\\protect\n\t\n"--defaultDocbookHeader :: String-defaultDocbookHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook XML V4.4//EN\"\n \"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd\">\n"--defaultS5Header :: String-defaultS5Header = s5Meta ++ s5CSS ++ s5Javascript--defaultRTFHeader :: String-defaultRTFHeader = "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0 \\fswiss Helvetica;}{\\f1 Courier;}}\n{\\colortbl;\\red255\\green0\\blue0;\\red0\\green0\\blue255;}\n\\widowctrl\\hyphauto\n\n"-
Text/Pandoc/Writers/Docbook.hs view
@@ -29,71 +29,12 @@ -} module Text.Pandoc.Writers.Docbook ( writeDocbook) where import Text.Pandoc.Definition+import Text.Pandoc.XML import Text.Pandoc.Shared import Text.Pandoc.Readers.TeXMath-import Data.List ( isPrefixOf, drop )+import Data.List ( isPrefixOf, drop, intercalate ) import Text.PrettyPrint.HughesPJ hiding ( Str ) ------ code to format XML------- | Escape one character as needed for XML.-escapeCharForXML :: Char -> String-escapeCharForXML x = case x of- '&' -> "&"- '<' -> "<"- '>' -> ">"- '"' -> """- '\160' -> " "- c -> [c] ---- | True if the character needs to be escaped.-needsEscaping :: Char -> Bool-needsEscaping c = c `elem` "&<>\"\160"---- | Escape string as needed for XML. Entity references are not preserved.-escapeStringForXML :: String -> String-escapeStringForXML "" = ""-escapeStringForXML str = - case break needsEscaping str of- (okay, "") -> okay- (okay, (c:cs)) -> okay ++ escapeCharForXML c ++ escapeStringForXML cs ---- | Return a text object with a string of formatted XML attributes. -attributeList :: [(String, String)] -> Doc-attributeList = text . concatMap - (\(a, b) -> " " ++ escapeStringForXML a ++ "=\"" ++ - escapeStringForXML b ++ "\"") ---- | Put the supplied contents between start and end tags of tagType,--- with specified attributes and (if specified) indentation.-inTags:: Bool -> String -> [(String, String)] -> Doc -> Doc-inTags isIndented tagType attribs contents = - let openTag = char '<' <> text tagType <> attributeList attribs <> - char '>'- closeTag = text "</" <> text tagType <> char '>'- in if isIndented- then openTag $$ nest 2 contents $$ closeTag- else openTag <> contents <> closeTag---- | Return a self-closing tag of tagType with specified attributes-selfClosingTag :: String -> [(String, String)] -> Doc-selfClosingTag tagType attribs = - char '<' <> text tagType <> attributeList attribs <> text " />" - --- | Put the supplied contents between start and end tags of tagType.-inTagsSimple :: String -> Doc -> Doc-inTagsSimple tagType = inTags False tagType []---- | Put the supplied contents in indented block btw start and end tags.-inTagsIndented :: String -> Doc -> Doc-inTagsIndented tagType = inTags True tagType []------- Docbook writer---- -- | Convert list of authors to a docbook <author> section authorToDocbook :: [Char] -> Doc authorToDocbook name = inTagsIndented "author" $ @@ -109,14 +50,14 @@ (firstname, lastname) = case lengthname of 0 -> ("","") 1 -> ("", name)- n -> (joinWithSep " " (take (n-1) namewords), last namewords)+ n -> (intercalate " " (take (n-1) namewords), last namewords) in inTagsSimple "firstname" (text $ escapeStringForXML firstname) $$ inTagsSimple "surname" (text $ escapeStringForXML lastname) -- | Convert Pandoc document to string in Docbook format. writeDocbook :: WriterOptions -> Pandoc -> String writeDocbook opts (Pandoc (Meta title authors date) blocks) = - let head = if writerStandalone opts+ let head' = if writerStandalone opts then text (writerHeader opts) else empty meta = if writerStandalone opts@@ -134,7 +75,7 @@ body' = if writerStandalone opts then inTagsIndented "article" (meta $$ body) else body - in render $ head $$ body' $$ text ""+ in render $ head' $$ body' $$ text "" -- | Convert an Element to Docbook. elementToDocbook :: WriterOptions -> Element -> Doc@@ -153,8 +94,9 @@ blocksToDocbook opts = vcat . map (blockToDocbook opts) -- | Auxiliary function to convert Plain block to Para.+plainToPara :: Block -> Block plainToPara (Plain x) = Para x-plainToPara x = x+plainToPara x = x -- | Convert a list of pairs of terms and definitions into a list of -- Docbook varlistentrys.@@ -181,17 +123,18 @@ -- | Convert a Pandoc block element to Docbook. blockToDocbook :: WriterOptions -> Block -> Doc-blockToDocbook opts Null = empty+blockToDocbook _ Null = empty+blockToDocbook _ (Header _ _) = empty -- should not occur after hierarchicalize blockToDocbook opts (Plain lst) = wrap opts lst blockToDocbook opts (Para lst) = inTagsIndented "para" $ wrap opts lst blockToDocbook opts (BlockQuote blocks) = inTagsIndented "blockquote" $ blocksToDocbook opts blocks-blockToDocbook opts (CodeBlock str) = +blockToDocbook _ (CodeBlock _ str) = text "<screen>\n" <> text (escapeStringForXML str) <> text "\n</screen>" blockToDocbook opts (BulletList lst) = inTagsIndented "itemizedlist" $ listItemsToDocbook opts lst -blockToDocbook opts (OrderedList _ []) = empty -blockToDocbook opts (OrderedList (start, numstyle, numdelim) (first:rest)) =+blockToDocbook _ (OrderedList _ []) = empty +blockToDocbook opts (OrderedList (start, numstyle, _) (first:rest)) = let attribs = case numstyle of DefaultStyle -> [] Decimal -> [("numeration", "arabic")]@@ -207,8 +150,8 @@ in inTags True "orderedlist" attribs items blockToDocbook opts (DefinitionList lst) = inTagsIndented "variablelist" $ deflistItemsToDocbook opts lst -blockToDocbook opts (RawHtml str) = text str -- raw XML block -blockToDocbook opts HorizontalRule = empty -- not semantic+blockToDocbook _ (RawHtml str) = text str -- raw XML block +blockToDocbook _ HorizontalRule = empty -- not semantic blockToDocbook opts (Table caption aligns widths headers rows) = let alignStrings = map alignmentToString aligns captionDoc = if null caption@@ -220,26 +163,39 @@ (colHeadsToDocbook opts alignStrings widths headers) $$ (vcat $ map (tableRowToDocbook opts alignStrings) rows) +colHeadsToDocbook :: WriterOptions + -> [[Char]]+ -> [Double]+ -> [[Block]] + -> Doc colHeadsToDocbook opts alignStrings widths headers = let heads = zipWith3 (\align width item -> tableItemToDocbook opts "th" align width item) alignStrings widths headers in inTagsIndented "tr" $ vcat heads +alignmentToString :: Alignment -> [Char] alignmentToString alignment = case alignment of AlignLeft -> "left" AlignRight -> "right" AlignCenter -> "center" AlignDefault -> "left" +tableRowToDocbook :: WriterOptions -> [[Char]] -> [[Block]] -> Doc tableRowToDocbook opts aligns cols = inTagsIndented "tr" $ vcat $ zipWith3 (tableItemToDocbook opts "td") aligns (repeat 0) cols +tableItemToDocbook :: WriterOptions+ -> [Char]+ -> [Char]+ -> Double+ -> [Block]+ -> Doc tableItemToDocbook opts tag align width item = let attrib = [("align", align)] ++ if width /= 0 then [("style", "{width: " ++ - show (truncate (100*width)) ++ "%;}")]+ show (truncate (100*width) :: Integer) ++ "%;}")] else [] in inTags True tag attrib $ vcat $ map (blockToDocbook opts) item @@ -255,7 +211,7 @@ -- | Convert an inline element to Docbook. inlineToDocbook :: WriterOptions -> Inline -> Doc-inlineToDocbook opts (Str str) = text $ escapeStringForXML str +inlineToDocbook _ (Str str) = text $ escapeStringForXML str inlineToDocbook opts (Emph lst) = inTagsSimple "emphasis" $ inlinesToDocbook opts lst inlineToDocbook opts (Strong lst) = @@ -267,20 +223,25 @@ inTagsSimple "superscript" $ inlinesToDocbook opts lst inlineToDocbook opts (Subscript lst) = inTagsSimple "subscript" $ inlinesToDocbook opts lst+inlineToDocbook opts (SmallCaps lst) = + inTags False "emphasis" [("role", "smallcaps")] $+ inlinesToDocbook opts lst inlineToDocbook opts (Quoted _ lst) = inTagsSimple "quote" $ inlinesToDocbook opts lst-inlineToDocbook opts Apostrophe = char '\''-inlineToDocbook opts Ellipses = text "…"-inlineToDocbook opts EmDash = text "—" -inlineToDocbook opts EnDash = text "–" -inlineToDocbook opts (Code str) = +inlineToDocbook opts (Cite _ lst) =+ inlinesToDocbook opts lst +inlineToDocbook _ Apostrophe = char '\''+inlineToDocbook _ Ellipses = text "…"+inlineToDocbook _ EmDash = text "—" +inlineToDocbook _ EnDash = text "–" +inlineToDocbook _ (Code str) = inTagsSimple "literal" $ text (escapeStringForXML str)-inlineToDocbook opts (Math str) = inlinesToDocbook opts $ readTeXMath str-inlineToDocbook opts (TeX str) = empty-inlineToDocbook opts (HtmlInline str) = empty-inlineToDocbook opts LineBreak = text $ "<literallayout></literallayout>" -inlineToDocbook opts Space = char ' '-inlineToDocbook opts (Link txt (src, tit)) =+inlineToDocbook opts (Math _ str) = inlinesToDocbook opts $ readTeXMath str+inlineToDocbook _ (TeX _) = empty+inlineToDocbook _ (HtmlInline _) = empty+inlineToDocbook _ LineBreak = text $ "<literallayout></literallayout>" +inlineToDocbook _ Space = char ' '+inlineToDocbook opts (Link txt (src, _)) = if isPrefixOf "mailto:" src then let src' = drop 7 src emailLink = inTagsSimple "email" $ text $ @@ -290,7 +251,7 @@ else inlinesToDocbook opts txt <+> char '(' <> emailLink <> char ')' else inTags False "ulink" [("url", src)] $ inlinesToDocbook opts txt-inlineToDocbook opts (Image alt (src, tit)) = +inlineToDocbook _ (Image _ (src, tit)) = let titleDoc = if null tit then empty else inTagsIndented "objectinfo" $
Text/Pandoc/Writers/HTML.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-deprecations #-} {- Copyright (C) 2006-8 John MacFarlane <jgm@berkeley.edu> @@ -29,17 +30,17 @@ -} module Text.Pandoc.Writers.HTML ( writeHtml , writeHtmlString ) where import Text.Pandoc.Definition-import Text.Pandoc.ASCIIMathML+import Text.Pandoc.LaTeXMathML import Text.Pandoc.CharacterReferences ( decodeCharacterReferences ) import Text.Pandoc.Shared import Text.Pandoc.Readers.TeXMath-import Text.Regex ( mkRegex, matchRegex )+import Text.Pandoc.Highlighting ( highlightHtml, defaultHighlightingCss ) import Numeric ( showHex ) import Data.Char ( ord, toLower, isAlpha )-import Data.List ( isPrefixOf, intersperse )+import Data.List ( isPrefixOf, intercalate ) import qualified Data.Set as S import Control.Monad.State-import Text.XHtml.Transitional+import Text.XHtml.Transitional hiding ( stringToHtml ) data WriterState = WriterState { stNotes :: [Html] -- ^ List of notes@@ -53,11 +54,29 @@ stMath = False, stCSS = S.empty} -- Helpers to render HTML with the appropriate function.-render opts = if writerWrapText opts then renderHtml else showHtml++render :: (HTML html) => WriterOptions -> html -> String+render opts = if writerWrapText opts then renderHtml else showHtml++renderFragment :: (HTML html) => WriterOptions -> html -> String renderFragment opts = if writerWrapText opts then renderHtmlFragment else showHtmlFragment +-- | Slightly modified version of Text.XHtml's stringToHtml.+-- Only uses numerical entities for 0xff and greater.+-- Adds .+stringToHtml :: String -> Html+stringToHtml = primHtml . concatMap fixChar+ where+ fixChar '<' = "<"+ fixChar '>' = ">"+ fixChar '&' = "&"+ fixChar '"' = """+ fixChar '\160' = " "+ fixChar c | ord c < 0xff = [c]+ fixChar c = "&#" ++ show (ord c) ++ ";"+ -- | Convert Pandoc document to Html string. writeHtmlString :: WriterOptions -> Pandoc -> String writeHtmlString opts = @@ -104,23 +123,23 @@ '\n':(unlines $ S.toList cssLines) math = if stMath newstate then case writerHTMLMathMethod opts of- ASCIIMathML Nothing -> - primHtml asciiMathMLScript- ASCIIMathML (Just url) ->+ LaTeXMathML Nothing -> + primHtml latexMathMLScript+ LaTeXMathML (Just url) -> script ! [src url, thetype "text/javascript"] $ noHtml _ -> noHtml else noHtml- head = header $ metadata +++ math +++ css +++ + head' = header $ metadata +++ math +++ css +++ primHtml (writerHeader opts) notes = reverse (stNotes newstate) before = primHtml $ writerIncludeBefore opts after = primHtml $ writerIncludeAfter opts thebody = before +++ titleHeader +++ toc +++ blocks' +++- footnoteSection opts notes +++ after+ footnoteSection notes +++ after in if writerStandalone opts- then head +++ body thebody+ then head' +++ body thebody else thebody -- | Construct table of contents from list of header blocks and identifiers.@@ -137,11 +156,11 @@ -- | Converts an Element to a list item for a table of contents, -- retrieving the appropriate identifier from state. elementToListItem :: WriterOptions -> Element -> State WriterState Html-elementToListItem opts (Blk _) = return noHtml+elementToListItem _ (Blk _) = return noHtml elementToListItem opts (Sec headerText subsecs) = do st <- get let ids = stIds st- let (id, rest) = if null ids+ let (id', rest) = if null ids then ("", []) else (head ids, tail ids) put $ st {stIds = rest}@@ -150,43 +169,51 @@ let subList = if null subHeads then noHtml else unordList subHeads - return $ (anchor ! [href ("#" ++ id), identifier ("TOC-" ++ id)] $ txt) +++ + return $ (anchor ! [href ("#" ++ id'), identifier ("TOC-" ++ id')] $ txt) +++ subList -- | Convert list of Note blocks to a footnote <div>. -- Assumes notes are sorted.-footnoteSection :: WriterOptions -> [Html] -> Html-footnoteSection opts notes =+footnoteSection :: [Html] -> Html+footnoteSection notes = if null notes then noHtml else thediv ! [theclass "footnotes"] $ hr +++ (olist << notes) ++-- | Parse a mailto link; return Just (name, domain) or Nothing.+parseMailto :: String -> Maybe (String, String)+parseMailto ('m':'a':'i':'l':'t':'o':':':addr) =+ let (name', rest) = span (/='@') addr+ domain = drop 1 rest+ in Just (name', domain)+parseMailto _ = Nothing + -- | Obfuscate a "mailto:" link using Javascript. obfuscateLink :: WriterOptions -> String -> String -> Html-obfuscateLink opts text src =- let emailRegex = mkRegex "^mailto:([^@]*)@(.*)$"- src' = map toLower src- in case (matchRegex emailRegex src') of- (Just [name, domain]) ->+obfuscateLink opts txt s =+ let s' = map toLower s + in case parseMailto s' of+ (Just (name', domain)) -> let domain' = substitute "." " dot " domain at' = obfuscateChar '@' (linkText, altText) = - if text == drop 7 src' -- autolink- then ("'<code>'+e+'</code>'", name ++ " at " ++ domain')- else ("'" ++ text ++ "'", text ++ " (" ++ name ++ " at " ++ + if txt == drop 7 s' -- autolink+ then ("'<code>'+e+'</code>'", name' ++ " at " ++ domain')+ else ("'" ++ txt ++ "'", txt ++ " (" ++ name' ++ " at " ++ domain' ++ ")") in if writerStrictMarkdown opts then -- need to use primHtml or &'s are escaped to & in URL- primHtml $ "<a href=\"" ++ (obfuscateString src')- ++ "\">" ++ (obfuscateString text) ++ "</a>"+ primHtml $ "<a href=\"" ++ (obfuscateString s')+ ++ "\">" ++ (obfuscateString txt) ++ "</a>" else (script ! [thetype "text/javascript"] $ primHtml ("\n<!--\nh='" ++ obfuscateString domain ++ "';a='" ++ at' ++ "';n='" ++ - obfuscateString name ++ "';e=n+a+h;\n" +++ obfuscateString name' ++ "';e=n+a+h;\n" ++ "document.write('<a h'+'ref'+'=\"ma'+'ilto'+':'+e+'\">'+" ++ linkText ++ "+'<\\/'+'a'+'>');\n// -->\n")) +++ noscript (primHtml $ obfuscateString altText)- _ -> anchor ! [href src] $ primHtml text -- malformed email+ _ -> anchor ! [href s] $ primHtml txt -- malformed email -- | Obfuscate character as entity. obfuscateChar :: Char -> String@@ -219,18 +246,21 @@ inlineListToIdentifier :: [Inline] -> String inlineListToIdentifier = dropWhile (not . isAlpha) . inlineListToIdentifier' +inlineListToIdentifier' :: [Inline] -> [Char] inlineListToIdentifier' [] = "" inlineListToIdentifier' (x:xs) = xAsText ++ inlineListToIdentifier' xs where xAsText = case x of Str s -> filter (\c -> c == '-' || not (isPunctuation c)) $- concat $ intersperse "-" $ words $ map toLower s+ intercalate "-" $ words $ map toLower s Emph lst -> inlineListToIdentifier' lst Strikeout lst -> inlineListToIdentifier' lst Superscript lst -> inlineListToIdentifier' lst+ SmallCaps lst -> inlineListToIdentifier' lst Subscript lst -> inlineListToIdentifier' lst Strong lst -> inlineListToIdentifier' lst Quoted _ lst -> inlineListToIdentifier' lst+ Cite _ lst -> inlineListToIdentifier' lst Code s -> s Space -> "-" EmDash -> "-"@@ -238,7 +268,7 @@ Apostrophe -> "" Ellipses -> "" LineBreak -> "-"- Math _ -> ""+ Math _ _ -> "" TeX _ -> "" HtmlInline _ -> "" Link lst _ -> inlineListToIdentifier' lst@@ -258,13 +288,22 @@ -- | Convert Pandoc block element to HTML. blockToHtml :: WriterOptions -> Block -> State WriterState Html-blockToHtml opts Null = return $ noHtml +blockToHtml _ Null = return $ noHtml blockToHtml opts (Plain lst) = inlineListToHtml opts lst blockToHtml opts (Para lst) = inlineListToHtml opts lst >>= (return . paragraph)-blockToHtml opts (RawHtml str) = return $ primHtml str-blockToHtml opts (HorizontalRule) = return $ hr-blockToHtml opts (CodeBlock str) = return $ pre $ thecode << (str ++ "\n") - -- the final \n for consistency with Markdown.pl+blockToHtml _ (RawHtml str) = return $ primHtml str+blockToHtml _ (HorizontalRule) = return $ hr+blockToHtml _ (CodeBlock attr@(_,classes,_) rawCode) = do+ case highlightHtml attr rawCode of+ Left _ -> -- change leading newlines into <br /> tags, because some+ -- browsers ignore leading newlines in pre blocks+ let (leadingBreaks, rawCode') = span (=='\n') rawCode+ in return $ pre ! (if null classes+ then []+ else [theclass $ unwords classes]) $ thecode <<+ (replicate (length leadingBreaks) br ++++ [stringToHtml $ rawCode' ++ "\n"])+ Right h -> addToCSS defaultHighlightingCss >> return h blockToHtml opts (BlockQuote blocks) = -- in S5, treat list in blockquote specially -- if default is incremental, make it nonincremental; @@ -277,22 +316,22 @@ [OrderedList attribs lst] -> blockToHtml (opts {writerIncremental = inc}) (OrderedList attribs lst)- otherwise -> blockListToHtml opts blocks >>= + _ -> blockListToHtml opts blocks >>= (return . blockquote) else blockListToHtml opts blocks >>= (return . blockquote) blockToHtml opts (Header level lst) = do contents <- inlineListToHtml opts lst st <- get let ids = stIds st- let (id, rest) = if null ids+ let (id', rest) = if null ids then ("", []) else (head ids, tail ids) put $ st {stIds = rest} let attribs = if writerStrictMarkdown opts && not (writerTableOfContents opts) then []- else [identifier id]+ else [identifier id'] let contents' = if writerTableOfContents opts- then anchor ! [href ("#TOC-" ++ id)] $ contents+ then anchor ! [href ("#TOC-" ++ id')] $ contents else contents return $ case level of 1 -> h1 contents' ! attribs@@ -318,13 +357,8 @@ then [start startnum] else []) ++ (if numstyle /= DefaultStyle- then [theclass numstyle']+ then [thestyle $ "list-style-type: " ++ numstyle' ++ ";"] else [])- if numstyle /= DefaultStyle- then addToCSS $ "ol." ++ numstyle' ++ - " { list-style-type: " ++ - numstyle' ++ "; }"- else return () return $ ordList ! attribs $ contents blockToHtml opts (DefinitionList lst) = do contents <- mapM (\(term, def) -> do term' <- inlineListToHtml opts term@@ -334,40 +368,55 @@ then [theclass "incremental"] else [] return $ defList ! attribs $ contents-blockToHtml opts (Table capt aligns widths headers rows) = do+blockToHtml opts (Table capt aligns widths headers rows') = do let alignStrings = map alignmentToString aligns captionDoc <- if null capt then return noHtml else inlineListToHtml opts capt >>= return . caption colHeads <- colHeadsToHtml opts alignStrings widths headers- rows' <- mapM (tableRowToHtml opts alignStrings) rows- return $ table $ captionDoc +++ colHeads +++ rows'+ rows'' <- mapM (tableRowToHtml opts alignStrings) rows'+ return $ table $ captionDoc +++ colHeads +++ rows'' +colHeadsToHtml :: WriterOptions+ -> [[Char]]+ -> [Double]+ -> [[Block]]+ -> State WriterState Html colHeadsToHtml opts alignStrings widths headers = do heads <- sequence $ zipWith3 - (\align width item -> tableItemToHtml opts th align width item) + (\alignment columnwidth item -> tableItemToHtml opts th alignment columnwidth item) alignStrings widths headers return $ tr $ toHtmlFromList heads +alignmentToString :: Alignment -> [Char] alignmentToString alignment = case alignment of AlignLeft -> "left" AlignRight -> "right" AlignCenter -> "center" AlignDefault -> "left" -tableRowToHtml opts aligns cols = - (sequence $ zipWith3 (tableItemToHtml opts td) aligns (repeat 0) cols) >>=+tableRowToHtml :: WriterOptions+ -> [[Char]]+ -> [[Block]]+ -> State WriterState Html+tableRowToHtml opts aligns columns = + (sequence $ zipWith3 (tableItemToHtml opts td) aligns (repeat 0) columns) >>= return . tr . toHtmlFromList -tableItemToHtml opts tag align' width item = do+tableItemToHtml :: WriterOptions+ -> (Html -> Html)+ -> [Char]+ -> Double+ -> [Block]+ -> State WriterState Html+tableItemToHtml opts tag' align' width' item = do contents <- blockListToHtml opts item let attrib = [align align'] ++ - if width /= 0 - then [thestyle ("width: " ++ show (truncate (100*width)) ++ - "%;")]+ if width' /= 0+ then [thestyle ("width: " ++ (show (truncate (100 * width') :: Integer)) ++ "%;")] else [] - return $ tag ! attrib $ contents+ return $ tag' ! attrib $ contents blockListToHtml :: WriterOptions -> [Block] -> State WriterState Html blockListToHtml opts lst = @@ -392,10 +441,10 @@ (Emph lst) -> inlineListToHtml opts lst >>= return . emphasize (Strong lst) -> inlineListToHtml opts lst >>= return . strong (Code str) -> return $ thecode << str- (Strikeout lst) -> addToCSS - ".strikeout { text-decoration: line-through; }" >> - inlineListToHtml opts lst >>=- return . (thespan ! [theclass "strikeout"])+ (Strikeout lst) -> inlineListToHtml opts lst >>=+ return . (thespan ! [thestyle "text-decoration: line-through;"])+ (SmallCaps lst) -> inlineListToHtml opts lst >>=+ return . (thespan ! [thestyle "font-variant: small-caps;"]) (Superscript lst) -> inlineListToHtml opts lst >>= return . sup (Subscript lst) -> inlineListToHtml opts lst >>= return . sub (Quoted quoteType lst) ->@@ -406,10 +455,13 @@ primHtmlChar "rdquo") in do contents <- inlineListToHtml opts lst return $ leftQuote +++ contents +++ rightQuote- (Math str) -> modify (\st -> st {stMath = True}) >> + (Math t str) -> + modify (\st -> st {stMath = True}) >> (case writerHTMLMathMethod opts of- ASCIIMathML _ -> - return $ stringToHtml ("$" ++ str ++ "$")+ LaTeXMathML _ -> + return $ if t == InlineMath+ then primHtml ("$" ++ str ++ "$")+ else primHtml ("$$" ++ str ++ "$$") MimeTeX url -> return $ image ! [src (url ++ "?" ++ str), alt str, title str]@@ -418,22 +470,25 @@ PlainMath -> inlineListToHtml opts (readTeXMath str) >>= return . (thespan ! [theclass "math"])) - (TeX str) -> return noHtml+ (TeX str) -> case writerHTMLMathMethod opts of+ LaTeXMathML _ -> do modify (\st -> st {stMath = True})+ return $ primHtml str+ _ -> return noHtml (HtmlInline str) -> return $ primHtml str - (Link [Code str] (src,tit)) | "mailto:" `isPrefixOf` src ->- return $ obfuscateLink opts str src- (Link txt (src,tit)) | "mailto:" `isPrefixOf` src -> do+ (Link [Code str] (s,_)) | "mailto:" `isPrefixOf` s ->+ return $ obfuscateLink opts str s+ (Link txt (s,_)) | "mailto:" `isPrefixOf` s -> do linkText <- inlineListToHtml opts txt - return $ obfuscateLink opts (show linkText) src- (Link txt (src,tit)) -> do+ return $ obfuscateLink opts (show linkText) s+ (Link txt (s,tit)) -> do linkText <- inlineListToHtml opts txt- return $ anchor ! ([href src] ++ + return $ anchor ! ([href s] ++ if null tit then [] else [title tit]) $ linkText- (Image txt (source,tit)) -> do+ (Image txt (s,tit)) -> do alternate <- inlineListToHtml opts txt let alternate' = renderFragment opts alternate- let attributes = [src source] +++ let attributes = [src s] ++ (if null tit then [] else [title tit]) ++ @@ -454,6 +509,7 @@ theclass "footnoteRef", identifier ("fnref" ++ ref)] << sup << ref+ (Cite _ il) -> inlineListToHtml opts il blockListToNote :: WriterOptions -> String -> [Block] -> State WriterState Html blockListToNote opts ref blocks =
Text/Pandoc/Writers/LaTeX.hs view
@@ -31,7 +31,7 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.Printf ( printf )-import Data.List ( (\\), isInfixOf, isSuffixOf, intersperse )+import Data.List ( (\\), isSuffixOf, intercalate ) import Data.Char ( toLower ) import qualified Data.Set as S import Control.Monad.State@@ -60,7 +60,7 @@ pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState Doc pandocToLaTeX options (Pandoc meta blocks) = do main <- blockListToLaTeX blocks- head <- if writerStandalone options+ head' <- if writerStandalone options then latexHeader options meta else return empty let before = if null (writerIncludeBefore options)@@ -76,7 +76,7 @@ let foot = if writerStandalone options then text "\\end{document}" else empty - return $ head $$ toc $$ body $$ foot+ return $ head' $$ toc $$ body $$ foot -- | Insert bibliographic information into LaTeX header. latexHeader :: WriterOptions -- ^ Options, including LaTeX header@@ -92,7 +92,7 @@ then text "\\VerbatimFootnotes % allows verbatim text in footnotes" else empty let authorstext = text $ "\\author{" ++ - joinWithSep "\\\\" (map stringToLaTeX authors) ++ "}"+ intercalate "\\\\" (map stringToLaTeX authors) ++ "}" let datetext = if date == "" then empty else text $ "\\date{" ++ stringToLaTeX date ++ "}"@@ -116,6 +116,7 @@ , ('|', "\\textbar{}") , ('<', "\\textless{}") , ('>', "\\textgreater{}")+ , ('\160', "~") ] -- | Puts contents into LaTeX command.@@ -146,7 +147,7 @@ blockToLaTeX (BlockQuote lst) = do contents <- blockListToLaTeX lst return $ text "\\begin{quote}" $$ contents $$ text "\\end{quote}"-blockToLaTeX (CodeBlock str) = do+blockToLaTeX (CodeBlock _ str) = do st <- get env <- if stInNote st then do addToHeader "\\usepackage{fancyvrb}"@@ -154,7 +155,7 @@ else return "verbatim" return $ text ("\\begin{" ++ env ++ "}\n") <> text str <> text ("\n\\end{" ++ env ++ "}")-blockToLaTeX (RawHtml str) = return empty+blockToLaTeX (RawHtml _) = return empty blockToLaTeX (BulletList lst) = do items <- mapM listItemToLaTeX lst return $ text "\\begin{itemize}" $$ vcat items $$ text "\\end{itemize}"@@ -163,7 +164,7 @@ let oldlevel = stOLLevel st put $ st {stOLLevel = oldlevel + 1} items <- mapM listItemToLaTeX lst- modify (\st -> st {stOLLevel = oldlevel})+ modify (\s -> s {stOLLevel = oldlevel}) exemplar <- if numstyle /= DefaultStyle || numdelim /= DefaultDelim then do addToHeader "\\usepackage{enumerate}" return $ char '[' <> @@ -208,24 +209,28 @@ headers $$ text "\\hline" $$ vcat rows' $$ text "\\end{tabular}" let centered txt = text "\\begin{center}" $$ txt $$ text "\\end{center}"- addToHeader "\\usepackage{array}\n\- \% This is needed because raggedright in table elements redefines \\\\:\n\- \\\newcommand{\\PreserveBackslash}[1]{\\let\\temp=\\\\#1\\let\\\\=\\temp}\n\- \\\let\\PBS=\\PreserveBackslash"+ addToHeader $ "\\usepackage{array}\n" +++ "% This is needed because raggedright in table elements redefines \\\\:\n" +++ "\\newcommand{\\PreserveBackslash}[1]{\\let\\temp=\\\\#1\\let\\\\=\\temp}\n" +++ "\\let\\PBS=\\PreserveBackslash" return $ if isEmpty captionText then centered tableBody <> char '\n' else text "\\begin{table}[h]" $$ centered tableBody $$ inCmd "caption" captionText $$ text "\\end{table}\n" +blockListToLaTeX :: [Block] -> State WriterState Doc blockListToLaTeX lst = mapM blockToLaTeX lst >>= return . vcat +tableRowToLaTeX :: [[Block]] -> State WriterState Doc tableRowToLaTeX cols = mapM blockListToLaTeX cols >>= return . ($$ text "\\\\") . foldl (\row item -> row $$ (if isEmpty row then empty else text " & ") <> item) empty -listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item " $$) .+listItemToLaTeX :: [Block] -> State WriterState Doc+listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) . (nest 2) +defListItemToLaTeX :: ([Inline], [Block]) -> State WriterState Doc defListItemToLaTeX (term, def) = do term' <- inlineListToLaTeX $ deVerb term def' <- blockListToLaTeX def@@ -257,9 +262,13 @@ inlineToLaTeX (Subscript lst) = do contents <- inlineListToLaTeX $ deVerb lst -- oddly, latex includes \textsuperscript but not \textsubscript- -- so we have to define it:- addToHeader "\\newcommand{\\textsubscript}[1]{\\ensuremath{_{\\scriptsize\\textrm{#1}}}}"- return $ inCmd "textsubscript" contents+ -- so we have to define it (using a different name so as not to conflict with memoir class):+ addToHeader "\\newcommand{\\textsubscr}[1]{\\ensuremath{_{\\scriptsize\\textrm{#1}}}}"+ return $ inCmd "textsubscr" contents+inlineToLaTeX (SmallCaps lst) =+ inlineListToLaTeX (deVerb lst) >>= return . inCmd "textsc"+inlineToLaTeX (Cite _ lst) =+ inlineListToLaTeX lst inlineToLaTeX (Code str) = do st <- get if stInNote st@@ -290,9 +299,10 @@ inlineToLaTeX EnDash = return $ text "--" inlineToLaTeX Ellipses = return $ text "\\ldots{}" inlineToLaTeX (Str str) = return $ text $ stringToLaTeX str-inlineToLaTeX (Math str) = return $ char '$' <> text str <> char '$'+inlineToLaTeX (Math InlineMath str) = return $ char '$' <> text str <> char '$'+inlineToLaTeX (Math DisplayMath str) = return $ text "\\[" <> text str <> text "\\]" inlineToLaTeX (TeX str) = return $ text str-inlineToLaTeX (HtmlInline str) = return empty+inlineToLaTeX (HtmlInline _) = return empty inlineToLaTeX (LineBreak) = return $ text "\\\\" inlineToLaTeX Space = return $ char ' ' inlineToLaTeX (Link txt (src, _)) = do@@ -304,14 +314,14 @@ _ -> do contents <- inlineListToLaTeX $ deVerb txt return $ text ("\\href{" ++ src ++ "}{") <> contents <> char '}'-inlineToLaTeX (Image alternate (source, tit)) = do+inlineToLaTeX (Image _ (source, _)) = do addToHeader "\\usepackage{graphicx}" return $ text $ "\\includegraphics{" ++ source ++ "}" inlineToLaTeX (Note contents) = do st <- get put (st {stInNote = True}) contents' <- blockListToLaTeX contents- modify (\st -> st {stInNote = False})+ modify (\s -> s {stInNote = False}) let rawnote = stripTrailingNewlines $ render contents' -- note: a \n before } is needed when note ends with a Verbatim environment let optNewline = "\\end{Verbatim}" `isSuffixOf` rawnote
Text/Pandoc/Writers/Man.hs view
@@ -31,9 +31,8 @@ module Text.Pandoc.Writers.Man ( writeMan) where import Text.Pandoc.Definition import Text.Pandoc.Shared-import Text.Pandoc.Readers.TeXMath import Text.Printf ( printf )-import Data.List ( isPrefixOf, drop, nub, intersperse )+import Data.List ( isPrefixOf, drop, nub, intersperse, intercalate ) import Text.PrettyPrint.HughesPJ hiding ( Str ) import Control.Monad.State @@ -52,14 +51,14 @@ let after = writerIncludeAfter opts let before' = if null before then empty else text before let after' = if null after then empty else text after- (head, foot) <- metaToMan opts meta+ (head', foot) <- metaToMan opts meta body <- blockListToMan opts blocks (notes, preprocessors) <- get let preamble = if null preprocessors || not (writerStandalone opts) then empty else text $ ".\\\" " ++ concat (nub preprocessors) notes' <- notesToMan opts (reverse notes)- return $ preamble $$ head $$ before' $$ body $$ notes' $$ foot $$ after'+ return $ preamble $$ head' $$ before' $$ body $$ notes' $$ foot $$ after' -- | Insert bibliographic information into Man header and footer. metaToMan :: WriterOptions -- ^ Options, including Man header@@ -74,14 +73,14 @@ xs -> (text (reverse xs), doubleQuotes empty) let extras = map (doubleQuotes . text . removeLeadingTrailingSpace) $ splitBy '|' rest- let head = (text ".TH") <+> title' <+> section <+> + let head' = (text ".TH") <+> title' <+> section <+> doubleQuotes (text date) <+> hsep extras let foot = case length authors of 0 -> empty- 1 -> text ".SH AUTHOR" $$ (text $ joinWithSep ", " authors)- 2 -> text ".SH AUTHORS" $$ (text $ joinWithSep ", " authors)+ 1 -> text ".SH AUTHOR" $$ (text $ intercalate ", " authors)+ _ -> text ".SH AUTHORS" $$ (text $ intercalate ", " authors) return $ if writerStandalone options- then (head, foot)+ then (head', foot) else (empty, empty) -- | Return man representation of notes.@@ -101,7 +100,7 @@ -- | Association list of characters to escape. manEscapes :: [(Char, String)]-manEscapes = [('\160', "\\ "), ('\'', "\\[aq]")] ++ backslashEscapes "\".@\\"+manEscapes = [('\160', "\\ "), ('\'', "\\[aq]")] ++ backslashEscapes ".@\\" -- | Escape special characters for Man. escapeString :: String -> String@@ -115,21 +114,21 @@ blockToMan :: WriterOptions -- ^ Options -> Block -- ^ Block element -> State WriterState Doc -blockToMan opts Null = return empty+blockToMan _ Null = return empty blockToMan opts (Plain inlines) = wrapIfNeeded opts (inlineListToMan opts) inlines blockToMan opts (Para inlines) = do contents <- wrapIfNeeded opts (inlineListToMan opts) inlines return $ text ".PP" $$ contents -blockToMan opts (RawHtml str) = return $ text str-blockToMan opts HorizontalRule = return $ text $ ".PP\n * * * * *"+blockToMan _ (RawHtml str) = return $ text str+blockToMan _ HorizontalRule = return $ text $ ".PP\n * * * * *" blockToMan opts (Header level inlines) = do contents <- inlineListToMan opts inlines let heading = case level of 1 -> ".SH " _ -> ".SS " return $ text heading <> contents -blockToMan opts (CodeBlock str) = return $+blockToMan _ (CodeBlock _ str) = return $ text ".PP" $$ text "\\f[CR]" $$ text ((unlines . map (" " ++) . lines) (escapeCode str)) <> text "\\f[]" blockToMan opts (BlockQuote blocks) = do @@ -145,7 +144,7 @@ modify (\(notes, preprocessors) -> (notes, "t":preprocessors)) let iwidths = map (printf "w(%0.2fn)" . (70 *)) widths -- 78n default width - 8n indent = 70n- let coldescriptions = text $ joinWithSep " " + let coldescriptions = text $ intercalate " " (zipWith (\align width -> aligncode align ++ width) alignments iwidths) ++ "." colheadings <- mapM (blockListToMan opts) headers@@ -175,7 +174,7 @@ -- | Convert bullet list item (list of blocks) to man. bulletListItemToMan :: WriterOptions -> [Block] -> State WriterState Doc-bulletListItemToMan opts [] = return empty+bulletListItemToMan _ [] = return empty bulletListItemToMan opts ((Para first):rest) = bulletListItemToMan opts ((Plain first):rest) bulletListItemToMan opts ((Plain first):rest) = do@@ -220,8 +219,9 @@ then return empty else do let (first, rest) = case items of- ((Para x):y) -> (Plain x,y)- (x:y) -> (x,y)+ ((Para x):y) -> (Plain x,y)+ (x:y) -> (x,y)+ [] -> error "items is null" rest' <- mapM (\item -> blockToMan opts item) rest >>= (return . vcat) first' <- blockToMan opts first@@ -256,24 +256,30 @@ inlineToMan opts (Subscript lst) = do contents <- inlineListToMan opts lst return $ char '~' <> contents <> char '~'+inlineToMan opts (SmallCaps lst) = inlineListToMan opts lst -- not supported inlineToMan opts (Quoted SingleQuote lst) = do contents <- inlineListToMan opts lst return $ char '`' <> contents <> char '\'' inlineToMan opts (Quoted DoubleQuote lst) = do contents <- inlineListToMan opts lst return $ text "\\[lq]" <> contents <> text "\\[rq]"-inlineToMan opts EmDash = return $ text "\\[em]"-inlineToMan opts EnDash = return $ text "\\[en]"-inlineToMan opts Apostrophe = return $ char '\''-inlineToMan opts Ellipses = return $ text "\\&..."-inlineToMan opts (Code str) =+inlineToMan opts (Cite _ lst) =+ inlineListToMan opts lst+inlineToMan _ EmDash = return $ text "\\[em]"+inlineToMan _ EnDash = return $ text "\\[en]"+inlineToMan _ Apostrophe = return $ char '\''+inlineToMan _ Ellipses = return $ text "\\&..."+inlineToMan _ (Code str) = return $ text $ "\\f[B]" ++ escapeCode str ++ "\\f[]"-inlineToMan opts (Str str) = return $ text $ escapeString str-inlineToMan opts (Math str) = inlineToMan opts (Code str)-inlineToMan opts (TeX str) = return empty-inlineToMan opts (HtmlInline str) = return $ text $ escapeCode str -inlineToMan opts (LineBreak) = return $ text "\n.PD 0\n.P\n.PD\n"-inlineToMan opts Space = return $ char ' '+inlineToMan _ (Str str) = return $ text $ escapeString str+inlineToMan opts (Math InlineMath str) = inlineToMan opts (Code str)+inlineToMan opts (Math DisplayMath str) = do+ contents <- inlineToMan opts (Code str)+ return $ text ".RS" $$ contents $$ text ".RE"+inlineToMan _ (TeX _) = return empty+inlineToMan _ (HtmlInline str) = return $ text $ escapeCode str +inlineToMan _ (LineBreak) = return $ text "\n.PD 0\n.P\n.PD\n"+inlineToMan _ Space = return $ char ' ' inlineToMan opts (Link txt (src, _)) = do linktext <- inlineListToMan opts txt let srcSuffix = if isPrefixOf "mailto:" src then drop 7 src else src@@ -287,7 +293,7 @@ else alternate linkPart <- inlineToMan opts (Link txt (source, tit)) return $ char '[' <> text "IMAGE: " <> linkPart <> char ']'-inlineToMan opts (Note contents) = do +inlineToMan _ (Note contents) = do modify (\(notes, prep) -> (contents:notes, prep)) -- add to notes in state (notes, _) <- get let ref = show $ (length notes)
Text/Pandoc/Writers/Markdown.hs view
@@ -33,8 +33,8 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.Pandoc.Blocks-import Text.ParserCombinators.Parsec ( parse, (<|>), GenParser )-import Data.List ( group, isPrefixOf, drop, find, intersperse )+import Text.ParserCombinators.Parsec ( parse, GenParser )+import Data.List ( group, isPrefixOf, drop, find, intersperse, intercalate ) import Text.PrettyPrint.HughesPJ hiding ( Str ) import Control.Monad.State @@ -55,7 +55,7 @@ let before' = if null before then empty else text before let after' = if null after then empty else text after metaBlock <- metaToMarkdown opts meta- let head = if writerStandalone opts+ let head' = if writerStandalone opts then metaBlock $+$ text (writerHeader opts) else empty let headerBlocks = filter isHeaderBlock blocks@@ -67,7 +67,7 @@ notes' <- notesToMarkdown opts (reverse notes) (_, refs) <- get -- note that the notes may contain refs refs' <- keyTableToMarkdown opts (reverse refs)- return $ head $+$ before' $+$ toc $+$ body $+$ text "" $+$ + return $ head' $+$ before' $+$ toc $+$ body $+$ text "" $+$ notes' $+$ text "" $+$ refs' $+$ after' -- | Return markdown representation of reference key table.@@ -100,7 +100,7 @@ -- | Escape special characters for Markdown. escapeString :: String -> String escapeString = escapeStringUsing markdownEscapes- where markdownEscapes = ('\160', " "):(backslashEscapes "`<\\*_^~")+ where markdownEscapes = backslashEscapes "`<\\*_^~" -- | Convert bibliographic information into Markdown header. metaToMarkdown :: WriterOptions -> Meta -> State WriterState Doc@@ -111,7 +111,7 @@ return $ title' $+$ authors' $+$ date' titleToMarkdown :: WriterOptions -> [Inline] -> State WriterState Doc-titleToMarkdown opts [] = return empty+titleToMarkdown _ [] = return empty titleToMarkdown opts lst = do contents <- inlineListToMarkdown opts lst return $ text "% " <> contents @@ -119,7 +119,7 @@ authorsToMarkdown :: [String] -> State WriterState Doc authorsToMarkdown [] = return empty authorsToMarkdown lst = return $ - text "% " <> text (joinWithSep ", " (map escapeString lst))+ text "% " <> text (intercalate ", " (map escapeString lst)) dateToMarkdown :: String -> State WriterState Doc dateToMarkdown [] = return empty@@ -142,9 +142,9 @@ -- | Ordered list start parser for use in Para below. olMarker :: GenParser Char st Char-olMarker = do (start, style, delim) <- anyOrderedListMarker+olMarker = do (start, style', delim) <- anyOrderedListMarker if delim == Period && - (style == UpperAlpha || (style == UpperRoman &&+ (style' == UpperAlpha || (style' == UpperRoman && start `elem` [1, 5, 10, 50, 100, 500, 1000])) then spaceChar >> spaceChar else spaceChar@@ -169,7 +169,7 @@ blockToMarkdown :: WriterOptions -- ^ Options -> Block -- ^ Block element -> State WriterState Doc -blockToMarkdown opts Null = return empty+blockToMarkdown _ Null = return empty blockToMarkdown opts (Plain inlines) = wrappedMarkdown opts inlines blockToMarkdown opts (Para inlines) = do@@ -180,12 +180,12 @@ then char '\\' else empty return $ esc <> contents <> text "\n"-blockToMarkdown opts (RawHtml str) = return $ text str-blockToMarkdown opts HorizontalRule = return $ text "\n* * * * *\n"+blockToMarkdown _ (RawHtml str) = return $ text str+blockToMarkdown _ HorizontalRule = return $ text "\n* * * * *\n" blockToMarkdown opts (Header level inlines) = do contents <- inlineListToMarkdown opts inlines return $ text ((replicate level '#') ++ " ") <> contents <> text "\n"-blockToMarkdown opts (CodeBlock str) = return $+blockToMarkdown opts (CodeBlock _ str) = return $ (nest (writerTabStop opts) $ vcat $ map text (lines str)) <> text "\n" blockToMarkdown opts (BlockQuote blocks) = do contents <- blockListToMarkdown opts blocks@@ -205,11 +205,10 @@ AlignDefault -> leftAlignBlock let makeRow = hsepBlocks . (zipWith alignHeader aligns) . (zipWith docToBlock widthsInChars)- let head = makeRow headers'+ let head' = makeRow headers' rows' <- mapM (\row -> do cols <- mapM (blockListToMarkdown opts) row return $ makeRow cols) rows- let tableWidth = sum widthsInChars- let maxRowHeight = maximum $ map heightOfBlock (head:rows')+ let maxRowHeight = maximum $ map heightOfBlock (head':rows') let isMultilineTable = maxRowHeight > 1 let underline = hsep $ map (\width -> text $ replicate width '-') widthsInChars@@ -220,7 +219,7 @@ then text "" else empty let body = vcat $ intersperse spacer $ map blockToDoc rows'- return $ (nest 2 $ border $+$ (blockToDoc head) $+$ underline $+$ body $+$ + return $ (nest 2 $ border $+$ (blockToDoc head') $+$ underline $+$ body $+$ border $+$ caption'') <> text "\n" blockToMarkdown opts (BulletList items) = do contents <- mapM (bulletListItemToMarkdown opts) items@@ -287,11 +286,11 @@ let label' = case find ((== label) . fst) refs of Just _ -> -- label is used; generate numerical label case find (\n -> not (any (== [Str (show n)])- (map fst refs))) [1..10000] of+ (map fst refs))) [1..(10000 :: Integer)] of Just x -> [Str (show x)] Nothing -> error "no unique label" Nothing -> label- modify (\(notes, refs) -> (notes, (label', (src,tit)):refs))+ modify (\(notes, refs') -> (notes, (label', (src,tit)):refs')) return label' -- | Convert list of Pandoc inline elements to markdown.@@ -318,17 +317,18 @@ contents <- inlineListToMarkdown opts lst let contents' = text $ substitute " " "\\ " $ render contents return $ char '~' <> contents' <> char '~'+inlineToMarkdown opts (SmallCaps lst) = inlineListToMarkdown opts lst inlineToMarkdown opts (Quoted SingleQuote lst) = do contents <- inlineListToMarkdown opts lst return $ char '\'' <> contents <> char '\'' inlineToMarkdown opts (Quoted DoubleQuote lst) = do contents <- inlineListToMarkdown opts lst return $ char '"' <> contents <> char '"'-inlineToMarkdown opts EmDash = return $ text "--"-inlineToMarkdown opts EnDash = return $ char '-'-inlineToMarkdown opts Apostrophe = return $ char '\''-inlineToMarkdown opts Ellipses = return $ text "..."-inlineToMarkdown opts (Code str) =+inlineToMarkdown _ EmDash = return $ text "--"+inlineToMarkdown _ EnDash = return $ char '-'+inlineToMarkdown _ Apostrophe = return $ char '\''+inlineToMarkdown _ Ellipses = return $ text "..."+inlineToMarkdown _ (Code str) = let tickGroups = filter (\s -> '`' `elem` s) $ group str longest = if null tickGroups then 0@@ -336,12 +336,20 @@ marker = replicate (longest + 1) '`' spacer = if (longest == 0) then "" else " " in return $ text (marker ++ spacer ++ str ++ spacer ++ marker)-inlineToMarkdown opts (Str str) = return $ text $ escapeString str-inlineToMarkdown opts (Math str) = return $ char '$' <> text str <> char '$'-inlineToMarkdown opts (TeX str) = return $ text str-inlineToMarkdown opts (HtmlInline str) = return $ text str -inlineToMarkdown opts (LineBreak) = return $ text " \n"-inlineToMarkdown opts Space = return $ char ' '+inlineToMarkdown _ (Str str) = return $ text $ escapeString str+inlineToMarkdown _ (Math InlineMath str) = return $ char '$' <> text str <> char '$'+inlineToMarkdown _ (Math DisplayMath str) = return $ text "$$" <> text str <> text "$$"+inlineToMarkdown _ (TeX str) = return $ text str+inlineToMarkdown _ (HtmlInline str) = return $ text str +inlineToMarkdown _ (LineBreak) = return $ text " \n"+inlineToMarkdown _ Space = return $ char ' '+inlineToMarkdown _ (Cite cits _ ) = do+ let format (a,b) xs = text a <>+ (if b /= [] then char '@' else empty) <>+ text b <> + (if isEmpty xs then empty else text "; ") <>+ xs+ return $ char '[' <> foldr format empty cits <> char ']' inlineToMarkdown opts (Link txt (src, tit)) = do linktext <- inlineListToMarkdown opts txt let linktitle = if null tit then empty else text $ " \"" ++ tit ++ "\""@@ -367,7 +375,7 @@ else alternate linkPart <- inlineToMarkdown opts (Link txt (source, tit)) return $ char '!' <> linkPart-inlineToMarkdown opts (Note contents) = do +inlineToMarkdown _ (Note contents) = do modify (\(notes, refs) -> (contents:notes, refs)) -- add to notes in state (notes, _) <- get let ref = show $ (length notes)
+ Text/Pandoc/Writers/MediaWiki.hs view
@@ -0,0 +1,396 @@+{-+Copyright (C) 2008 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.Writers.MediaWiki + Copyright : Copyright (C) 2006-7 John MacFarlane+ License : GNU GPL, version 2 or above ++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Conversion of 'Pandoc' documents to MediaWiki markup.++MediaWiki: <http://www.mediawiki.org/wiki/MediaWiki>+-}+module Text.Pandoc.Writers.MediaWiki ( writeMediaWiki ) where+import Text.Pandoc.Definition+import Text.Pandoc.Shared +import Text.Pandoc.XML ( escapeStringForXML )+import Data.List ( intersect )+import Network.URI ( isURI )+import Control.Monad.State++data WriterState = WriterState {+ stNotes :: Bool -- True if there are notes+ , stListLevel :: [Char] -- String at beginning of list items, e.g. "**"+ , stUseTags :: Bool -- True if we should use HTML tags because we're in a complex list+ }++-- | Convert Pandoc to MediaWiki.+writeMediaWiki :: WriterOptions -> Pandoc -> String+writeMediaWiki opts document = + evalState (pandocToMediaWiki opts document) + (WriterState { stNotes = False, stListLevel = [], stUseTags = False }) ++-- | Return MediaWiki representation of document.+pandocToMediaWiki :: WriterOptions -> Pandoc -> State WriterState String+pandocToMediaWiki opts (Pandoc _ blocks) = do+ let before = writerIncludeBefore opts+ let after = writerIncludeAfter opts+ let head' = if writerStandalone opts+ then writerHeader opts+ else ""+ let toc = if writerTableOfContents opts + then "__TOC__\n"+ else ""+ body <- blockListToMediaWiki opts blocks+ notesExist <- get >>= return . stNotes+ let notes = if notesExist+ then "\n== Notes ==\n<references />"+ else "" + return $ head' ++ before ++ toc ++ body ++ after ++ notes++-- | Escape special characters for MediaWiki.+escapeString :: String -> String+escapeString = escapeStringForXML++-- | Convert Pandoc block element to MediaWiki. +blockToMediaWiki :: WriterOptions -- ^ Options+ -> Block -- ^ Block element+ -> State WriterState String ++blockToMediaWiki _ Null = return ""++blockToMediaWiki opts (Plain inlines) = + inlineListToMediaWiki opts inlines++blockToMediaWiki opts (Para inlines) = do+ useTags <- get >>= return . stUseTags+ listLevel <- get >>= return . stListLevel+ contents <- inlineListToMediaWiki opts inlines+ return $ if useTags+ then "<p>" ++ contents ++ "</p>"+ else contents ++ if null listLevel then "\n" else ""++blockToMediaWiki _ (RawHtml str) = return str++blockToMediaWiki _ HorizontalRule = return "\n-----\n"++blockToMediaWiki opts (Header level inlines) = do+ contents <- inlineListToMediaWiki opts inlines+ let eqs = replicate (level + 1) '='+ return $ eqs ++ " " ++ contents ++ " " ++ eqs ++ "\n"++blockToMediaWiki _ (CodeBlock (_,classes,_) str) = do+ let at = classes `intersect` ["actionscript", "ada", "apache", "applescript", "asm", "asp",+ "autoit", "bash", "blitzbasic", "bnf", "c", "c_mac", "caddcl", "cadlisp", "cfdg", "cfm",+ "cpp", "cpp-qt", "csharp", "css", "d", "delphi", "diff", "div", "dos", "eiffel", "fortran",+ "freebasic", "gml", "groovy", "html4strict", "idl", "ini", "inno", "io", "java", "java5",+ "javascript", "latex", "lisp", "lua", "matlab", "mirc", "mpasm", "mysql", "nsis", "objc",+ "ocaml", "ocaml-brief", "oobas", "oracle8", "pascal", "perl", "php", "php-brief", "plsql",+ "python", "qbasic", "rails", "reg", "robots", "ruby", "sas", "scheme", "sdlbasic",+ "smalltalk", "smarty", "sql", "tcl", "", "thinbasic", "tsql", "vb", "vbnet", "vhdl", + "visualfoxpro", "winbatch", "xml", "xpp", "z80"]+ let (beg, end) = if null at+ then ("<pre" ++ if null classes then ">" else " class=\"" ++ unwords classes ++ "\">", "</pre>")+ else ("<source lang=\"" ++ head at ++ "\">", "</source>")+ return $ beg ++ escapeString str ++ end++blockToMediaWiki opts (BlockQuote blocks) = do+ contents <- blockListToMediaWiki opts blocks+ return $ "<blockquote>" ++ contents ++ "</blockquote>" ++blockToMediaWiki opts (Table caption aligns widths headers rows) = do+ let alignStrings = map alignmentToString aligns+ captionDoc <- if null caption+ then return ""+ else do+ c <- inlineListToMediaWiki opts caption+ return $ "<caption>" ++ c ++ "</caption>"+ colHeads <- colHeadsToMediaWiki opts alignStrings widths headers+ rows' <- mapM (tableRowToMediaWiki opts alignStrings) rows+ return $ "<table>\n" ++ captionDoc ++ colHeads ++ vcat rows' ++ "\n</table>"+ +blockToMediaWiki opts x@(BulletList items) = do+ oldUseTags <- get >>= return . stUseTags+ let useTags = oldUseTags || not (isSimpleList x)+ if useTags+ then do+ modify $ \s -> s { stUseTags = True }+ contents <- mapM (listItemToMediaWiki opts) items+ modify $ \s -> s { stUseTags = oldUseTags }+ return $ "<ul>\n" ++ vcat contents ++ "</ul>\n"+ else do+ modify $ \s -> s { stListLevel = stListLevel s ++ "*" }+ contents <- mapM (listItemToMediaWiki opts) items+ modify $ \s -> s { stListLevel = init (stListLevel s) }+ return $ vcat contents++blockToMediaWiki opts x@(OrderedList attribs items) = do+ oldUseTags <- get >>= return . stUseTags+ let useTags = oldUseTags || not (isSimpleList x)+ if useTags+ then do+ modify $ \s -> s { stUseTags = True }+ contents <- mapM (listItemToMediaWiki opts) items+ modify $ \s -> s { stUseTags = oldUseTags }+ return $ "<ol" ++ listAttribsToString attribs ++ ">\n" ++ vcat contents ++ "</ol>\n"+ else do+ modify $ \s -> s { stListLevel = stListLevel s ++ "#" }+ contents <- mapM (listItemToMediaWiki opts) items+ modify $ \s -> s { stListLevel = init (stListLevel s) }+ return $ vcat contents++blockToMediaWiki opts x@(DefinitionList items) = do+ oldUseTags <- get >>= return . stUseTags+ let useTags = oldUseTags || not (isSimpleList x)+ if useTags+ then do+ modify $ \s -> s { stUseTags = True }+ contents <- mapM (definitionListItemToMediaWiki opts) items+ modify $ \s -> s { stUseTags = oldUseTags }+ return $ "<dl>\n" ++ vcat contents ++ "</dl>\n"+ else do+ modify $ \s -> s { stListLevel = stListLevel s ++ ";" }+ contents <- mapM (definitionListItemToMediaWiki opts) items+ modify $ \s -> s { stListLevel = init (stListLevel s) }+ return $ vcat contents++-- Auxiliary functions for lists:++-- | Convert ordered list attributes to HTML attribute string+listAttribsToString :: ListAttributes -> String+listAttribsToString (startnum, numstyle, _) =+ let numstyle' = camelCaseToHyphenated $ show numstyle+ in (if startnum /= 1+ then " start=\"" ++ show startnum ++ "\""+ else "") +++ (if numstyle /= DefaultStyle+ then " style=\"list-style-type: " ++ numstyle' ++ ";\""+ else "")++-- | Convert bullet or ordered list item (list of blocks) to MediaWiki.+listItemToMediaWiki :: WriterOptions -> [Block] -> State WriterState String+listItemToMediaWiki opts items = do+ contents <- blockListToMediaWiki opts items+ useTags <- get >>= return . stUseTags+ if useTags+ then return $ "<li>" ++ contents ++ "</li>"+ else do+ marker <- get >>= return . stListLevel+ return $ marker ++ " " ++ contents++-- | Convert definition list item (label, list of blocks) to MediaWiki.+definitionListItemToMediaWiki :: WriterOptions+ -> ([Inline],[Block]) + -> State WriterState String+definitionListItemToMediaWiki opts (label, items) = do+ labelText <- inlineListToMediaWiki opts label+ contents <- blockListToMediaWiki opts items+ useTags <- get >>= return . stUseTags+ if useTags+ then return $ "<dt>" ++ labelText ++ "</dt>\n<dd>" ++ contents ++ "</dd>"+ else do+ marker <- get >>= return . stListLevel+ return $ marker ++ " " ++ labelText ++ "\n" ++ (init marker ++ ": ") ++ contents++-- | True if the list can be handled by simple wiki markup, False if HTML tags will be needed.+isSimpleList :: Block -> Bool+isSimpleList x =+ case x of+ BulletList items -> all isSimpleListItem items+ OrderedList (num, sty, _) items -> all isSimpleListItem items &&+ num == 1 && sty `elem` [DefaultStyle, Decimal]+ DefinitionList items -> all isSimpleListItem $ map snd items + _ -> False++-- | True if list item can be handled with the simple wiki syntax. False if+-- HTML tags will be needed.+isSimpleListItem :: [Block] -> Bool+isSimpleListItem [] = True+isSimpleListItem [x] =+ case x of+ Plain _ -> True+ Para _ -> True+ BulletList _ -> isSimpleList x+ OrderedList _ _ -> isSimpleList x+ DefinitionList _ -> isSimpleList x+ _ -> False+isSimpleListItem [x, y] | isPlainOrPara x =+ case y of+ BulletList _ -> isSimpleList y+ OrderedList _ _ -> isSimpleList y+ DefinitionList _ -> isSimpleList y+ _ -> False+isSimpleListItem _ = False++isPlainOrPara :: Block -> Bool+isPlainOrPara (Plain _) = True+isPlainOrPara (Para _) = True+isPlainOrPara _ = False++tr :: String -> String +tr x = "<tr>\n" ++ x ++ "\n</tr>"++-- | Concatenates strings with line breaks between them.+vcat :: [String] -> String+vcat [] = ""+vcat [x] = x+vcat (x:xs) = x ++ "\n" ++ vcat xs++-- Auxiliary functions for tables:++colHeadsToMediaWiki :: WriterOptions+ -> [[Char]]+ -> [Double]+ -> [[Block]]+ -> State WriterState String+colHeadsToMediaWiki opts alignStrings widths headers = do+ heads <- sequence $ zipWith3 + (\alignment columnwidth item -> tableItemToMediaWiki opts "th" alignment columnwidth item) + alignStrings widths headers+ return $ tr $ vcat heads++alignmentToString :: Alignment -> [Char]+alignmentToString alignment = case alignment of+ AlignLeft -> "left"+ AlignRight -> "right"+ AlignCenter -> "center"+ AlignDefault -> "left"++tableRowToMediaWiki :: WriterOptions+ -> [[Char]]+ -> [[Block]]+ -> State WriterState String+tableRowToMediaWiki opts aligns columns = + (sequence $ zipWith3 (tableItemToMediaWiki opts "td") aligns (repeat 0) columns) >>=+ return . tr . vcat++tableItemToMediaWiki :: WriterOptions+ -> [Char]+ -> [Char]+ -> Double+ -> [Block]+ -> State WriterState String+tableItemToMediaWiki opts tag' align' width' item = do+ contents <- blockListToMediaWiki opts item+ let attrib = " align=\"" ++ align' ++ "\"" +++ if width' /= 0+ then " style=\"width: " ++ (show (truncate (100 * width') :: Integer)) ++ "%;\""+ else "" + return $ "<" ++ tag' ++ attrib ++ ">" ++ contents ++ "<" ++ tag' ++ ">"++-- | Convert list of Pandoc block elements to MediaWiki.+blockListToMediaWiki :: WriterOptions -- ^ Options+ -> [Block] -- ^ List of block elements+ -> State WriterState String +blockListToMediaWiki opts blocks =+ mapM (blockToMediaWiki opts) blocks >>= return . vcat++-- | Convert list of Pandoc inline elements to MediaWiki.+inlineListToMediaWiki :: WriterOptions -> [Inline] -> State WriterState String+inlineListToMediaWiki opts lst =+ mapM (inlineToMediaWiki opts) lst >>= return . concat++-- | Convert Pandoc inline element to MediaWiki.+inlineToMediaWiki :: WriterOptions -> Inline -> State WriterState String++inlineToMediaWiki opts (Emph lst) = do + contents <- inlineListToMediaWiki opts lst+ return $ "''" ++ contents ++ "''" ++inlineToMediaWiki opts (Strong lst) = do+ contents <- inlineListToMediaWiki opts lst+ return $ "'''" ++ contents ++ "'''"++inlineToMediaWiki opts (Strikeout lst) = do+ contents <- inlineListToMediaWiki opts lst+ return $ "<s>" ++ contents ++ "</s>"++inlineToMediaWiki opts (Superscript lst) = do+ contents <- inlineListToMediaWiki opts lst+ return $ "<sup>" ++ contents ++ "</sup>"++inlineToMediaWiki opts (Subscript lst) = do+ contents <- inlineListToMediaWiki opts lst+ return $ "<sub>" ++ contents ++ "</sub>"++inlineToMediaWiki opts (SmallCaps lst) = inlineListToMediaWiki opts lst++inlineToMediaWiki opts (Quoted SingleQuote lst) = do+ contents <- inlineListToMediaWiki opts lst+ return $ "‘" ++ contents ++ "’"++inlineToMediaWiki opts (Quoted DoubleQuote lst) = do+ contents <- inlineListToMediaWiki opts lst+ return $ "“" ++ contents ++ "”"++inlineToMediaWiki opts (Cite _ lst) = inlineListToMediaWiki opts lst++inlineToMediaWiki _ EmDash = return "—"++inlineToMediaWiki _ EnDash = return "–"++inlineToMediaWiki _ Apostrophe = return "’"++inlineToMediaWiki _ Ellipses = return "…"++inlineToMediaWiki _ (Code str) =+ return $ "<tt>" ++ (escapeString str) ++ "</tt>"++inlineToMediaWiki _ (Str str) = return $ escapeString str++inlineToMediaWiki _ (Math _ str) = return $ "<math>" ++ str ++ "</math>"+ -- note: str should NOT be escaped++inlineToMediaWiki _ (TeX _) = return ""++inlineToMediaWiki _ (HtmlInline str) = return str ++inlineToMediaWiki _ (LineBreak) = return "<br />\n"++inlineToMediaWiki _ Space = return " "++inlineToMediaWiki opts (Link txt (src, _)) = do+ link <- inlineListToMediaWiki opts txt+ let useAuto = txt == [Code src]+ let src' = if isURI src+ then src+ else if take 1 src == "/"+ then "http://{{SERVERNAME}}" ++ src+ else "http://{{SERVERNAME}}/" ++ src+ return $ if useAuto+ then src'+ else "[" ++ src' ++ " " ++ link ++ "]"++inlineToMediaWiki opts (Image alt (source, tit)) = do+ alt' <- inlineListToMediaWiki opts alt+ let txt = if (null tit)+ then if null alt+ then ""+ else "|" ++ alt'+ else "|" ++ tit+ return $ "[[Image:" ++ source ++ txt ++ "]]"++inlineToMediaWiki opts (Note contents) = do + contents' <- blockListToMediaWiki opts contents+ modify (\s -> s { stNotes = True })+ return $ "<ref>" ++ contents' ++ "</ref>"+ -- note - may not work for notes with multiple blocks
+ Text/Pandoc/Writers/OpenDocument.hs view
@@ -0,0 +1,568 @@+{-# LANGUAGE PatternGuards #-}+{-+Copyright (C) 2008 Andrea Rossato <andrea.rossato@ing.unitn.it>++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.Writers.OpenDocument+ Copyright : Copyright (C) 2008 Andrea Rossato+ License : GNU GPL, version 2 or above++ Maintainer : Andrea Rossato <andrea.rossato@ing.unitn.it>+ Stability : alpha+ Portability : portable++Conversion of 'Pandoc' documents to OpenDocument XML.+-}+module Text.Pandoc.Writers.OpenDocument ( writeOpenDocument ) where+import Text.Pandoc.Definition+import Text.Pandoc.Shared+import Text.Pandoc.XML+import Text.Pandoc.Readers.TeXMath+import Text.PrettyPrint.HughesPJ hiding ( Str )+import Text.Printf ( printf )+import Control.Applicative ( (<$>) )+import Control.Arrow ( (***), (>>>) )+import Control.Monad.State hiding ( when )+import Data.Char (chr)+import Data.List (intercalate)++-- | Auxiliary function to convert Plain block to Para.+plainToPara :: Block -> Block+plainToPara (Plain x) = Para x+plainToPara x = x++--+-- OpenDocument writer+--++data WriterState =+ WriterState { stNotes :: [Doc]+ , stTableStyles :: [Doc]+ , stParaStyles :: [Doc]+ , stListStyles :: [(Int, [Doc])]+ , stTextStyles :: [Doc]+ , stTextStyleAttr :: [(TextStyle,[(String,String)])]+ , stIndentPara :: Int+ , stInDefinition :: Bool+ , stTight :: Bool+ }++defaultWriterState :: WriterState+defaultWriterState =+ WriterState { stNotes = []+ , stTableStyles = []+ , stParaStyles = []+ , stListStyles = []+ , stTextStyles = []+ , stTextStyleAttr = []+ , stIndentPara = 0+ , stInDefinition = False+ , stTight = False+ }++when :: Bool -> Doc -> Doc+when p a = if p then a else empty++addTableStyle :: Doc -> State WriterState ()+addTableStyle i = modify $ \s -> s { stTableStyles = i : stTableStyles s }++addNote :: Doc -> State WriterState ()+addNote i = modify $ \s -> s { stNotes = i : stNotes s }++addParaStyle :: Doc -> State WriterState ()+addParaStyle i = modify $ \s -> s { stParaStyles = i : stParaStyles s }++addTextStyle :: Doc -> State WriterState ()+addTextStyle i = modify $ \s -> s { stTextStyles = i : stTextStyles s }++addTextStyleAttr :: (TextStyle, [(String,String)]) -> State WriterState ()+addTextStyleAttr i = modify $ \s -> s { stTextStyleAttr = i : stTextStyleAttr s }++rmTextStyleAttr :: State WriterState ()+rmTextStyleAttr = modify $ \s -> s { stTextStyleAttr = rmHead (stTextStyleAttr s) }+ where rmHead l = if l /= [] then tail l else []++increaseIndent :: State WriterState ()+increaseIndent = modify $ \s -> s { stIndentPara = 1 + stIndentPara s }++resetIndent :: State WriterState ()+resetIndent = modify $ \s -> s { stIndentPara = (stIndentPara s) - 1 }++inTightList :: State WriterState a -> State WriterState a+inTightList f = modify (\s -> s { stTight = True }) >> f >>= \r ->+ modify (\s -> s { stTight = False }) >> return r++setInDefinitionList :: Bool -> State WriterState ()+setInDefinitionList b = modify $ \s -> s { stInDefinition = b }++inParagraphTags :: Doc -> Doc+inParagraphTags = inTags False "text:p" [("text:style-name", "Text_20_body")]++inParagraphTagsWithStyle :: String -> Doc -> Doc+inParagraphTagsWithStyle sty = inTags False "text:p" [("text:style-name", sty)]++inSpanTags :: String -> Doc -> Doc+inSpanTags s = inTags False "text:span" [("text:style-name",s)]++withTextStyle :: TextStyle -> State WriterState a -> State WriterState a+withTextStyle s f = addTextStyleAttr (s,textStyleAttr s) >>+ f >>= \r -> rmTextStyleAttr >> return r++inTextStyle :: Doc -> State WriterState Doc+inTextStyle d = do+ at <- gets stTextStyleAttr+ if at == []+ then return d+ else do+ tn <- (+) 1 . length <$> gets stTextStyles+ addTextStyle $ inTags False "style:style" [("style:name" , "T" ++ show tn)+ ,("style:family", "text" )]+ $ selfClosingTag "style:text-properties" (concatMap snd at)+ return $ inTags False "text:span" [("text:style-name","T" ++ show tn)] d++inHeaderTags :: Int -> Doc -> Doc+inHeaderTags i = inTags False "text:h" [ ("text:style-name", "Heading_20_" ++ show i)+ , ("text:outline-level", show i)]++inQuotes :: QuoteType -> Doc -> Doc+inQuotes SingleQuote s = text "‘" <> s <> text "’"+inQuotes DoubleQuote s = text "“" <> s <> text "”"++handleSpaces :: String -> Doc+handleSpaces s+ | ( ' ':_) <- s = genTag s+ | ('\t':x) <- s = selfClosingTag "text:tab" [] <> rm x+ | otherwise = rm s+ where+ genTag = span (==' ') >>> tag . length *** rm >>> uncurry (<>)+ tag n = when (n /= 0) $ selfClosingTag "text:s" [("text:c", show n)]+ rm ( ' ':xs) = char ' ' <> genTag xs+ rm ('\t':xs) = selfClosingTag "text:tab" [] <> genTag xs+ rm ( x:xs) = char x <> rm xs+ rm [] = empty++-- | Convert list of authors to a docbook <author> section+authorToOpenDocument :: [Char] -> Doc+authorToOpenDocument name =+ if ',' `elem` name+ then -- last name first+ let (lastname, rest) = break (==',') name+ firstname = removeLeadingSpace rest+ in inParagraphTagsWithStyle "Author" $+ (text $ escapeStringForXML firstname) <+>+ (text $ escapeStringForXML lastname)+ else -- last name last+ let namewords = words name+ lengthname = length namewords+ (firstname, lastname) = case lengthname of+ 0 -> ("","")+ 1 -> ("", name)+ n -> (intercalate " " (take (n-1) namewords), last namewords)+ in inParagraphTagsWithStyle "Author" $+ (text $ escapeStringForXML firstname) <+>+ (text $ escapeStringForXML lastname)++-- | Convert Pandoc document to string in OpenDocument format.+writeOpenDocument :: WriterOptions -> Pandoc -> String+writeOpenDocument opts (Pandoc (Meta title authors date) blocks) =+ let root = inTags True "office:document-content" openDocumentNameSpaces+ header = when (writerStandalone opts) $ text (writerHeader opts)+ title' = case runState (wrap opts title) defaultWriterState of+ (t,_) -> if isEmpty t then empty else inHeaderTags 1 t+ authors' = when (authors /= []) $ vcat (map authorToOpenDocument authors)+ date' = when (date /= []) $+ inParagraphTagsWithStyle "Date" (text $ escapeStringForXML date)+ meta = when (writerStandalone opts) $ title' $$ authors' $$ date'+ before = writerIncludeBefore opts+ after = writerIncludeAfter opts+ (doc, s) = runState (blocksToOpenDocument opts blocks) defaultWriterState+ body = (if null before then empty else text before) $$+ doc $$+ (if null after then empty else text after)+ body' = if writerStandalone opts+ then inTagsIndented "office:body" $+ inTagsIndented "office:text" (meta $$ body)+ else body+ styles = stTableStyles s ++ stParaStyles s ++ stTextStyles s+ listStyle (n,l) = inTags True "text:list-style" [("style:name", "L" ++ show n)] (vcat l)+ listStyles = map listStyle (stListStyles s)+ in render $ header $$ root (generateStyles (styles ++ listStyles) $$ body' $$ text "")++withParagraphStyle :: WriterOptions -> String -> [Block] -> State WriterState Doc+withParagraphStyle o s (b:bs)+ | Para l <- b = go =<< inParagraphTagsWithStyle s <$> inlinesToOpenDocument o l+ | otherwise = go =<< blockToOpenDocument o b+ where go i = ($$) i <$> withParagraphStyle o s bs+withParagraphStyle _ _ [] = return empty++inPreformattedTags :: String -> State WriterState Doc+inPreformattedTags s = do+ n <- paraStyle "Preformatted_20_Text" []+ return . inParagraphTagsWithStyle ("P" ++ show n) . handleSpaces $ s++orderedListToOpenDocument :: WriterOptions -> Int -> [[Block]] -> State WriterState Doc+orderedListToOpenDocument o pn bs =+ vcat . map (inTagsIndented "text:list-item") <$>+ mapM (orderedItemToOpenDocument o pn . map plainToPara) bs++orderedItemToOpenDocument :: WriterOptions -> Int -> [Block] -> State WriterState Doc+orderedItemToOpenDocument o n (b:bs)+ | OrderedList a l <- b = newLevel a l+ | Para l <- b = go =<< inParagraphTagsWithStyle ("P" ++ show n) <$> inlinesToOpenDocument o l+ | otherwise = go =<< blockToOpenDocument o b+ where+ go i = ($$) i <$> orderedItemToOpenDocument o n bs+ newLevel a l = do+ nn <- length <$> gets stParaStyles+ ls <- head <$> gets stListStyles+ modify $ \s -> s { stListStyles = orderedListLevelStyle a ls : tail (stListStyles s) }+ inTagsIndented "text:list" <$> orderedListToOpenDocument o nn l+orderedItemToOpenDocument _ _ [] = return empty++isTightList :: [[Block]] -> Bool+isTightList [] = False+isTightList (b:_)+ | Plain {} : _ <- b = True+ | otherwise = False++newOrderedListStyle :: Bool -> ListAttributes -> State WriterState (Int,Int)+newOrderedListStyle b a = do+ ln <- (+) 1 . length <$> gets stListStyles+ let nbs = orderedListLevelStyle a (ln, [])+ pn <- if b then inTightList (paraListStyle ln) else paraListStyle ln+ modify $ \s -> s { stListStyles = nbs : stListStyles s }+ return (ln,pn)++bulletListToOpenDocument :: WriterOptions -> [[Block]] -> State WriterState Doc+bulletListToOpenDocument o b = do+ ln <- (+) 1 . length <$> gets stListStyles+ (pn,ns) <- if isTightList b then inTightList (bulletListStyle ln) else bulletListStyle ln+ modify $ \s -> s { stListStyles = ns : stListStyles s }+ is <- listItemsToOpenDocument ("P" ++ show pn) o b+ return $ inTags True "text:list" [("text:style-name", "L" ++ show ln)] is++listItemsToOpenDocument :: String -> WriterOptions -> [[Block]] -> State WriterState Doc+listItemsToOpenDocument s o is =+ vcat . map (inTagsIndented "text:list-item") <$> mapM (withParagraphStyle o s . map plainToPara) is++deflistItemToOpenDocument :: WriterOptions -> ([Inline],[Block]) -> State WriterState Doc+deflistItemToOpenDocument o (t,d) = do+ let ts = if isTightList [d]+ then "Definition_20_Term_20_Tight" else "Definition_20_Term"+ ds = if isTightList [d]+ then "Definition_20_Definition_20_Tight" else "Definition_20_Definition"+ t' <- withParagraphStyle o ts [Para t]+ d' <- withParagraphStyle o ds (map plainToPara d)+ return $ t' $$ d'++inBlockQuote :: WriterOptions -> Int -> [Block] -> State WriterState Doc+inBlockQuote o i (b:bs)+ | BlockQuote l <- b = do increaseIndent+ ni <- paraStyle "Quotations" []+ go =<< inBlockQuote o ni (map plainToPara l)+ | Para l <- b = do go =<< inParagraphTagsWithStyle ("P" ++ show i) <$> inlinesToOpenDocument o l+ | otherwise = do go =<< blockToOpenDocument o b+ where go block = ($$) block <$> inBlockQuote o i bs+inBlockQuote _ _ [] = resetIndent >> return empty++-- | Convert a list of Pandoc blocks to OpenDocument.+blocksToOpenDocument :: WriterOptions -> [Block] -> State WriterState Doc+blocksToOpenDocument o b = vcat <$> mapM (blockToOpenDocument o) b++-- | Convert a Pandoc block element to OpenDocument.+blockToOpenDocument :: WriterOptions -> Block -> State WriterState Doc+blockToOpenDocument o bs+ | Plain b <- bs = inParagraphTags <$> wrap o b+ | Para b <- bs = inParagraphTags <$> wrap o b+ | Header i b <- bs = inHeaderTags i <$> wrap o b+ | BlockQuote b <- bs = mkBlockQuote b+ | CodeBlock _ s <- bs = preformatted s+ | RawHtml _ <- bs = return empty+ | DefinitionList b <- bs = defList b+ | BulletList b <- bs = bulletListToOpenDocument o b+ | OrderedList a b <- bs = orderedList a b+ | Table c a w h r <- bs = table c a w h r+ | Null <- bs = return empty+ | HorizontalRule <- bs = return empty+ | otherwise = return empty+ where+ defList b = do setInDefinitionList True+ r <- vcat <$> mapM (deflistItemToOpenDocument o) b+ setInDefinitionList False+ return r+ preformatted s = vcat <$> mapM (inPreformattedTags . escapeStringForXML) (lines s)+ mkBlockQuote b = do increaseIndent+ i <- paraStyle "Quotations" []+ inBlockQuote o i (map plainToPara b)+ orderedList a b = do (ln,pn) <- newOrderedListStyle (isTightList b) a+ inTags True "text:list" [ ("text:style-name", "L" ++ show ln)]+ <$> orderedListToOpenDocument o pn b+ table c a w h r = do+ tn <- length <$> gets stTableStyles+ pn <- length <$> gets stParaStyles+ let genIds = map chr [65..]+ name = "Table" ++ show (tn + 1)+ columnIds = zip genIds w+ mkColumn n = selfClosingTag "table:table-column" [("table:style-name", name ++ "." ++ [fst n])]+ columns = map mkColumn columnIds+ paraHStyles = paraTableStyles "Heading" pn a+ paraStyles = paraTableStyles "Contents" (pn + length (newPara paraHStyles)) a+ newPara = map snd . filter (not . isEmpty . snd)+ addTableStyle $ tableStyle tn columnIds+ mapM_ addParaStyle . newPara $ paraHStyles ++ paraStyles+ captionDoc <- if null c+ then return empty+ else withParagraphStyle o "Caption" [Para c]+ th <- colHeadsToOpenDocument o name (map fst paraHStyles) h+ tr <- mapM (tableRowToOpenDocument o name (map fst paraStyles)) r+ return $ inTags True "table:table" [ ("table:name" , name)+ , ("table:style-name", name)+ ] (vcat columns $$ th $$ vcat tr) $$ captionDoc++colHeadsToOpenDocument :: WriterOptions -> String -> [String] -> [[Block]] -> State WriterState Doc+colHeadsToOpenDocument o tn ns hs =+ inTagsIndented "table:table-header-rows" . inTagsIndented "table:table-row" . vcat <$>+ mapM (tableItemToOpenDocument o tn) (zip ns hs)++tableRowToOpenDocument :: WriterOptions -> String -> [String] -> [[Block]] -> State WriterState Doc+tableRowToOpenDocument o tn ns cs =+ inTagsIndented "table:table-row" . vcat <$>+ mapM (tableItemToOpenDocument o tn) (zip ns cs)++tableItemToOpenDocument :: WriterOptions -> String -> (String,[Block])-> State WriterState Doc+tableItemToOpenDocument o tn (n,i) =+ let a = [ ("table:style-name" , tn ++ ".A1" )+ , ("office:value-type", "string" )+ ]+ in inTags True "table:table-cell" a <$>+ withParagraphStyle o n (map plainToPara i)++-- | Take list of inline elements and return wrapped doc.+wrap :: WriterOptions -> [Inline] -> State WriterState Doc+wrap o l = if writerWrapText o+ then fsep <$> mapM (inlinesToOpenDocument o) (splitBy Space l)+ else inlinesToOpenDocument o l++-- | Convert a list of inline elements to OpenDocument.+inlinesToOpenDocument :: WriterOptions -> [Inline] -> State WriterState Doc+inlinesToOpenDocument o l = hcat <$> mapM (inlineToOpenDocument o) l++-- | Convert an inline element to OpenDocument.+inlineToOpenDocument :: WriterOptions -> Inline -> State WriterState Doc+inlineToOpenDocument o ils+ | Ellipses <- ils = inTextStyle $ text "…"+ | EmDash <- ils = inTextStyle $ text "—"+ | EnDash <- ils = inTextStyle $ text "–"+ | Apostrophe <- ils = inTextStyle $ text "’"+ | Space <- ils = inTextStyle $ char ' '+ | LineBreak <- ils = return $ selfClosingTag "text:line-break" []+ | Str s <- ils = inTextStyle $ handleSpaces $ escapeStringForXML s+ | Emph l <- ils = withTextStyle Italic $ inlinesToOpenDocument o l+ | Strong l <- ils = withTextStyle Bold $ inlinesToOpenDocument o l+ | Strikeout l <- ils = withTextStyle Strike $ inlinesToOpenDocument o l+ | Superscript l <- ils = withTextStyle Sup $ inlinesToOpenDocument o l+ | Subscript l <- ils = withTextStyle Sub $ inlinesToOpenDocument o l+ | SmallCaps l <- ils = withTextStyle SmallC $ inlinesToOpenDocument o l+ | Quoted t l <- ils = inQuotes t <$> inlinesToOpenDocument o l+ | Code s <- ils = preformatted s+ | Math _ s <- ils = inlinesToOpenDocument o (readTeXMath s)+ | Cite _ l <- ils = inlinesToOpenDocument o l+ | TeX s <- ils = preformatted s+ | HtmlInline s <- ils = preformatted s+ | Link l (s,t) <- ils = mkLink s t <$> inlinesToOpenDocument o l+ | Image _ (s,_) <- ils = return $ mkImg s+ | Note l <- ils = mkNote l+ | otherwise = return empty+ where+ preformatted = return . inSpanTags "Teletype" . handleSpaces . escapeStringForXML+ mkLink s t = inTags False "text:a" [ ("xlink:type" , "simple")+ , ("xlink:href" , s )+ , ("office:name", t )+ ] . inSpanTags "Definition"+ mkImg s = inTags False "draw:frame" [] $+ selfClosingTag "draw:image" [ ("xlink:href" , s )+ , ("xlink:type" , "simple")+ , (" xlink:show" , "embed" )+ , ("xlink:actuate", "onLoad")]+ mkNote l = do+ n <- length <$> gets stNotes+ let footNote t = inTags False "text:note"+ [ ("text:id" , "ftn" ++ show n)+ , ("text:note-class", "footnote" )] $+ inTagsSimple "text:note-citation" (text . show $ n + 1) $$+ inTagsSimple "text:note-body" t+ nn <- footNote <$> withParagraphStyle o "Footnote" l+ addNote nn+ return nn++generateStyles :: [Doc] -> Doc+generateStyles acc =+ let scripts = selfClosingTag "office:scripts" []+ fonts = inTagsIndented "office:font-face-decls"+ (vcat $ map font ["Lucida Sans Unicode", "Tahoma", "Times New Roman"])+ font fn = selfClosingTag "style:font-face"+ [ ("style:name" , "'" ++ fn ++ "'")+ , ("svg:font-family", fn )]+ in scripts $$ fonts $$ inTagsIndented "office:automatic-styles" (vcat $ reverse acc)++bulletListStyle :: Int -> State WriterState (Int,(Int,[Doc]))+bulletListStyle l =+ let doStyles i = inTags True "text:list-level-style-bullet"+ [ ("text:level" , show (i + 1) )+ , ("text:style-name" , "Bullet_20_Symbols")+ , ("style:num-suffix", "." )+ , ("text:bullet-char", [bulletList !! i] )+ ] (listLevelStyle (1 + i))+ bulletList = map chr $ cycle [8226,8227,8259]+ listElStyle = map doStyles [0..9]+ in do pn <- paraListStyle l+ return (pn, (l, listElStyle))++orderedListLevelStyle :: ListAttributes -> (Int, [Doc]) -> (Int,[Doc])+orderedListLevelStyle (s,n, d) (l,ls) =+ let suffix = case d of+ OneParen -> [("style:num-suffix", ")")]+ TwoParens -> [("style:num-prefix", "(")+ ,("style:num-suffix", ")")]+ _ -> [("style:num-suffix", ".")]+ format = case n of+ UpperAlpha -> "A"+ LowerAlpha -> "a"+ UpperRoman -> "I"+ LowerRoman -> "i"+ _ -> "1"+ listStyle = inTags True "text:list-level-style-number"+ ([ ("text:level" , show $ 1 + length ls )+ , ("text:style-name" , "Numbering_20_Symbols")+ , ("style:num-format", format )+ , ("text:start-value", show s )+ ] ++ suffix) (listLevelStyle (1 + length ls))+ in (l, ls ++ [listStyle])++listLevelStyle :: Int -> Doc+listLevelStyle i =+ let indent = show (0.25 * fromIntegral i :: Double) in+ selfClosingTag "style:list-level-properties"+ [ ("text:space-before" , indent ++ "in")+ , ("text:min-label-width", "0.25in")]++tableStyle :: Int -> [(Char,Double)] -> Doc+tableStyle num wcs =+ let tableId = "Table" ++ show (num + 1)+ table = inTags True "style:style"+ [("style:name", tableId)] $+ selfClosingTag "style:table-properties"+ [ ("style:rel-width", "100%" )+ , ("table:align" , "center")]+ colStyle (c,w) = inTags True "style:style"+ [ ("style:name" , tableId ++ "." ++ [c])+ , ("style:family", "table-column" )] $+ selfClosingTag "style:table-column-properties"+ [("style:column-width", printf "%.2f" (7 * w) ++ "in")]+ cellStyle = inTags True "style:style"+ [ ("style:name" , tableId ++ ".A1")+ , ("style:family", "table-cell" )] $+ selfClosingTag "style:table-cell-properties"+ [ ("fo:border", "none")]+ columnStyles = map colStyle wcs+ in table $$ vcat columnStyles $$ cellStyle++paraStyle :: String -> [(String,String)] -> State WriterState Int+paraStyle parent attrs = do+ pn <- (+) 1 . length <$> gets stParaStyles+ i <- (*) 0.5 . fromIntegral <$> gets stIndentPara :: State WriterState Double+ b <- gets stInDefinition+ t <- gets stTight+ let styleAttr = [ ("style:name" , "P" ++ show pn)+ , ("style:family" , "paragraph" )+ , ("style:parent-style-name", parent )]+ indentVal = flip (++) "in" . show $ if b then (max 0.5 i) else i+ tight = if t then [ ("fo:margin-top" , "0in" )+ , ("fo:margin-bottom" , "0in" )]+ else []+ indent = when (i /= 0 || b || t) $+ selfClosingTag "style:paragraph-properties" $+ [ ("fo:margin-left" , indentVal)+ , ("fo:margin-right" , "0in" )+ , ("fo:text-indent" , "0in" )+ , ("style:auto-text-indent" , "false" )]+ ++ tight+ addParaStyle $ inTags True "style:style" (styleAttr ++ attrs) indent+ return pn++paraListStyle :: Int -> State WriterState Int+paraListStyle l = paraStyle "Text_20_body" [("style:list-style-name", "L" ++ show l )]++paraTableStyles :: String -> Int -> [Alignment] -> [(String, Doc)]+paraTableStyles _ _ [] = []+paraTableStyles t s (a:xs)+ | AlignRight <- a = ( pName s, res s "end" ) : paraTableStyles t (s + 1) xs+ | AlignCenter <- a = ( pName s, res s "center") : paraTableStyles t (s + 1) xs+ | otherwise = ("Table_20_" ++ t, empty ) : paraTableStyles t s xs+ where pName sn = "P" ++ show (sn + 1)+ res sn x = inTags True "style:style"+ [ ("style:name" , pName sn )+ , ("style:family" , "paragraph" )+ , ("style:parent-style-name", "Table_20_" ++ t)] $+ selfClosingTag "style:paragraph-properties"+ [ ("fo:text-align", x)+ , ("style:justify-single-word", "false")]++data TextStyle = Italic | Bold | Strike | Sub | Sup | SmallC deriving ( Eq )++textStyleAttr :: TextStyle -> [(String,String)]+textStyleAttr s+ | Italic <- s = [("fo:font-style" ,"italic" )+ ,("style:font-style-asian" ,"italic" )+ ,("style:font-style-complex" ,"italic" )]+ | Bold <- s = [("fo:font-weight" ,"bold" )+ ,("style:font-weight-asian" ,"bold" )+ ,("style:font-weight-complex" ,"bold" )]+ | Strike <- s = [("style:text-line-through-style", "solid" )]+ | Sub <- s = [("style:text-position" ,"sub 58%" )]+ | Sup <- s = [("style:text-position" ,"super 58%" )]+ | SmallC <- s = [("fo:font-variant" ,"small-caps")]+ | otherwise = []++openDocumentNameSpaces :: [(String, String)]+openDocumentNameSpaces =+ [ ("xmlns:office" , "urn:oasis:names:tc:opendocument:xmlns:office:1.0" )+ , ("xmlns:style" , "urn:oasis:names:tc:opendocument:xmlns:style:1.0" )+ , ("xmlns:text" , "urn:oasis:names:tc:opendocument:xmlns:text:1.0" )+ , ("xmlns:table" , "urn:oasis:names:tc:opendocument:xmlns:table:1.0" )+ , ("xmlns:draw" , "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" )+ , ("xmlns:fo" , "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0")+ , ("xmlns:xlink" , "http://www.w3.org/1999/xlink" )+ , ("xmlns:dc" , "http://purl.org/dc/elements/1.1/" )+ , ("xmlns:meta" , "urn:oasis:names:tc:opendocument:xmlns:meta:1.0" )+ , ("xmlns:number" , "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" )+ , ("xmlns:svg" , "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" )+ , ("xmlns:chart" , "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" )+ , ("xmlns:dr3d" , "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" )+ , ("xmlns:math" , "http://www.w3.org/1998/Math/MathML" )+ , ("xmlns:form" , "urn:oasis:names:tc:opendocument:xmlns:form:1.0" )+ , ("xmlns:script" , "urn:oasis:names:tc:opendocument:xmlns:script:1.0" )+ , ("xmlns:ooo" , "http://openoffice.org/2004/office" )+ , ("xmlns:ooow" , "http://openoffice.org/2004/writer" )+ , ("xmlns:oooc" , "http://openoffice.org/2004/calc" )+ , ("xmlns:dom" , "http://www.w3.org/2001/xml-events" )+ , ("xmlns:xforms" , "http://www.w3.org/2002/xforms" )+ , ("xmlns:xsd" , "http://www.w3.org/2001/XMLSchema" )+ , ("xmlns:xsi" , "http://www.w3.org/2001/XMLSchema-instance" )+ , ("office:version", "1.0" )+ ]
Text/Pandoc/Writers/RST.hs view
@@ -32,14 +32,11 @@ module Text.Pandoc.Writers.RST ( writeRST) where import Text.Pandoc.Definition import Text.Pandoc.Shared -import Text.Pandoc.Readers.TeXMath import Text.Pandoc.Blocks import Data.List ( isPrefixOf, isSuffixOf, drop, intersperse ) import Text.PrettyPrint.HughesPJ hiding ( Str ) import Control.Monad.State -type Notes = [[Block]]-type Refs = KeyTable data WriterState = WriterState { stNotes :: [[Block]] , stLinks :: KeyTable@@ -65,9 +62,9 @@ before' = if null before then empty else text before after' = if null after then empty else text after metaBlock <- metaToRST opts meta- let head = if (writerStandalone opts)- then metaBlock $+$ text (writerHeader opts)- else empty+ let head' = if (writerStandalone opts)+ then metaBlock $+$ text (writerHeader opts)+ else empty body <- blockListToRST blocks includes <- get >>= (return . concat . stIncludes) let includes' = if null includes then empty else text includes@@ -75,7 +72,7 @@ -- note that the notes may contain refs, so we do them first refs <- get >>= (keyTableToRST . reverse . stLinks) pics <- get >>= (pictTableToRST . reverse . stImages)- return $ head $+$ before' $+$ includes' $+$ body $+$ notes $+$ text "" $+$+ return $ head' $+$ before' $+$ includes' $+$ body $+$ notes $+$ text "" $+$ refs $+$ pics $+$ after' -- | Return RST representation of reference key table.@@ -85,7 +82,7 @@ -- | Return RST representation of a reference key. keyToRST :: ([Inline], (String, String)) -> State WriterState Doc-keyToRST (label, (src, tit)) = do+keyToRST (label, (src, _)) = do label' <- inlineListToRST label let label'' = if ':' `elem` (render label') then char '`' <> label' <> char '`'@@ -179,7 +176,7 @@ let headerChar = if level > 5 then ' ' else "=-~^'" !! (level - 1) let border = text $ replicate headerLength headerChar return $ contents $+$ border <> text "\n"-blockToRST (CodeBlock str) = do+blockToRST (CodeBlock _ str) = do tabstop <- get >>= (return . writerTabStop . stOptions) return $ (text "::\n") $+$ (nest tabstop $ vcat $ map text (lines str)) <> text "\n"@@ -187,46 +184,39 @@ tabstop <- get >>= (return . writerTabStop . stOptions) contents <- blockListToRST blocks return $ (nest tabstop contents) <> text "\n"-blockToRST (Table caption aligns widths headers rows) = do+blockToRST (Table caption _ widths headers rows) = do caption' <- inlineListToRST caption let caption'' = if null caption then empty else text "" $+$ (text "Table: " <> caption') headers' <- mapM blockListToRST headers let widthsInChars = map (floor . (78 *)) widths- let alignHeader alignment = case alignment of- AlignLeft -> leftAlignBlock- AlignCenter -> centerAlignBlock- AlignRight -> rightAlignBlock- AlignDefault -> leftAlignBlock let hpipeBlocks blocks = hcatBlocks [beg, middle, end] where height = maximum (map heightOfBlock blocks)- sep = TextBlock 3 height (replicate height " | ")+ sep' = TextBlock 3 height (replicate height " | ") beg = TextBlock 2 height (replicate height "| ") end = TextBlock 2 height (replicate height " |")- middle = hcatBlocks $ intersperse sep blocks+ middle = hcatBlocks $ intersperse sep' blocks let makeRow = hpipeBlocks . zipWith docToBlock widthsInChars- let head = makeRow headers'+ let head' = makeRow headers' rows' <- mapM (\row -> do cols <- mapM blockListToRST row return $ makeRow cols) rows- let tableWidth = sum widthsInChars- let maxRowHeight = maximum $ map heightOfBlock (head:rows') let border ch = char '+' <> char ch <> (hcat $ intersperse (char ch <> char '+' <> char ch) $ map (\l -> text $ replicate l ch) widthsInChars) <> char ch <> char '+' let body = vcat $ intersperse (border '-') $ map blockToDoc rows'- return $ border '-' $+$ blockToDoc head $+$ border '=' $+$ body $+$ + return $ border '-' $+$ blockToDoc head' $+$ border '=' $+$ body $+$ border '-' $$ caption'' $$ text "" blockToRST (BulletList items) = do contents <- mapM bulletListItemToRST items -- ensure that sublists have preceding blank line return $ text "" $+$ vcat contents <> text "\n"-blockToRST (OrderedList (start, style, delim) items) = do- let markers = if start == 1 && style == DefaultStyle && delim == DefaultDelim +blockToRST (OrderedList (start, style', delim) items) = do+ let markers = if start == 1 && style' == DefaultStyle && delim == DefaultDelim then take (length items) $ repeat "#." else take (length items) $ orderedListMarkers - (start, style, delim)+ (start, style', delim) let maxMarkerLength = maximum $ map length markers let markers' = map (\m -> let s = maxMarkerLength - length m in m ++ replicate s ' ') markers@@ -255,10 +245,10 @@ -- | Convert defintion list item (label, list of blocks) to RST. definitionListItemToRST :: ([Inline], [Block]) -> State WriterState Doc definitionListItemToRST (label, items) = do- label <- inlineListToRST label+ label' <- inlineListToRST label contents <- blockListToRST items tabstop <- get >>= (return . writerTabStop . stOptions)- return $ label $+$ nest tabstop contents+ return $ label' $+$ nest tabstop contents -- | Convert list of Pandoc block elements to RST. blockListToRST :: [Block] -- ^ List of block elements@@ -286,33 +276,38 @@ inlineToRST (Subscript lst) = do contents <- inlineListToRST lst return $ text "\\ :sub:`" <> contents <> text "`\\ "+inlineToRST (SmallCaps lst) = inlineListToRST lst inlineToRST (Quoted SingleQuote lst) = do contents <- inlineListToRST lst return $ char '\'' <> contents <> char '\'' inlineToRST (Quoted DoubleQuote lst) = do contents <- inlineListToRST lst return $ char '"' <> contents <> char '"'+inlineToRST (Cite _ lst) =+ inlineListToRST lst inlineToRST EmDash = return $ text "--" inlineToRST EnDash = return $ char '-' inlineToRST Apostrophe = return $ char '\'' inlineToRST Ellipses = return $ text "..." inlineToRST (Code str) = return $ text $ "``" ++ str ++ "``" inlineToRST (Str str) = return $ text $ escapeString str-inlineToRST (Math str) = do+inlineToRST (Math t str) = do includes <- get >>= (return . stIncludes)- let rawMathRole = ".. role:: math(raw)\n\- \ :format: html latex\n"+ let rawMathRole = ".. role:: math(raw)\n" +++ " :format: html latex\n" if not (rawMathRole `elem` includes) then modify $ \st -> st { stIncludes = rawMathRole : includes } else return ()- return $ text $ ":math:`$" ++ str ++ "$`"-inlineToRST (TeX str) = return empty-inlineToRST (HtmlInline str) = return empty+ return $ if t == InlineMath+ then text $ ":math:`$" ++ str ++ "$`"+ else text $ ":math:`$$" ++ str ++ "$$`"+inlineToRST (TeX _) = return empty+inlineToRST (HtmlInline _) = return empty inlineToRST (LineBreak) = do return $ empty -- there's no line break in RST inlineToRST Space = return $ char ' '-inlineToRST (Link [Code str] (src, tit)) | src == str ||- src == "mailto:" ++ str = do+inlineToRST (Link [Code str] (src, _)) | src == str ||+ src == "mailto:" ++ str = do let srcSuffix = if isPrefixOf "mailto:" src then drop 7 src else src return $ text srcSuffix inlineToRST (Link txt (src, tit)) = do
Text/Pandoc/Writers/RTF.hs view
@@ -31,16 +31,15 @@ import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.Pandoc.Readers.TeXMath-import Text.Regex ( matchRegexAll, mkRegex )-import Data.List ( isSuffixOf )-import Data.Char ( ord )+import Data.List ( isSuffixOf, intercalate )+import Data.Char ( ord, isDigit ) -- | Convert Pandoc to a string in rich text format. writeRTF :: WriterOptions -> Pandoc -> String writeRTF options (Pandoc meta blocks) = - let head = if writerStandalone options- then rtfHeader (writerHeader options) meta - else ""+ let head' = if writerStandalone options+ then rtfHeader (writerHeader options) meta + else "" toc = if writerTableOfContents options then tableOfContents $ filter isHeaderBlock blocks else "" @@ -48,7 +47,7 @@ body = writerIncludeBefore options ++ concatMap (blockToRTF 0 AlignDefault) blocks ++ writerIncludeAfter options- in head ++ toc ++ body ++ foot+ in head' ++ toc ++ body ++ foot -- | Construct table of contents from list of header blocks. tableOfContents :: [Block] -> String @@ -83,11 +82,7 @@ -- | Escape things as needed for code block in RTF. codeStringToRTF :: String -> String-codeStringToRTF str = joinWithSep "\\line\n" $ lines (stringToRTF str)---- | Deal with raw LaTeX.-latexToRTF :: String -> String-latexToRTF str = "{\\cf1 " ++ (stringToRTF str) ++ "\\cf0 } "+codeStringToRTF str = intercalate "\\line\n" $ lines (stringToRTF str) -- | Make a paragraph with first-line indent, block indent, and space after. rtfParSpaced :: Int -- ^ space after (in twips)@@ -123,22 +118,25 @@ rtfCompact = rtfParSpaced 0 -- number of twips to indent+indentIncrement :: Int indentIncrement = 720++listIncrement :: Int listIncrement = 360 -- | Returns appropriate bullet list marker for indent level. bulletMarker :: Int -> String bulletMarker indent = case indent `mod` 720 of- 0 -> "\\bullet "- otherwise -> "\\endash "+ 0 -> "\\bullet "+ _ -> "\\endash " -- | Returns appropriate (list of) ordered list markers for indent level. orderedMarkers :: Int -> ListAttributes -> [String] orderedMarkers indent (start, style, delim) = if style == DefaultStyle && delim == DefaultDelim then case indent `mod` 720 of- 0 -> orderedListMarkers (start, Decimal, Period)- otherwise -> orderedListMarkers (start, LowerAlpha, Period)+ 0 -> orderedListMarkers (start, Decimal, Period)+ _ -> orderedListMarkers (start, LowerAlpha, Period) else orderedListMarkers (start, style, delim) -- | Returns RTF header.@@ -152,7 +150,7 @@ "\\b \\fs36 " ++ inlineListToRTF title authorstext = if null authors then "" - else rtfPar 0 0 AlignCenter (" " ++ (joinWithSep "\\" $+ else rtfPar 0 0 AlignCenter (" " ++ (intercalate "\\" $ map stringToRTF authors)) datetext = if date == "" then ""@@ -174,9 +172,9 @@ rtfPar indent 0 alignment $ inlineListToRTF lst blockToRTF indent alignment (BlockQuote lst) = concatMap (blockToRTF (indent + indentIncrement) alignment) lst -blockToRTF indent _ (CodeBlock str) =+blockToRTF indent _ (CodeBlock _ str) = rtfPar indent 0 AlignLeft ("\\f1 " ++ (codeStringToRTF str))-blockToRTF _ _ (RawHtml str) = ""+blockToRTF _ _ (RawHtml _) = "" blockToRTF indent alignment (BulletList lst) = spaceAtEnd $ concatMap (listItemToRTF alignment indent (bulletMarker indent)) lst blockToRTF indent alignment (OrderedList attribs lst) = spaceAtEnd $ concat $ @@ -192,12 +190,12 @@ concatMap (tableRowToRTF False indent aligns sizes) rows ++ rtfPar indent 0 alignment (inlineListToRTF caption) -tableRowToRTF :: Bool -> Int -> [Alignment] -> [Float] -> [[Block]] -> String +tableRowToRTF :: Bool -> Int -> [Alignment] -> [Double] -> [[Block]] -> String tableRowToRTF header indent aligns sizes cols = let columns = concat $ zipWith (tableItemToRTF indent) aligns cols totalTwips = 6 * 1440 -- 6 inches rightEdges = tail $ scanl (\sofar new -> sofar + floor (new * totalTwips))- 0 sizes+ (0 :: Integer) sizes cellDefs = map (\edge -> (if header then "\\clbrdrb\\brdrs" else "") ++ "\\cellx" ++ show edge)@@ -230,15 +228,18 @@ rtfCompact (indent + listIncrement) (0 - listIncrement) alignment (marker ++ "\\tx" ++ (show listIncrement) ++ "\\tab ") listItemToRTF alignment indent marker list = - let (first:rest) = map (blockToRTF (indent + listIncrement) alignment) list in- -- insert the list marker into the (processed) first block- let modFirst = case matchRegexAll (mkRegex "\\\\fi-?[0-9]+") first of- Just (before, matched, after, _) -> - before ++ "\\fi" ++ show (0 - listIncrement) ++ - " " ++ marker ++ "\\tx" ++ - show listIncrement ++ "\\tab" ++ after- Nothing -> first in- modFirst ++ concat rest+ let (first:rest) = map (blockToRTF (indent + listIncrement) alignment) list+ listMarker = "\\fi" ++ show (0 - listIncrement) ++ " " ++ marker ++ "\\tx" +++ show listIncrement ++ "\\tab"+ insertListMarker ('\\':'f':'i':'-':d:xs) | isDigit d =+ listMarker ++ dropWhile isDigit xs+ insertListMarker ('\\':'f':'i':d:xs) | isDigit d =+ listMarker ++ dropWhile isDigit xs+ insertListMarker (x:xs) =+ x : insertListMarker xs+ insertListMarker [] = []+ -- insert the list marker into the (processed) first block+ in insertListMarker first ++ concat rest -- | Convert definition list item (label, list of blocks) to RTF. definitionListItemToRTF :: Alignment -- ^ alignment@@ -258,11 +259,12 @@ -- | Convert inline item to RTF. inlineToRTF :: Inline -- ^ inline to convert -> String-inlineToRTF (Emph lst) = "{\\i " ++ (inlineListToRTF lst) ++ "} "-inlineToRTF (Strong lst) = "{\\b " ++ (inlineListToRTF lst) ++ "} "-inlineToRTF (Strikeout lst) = "{\\strike " ++ (inlineListToRTF lst) ++ "} "-inlineToRTF (Superscript lst) = "{\\super " ++ (inlineListToRTF lst) ++ "} "-inlineToRTF (Subscript lst) = "{\\sub " ++ (inlineListToRTF lst) ++ "} "+inlineToRTF (Emph lst) = "{\\i " ++ (inlineListToRTF lst) ++ "}"+inlineToRTF (Strong lst) = "{\\b " ++ (inlineListToRTF lst) ++ "}"+inlineToRTF (Strikeout lst) = "{\\strike " ++ (inlineListToRTF lst) ++ "}"+inlineToRTF (Superscript lst) = "{\\super " ++ (inlineListToRTF lst) ++ "}"+inlineToRTF (Subscript lst) = "{\\sub " ++ (inlineListToRTF lst) ++ "}"+inlineToRTF (SmallCaps lst) = "{\\scaps " ++ (inlineListToRTF lst) ++ "}" inlineToRTF (Quoted SingleQuote lst) = "\\u8216'" ++ (inlineListToRTF lst) ++ "\\u8217'" inlineToRTF (Quoted DoubleQuote lst) = @@ -271,17 +273,18 @@ inlineToRTF Ellipses = "\\u8230?" inlineToRTF EmDash = "\\u8212-" inlineToRTF EnDash = "\\u8211-"-inlineToRTF (Code str) = "{\\f1 " ++ (codeStringToRTF str) ++ "} "+inlineToRTF (Code str) = "{\\f1 " ++ (codeStringToRTF str) ++ "}" inlineToRTF (Str str) = stringToRTF str-inlineToRTF (Math str) = inlineListToRTF $ readTeXMath str-inlineToRTF (TeX str) = ""-inlineToRTF (HtmlInline str) = ""+inlineToRTF (Math _ str) = inlineListToRTF $ readTeXMath str+inlineToRTF (Cite _ lst) = inlineListToRTF lst+inlineToRTF (TeX _) = ""+inlineToRTF (HtmlInline _) = "" inlineToRTF (LineBreak) = "\\line " inlineToRTF Space = " "-inlineToRTF (Link text (src, tit)) = +inlineToRTF (Link text (src, _)) = "{\\field{\\*\\fldinst{HYPERLINK \"" ++ (codeStringToRTF src) ++ "\"}}{\\fldrslt{\\ul\n" ++ (inlineListToRTF text) ++ "\n}}}\n"-inlineToRTF (Image alternate (source, tit)) = +inlineToRTF (Image _ (source, _)) = "{\\cf1 [image: " ++ source ++ "]\\cf0}" inlineToRTF (Note contents) = "{\\super\\chftn}{\\*\\footnote\\chftn\\~\\plain\\pard " ++
Text/Pandoc/Writers/S5.hs view
@@ -1,9 +1,4 @@-------------------------------------------------------- Do not edit this file by hand. Edit --- 'templates/S5.hs'--- and run ./fillTemplates.pl Text/Pandoc/Writers/S5.hs------------------------------------------------------+{-# LANGUAGE CPP, TemplateHaskell #-} {- Copyright (C) 2006-7 John MacFarlane <jgm@berkeley.edu> @@ -45,34 +40,53 @@ writeS5String, insertS5Structure ) where-import Text.Pandoc.Shared ( joinWithSep, WriterOptions )+import Text.Pandoc.Shared ( WriterOptions )+import Text.Pandoc.TH ( contentsOf ) import Text.Pandoc.Writers.HTML ( writeHtml, writeHtmlString ) import Text.Pandoc.Definition import Text.XHtml.Strict+import System.FilePath ( (</>) )+import Data.List ( intercalate ) 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// S5 v1.1 slides.js -- released into the Public Domain\n//\n// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information \n// about all the wonderful and talented contributors to this code!\n\nvar undef;\nvar slideCSS = '';\nvar snum = 0;\nvar smax = 1;\nvar incpos = 0;\nvar number = undef;\nvar s5mode = true;\nvar defaultView = 'slideshow';\nvar controlVis = 'visible';\n\nvar isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;\nvar isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;\nvar isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;\n\nfunction hasClass(object, className) {\n\tif (!object.className) return false;\n\treturn (object.className.search('(^|\\\\s)' + className + '(\\\\s|$)') != -1);\n}\n\nfunction hasValue(object, value) {\n\tif (!object) return false;\n\treturn (object.search('(^|\\\\s)' + value + '(\\\\s|$)') != -1);\n}\n\nfunction removeClass(object,className) {\n\tif (!object) return;\n\tobject.className = object.className.replace(new RegExp('(^|\\\\s)'+className+'(\\\\s|$)'), RegExp.$1+RegExp.$2);\n}\n\nfunction addClass(object,className) {\n\tif (!object || hasClass(object, className)) return;\n\tif (object.className) {\n\t\tobject.className += ' '+className;\n\t} else {\n\t\tobject.className = className;\n\t}\n}\n\nfunction GetElementsWithClassName(elementName,className) {\n\tvar allElements = document.getElementsByTagName(elementName);\n\tvar elemColl = new Array();\n\tfor (var i = 0; i< allElements.length; i++) {\n\t\tif (hasClass(allElements[i], className)) {\n\t\t\telemColl[elemColl.length] = allElements[i];\n\t\t}\n\t}\n\treturn elemColl;\n}\n\nfunction isParentOrSelf(element, id) {\n\tif (element == null || element.nodeName=='BODY') return false;\n\telse if (element.id == id) return true;\n\telse return isParentOrSelf(element.parentNode, id);\n}\n\nfunction nodeValue(node) {\n\tvar result = \"\";\n\tif (node.nodeType == 1) {\n\t\tvar children = node.childNodes;\n\t\tfor (var i = 0; i < children.length; ++i) {\n\t\t\tresult += nodeValue(children[i]);\n\t\t}\t\t\n\t}\n\telse if (node.nodeType == 3) {\n\t\tresult = node.nodeValue;\n\t}\n\treturn(result);\n}\n\nfunction slideLabel() {\n\tvar slideColl = GetElementsWithClassName('*','slide');\n\tvar list = document.getElementById('jumplist');\n\tsmax = slideColl.length;\n\tfor (var n = 0; n < smax; n++) {\n\t\tvar obj = slideColl[n];\n\n\t\tvar did = 'slide' + n.toString();\n\t\tobj.setAttribute('id',did);\n\t\tif (isOp) continue;\n\n\t\tvar otext = '';\n\t\tvar menu = obj.firstChild;\n\t\tif (!menu) continue; // to cope with empty slides\n\t\twhile (menu && menu.nodeType == 3) {\n\t\t\tmenu = menu.nextSibling;\n\t\t}\n\t \tif (!menu) continue; // to cope with slides with only text nodes\n\n\t\tvar menunodes = menu.childNodes;\n\t\tfor (var o = 0; o < menunodes.length; o++) {\n\t\t\totext += nodeValue(menunodes[o]);\n\t\t}\n\t\tlist.options[list.length] = new Option(n + ' : ' + otext, n);\n\t}\n}\n\nfunction currentSlide() {\n\tvar cs;\n\tif (document.getElementById) {\n\t\tcs = document.getElementById('currentSlide');\n\t} else {\n\t\tcs = document.currentSlide;\n\t}\n\tcs.innerHTML = '<span id=\"csHere\">' + snum + '<\\/span> ' + \n\t\t'<span id=\"csSep\">\\/<\\/span> ' + \n\t\t'<span id=\"csTotal\">' + (smax-1) + '<\\/span>';\n\tif (snum == 0) {\n\t\tcs.style.visibility = 'hidden';\n\t} else {\n\t\tcs.style.visibility = 'visible';\n\t}\n}\n\nfunction go(step) {\n\tif (document.getElementById('slideProj').disabled || step == 0) return;\n\tvar jl = document.getElementById('jumplist');\n\tvar cid = 'slide' + snum;\n\tvar ce = document.getElementById(cid);\n\tif (incrementals[snum].length > 0) {\n\t\tfor (var i = 0; i < incrementals[snum].length; i++) {\n\t\t\tremoveClass(incrementals[snum][i], 'current');\n\t\t\tremoveClass(incrementals[snum][i], 'incremental');\n\t\t}\n\t}\n\tif (step != 'j') {\n\t\tsnum += step;\n\t\tlmax = smax - 1;\n\t\tif (snum > lmax) snum = lmax;\n\t\tif (snum < 0) snum = 0;\n\t} else\n\t\tsnum = parseInt(jl.value);\n\tvar nid = 'slide' + snum;\n\tvar ne = document.getElementById(nid);\n\tif (!ne) {\n\t\tne = document.getElementById('slide0');\n\t\tsnum = 0;\n\t}\n\tif (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}\n\tif (incrementals[snum].length > 0 && incpos == 0) {\n\t\tfor (var i = 0; i < incrementals[snum].length; i++) {\n\t\t\tif (hasClass(incrementals[snum][i], 'current'))\n\t\t\t\tincpos = i + 1;\n\t\t\telse\n\t\t\t\taddClass(incrementals[snum][i], 'incremental');\n\t\t}\n\t}\n\tif (incrementals[snum].length > 0 && incpos > 0)\n\t\taddClass(incrementals[snum][incpos - 1], 'current');\n\tce.style.visibility = 'hidden';\n\tne.style.visibility = 'visible';\n\tjl.selectedIndex = snum;\n\tcurrentSlide();\n\tnumber = 0;\n}\n\nfunction goTo(target) {\n\tif (target >= smax || target == snum) return;\n\tgo(target - snum);\n}\n\nfunction subgo(step) {\n\tif (step > 0) {\n\t\tremoveClass(incrementals[snum][incpos - 1],'current');\n\t\tremoveClass(incrementals[snum][incpos], 'incremental');\n\t\taddClass(incrementals[snum][incpos],'current');\n\t\tincpos++;\n\t} else {\n\t\tincpos--;\n\t\tremoveClass(incrementals[snum][incpos],'current');\n\t\taddClass(incrementals[snum][incpos], 'incremental');\n\t\taddClass(incrementals[snum][incpos - 1],'current');\n\t}\n}\n\nfunction toggle() {\n\tvar slideColl = GetElementsWithClassName('*','slide');\n\tvar slides = document.getElementById('slideProj');\n\tvar outline = document.getElementById('outlineStyle');\n\tif (!slides.disabled) {\n\t\tslides.disabled = true;\n\t\toutline.disabled = false;\n\t\ts5mode = false;\n\t\tfontSize('1em');\n\t\tfor (var n = 0; n < smax; n++) {\n\t\t\tvar slide = slideColl[n];\n\t\t\tslide.style.visibility = 'visible';\n\t\t}\n\t} else {\n\t\tslides.disabled = false;\n\t\toutline.disabled = true;\n\t\ts5mode = true;\n\t\tfontScale();\n\t\tfor (var n = 0; n < smax; n++) {\n\t\t\tvar slide = slideColl[n];\n\t\t\tslide.style.visibility = 'hidden';\n\t\t}\n\t\tslideColl[snum].style.visibility = 'visible';\n\t}\n}\n\nfunction showHide(action) {\n\tvar obj = GetElementsWithClassName('*','hideme')[0];\n\tswitch (action) {\n\tcase 's': obj.style.visibility = 'visible'; break;\n\tcase 'h': obj.style.visibility = 'hidden'; break;\n\tcase 'k':\n\t\tif (obj.style.visibility != 'visible') {\n\t\t\tobj.style.visibility = 'visible';\n\t\t} else {\n\t\t\tobj.style.visibility = 'hidden';\n\t\t}\n\tbreak;\n\t}\n}\n\n// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)\nfunction keys(key) {\n\tif (!key) {\n\t\tkey = event;\n\t\tkey.which = key.keyCode;\n\t}\n\tif (key.which == 84) {\n\t\ttoggle();\n\t\treturn;\n\t}\n\tif (s5mode) {\n\t\tswitch (key.which) {\n\t\t\tcase 10: // return\n\t\t\tcase 13: // enter\n\t\t\t\tif (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;\n\t\t\t\tif (key.target && isParentOrSelf(key.target, 'controls')) return;\n\t\t\t\tif(number != undef) {\n\t\t\t\t\tgoTo(number);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tcase 32: // spacebar\n\t\t\tcase 34: // page down\n\t\t\tcase 39: // rightkey\n\t\t\tcase 40: // downkey\n\t\t\t\tif(number != undef) {\n\t\t\t\t\tgo(number);\n\t\t\t\t} else if (!incrementals[snum] || incpos >= incrementals[snum].length) {\n\t\t\t\t\tgo(1);\n\t\t\t\t} else {\n\t\t\t\t\tsubgo(1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 33: // page up\n\t\t\tcase 37: // leftkey\n\t\t\tcase 38: // upkey\n\t\t\t\tif(number != undef) {\n\t\t\t\t\tgo(-1 * number);\n\t\t\t\t} else if (!incrementals[snum] || incpos <= 0) {\n\t\t\t\t\tgo(-1);\n\t\t\t\t} else {\n\t\t\t\t\tsubgo(-1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 36: // home\n\t\t\t\tgoTo(0);\n\t\t\t\tbreak;\n\t\t\tcase 35: // end\n\t\t\t\tgoTo(smax-1);\n\t\t\t\tbreak;\n\t\t\tcase 67: // c\n\t\t\t\tshowHide('k');\n\t\t\t\tbreak;\n\t\t}\n\t\tif (key.which < 48 || key.which > 57) {\n\t\t\tnumber = undef;\n\t\t} else {\n\t\t\tif (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;\n\t\t\tif (key.target && isParentOrSelf(key.target, 'controls')) return;\n\t\t\tnumber = (((number != undef) ? number : 0) * 10) + (key.which - 48);\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction clicker(e) {\n\tnumber = undef;\n\tvar target;\n\tif (window.event) {\n\t\ttarget = window.event.srcElement;\n\t\te = window.event;\n\t} else target = e.target;\n\tif (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;\n\tif (!e.which || e.which == 1) {\n\t\tif (!incrementals[snum] || incpos >= incrementals[snum].length) {\n\t\t\tgo(1);\n\t\t} else {\n\t\t\tsubgo(1);\n\t\t}\n\t}\n}\n\nfunction findSlide(hash) {\n\tvar target = null;\n\tvar slides = GetElementsWithClassName('*','slide');\n\tfor (var i = 0; i < slides.length; i++) {\n\t\tvar targetSlide = slides[i];\n\t\tif ( (targetSlide.name && targetSlide.name == hash)\n\t\t || (targetSlide.id && targetSlide.id == hash) ) {\n\t\t\ttarget = targetSlide;\n\t\t\tbreak;\n\t\t}\n\t}\n\twhile(target != null && target.nodeName != 'BODY') {\n\t\tif (hasClass(target, 'slide')) {\n\t\t\treturn parseInt(target.id.slice(5));\n\t\t}\n\t\ttarget = target.parentNode;\n\t}\n\treturn null;\n}\n\nfunction slideJump() {\n\tif (window.location.hash == null) return;\n\tvar sregex = /^#slide(\\d+)$/;\n\tvar matches = sregex.exec(window.location.hash);\n\tvar dest = null;\n\tif (matches != null) {\n\t\tdest = parseInt(matches[1]);\n\t} else {\n\t\tdest = findSlide(window.location.hash.slice(1));\n\t}\n\tif (dest != null)\n\t\tgo(dest - snum);\n}\n\nfunction fixLinks() {\n\tvar thisUri = window.location.href;\n\tthisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);\n\tvar aelements = document.getElementsByTagName('A');\n\tfor (var i = 0; i < aelements.length; i++) {\n\t\tvar a = aelements[i].href;\n\t\tvar slideID = a.match('\\#slide[0-9]{1,2}');\n\t\tif ((slideID) && (slideID[0].slice(0,1) == '#')) {\n\t\t\tvar dest = findSlide(slideID[0].slice(1));\n\t\t\tif (dest != null) {\n\t\t\t\tif (aelements[i].addEventListener) {\n\t\t\t\t\taelements[i].addEventListener(\"click\", new Function(\"e\",\n\t\t\t\t\t\t\"if (document.getElementById('slideProj').disabled) return;\" +\n\t\t\t\t\t\t\"go(\"+dest+\" - snum); \" +\n\t\t\t\t\t\t\"if (e.preventDefault) e.preventDefault();\"), true);\n\t\t\t\t} else if (aelements[i].attachEvent) {\n\t\t\t\t\taelements[i].attachEvent(\"onclick\", new Function(\"\",\n\t\t\t\t\t\t\"if (document.getElementById('slideProj').disabled) return;\" +\n\t\t\t\t\t\t\"go(\"+dest+\" - snum); \" +\n\t\t\t\t\t\t\"event.returnValue = false;\"));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction externalLinks() {\n\tif (!document.getElementsByTagName) return;\n\tvar anchors = document.getElementsByTagName('a');\n\tfor (var i=0; i<anchors.length; i++) {\n\t\tvar anchor = anchors[i];\n\t\tif (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {\n\t\t\tanchor.target = '_blank';\n\t\t\taddClass(anchor,'external');\n\t\t}\n\t}\n}\n\nfunction createControls() {\n\tvar controlsDiv = document.getElementById(\"controls\");\n\tif (!controlsDiv) return;\n\tvar hider = ' onmouseover=\"showHide(\\'s\\');\" onmouseout=\"showHide(\\'h\\');\"';\n\tvar hideDiv, hideList = '';\n\tif (controlVis == 'hidden') {\n\t\thideDiv = hider;\n\t} else {\n\t\thideList = hider;\n\t}\n\tcontrolsDiv.innerHTML = '<form action=\"#\" id=\"controlForm\"' + hideDiv + '>' +\n\t'<div id=\"navLinks\">' +\n\t'<a accesskey=\"t\" id=\"toggle\" href=\"javascript:toggle();\">Ø<\\/a>' +\n\t'<a accesskey=\"z\" id=\"prev\" href=\"javascript:go(-1);\">«<\\/a>' +\n\t'<a accesskey=\"x\" id=\"next\" href=\"javascript:go(1);\">»<\\/a>' +\n\t'<div id=\"navList\"' + hideList + '><select id=\"jumplist\" onchange=\"go(\\'j\\');\"><\\/select><\\/div>' +\n\t'<\\/div><\\/form>';\n\tif (controlVis == 'hidden') {\n\t\tvar hidden = document.getElementById('navLinks');\n\t} else {\n\t\tvar hidden = document.getElementById('jumplist');\n\t}\n\taddClass(hidden,'hideme');\n}\n\nfunction fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers\n\tif (!s5mode) return false;\n\tvar vScale = 22; // both yield 32 (after rounding) at 1024x768\n\tvar hScale = 32; // perhaps should auto-calculate based on theme's declared value?\n\tif (window.innerHeight) {\n\t\tvar vSize = window.innerHeight;\n\t\tvar hSize = window.innerWidth;\n\t} else if (document.documentElement.clientHeight) {\n\t\tvar vSize = document.documentElement.clientHeight;\n\t\tvar hSize = document.documentElement.clientWidth;\n\t} else if (document.body.clientHeight) {\n\t\tvar vSize = document.body.clientHeight;\n\t\tvar hSize = document.body.clientWidth;\n\t} else {\n\t\tvar vSize = 700; // assuming 1024x768, minus chrome and such\n\t\tvar hSize = 1024; // these do not account for kiosk mode or Opera Show\n\t}\n\tvar newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));\n\tfontSize(newSize + 'px');\n\tif (isGe) { // hack to counter incremental reflow bugs\n\t\tvar obj = document.getElementsByTagName('body')[0];\n\t\tobj.style.display = 'none';\n\t\tobj.style.display = 'block';\n\t}\n}\n\nfunction fontSize(value) {\n\tif (!(s5ss = document.getElementById('s5ss'))) {\n\t\tif (!isIE) {\n\t\t\tdocument.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));\n\t\t\ts5ss.setAttribute('media','screen, projection');\n\t\t\ts5ss.setAttribute('id','s5ss');\n\t\t} else {\n\t\t\tdocument.createStyleSheet();\n\t\t\tdocument.s5ss = document.styleSheets[document.styleSheets.length - 1];\n\t\t}\n\t}\n\tif (!isIE) {\n\t\twhile (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);\n\t\ts5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));\n\t} else {\n\t\tdocument.s5ss.addRule('body','font-size: ' + value + ' !important;');\n\t}\n}\n\nfunction notOperaFix() {\n\tslideCSS = document.getElementById('slideProj').href;\n\tvar slides = document.getElementById('slideProj');\n\tvar outline = document.getElementById('outlineStyle');\n\tslides.setAttribute('media','screen');\n\toutline.disabled = true;\n\tif (isGe) {\n\t\tslides.setAttribute('href','null'); // Gecko fix\n\t\tslides.setAttribute('href',slideCSS); // Gecko fix\n\t}\n\tif (isIE && document.styleSheets && document.styleSheets[0]) {\n\t\tdocument.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');\n\t\tdocument.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');\n\t\tdocument.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');\n\t}\n}\n\nfunction getIncrementals(obj) {\n\tvar incrementals = new Array();\n\tif (!obj) \n\t\treturn incrementals;\n\tvar children = obj.childNodes;\n\tfor (var i = 0; i < children.length; i++) {\n\t\tvar child = children[i];\n\t\tif (hasClass(child, 'incremental')) {\n\t\t\tif (child.nodeName == 'OL' || child.nodeName == 'UL') {\n\t\t\t\tremoveClass(child, 'incremental');\n\t\t\t\tfor (var j = 0; j < child.childNodes.length; j++) {\n\t\t\t\t\tif (child.childNodes[j].nodeType == 1) {\n\t\t\t\t\t\taddClass(child.childNodes[j], 'incremental');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tincrementals[incrementals.length] = child;\n\t\t\t\tremoveClass(child,'incremental');\n\t\t\t}\n\t\t}\n\t\tif (hasClass(child, 'show-first')) {\n\t\t\tif (child.nodeName == 'OL' || child.nodeName == 'UL') {\n\t\t\t\tremoveClass(child, 'show-first');\n\t\t\t\tif (child.childNodes[isGe].nodeType == 1) {\n\t\t\t\t\tremoveClass(child.childNodes[isGe], 'incremental');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tincrementals[incrementals.length] = child;\n\t\t\t}\n\t\t}\n\t\tincrementals = incrementals.concat(getIncrementals(child));\n\t}\n\treturn incrementals;\n}\n\nfunction createIncrementals() {\n\tvar incrementals = new Array();\n\tfor (var i = 0; i < smax; i++) {\n\t\tincrementals[i] = getIncrementals(document.getElementById('slide'+i));\n\t}\n\treturn incrementals;\n}\n\nfunction defaultCheck() {\n\tvar allMetas = document.getElementsByTagName('meta');\n\tfor (var i = 0; i< allMetas.length; i++) {\n\t\tif (allMetas[i].name == 'defaultView') {\n\t\t\tdefaultView = allMetas[i].content;\n\t\t}\n\t\tif (allMetas[i].name == 'controlVis') {\n\t\t\tcontrolVis = allMetas[i].content;\n\t\t}\n\t}\n}\n\n// Key trap fix, new function body for trap()\nfunction trap(e) {\n\tif (!e) {\n\t\te = event;\n\t\te.which = e.keyCode;\n\t}\n\ttry {\n\t\tmodifierKey = e.ctrlKey || e.altKey || e.metaKey;\n\t}\n\tcatch(e) {\n\t\tmodifierKey = false;\n\t}\n\treturn modifierKey || e.which == 0;\n}\n\nfunction startup() {\n\tdefaultCheck();\n\tif (!isOp) \n\t\tcreateControls();\n\tslideLabel();\n\tfixLinks();\n\texternalLinks();\n\tfontScale();\n\tif (!isOp) {\n\t\tnotOperaFix();\n\t\tincrementals = createIncrementals();\n\t\tslideJump();\n\t\tif (defaultView == 'outline') {\n\t\t\ttoggle();\n\t\t}\n\t\tdocument.onkeyup = keys;\n\t\tdocument.onkeypress = trap;\n\t\tdocument.onclick = clicker;\n\t}\n}\n\nwindow.onload = startup;\nwindow.onresize = function(){setTimeout('fontScale()', 50);}</script>\n" +#ifndef __HADDOCK__+s5Javascript = "<script type=\"text/javascript\">\n" +++ $(contentsOf $ "data" </> "ui" </> "default" </> "slides.js.comment") +++ $(contentsOf $ "data" </> "ui" </> "default" </> "slides.js.packed") ++ "</script>\n" +#endif s5CoreCSS :: String-s5CoreCSS = "/* Do not edit or override these styles! The system will likely break if you do. */\n\ndiv#header, div#footer, div#controls, .slide {position: absolute;}\nhtml>body div#header, html>body div#footer, \n html>body div#controls, html>body .slide {position: fixed;}\n.handout {display: none;}\n.layout {display: block;}\n.slide, .hideme, .incremental {visibility: hidden;}\n#slide0 {visibility: visible;}\n"+#ifndef __HADDOCK__+s5CoreCSS = $(contentsOf $ "data" </> "ui" </> "default" </> "s5-core.css")+#endif s5FramingCSS :: String-s5FramingCSS = "/* The following styles size, place, and layer the slide components.\n Edit these if you want to change the overall slide layout.\n The commented lines can be uncommented (and modified, if necessary) \n to help you with the rearrangement process. */\n\n/* target = 1024x768 */\n\ndiv#header, div#footer, .slide {width: 100%; top: 0; left: 0;}\ndiv#header {top: 0; height: 3em; z-index: 1;}\ndiv#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}\n.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}\ndiv#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}\ndiv#controls form {position: absolute; bottom: 0; right: 0; width: 100%;\n margin: 0;}\n#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}\nhtml>body #currentSlide {position: fixed;}\n\n/*\ndiv#header {background: #FCC;}\ndiv#footer {background: #CCF;}\ndiv#controls {background: #BBD;}\ndiv#currentSlide {background: #FFC;}\n*/\n"+#ifndef __HADDOCK__+s5FramingCSS = $(contentsOf $ "data" </> "ui" </> "default" </> "framing.css")+#endif s5PrettyCSS :: String-s5PrettyCSS = "/* Following are the presentation styles -- edit away! */\n\nbody {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}\n:link, :visited {text-decoration: none; color: #00C;}\n#controls :active {color: #88A !important;}\n#controls :focus {outline: 1px dotted #227;}\nh1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}\nul, pre {margin: 0; line-height: 1em;}\nhtml, body {margin: 0; padding: 0;}\n\nblockquote, q {font-style: italic;}\nblockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}\nblockquote p {margin: 0;}\nblockquote i {font-style: normal;}\nblockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}\nblockquote b i {font-style: italic;}\n\nkbd {font-weight: bold; font-size: 1em;}\nsup {font-size: smaller; line-height: 1px;}\n\n.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}\n.slide code.bad, code del {color: red;}\n.slide code.old {color: silver;}\n.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}\n.slide pre code {display: block;}\n.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}\n.slide li {margin-top: 0.75em; margin-right: 0;}\n.slide ul ul {line-height: 1;}\n.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}\n.slide img.leader {display: block; margin: 0 auto;}\n\ndiv#header, div#footer {background: #005; color: #AAB;\n font-family: Verdana, Helvetica, sans-serif;}\ndiv#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;\n line-height: 1px;}\ndiv#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}\n#footer h1, #footer h2 {display: block; padding: 0 1em;}\n#footer h2 {font-style: italic;}\n\ndiv.long {font-size: 0.75em;}\n.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;\n margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;\n font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;\n color: #DDE; background: #005;}\n.slide h3 {font-size: 130%;}\nh1 abbr {font-variant: small-caps;}\n\ndiv#controls {position: absolute; left: 50%; bottom: 0;\n width: 50%;\n text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}\nhtml>body div#controls {position: fixed; padding: 0 0 1em 0;\n top: auto;}\ndiv#controls form {position: absolute; bottom: 0; right: 0; width: 100%;\n margin: 0; padding: 0;}\n#controls #navLinks a {padding: 0; margin: 0 0.5em; \n background: #005; border: none; color: #779; \n cursor: pointer;}\n#controls #navList {height: 1em;}\n#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}\n\n#currentSlide {text-align: center; font-size: 0.5em; color: #449;}\n\n#slide0 {padding-top: 3.5em; font-size: 90%;}\n#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;\n font: bold 2em Helvetica, sans-serif; white-space: normal;\n color: #000; background: transparent;}\n#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}\n#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}\n#slide0 h4 {margin-top: 0; font-size: 1em;}\n\nul.urls {list-style: none; display: inline; margin: 0;}\n.urls li {display: inline; margin: 0;}\n.note {display: none;}\n.external {border-bottom: 1px dotted gray;}\nhtml>body .external {border-bottom: none;}\n.external:after {content: \" \\274F\"; font-size: smaller; color: #77B;}\n\n.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}\nimg.incremental {visibility: hidden;}\n.slide .current {color: #B02;}\n\n\n/* diagnostics\n\nli:after {content: \" [\" attr(class) \"]\"; color: #F88;}\n */"+#ifndef __HADDOCK__+s5PrettyCSS = $(contentsOf $ "data" </> "ui" </> "default" </> "pretty.css")+#endif s5OperaCSS :: String-s5OperaCSS = "/* DO NOT CHANGE THESE unless you really want to break Opera Show */\n.slide {\n\tvisibility: visible !important;\n\tposition: static !important;\n\tpage-break-before: always;\n}\n#slide0 {page-break-before: avoid;}\n"+#ifndef __HADDOCK__+s5OperaCSS = $(contentsOf $ "data" </> "ui" </> "default" </> "opera.css")+#endif s5OutlineCSS :: String-s5OutlineCSS = "/* don't change this unless you want the layout stuff to show up in the outline view! */\n\n.layout div, #footer *, #controlForm * {display: none;}\n#footer, #controls, #controlForm, #navLinks, #toggle {\n display: block; visibility: visible; margin: 0; padding: 0;}\n#toggle {float: right; padding: 0.5em;}\nhtml>body #toggle {position: fixed; top: 0; right: 0;}\n\n/* making the outline look pretty-ish */\n\n#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}\n#slide0 h1 {padding-top: 1.5em;}\n.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;\n border-top: 1px solid #888; border-bottom: 1px solid #AAA;}\n#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}\n"+#ifndef __HADDOCK__+s5OutlineCSS = $(contentsOf $ "data" </> "ui" </> "default" </> "outline.css")+#endif s5PrintCSS :: String-s5PrintCSS = "/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */\n.slide, ul {page-break-inside: avoid; visibility: visible !important;}\nh1 {page-break-after: avoid;}\n\nbody {font-size: 12pt; background: white;}\n* {color: black;}\n\n#slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;}\n#slide0 h3 {margin: 0; padding: 0;}\n#slide0 h4 {margin: 0 0 0.5em; padding: 0;}\n#slide0 {margin-bottom: 3em;}\n\nh1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;}\n.extra {background: transparent !important;}\ndiv.extra, pre.extra, .example {font-size: 10pt; color: #333;}\nul.extra a {font-weight: bold;}\np.example {display: none;}\n\n#header {display: none;}\n#footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;}\n#footer h2, #controls {display: none;}\n\n/* The following rule keeps the layout stuff out of print. Remove at your own risk! */\n.layout, .layout * {display: none !important;}\n"+#ifndef __HADDOCK__+s5PrintCSS = $(contentsOf $ "data" </> "ui" </> "default" </> "print.css")+#endif 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"@@ -92,14 +106,18 @@ layoutDiv :: [Inline] -- ^ Title of document (for header or footer) -> String -- ^ Date of document (for header or footer) -> [Block] -- ^ List of block elements returned-layoutDiv title date = [(RawHtml "<div class=\"layout\">\n<div id=\"controls\"></div>\n<div id=\"currentSlide\"></div>\n<div id=\"header\"></div>\n<div id=\"footer\">\n"), (Header 1 [Str date]), (Header 2 title), (RawHtml "</div>\n</div>\n")]+layoutDiv title' date = [(RawHtml "<div class=\"layout\">\n<div id=\"controls\"></div>\n<div id=\"currentSlide\"></div>\n<div id=\"header\"></div>\n<div id=\"footer\">\n"), (Header 1 [Str date]), (Header 2 title'), (RawHtml "</div>\n</div>\n")] +presentationStart :: Block presentationStart = RawHtml "<div class=\"presentation\">\n\n" +presentationEnd :: Block presentationEnd = RawHtml "</div>\n" +slideStart :: Block slideStart = RawHtml "<div class=\"slide\">\n" +slideEnd :: Block slideEnd = RawHtml "</div>\n" -- | Returns 'True' if block is a Header 1.@@ -126,15 +144,14 @@ -- | Insert blocks into 'Pandoc' for slide structure. insertS5Structure :: Pandoc -> Pandoc-insertS5Structure (Pandoc meta []) = Pandoc meta []-insertS5Structure (Pandoc (Meta title authors date) blocks) = +insertS5Structure (Pandoc meta' []) = Pandoc meta' []+insertS5Structure (Pandoc (Meta title' authors date) blocks) = let slides = insertSlides True blocks - firstSlide = if not (null title)- then [slideStart, (Header 1 title), - (Header 3 [Str (joinWithSep ", " authors)]),+ firstSlide = if not (null title')+ then [slideStart, (Header 1 title'), + (Header 3 [Str (intercalate ", " authors)]), (Header 4 [Str date]), slideEnd] else []- newBlocks = (layoutDiv title date) ++ presentationStart:firstSlide +++ newBlocks = (layoutDiv title' date) ++ presentationStart:firstSlide ++ slides ++ [presentationEnd]- in Pandoc (Meta title authors date) newBlocks-+ in Pandoc (Meta title' authors date) newBlocks
+ Text/Pandoc/Writers/Texinfo.hs view
@@ -0,0 +1,474 @@+{-+Copyright (C) 2008 John MacFarlane and Peter Wang++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.Writers.Texinfo+ Copyright : Copyright (C) 2008 John MacFarlane and Peter Wang+ License : GNU GPL, version 2 or above ++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha + Portability : portable++Conversion of 'Pandoc' format into Texinfo.+-}+module Text.Pandoc.Writers.Texinfo ( writeTexinfo ) where+import Text.Pandoc.Definition+import Text.Pandoc.Shared+import Text.Pandoc.Readers.TeXMath+import Text.Printf ( printf )+import Data.List ( isSuffixOf )+import Data.Char ( chr, ord )+import qualified Data.Set as S+import Control.Monad.State+import Text.PrettyPrint.HughesPJ hiding ( Str )++data WriterState = + WriterState { stIncludes :: S.Set String -- strings to include in header+ }++{- TODO:+ - internal cross references a la HTML+ - generated .texi files don't work when run through texi2dvi+ -}++-- | Add line to header.+addToHeader :: String -> State WriterState ()+addToHeader str = do+ st <- get+ let includes = stIncludes st+ put st {stIncludes = S.insert str includes}++-- | Convert Pandoc to Texinfo.+writeTexinfo :: WriterOptions -> Pandoc -> String+writeTexinfo options document = + render $ evalState (pandocToTexinfo options $ wrapTop document) $ + WriterState { stIncludes = S.empty } ++-- | Add a "Top" node around the document, needed by Texinfo.+wrapTop :: Pandoc -> Pandoc+wrapTop (Pandoc (Meta title authors date) blocks) =+ Pandoc (Meta title authors date) (Header 0 title : blocks)++pandocToTexinfo :: WriterOptions -> Pandoc -> State WriterState Doc+pandocToTexinfo options (Pandoc meta blocks) = do+ main <- blockListToTexinfo blocks+ head' <- if writerStandalone options+ then texinfoHeader options meta+ else return empty+ let before = if null (writerIncludeBefore options)+ then empty+ else text (writerIncludeBefore options)+ let after = if null (writerIncludeAfter options)+ then empty+ else text (writerIncludeAfter options)+ let body = before $$ main $$ after+ -- XXX toc untested+ let toc = if writerTableOfContents options+ then text "@contents"+ else empty + let foot = if writerStandalone options+ then text "@bye"+ else empty + return $ head' $$ toc $$ body $$ foot++-- | Insert bibliographic information into Texinfo header.+texinfoHeader :: WriterOptions -- ^ Options, including Texinfo header+ -> Meta -- ^ Meta with bibliographic information+ -> State WriterState Doc+texinfoHeader options (Meta title authors date) = do+ titletext <- if null title+ then return empty+ else do+ t <- inlineListToTexinfo title+ return $ text "@title " <> t+ headerIncludes <- get >>= return . S.toList . stIncludes+ let extras = text $ unlines headerIncludes+ let authorstext = map makeAuthor authors+ let datetext = if date == ""+ then empty + else text $ stringToTexinfo date++ let baseHeader = text $ writerHeader options+ let header = baseHeader $$ extras+ return $ text "\\input texinfo" $$+ header $$+ text "@ifnottex" $$+ text "@paragraphindent 0" $$+ text "@end ifnottex" $$+ text "@titlepage" $$+ titletext $$ vcat authorstext $$+ datetext $$+ text "@end titlepage"++makeAuthor :: String -> Doc+makeAuthor author = text $ "@author " ++ (stringToTexinfo author)++-- | Escape things as needed for Texinfo.+stringToTexinfo :: String -> String+stringToTexinfo = escapeStringUsing texinfoEscapes+ where texinfoEscapes = [ ('{', "@{")+ , ('}', "@}")+ , ('@', "@@")+ , (',', "@comma{}") -- only needed in argument lists+ , ('\160', "@ ")+ ]++-- | Puts contents into Texinfo command.+inCmd :: String -> Doc -> Doc+inCmd cmd contents = char '@' <> text cmd <> braces contents++-- | Convert Pandoc block element to Texinfo.+blockToTexinfo :: Block -- ^ Block to convert+ -> State WriterState Doc++blockToTexinfo Null = return empty++blockToTexinfo (Plain lst) =+ inlineListToTexinfo lst++blockToTexinfo (Para lst) =+ inlineListToTexinfo lst -- this is handled differently from Plain in blockListToTexinfo++blockToTexinfo (BlockQuote lst) = do+ contents <- blockListToTexinfo lst+ return $ text "@quotation" $$+ contents $$+ text "@end quotation"++blockToTexinfo (CodeBlock _ str) = do+ return $ text "@verbatim" $$+ vcat (map text (lines str)) $$+ text "@end verbatim\n"++blockToTexinfo (RawHtml _) = return empty++blockToTexinfo (BulletList lst) = do+ items <- mapM listItemToTexinfo lst+ return $ text "@itemize" $$+ vcat items $$+ text "@end itemize\n"++blockToTexinfo (OrderedList (start, numstyle, _) lst) = do+ items <- mapM listItemToTexinfo lst+ return $ text "@enumerate " <> exemplar $$+ vcat items $$+ text "@end enumerate\n"+ where+ exemplar = case numstyle of+ DefaultStyle -> decimal+ Decimal -> decimal+ UpperRoman -> decimal -- Roman numerals not supported+ LowerRoman -> decimal+ UpperAlpha -> upperAlpha+ LowerAlpha -> lowerAlpha+ decimal = if start == 1+ then empty+ else text (show start)+ upperAlpha = text [chr $ ord 'A' + start - 1]+ lowerAlpha = text [chr $ ord 'a' + start - 1]++blockToTexinfo (DefinitionList lst) = do+ items <- mapM defListItemToTexinfo lst+ return $ text "@table @asis" $$+ vcat items $$+ text "@end table\n"++blockToTexinfo HorizontalRule =+ -- XXX can't get the equivalent from LaTeX.hs to work+ return $ text "@iftex" $$+ text "@bigskip@hrule@bigskip" $$+ text "@end iftex" $$+ text "@ifnottex" $$+ text (take 72 $ repeat '-') $$+ text "@end ifnottex"++blockToTexinfo (Header 0 lst) = do+ txt <- if null lst+ then return $ text "Top"+ else inlineListToTexinfo lst+ return $ text "@node Top" $$+ text "@top " <> txt <> char '\n'++blockToTexinfo (Header level lst) = do+ node <- inlineListForNode lst+ txt <- inlineListToTexinfo lst+ return $ if (level > 0) && (level <= 4)+ then text "\n@node " <> node <> char '\n' <>+ text (seccmd level) <> txt+ else txt+ where+ seccmd 1 = "@chapter "+ seccmd 2 = "@section "+ seccmd 3 = "@subsection "+ seccmd 4 = "@subsubsection "+ seccmd _ = error "illegal seccmd level"++blockToTexinfo (Table caption aligns widths heads rows) = do+ headers <- tableHeadToTexinfo aligns heads+ captionText <- inlineListToTexinfo caption+ rowsText <- mapM (tableRowToTexinfo aligns) rows+ let colWidths = map (printf "%.2f ") widths+ let colDescriptors = concat colWidths+ let tableBody = text ("@multitable @columnfractions " ++ colDescriptors) $$+ headers $$+ vcat rowsText $$ + text "@end multitable" + return $ if isEmpty captionText+ then tableBody <> char '\n'+ else text "@float" $$+ tableBody $$ + inCmd "caption" captionText $$+ text "@end float"++tableHeadToTexinfo :: [Alignment]+ -> [[Block]]+ -> State WriterState Doc+tableHeadToTexinfo = tableAnyRowToTexinfo "@headitem "++tableRowToTexinfo :: [Alignment]+ -> [[Block]]+ -> State WriterState Doc+tableRowToTexinfo = tableAnyRowToTexinfo "@item "++tableAnyRowToTexinfo :: String+ -> [Alignment]+ -> [[Block]]+ -> State WriterState Doc+tableAnyRowToTexinfo itemtype aligns cols =+ zipWithM alignedBlock aligns cols >>= + return . (text itemtype $$) . foldl (\row item -> row $$+ (if isEmpty row then empty else text " @tab ") <> item) empty++alignedBlock :: Alignment+ -> [Block]+ -> State WriterState Doc+-- XXX @flushleft and @flushright text won't get word wrapped. Since word+-- wrapping is more important than alignment, we ignore the alignment.+alignedBlock _ = blockListToTexinfo+{-+alignedBlock AlignLeft col = do+ b <- blockListToTexinfo col+ return $ text "@flushleft" $$ b $$ text "@end flushleft"+alignedBlock AlignRight col = do+ b <- blockListToTexinfo col+ return $ text "@flushright" $$ b $$ text "@end flushright"+alignedBlock _ col = blockListToTexinfo col+-}++-- | Convert Pandoc block elements to Texinfo.+blockListToTexinfo :: [Block]+ -> State WriterState Doc+blockListToTexinfo [] = return $ empty+blockListToTexinfo (x:xs) = do+ x' <- blockToTexinfo x+ case x of+ Header level _ -> do+ -- We need need to insert a menu for this node.+ let (before, after) = break isHeader xs+ before' <- blockListToTexinfo before+ let menu = if level < 4+ then collectNodes (level + 1) after+ else []+ lines' <- mapM makeMenuLine menu+ let menu' = if null lines'+ then empty+ else text "@menu" $$+ vcat lines' $$+ text "@end menu"+ after' <- blockListToTexinfo after+ return $ x' $$ before' $$ menu' $$ after'+ Para _ -> do+ xs' <- blockListToTexinfo xs+ case xs of+ ((CodeBlock _ _):_) -> return $ x' $$ xs'+ _ -> return $ x' $$ text "" $$ xs'+ _ -> do+ xs' <- blockListToTexinfo xs+ return $ x' $$ xs'++isHeader :: Block -> Bool+isHeader (Header _ _) = True+isHeader _ = False++collectNodes :: Int -> [Block] -> [Block]+collectNodes _ [] = []+collectNodes level (x:xs) =+ case x of+ (Header hl _) ->+ if hl < level+ then []+ else if hl == level+ then x : collectNodes level xs+ else collectNodes level xs+ _ ->+ collectNodes level xs++makeMenuLine :: Block+ -> State WriterState Doc+makeMenuLine (Header _ lst) = do+ txt <- inlineListForNode lst+ return $ text "* " <> txt <> text "::"+makeMenuLine _ = error "makeMenuLine called with non-Header block"++listItemToTexinfo :: [Block]+ -> State WriterState Doc+listItemToTexinfo lst = blockListToTexinfo lst >>=+ return . (text "@item" $$) ++defListItemToTexinfo :: ([Inline], [Block])+ -> State WriterState Doc+defListItemToTexinfo (term, def) = do+ term' <- inlineListToTexinfo term+ def' <- blockListToTexinfo def+ return $ text "@item " <> term' <> text "\n" $$ def'++-- | Convert list of inline elements to Texinfo.+inlineListToTexinfo :: [Inline] -- ^ Inlines to convert+ -> State WriterState Doc+inlineListToTexinfo lst = mapM inlineToTexinfo lst >>= return . hcat++-- | Convert list of inline elements to Texinfo acceptable for a node name.+inlineListForNode :: [Inline] -- ^ Inlines to convert+ -> State WriterState Doc+inlineListForNode lst = mapM inlineForNode lst >>= return . hcat++inlineForNode :: Inline -> State WriterState Doc+inlineForNode (Str str) = return $ text $ filter (not.disallowedInNode) str+inlineForNode (Emph lst) = inlineListForNode lst+inlineForNode (Strong lst) = inlineListForNode lst+inlineForNode (Strikeout lst) = inlineListForNode lst+inlineForNode (Superscript lst) = inlineListForNode lst+inlineForNode (Subscript lst) = inlineListForNode lst+inlineForNode (SmallCaps lst) = inlineListForNode lst+inlineForNode (Quoted _ lst) = inlineListForNode lst+inlineForNode (Cite _ lst) = inlineListForNode lst+inlineForNode (Code str) = inlineForNode (Str str)+inlineForNode Space = return $ char ' '+inlineForNode EmDash = return $ text "---"+inlineForNode EnDash = return $ text "--"+inlineForNode Apostrophe = return $ char '\''+inlineForNode Ellipses = return $ text "..."+inlineForNode LineBreak = return empty+inlineForNode (Math _ str) = inlineListForNode $ readTeXMath str+inlineForNode (TeX _) = return empty+inlineForNode (HtmlInline _) = return empty+inlineForNode (Link lst _) = inlineListForNode lst+inlineForNode (Image lst _) = inlineListForNode lst+inlineForNode (Note _) = return empty++-- periods, commas, colons, and parentheses are disallowed in node names+disallowedInNode :: Char -> Bool+disallowedInNode c = c `elem` ".,:()"++-- | Convert inline element to Texinfo+inlineToTexinfo :: Inline -- ^ Inline to convert+ -> State WriterState Doc++inlineToTexinfo (Emph lst) =+ inlineListToTexinfo lst >>= return . inCmd "emph"++inlineToTexinfo (Strong lst) = + inlineListToTexinfo lst >>= return . inCmd "strong" ++inlineToTexinfo (Strikeout lst) = do+ addToHeader $ "@macro textstrikeout{text}\n" +++ "~~\\text\\~~\n" +++ "@end macro\n"+ contents <- inlineListToTexinfo lst+ return $ text "@textstrikeout{" <> contents <> text "}"++inlineToTexinfo (Superscript lst) = do+ addToHeader $ "@macro textsuperscript{text}\n" +++ "@iftex\n" +++ "@textsuperscript{\\text\\}\n" +++ "@end iftex\n" +++ "@ifnottex\n" +++ "^@{\\text\\@}\n" +++ "@end ifnottex\n" +++ "@end macro\n"+ contents <- inlineListToTexinfo lst+ return $ text "@textsuperscript{" <> contents <> char '}'++inlineToTexinfo (Subscript lst) = do+ addToHeader $ "@macro textsubscript{text}\n" +++ "@iftex\n" +++ "@textsubscript{\\text\\}\n" +++ "@end iftex\n" +++ "@ifnottex\n" +++ "_@{\\text\\@}\n" +++ "@end ifnottex\n" +++ "@end macro\n"+ contents <- inlineListToTexinfo lst+ return $ text "@textsubscript{" <> contents <> char '}'++inlineToTexinfo (SmallCaps lst) =+ inlineListToTexinfo lst >>= return . inCmd "sc"++inlineToTexinfo (Code str) = do+ return $ text $ "@code{" ++ stringToTexinfo str ++ "}"++inlineToTexinfo (Quoted SingleQuote lst) = do+ contents <- inlineListToTexinfo lst+ return $ char '`' <> contents <> char '\''++inlineToTexinfo (Quoted DoubleQuote lst) = do+ contents <- inlineListToTexinfo lst+ return $ text "``" <> contents <> text "''"++inlineToTexinfo (Cite _ lst) =+ inlineListToTexinfo lst+inlineToTexinfo Apostrophe = return $ char '\''+inlineToTexinfo EmDash = return $ text "---"+inlineToTexinfo EnDash = return $ text "--"+inlineToTexinfo Ellipses = return $ text "@dots{}"+inlineToTexinfo (Str str) = return $ text (stringToTexinfo str)+inlineToTexinfo (Math _ str) = return $ inCmd "math" $ text str+inlineToTexinfo (TeX str) = return $ text "@tex" $$ text str $$ text "@end tex"+inlineToTexinfo (HtmlInline _) = return empty+inlineToTexinfo (LineBreak) = return $ text "@*"+inlineToTexinfo Space = return $ char ' '++inlineToTexinfo (Link txt (src, _)) = do+ case txt of+ [Code x] | x == src -> -- autolink+ do return $ text $ "@url{" ++ x ++ "}"+ _ -> do contents <- inlineListToTexinfo txt+ let src1 = stringToTexinfo src+ return $ text ("@uref{" ++ src1 ++ ",") <> contents <>+ char '}'++inlineToTexinfo (Image alternate (source, _)) = do+ content <- inlineListToTexinfo alternate+ return $ text ("@image{" ++ base ++ ",,,") <> content <> text "," <>+ text (ext ++ "}")+ where+ (revext, revbase) = break (=='.') (reverse source)+ ext = reverse revext+ base = case revbase of+ ('.' : rest) -> reverse rest+ _ -> reverse revbase++inlineToTexinfo (Note contents) = do+ contents' <- blockListToTexinfo contents+ let rawnote = stripTrailingNewlines $ render contents'+ let optNewline = "@end verbatim" `isSuffixOf` rawnote+ return $ text "@footnote{" <>+ text rawnote <>+ (if optNewline then char '\n' else empty) <>+ char '}'
+ Text/Pandoc/XML.hs view
@@ -0,0 +1,88 @@+{-+Copyright (C) 2006-7 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.XML+ Copyright : Copyright (C) 2006-7 John MacFarlane+ License : GNU GPL, version 2 or above++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Functions for escaping and formatting XML.+-}+module Text.Pandoc.XML ( escapeCharForXML,+ escapeStringForXML,+ inTags,+ selfClosingTag,+ inTagsSimple,+ inTagsIndented ) where+import Text.PrettyPrint.HughesPJ++-- | Escape one character as needed for XML.+escapeCharForXML :: Char -> String+escapeCharForXML x = case x of+ '&' -> "&"+ '<' -> "<"+ '>' -> ">"+ '"' -> """+ '\160' -> " "+ c -> [c]++-- | True if the character needs to be escaped.+needsEscaping :: Char -> Bool+needsEscaping c = c `elem` "&<>\"\160"++-- | Escape string as needed for XML. Entity references are not preserved.+escapeStringForXML :: String -> String+escapeStringForXML "" = ""+escapeStringForXML str =+ case break needsEscaping str of+ (okay, "") -> okay+ (okay, (c:cs)) -> okay ++ escapeCharForXML c ++ escapeStringForXML cs++-- | Return a text object with a string of formatted XML attributes.+attributeList :: [(String, String)] -> Doc+attributeList = text . concatMap+ (\(a, b) -> " " ++ escapeStringForXML a ++ "=\"" +++ escapeStringForXML b ++ "\"")++-- | Put the supplied contents between start and end tags of tagType,+-- with specified attributes and (if specified) indentation.+inTags:: Bool -> String -> [(String, String)] -> Doc -> Doc+inTags isIndented tagType attribs contents =+ let openTag = char '<' <> text tagType <> attributeList attribs <>+ char '>'+ closeTag = text "</" <> text tagType <> char '>'+ in if isIndented+ then openTag $$ nest 2 contents $$ closeTag+ else openTag <> contents <> closeTag++-- | Return a self-closing tag of tagType with specified attributes+selfClosingTag :: String -> [(String, String)] -> Doc+selfClosingTag tagType attribs =+ char '<' <> text tagType <> attributeList attribs <> text " />"++-- | Put the supplied contents between start and end tags of tagType.+inTagsSimple :: String -> Doc -> Doc+inTagsSimple tagType = inTags False tagType []++-- | Put the supplied contents in indented block btw start and end tags.+inTagsIndented :: String -> Doc -> Doc+inTagsIndented tagType = inTags True tagType []
+ changelog view
@@ -0,0 +1,1679 @@+pandoc (1.0)++ [ Andrea Rossato ]++ * Added new OpenDocument writer.++ * Added support for SmallCaps inline element.++ * Added support for integrating pandoc with citeproc-hs.++ + Added Cite element to definition and writers.+ + Added Text.Pandoc.Biblio module+ + Note: This support is included only if the 'citeproc'+ Cabal configuration flag is set.++ * Made Pandoc data structure an instance of Typeable.+ Added new processPandoc and queryPandoc functions, to query+ or transform matching elements in a Pandoc structure.++ [ Peter Wang ]++ * Added new Texinfo writer.++ [ John MacFarlane ]++ * Changes to Texinfo writer:++ + No space between paragraph and following @verbatim (provides more+ pleasing appearance in text formats)+ + Blank line consistently after list environments.+ + Removed deVerb.+ + Use @code instead of @verb for inline code (this solves the character+ escaping problem for texi2dvi and texi2pdf).+ + Added news of Texinfo writer to README.+ + Added Texinfo to list of formats in man page, and removed extra 'groff'.+ + Added texi & texinfo extensions to Main.hs, and fixed bug in determining+ default output extension.+ + Modified disallowedInNode in Texinfo writer to correct list of disallowed characters.++ * Added tests for OpenDocument writer.++ * Added ODT writer (using zip-archive library to package output of+ OpenDocument writer). Added odt-styles directory with default ODT styles.++ * Added new mediawiki writer and tests.++ * Markdown reader: Added support for delimited code blocks, with optional+ syntax highlighting using highlighting-kate (if the 'highlighting'+ configuration option is selected).++ + Currently highlighting is supported only in the HTML writer.+ + Delimited code blocks can have attributes; using the language name as+ class triggers highlighting.+ + New Attributes parameter in CodeBlock structure.+ + --version now indicates whether syntax highlighting support is compiled+ in, and prints a list of supported languages++ * Removed debian directory. Pandoc is no longer a native debian package.++ * Changes to build process: pandoc can now be built from the repository+ using Cabal. No unix tools are needed (so, pandoc can be built on Windows+ without Cygwin).++ + Include shell scripts themselves in repo, rather than generating from wrappers.+ Removed wrappers directory and wrappers Makefile target.+ + Text/Pandoc/ASCIIMathML.hs, Text/Pandoc/DefaultHeaders.hs,+ and Text/Pandoc/Writers/S5.hs are no longer built in Makefile+ from templates in the templates/ directory. Instead, they use template+ haskell to read data at compile time from the relevant files in data/.+ Template haskell functions go in a new module, Text.Pandoc.TH.+ + man pages are now generated in Setup.hs hook, not by Makefile+ + Makefile 'tarball' target now calls Cabal's 'sdist'+ + Added "Extra-Source-Files" to pandoc.cabal, so sdist contains everything needed+ + Added "Build-Type" field to pandoc.cabal to avoid warning.+ + Added to "Extra-source-files" and "Extra-tmp-files" in pandoc.cabal,+ so 'sdist' and 'clean' will work properly.+ + Setup.hs now generates man pages in a postbuild hook.+ + Added dependency-checking to Setup.hs, so it only rebuilds things+ that need rebuilding.+ + Added 'library' and 'executable' configuration flags.+ Cabal can now be told to build just the library or just the executable.+ + CABALOPTS may now be specified with 'make' to pass Cabal configuration flags.+ For example: CABALOPTS=-fhighlighting make++ * Rewrote test suite so it doesn't depend on perl or unix tools.++ + Replaced old runtests.pl with a Haskell script RunTests.hs.+ + Added Diff.hs module to be used by RunTests.hs instead of unix 'diff'.+ + Added test hook to Setup.hs, so tests may be run from cabal.+ + Changed Makefile's 'test' target to run tests via cabal.+ + Removed old generate.sh.+ + Since we no longer have 'sed' to filter out raw HTML sections+ from the docbook writer test, or raw LaTeX sections from the+ context writer test, we now just include these sections.+ They can be taken out if it is necessary to process the files.+ + Updated latex and context writer tests to remove extra spaces+ after '\\item'+ + Added a markdown table reader test.+ + Added markdown-reader-more.txt to test suite, for additional test cases+ for raw ConTeXt environments and more.++ * Compatibility fixes for CPP, Cabal, and haddock:++ + Use CPP in "Extensions" field in pandoc.cabal.+ + Removed use of backslash string continuations in source files.++ * Removed pandoc.cabal.ghc66. We now require Cabal >= 1.2, GHC >= 6.8,+ base >= 3.++ * Require parsec < 3.+ The compatibility module in parsec 3.0.0 gives far worse performance than+ parsec 2.1. Eventually pandoc will be upgraded to use the new bytestring+ version of parsec, and then we'll go to parsec 3.0.0.++ * Removed Text.Regex dependencies by rewriting using plain Haskell+ (Text.Pandoc.Writers.RTF, Text.Pandoc.Writers.HTML, Main.hs)++ * Moved Text.Pandoc.Writers.DefaultHeaders -> Text.Pandoc.DefaultHeaders.++ * Makefile:++ + Added 'configure' as dependency of 'uninstall-all'.+ (It uses the Cabal build program.)+ + Makefile: only use --with-hc-pkg if GHC_PKG is defined.+ Note that Cabal will automatically choose the ghc-pkg appropriate+ for the compiler selected, so normally specifying GHC by itself+ is sufficient.++ * Removed Text.Pandoc.UTF8 module; instead, depend on utf8-string and use+ its IO and conversion functions.++ * Added -Wall to ghc-options in pandoc.cabal. Cleaned up modules so that+ everything is -Wall clean.++ + Added pragma to HTML writer to avoid deprecation warning for use of "start" attribute.+ + Added pragma to Text/Pandoc/Shared.hs to get rid of "orphan instance" warnings.+ (These are caused by the Lift instance for ByteString.)++ * Changed the comment used to replace unsafe HTML if sanitize-html option+ selected.++ * Made -c/--css option repeatable on the command line (like -H, -A, -B).++ * Moved XML-formatting functions to new unexported module Text.Pandoc.XML.++ * Escape '\160' as " ", not " " in XML.+ "nbsp" isn't a predefined XML entity.++ * Fixed bug in RST reader, which would choke on: "p. one\ntwo\n".+ Added some try's in ordered list parsers.++ * Man writer: don't escape " as \".++ * Allow newline before URL in markdown link references. Resolves Issue #81.+ Added tests for this issue in new "markdown-reader-more" tests.+ Changed RunTests.hs to run these tests.++ * Support for display math. Resolves Issue #47.++ + Added a DisplayMath/InlineMath selector to Math inlines.+ + Markdown parser yields DisplayMath for $$...$$.+ + LaTeX parser yields DisplayMath when appropriate. Removed+ mathBlock parsers, since the same effect is achieved by the math+ inline parsers, now that they handle display math.+ + Writers handle DisplayMath as appropriate for the format.+ + Modified tests accordingly; added new tests for display math.++ * Use LaTeXMathML instead of ASCIIMathML. LaTeXMathML is closer+ to LaTeX in its display of math, and supports many non-math LaTeX environments.++ + Changed -m option to use LaTeXMathML rather than ASCIIMathML.+ + Modified HTML writer to print raw TeX when LaTeXMathML is+ being used instead of suppressing it.+ + Removed ASCIIMathML files from data/ and added LaTeXMathML.+ + Replaced ASCIIMathML with LaTeXMathML in source files.+ + Modified README and pandoc man page source.+ + Added --latexmathml option (kept --asciimathml as a synonym+ for backwards compatibility)++ * Markdown reader: Parse setext headers before atx headers.+ Test case:+ # hi+ ====+ parsed by Markdown.pl as an H1 header with contents "# hi".++ * Markdown reader: Treat "mixed" lists the same way as Markdown.pl does.+ The marker on the first list item determines the type of the whole+ list. Thus, a list like+ 1. one+ - two+ * three+ gets parsed as a single ordered list. (Previous versions of pandoc+ treated this as an ordered list with an unordered sublist.)++ * Markdown smart typography:++ + Em dashes no longer eat surrounding whitespace. Resolves Issue #69.+ + Use nonbreaking spaces after known abbreviations in markdown parser.+ Thus, for example, "Mr. Brown" comes out as "Mr.~Brown" in LaTeX, and does+ not produce a sentence-separating space. Resolves Issue #75.++ * Markdown writer: Print unicode \160 literally, rather than as .++ * Treat '\ ' in (extended) markdown as nonbreaking space.+ Print nonbreaking space appropriately in each writer (e.g. ~ in LaTeX).++ * The '--sanitize-html' option now examines URIs in markdown links+ and images, and in HTML href and src attributes. If the URI scheme+ is not on a whitelist of safe schemes, it is rejected. The main point+ is to prevent cross-site scripting attacks using 'javascript:' URIs.+ See http://www.mail-archive.com/markdown-discuss@six.pairlist.net/msg01186.html+ and http://ha.ckers.org/xss.html. Resolves Issue #62.++ * HTML writer:++ + Override Text.XHtml's stringToHtml function,+ so that characters below 0xff are not converted to numerical entity+ references. Also convert '\160' to " ". This should aid readability+ and editability of the HTML source. It does presuppose that the HTML+ will be served as UTF-8.+ + In code blocks, change leading newlines to <br /> tags.+ (Some browsers ignore them.) Resolves Issue #71.+ See http://six.pairlist.net/pipermail/markdown-discuss/2008-May/001297.html+ + Use style attributes rather than css classes for strikethrough+ and ordered list styles. This works better when fragments, rather than+ standalone documents, are generated.++ * HTML reader: Count anything that isn't a known block (HTML) tag as an+ inline tag (rather than the other way around). Added "html", "head", and+ "body" to list of block tags. Resolves Issue #66, allowing+ <lj> to count as an inline tag.++ * RTF writer: Fixed bug. Extra spaces were being printed after emphasized,+ boldface, and other inline elements. Resolves Issue #64.++ * LaTeX reader: improvements in raw LaTeX parsing.++ + "loose punctuation" (like {}) parsed as Space+ + Para elements must contain more than Str "" and Space elements+ + Added parser for "\ignore" command used in literate haskell.+ + Reworked unknownCommand and rawLaTeXInline: when not in "parse raw"+ mode, these parsers simply strip off the command part and allow+ the arguments to be parsed normally. So, for example,+ \blorg{\emph{hi}} will be parsed as Emph "hi" rather than+ Str "{\\emph{hi}}".+ + Parse lhs "code" environments as verbatim.+ Refactored parsers for verbatim environments.+ + Removed specialEnvironment parser.+ + parse '{}', if present, after \textless, \textgreater,+ \textbar, \textbackslash, \ldots.+ + Parse unescaped special characters verbatim rather than+ changing them to spaces. This way arguments of unknown+ commands will appear in braces.++ * Parse raw ConTeXt environments as TeX in markdown reader.+ Resolves Issue #73.++ * Moved BlockWrapper and wrappedBlocksToDoc from ConTeXt writer to Shared.++ * Made some structural changes to parsing of raw LaTeX environments.+ Previously there was a special block parser for LaTeX environments.+ It returned a Para element containing the raw TeX inline. This has+ been removed, and the raw LaTeX environment parser is now used in the+ rawLaTeXInline parser. The effect is exactly the same, except that we+ can now handle consecutive LaTeX and ConTeXt environments not separated+ by spaces. This new flexibility is required by the example in+ Issue #73:++ \placeformula \startformula+ L_{1} = L_{2}+ \stopformula++ API change: The LaTeX reader now exports rawLaTeXEnvironment' (which+ returns a string) rather than rawLaTeXEnvironment (which returns a block+ element). This is more likely to be useful in other applications.++ * Use \textsubscr instead of \textsubscript for LaTeX subscript macro.+ \textsubscript conflicts with a definition in the memoir class.+ Resolves Issue #65.++ * Removed unneeded space after "\\item" in LaTeX and ConTeXt output.++ * Added amsmath package to default LaTeX header. Resolves Issue #48.++ * Added \setupitemize[autointro] to ConTeXt header, to prevent orphaned+ list introduction lines.++ * Changed Float to Double in definition of Table element.+ (Double is more efficient in GHC.)++ * Fixed bug in Markdown parser: regular $s triggering math mode.+ For example: "shoes ($20) and socks ($5)."+ The fix consists in two new restrictions:++ + the $ that ends a math span may not be directly followed by a digit.+ + no blank lines may be included within a math span.++ Thanks to Joseph Reagle for noticing the bug.++ * Use Data.List's 'intercalate' instead of custom 'joinWithSep'.+ Removed 'joinWithSep' from Text.Pandoc.Shared.++ * Updated README and man pages. Acknowledge contributors in README.+ Added paragraph to README about producing S5 with separate CSS/javascript.++ * Updated INSTALL to reflect new build system (including configuration+ options) and document new dependencies. Added note to INSTALL that+ Cabal >= 1.2 is required for build. Resolves Issue #74.++ * Fixed some haddock documentation errors.++ * Small fix to markdown2pdf man page: only input needs to be piped through iconv.++pandoc (0.46) unstable; urgency=low++ [ John MacFarlane ]++ * Made -H, -A, and -B options cumulative: if they are specified+ multiple times, multiple files will be included.++ * Added optional HTML sanitization using a whitelist.+ When this option is specified (--sanitize-html on the command line),+ unsafe HTML tags will be replaced by HTML comments, and unsafe HTML+ attributes will be removed. This option should be especially useful+ for those who want to use pandoc libraries in web applications, where+ users will provide the input.++ + Main.hs: Added --sanitize-html option.++ + Text.Pandoc.Shared: Added stateSanitizeHTML to ParserState.++ + Text.Pandoc.Readers.HTML:+ - Added whitelists of sanitaryTags and sanitaryAttributes.+ - Added parsers to check these lists (and state) to see if a given+ tag or attribute should be counted unsafe.+ - Modified anyHtmlTag and anyHtmlEndTag to replace unsafe tags+ with comments.+ - Modified htmlAttribute to remove unsafe attributes.+ - Modified htmlScript and htmlStyle to remove these elements if+ unsafe.++ + Modified README and man pages to document new option.++ * Improved handling of email addresses in markdown and reStructuredText.+ Consolidated uri and email address parsers. (Resolves Issue #37.)++ + New emailAddress and uri parsers in Text.Pandoc.Shared.+ - uri parser uses parseURI from Network.URI.+ - emailAddress parser properly handles email addresses with periods+ in them.++ + Removed uri and emailAddress parsers from Text.Pandoc.Readers.RST+ and Text.Pandoc.Readers.Markdown.++ * Markdown reader:++ + Fixed emph parser so that "*hi **there***" is parsed as a Strong+ nested in an Emph. (A '*' is only recognized as the end of the+ emphasis if it's not the beginning of a strong emphasis.)++ + Moved blockQuote parser before list parsers for performance.++ + Modified 'source' parser to allow backslash-escapes in URLs.+ So, for example, [my](/url\(1\)) yields a link to /url(1).+ Resolves Issue #34.++ + Disallowed links within links. (Resolves Issue #35.)+ - Replaced inlinesInBalanced with inlinesInBalancedBrackets, which+ instead of hard-coding the inline parser takes an inline parser+ as a parameter.+ - Modified reference and inlineNote to use inlinesInBalancedBrackets.+ - Removed unneeded inlineString function.+ - Added inlineNonLink parser, which is now used in the definition of+ reference.+ - Added inlineParsers list and redefined inline and inlineNonLink parsers+ in terms of it.+ - Added failIfLink parser.++ + Better handling of parentheses in URLs and quotation marks in titles.+ - 'source' parser first tries to parse URL with balanced parentheses;+ if that doesn't work, it tries to parse everything beginning with+ '(' and ending with ')'.+ - source parser now uses an auxiliary function source'.+ - linkTitle parser simplified and improved, under assumption that it+ will be called in context of source'.++ + Make 'block' conditional on strictness state, instead of using+ failIfStrict in block parsers. Use a different ordering of parsers+ in strict mode (raw HTML block before paragraph) for performance.+ In non-strict mode use rawHtmlBlocks instead of htmlBlock.+ Simplified htmlBlock, since we know it's only called in strict+ mode.++ + Improved handling of raw HTML. (Resolves Issue #36.)+ - Tags that can be either block or inline (e.g. <ins>) should+ be treated as block when appropriate and as inline when+ appropriate. Thus, for example,+ <ins>hi</ins>+ should be treated as a paragraph with inline <ins> tags, while+ <ins>+ hi+ </ins>+ should be treated as a paragraph within <ins> tags.+ - Moved htmlBlock after para in list of block parsers. This ensures+ that tags that can be either block or inline get parsed as inline+ when appropriate.+ - Modified rawHtmlInline' so that block elements aren't treated as+ inline.+ - Modified para parser so that paragraphs containing only HTML tags and+ blank space are not allowed. Treat these as raw HTML blocks instead.++ + Fixed bug wherein HTML preceding a code block could cause it to+ be parsed as a paragraph. The problem is that the HTML parser+ used to eat all blank space after an HTML block, including the+ indentation of the code block. (Resolves Issue #39.)+ - In Text.Pandoc.Readers.HTML, removed parsing of following space+ from rawHtmlBlock.+ - In Text.Pandoc.Readers.Markdown, modified rawHtmlBlocks so that+ indentation is eaten *only* on the first line after the HTML+ block. This means that in+ <div>+ foo+ <div>+ the foo won't be treated as a code block, but in+ <div>++ foo++ </div>+ it will. This seems the right approach for least surprise.++ * RST reader:++ + Fixed bug in parsing explicit links (resolves Issue #44).+ The problem was that we were looking for inlines until a '<' character+ signaled the start of the URL; so, if you hit a reference-style link,+ it would keep looking til the end of the document. Fix: change+ inline => (notFollowedBy (char '`') >> inline). Note that this won't+ allow code inlines in links, but these aren't allowed in resT anyway.++ + Cleaned up parsing of reference names in key blocks and links.+ Allow nonquoted reference links to contain isolated '.', '-', '_', so+ so that strings like 'a_b_' count as links.++ + Removed unnecessary check for following link in str.+ This is unnecessary now that link is above str in the definition of+ 'inline'.++ * HTML reader:++ + Modified rawHtmlBlock so it parses </html> and </body> tags.+ This allows these tags to be handled correctly in Markdown.+ HTML reader now uses rawHtmlBlock', which excludes </html> and </body>,+ since these are handled in parseHtml. (Resolves Issue #38.)++ + Fixed bug (emph parser was looking for <IT> tag, not <I>).++ + Don't interpret contents of style tags as markdown.+ (Resolves Issue #40.)+ - Added htmlStyle, analagous to htmlScript.+ - Use htmlStyle in htmlBlockElement and rawHtmlInline.+ - Moved "script" from the list of tags that can be either block or+ inline to the list of block tags.++ + Modified rawHtmlBlock to use anyHtmlBlockTag instead of anyHtmlTag+ and anyHtmlEndTag. This fixes a bug in markdown parsing, where+ inline tags would be included in raw HTML blocks.++ + Modified anyHtmlBlockTag to test for (not inline) rather than+ directly for block. This allows us to handle e.g. docbook in+ the markdown reader.++ * LaTeX reader: Properly recognize --parse-raw in rawLaTeXInline.+ Updated LaTeX reader test to use --parse-raw.++ * HTML writer:++ + Modified rules for automatic HTML header identifiers to+ ensure that identifiers begin with an alphabetic character.+ The new rules are described in README. (Resolves Issue #33.)++ + Changed handling of titles in HTML writer so you don't get+ "titleprefix - " followed by nothing.++ * ConTeXt writer: Use wrappers around Doc elements to ensure proper+ spacing. Each block element is wrapped with either Pad or Reg.+ Pad'ed elements are guaranteed to have a blank line in between.++ * RST writer:++ + Refactored RST writer to use a record instead of a tuple for state,+ and to include options in state so it doesn't need to be passed as+ a parameter.++ + Use an interpreted text role to render math in restructuredText.+ See http://www.american.edu/econ/itex2mml/mathhack.rst for the+ strategy.++ [ Recai Oktaş ]++ * Debian packaging changes:++ + Remove the empty 'include' directory in -dev package, which lintian+ complains about.+ + Bump Standarts-Version to 3.7.3.+ + Use new 'Homepage:' field to specify the upstream URL on suggestion of+ lintian.++ -- Recai Oktaş <roktas@debian.org> Tue, 08 Jan 2008 05:13:31 +0200++pandoc (0.45) unstable; urgency=low++ [ John MacFarlane ]++ * Simplified parsing of reference keys and notes in markdown and RST+ readers: The Reference data structure from Text.Pandoc.Shared is no+ longer needed, since referenceKey and noteBlock parses return strings+ (as many blank lines as were occupied by the key or note) and update+ state themselves. getPosition and setPosition are now used to ensure+ that error messages will give the correct line number. This yields+ cleaner (and slightly faster) code, with more accurate parsing error+ messages.++ * Added new Math inline element:++ + Markdown and LaTeX readers now convert TeX math into Math elements,+ not TeX.+ + This allows math to be treated differently from raw TeX in output.+ TeX elements are no longer printed in output formats other than+ Markdown, LaTeX, and ConTeXt. But Math elements are always printed.++ * New default handling of math in writers:++ + New module Text.Pandoc.Readers.TeXMath exports readTeXMath, which+ parses raw TeX math and outputs a string of Pandoc inlines that+ tries to render it as far as possible using unicode characters,+ lapsing into literal TeX when needed.+ + readTeXMath is now used for default HTML output in HTML, S5, RTF,+ and Docbook, if no other method for displaying math in HTML is+ specified. Enclosing $'s are no longer printed by default.+ + By default, math is put inside <span class="math">. This way it can be+ distinguished from the surrounding text, e.g. put in a different+ font.++ * New --gladtex and --mimetex options for display of math in HTML:++ + If --gladtex is specified, math is output between <eq> tags, so+ it can be processed by gladTeX.+ + If --mimetex is specified, math is put in <img> tags with a link+ to the mimetex CGI script (or any other script that takes TeX math+ as input and outputs an image). The URL of the script may be+ specified, but defaults to /cgi-bin/mimetex.cgi.+ + HTMLMathMethod structure in WriterOptions keeps track of how to+ display math in HTML output.+ + Updated README with a description of the four options for displaying+ math in HTML.++ * HTML reader:++ + Fixed bug: parser for minimized attributes should not swallow+ trailing spaces.+ + Simplified HTML attribute parsing.+ + Changed parsing of code blocks in HTML reader: <code> tag is no+ longer needed. <pre> suffices. All HTML tags in the code block+ (e.g. for syntax highlighting) are skipped, because they are not+ portable to other output formats. A <code>...</code> block not+ surrounded by <pre> now counts as inline HTML, not a code block.+ + Remove just one leading and one trailing newline from contents of+ <pre>...</pre> in codeBlock parser.++ * Markdown reader:++ + Removed support for box-style block quotes.+ + Require space before title in links and references.+ This fixes a bug in parsing URLs like http://silly/url(withparen).+ + Improved and simplified setextHeader parser.+ + Fixed logic in smart quote parsing, adding some needed 'try'+ statements.+ + Fixed smart quote parsing so that unicode characters 8216 and 8217+ are recognized as single quotes, and 8220 and 8221 as double quotes.++ * RST reader:++ + Fixed bug in parsing of code blocks. Previously a full tab indent+ was required, but RST allows code to be indented any amount.+ Resolves Issue #27.+ + Allow field lists to be indented.+ + Parse the contents of field lists instead of treating as a raw string.+ + Represent field lists as definition lists instead of blockquotes.+ + Fixed bug in which metadata would be overridden if the document+ contained multiple field lists.+ + Parse fields associated with '.. image::' blocks, and use 'alt'+ field, if given, for image alt and title attributes.++ * LaTeX reader:++ + Modified specialChar so that '"' characters are parsed.+ + Fixed a bug in parsing of \[ \] math blocks (thanks to Mark Kalderon).++ * HTML writer:++ + Changes in handling of math (see above).+ + Don't produce HTML for table of contents if there are+ no headers. (This would be an empty list, which is invalid XHTML.)++ * Markdown writer:++ + Don't print title attribute if title is empty. (This differs from+ the behavior of Markdown.pl, and agrees with PHP Markdown. But John+ Gruber has indicated that he prefers this behavior.) Adjusted test+ suite accordingly.+ + Fixed incorrect line wrapping in paragraphs including hard line+ breaks. Resolves Issue #25.+ + Fixed bug in markdown writer: If an ordered list item began with+ a marker greater than 3 characters in width, and the item took more+ than one line, it would appear on the line after the list marker,+ e.g.:++ (12)+ My list item.+ Multiline.++ Now it works as follows:++ (12) My list item.+ Multiline.++ * RST writer++ + Fixed bug in RST writer's handling of ordered lists. Previously,+ list items with multiple lines would not always line up with+ single-line list items. Now, list items are nested the length of+ the list marker + 1. This looks better and ensures that list items+ all line up. (Note that list markers are padded to the length of+ the longest list marker in the series.)+ + Use 3-space indent for unordered lists.+ + If label for a link reference contains a colon, surround it by `+ signs so it won't be interpreted as the end of the link label.++ * LaTeX writer:++ + Cleaner output for footnotes. Footnotes now always begin on a new+ line, and the final } is on a line by itself only when it needs to+ be (i.e. only when the note ends with a Verbatim environment).+ + Added writer options to state, so state doesn't need to be passed as+ a parameter.+ + Text wrapping now provided, using wrapTeXIfNeeded.++ * ConTeXt writer: many improvements for more idiomatic ConTeXt output+ (thanks to Idris Samawi Hamid for suggestions).++ + PrettyPrint module now used for output.+ + Writer options are now in state, so they don't have to be passed as+ a parameter.+ + Text wrapping now provided, using wrapTeXIfNeeded.+ + Better treatment of footnotes: footnotes are always on lines by+ themselves, and the final } is on a line by itself only when+ it needs to be (after \stoptyping).+ + Use \subject, \subsubject, ... or \section, \subsection, ... for headings,+ depending on whether --number-sections option is selected.+ + Extra blank line inserted after \stopitemize+ + Use new, "official" definition of blockquote environment. Also, use+ blank line after \startblockquote to balance blank line at the end.+ + Both itemized and enumerated lists are now generated using+ \start-stopitemize, with appropriate options. Removed definitions+ of ltxenum and ltxitem, which are no longer needed. Provided+ defaults for itemized lists in the preamble. State keeps track of+ ordered list level, so that when default numbering is specified,+ the appropriate scheme can be used.+ + Changed \useurl to \useURL.+ + Changed link color from red to blue.+ + Use \subsubsubsubsection etc., since these are supported+ (up to at least sub x 5).++ * Text.Pandoc.Shared:++ + Save and restore position in parseFromString, so that accurate+ error messages can be given.+ + Improved efficiency of romanNumeral parser.+ + Added wrappedTeX and wrapTeXIfNeeded functions. These ensure+ that footnotes occur on lines by themselves (to make them+ easier to see and move) and do not screw up line wrapping.++ * Text.Pandoc.UTF8: modified fromUTF8 to strip out the BOM+ if present. Windows Notepad and other applications insert a+ BOM at the beginning of a UTF8 file.++ * Main.hs (tabFilter): Treat '\r' at end of line as newline (in+ addition to "\r\n" and '\n').++ * Added a writer option for wrapped text and a command-line option+ '--no-wrap', which disables text wrapping and minimizes whitespace+ in HTML. (Resolves Issue #26.)++ + Added support for '--no-wrap' to Main.hs.+ + Added wrapIfNeeded function to Text.Pandoc.Shared.+ + Use wrapIfNeeded instead of wrapped in the RST, Man, Docbook, and+ Markdown writers.+ + Added render and renderFragment helpers to HTML writer.++ * Modified html2markdown to run tidy only if the HTML cannot be+ parsed. Previously html2markdown piped all input through tidy+ before passing it to pandoc. This caused problems on certain pages+ (e.g. http://daringfireball.com/markdown) which have well-formed+ XHTML that causes tidy to choke. The solution is to pipe through+ tidy only if pandoc cannot parse the input by itself. This means+ that a temp file is now always used, even when input comes from a+ local file or standard input.++ * Removed 'version' constant from Main.hs; added 'pandocVersion' to+ Text.Pandoc library.++ * pandoc.cabal:++ + Modified to work with GHC 6.8 and Cabal configurations. (For GHC+ 6.8, pretty and containers must be added to Build-Depends, and it+ is desirable to use the -O2 compiler option.) Cabal configurations+ allows one to select options depending on the compiler version.+ For GHC 6.6, the splitBase option can be disabled.+ + pandoc.cabal.ghc66 is provided for users with older versions of+ Cabal, which do not support configurations.+ + Use Ghc-Prof-Options to ensure that '-auto-all' is used when+ '--enable-(executable|library)-profiling' is specified. Updated+ PROFILING instructions accordingly.++ * Makefile:++ + Makefile now checks GHC version. If GHC is 6.6, pandoc.cabal.ghc66+ is copied to pandoc.cabal, and the old pandoc.cabal is copied+ to pandoc.cabal.orig. Otherwise, pandoc.cabal is copied to+ pandoc.cabal.orig but otherwise unmodified. This way, the Makefile+ will work properly with either GHC 6.6 or 6.8.+ + Changed BUILDCONF to point to dist/setup-config, not .setup-config.+ This is where current versions of Cabal put it.+ + Added $(BUILDCMD) target, so setup doesn't get compiled every time.+ + Removed dependency of templates on ./templates, which is circular+ now that templates is a subdirectory of the top-level.++ * MacPorts Portfile:++ + Modified to install the pandoc library in addition to programs.+ + Installation must be done manually rather than using Makefile's+ install-all.+ + Note that the library must be registered in the activate phase,+ after the library files have been copied out of the destroot.+ Cabal generates a 'register.sh' script that will do this.++ * debian/control: Added libghc6-network-dev, libghc6-xhtml-dev, and+ libghc6-mtl-dev as dependencies for libghc6-pandoc-dev.+ Closes: #445235++ * debian/rules: Converted to UTF-8.++ * Changed pandoc home page to http://johnmacfarlane.net/pandoc/.++ * Updated ASCIIMathML.js to latest version.++ * Directory structure:++ + Moved everything from src into the top-level directory.+ + Changed references to source directory in Makefile and+ pandoc.cabal.*.+ + Moved ASCIIMathML.js, headers, and ui into templates directory.+ + Modified fillTemplates.pl to reflect new paths.++ [ Recai Oktaş ]++ * Makefile: Fixed the issue of having two copies of the library+ documentation under some usage scenarios.++ * Replaced 'ghc' with '$(GHC)' in Makefile, and made GHC+ and GHC_PKG configurable through the environment, to support+ unusual ghc installations. For example:+ GHC=/opt/ghc/bin/ghc GHC_PKG=/opt/ghc/bin/ghc-pkg make++ -- Recai Oktaş <roktas@debian.org> Sun, 07 Oct 2007 20:51:43 +0300++pandoc (0.44) unstable; urgency=low++ [ John MacFarlane ]++ * Fixed bug in HTML writer: when --toc was used, anchors were put around+ headers, which is invalid XHTML (block content within inline element).+ Now the anchors are put inside the header tags. Resolves Issue #23.++ * Added xmlns attribute to html element in html writer tests.+ This attribute is added by more recent versions of the+ xhtml library (>= 3000), and is required for valid XHTML.++ [ Recai Oktaş ]++ * On configure, compile 'Setup.hs' to 'setup' and use 'setup' as the build+ command instead of 'runhaskell', which, on some platforms (such as s390,+ alpha, m68k), throws the following error:++ runhaskell Setup.hs configure --prefix=/usr+ ghc-6.6.1: not built for interactive use++ This causes a serious FTBFS bug. Closes: #440668.++ -- Recai Oktaş <roktas@debian.org> Mon, 03 Sep 2007 18:24:02 +0300++pandoc (0.43) unstable; urgency=low++ [ John MacFarlane ]++ * The focus of this release is performance. The markdown parser+ is about five times faster than in 0.42, based on benchmarks+ with the TextMate manual.++ * Main.hs: Replaced CRFilter and tabFilter with single function+ tabFilter, which operates on the whole string rather than breaking+ it into lines, and handles dos-style line-endings as well as tabs.++ * Added separate LaTeX reader and native reader tests; removed+ round-trip tests.++ * Text.Pandoc.Shared:++ + Removed tabsToSpaces and tabsInLine (they were used only in Main.hs.)+ + General code cleanup (to elimante warnings when compiling with -Wall.)+ + Added 'wrapped' function, which helps wrap text into paragraphs,+ using the prettyprinting library.+ + Rewrote charsInBalanced and charsInBalanced'.+ - Documented restriction: open and close must be distinct characters.+ - Rearranged options for greater efficiency.+ - Bug fix: Changed inner call to charsInBalanced inside+ charsInBalanced' to charsInBalanced'.+ + anyLine now requires that the line end with a newline (not eof).+ This is a harmless assumption, since we always add newlines to the+ end of a block before parsing with anyLine, and it yields a 10% speed+ boost.+ + Removed unnecessary 'try' in anyLine.+ + Removed unneeded 'try' from romanNumeral parser.+ + Use notFollowedBy instead of notFollowedBy' in charsInBalanced.+ + Removed unneeded 'try' in parseFromString.+ + Removed unneeded 'try' from stringAnyCase. (Now it behaves+ like 'string'.)+ + Changed definition of 'enclosed' in Text.Pandoc.Shared so that+ 'try' is not automatically applied to the 'end' parser. Added+ 'try' in calls to 'enclosed' where needed. Slight speed increase.++ * Writers:++ + Replaced individual wrapping routines in RST, Man, and Markdown+ writers with 'wrapped' from Text.Pandoc.Shared.+ + Rewrote LaTeX writer to use the prettyprinting library,+ so we get word wrapping, etc.+ + Modified latex writer tests for new latex writer using prettyprinter.+ + Fixed bug in LaTeX writer: autolinks would not cause+ '\usepackage{url}' to be put in the document header. Also, changes+ to state in enumerated list items would be overwritten.+ + In Markdown writer, escape paragraphs that begin with ordered list+ markers, so they don't get interpreted as ordered lists.++ * Text.Pandoc.Reades.LaTeX:++ + Fixed bug in LaTeX reader, which wrongly assumed that the roman+ numeral after "enum" in "setcounter" would consist entirely of+ "i"s. 'enumiv' is legitimate.+ + LaTeX command and environment names can't contain numbers.+ + Rearranged order of parsers in inline for slight speed improvement.+ + Added '`' to special characters and 'unescapedChar'.++ * Text.Pandoc.Readers.RST:++ + Removed unneeded try's in RST reader; also minor code cleanup.+ + Removed tabchar.+ + Rearranged parsers in inline (doubled speed).++ * Text.Pandoc.Readers.Markdown:++ + Skip notes parsing if running in strict mode. (This yields a nice+ speed improvement in strict mode.)+ + Simplify autolink parsing code, using Network.URI to test for+ URIs. Added dependency on network library to debian/control and+ pandoc.cabal.+ + More perspicuous definition of nonindentSpaces.+ + Removed unneeded 'try' in 'rawLine'.+ + Combined linebreak and whitespace into a new whitespace parser, to+ avoid unnecessary reparsing of space characters.+ + Removed unnecessary 'try' in 'codeBlock', 'ellipses', 'noteMarker',+ 'multilineRow', 'dashedLine', 'rawHtmlBlocks'.+ + Use lookAhead in parsers for setext headers and definition lists+ to see if the next line begins appropriately; if not, don't waste+ any more time parsing.+ + Don't require blank lines after code block. (It's sufficient to+ end code block with a nonindented line.)+ + Changed definition of 'emph': italics with '_' must not+ be followed by an alphanumeric character. This is to help+ prevent interpretation of e.g. [LC_TYPE]: my_type as+ '[LC<em>TYPE]:my</em>type'.+ + Improved Markdown.pl-compatibility in referenceLink: the two parts+ of a reference-style link may be separated by one space, but not+ more... [a] [link], [not] [a link].+ + Fixed markdown inline code parsing so it better accords with+ Markdown.pl: the marker for the end of the code section is a clump+ of the same number of `'s with which the section began, followed+ by a non-` character. So, for example,+ ` h ``` i ` -> <code>h ``` i</code>.+ + Split 'title' into 'linkTitle' and 'referenceTitle', since the+ rules are slightly different.+ + Rewrote 'para' for greater efficiency.+ + Rewrote link parsers for greater efficiency.+ + Removed redundant 'referenceLink' in definition of inline (it's+ already in 'link').+ + Refactored escapeChar so it doesn't need 'try'.+ + Refactored hrule for performance in Markdown reader.+ + More intelligent rearranging of 'inline' so that most frequently+ used parsers are tried first.+ + Removed tabchar parser, as whitespace handles tabs anyway.++ * Text.Pandoc.CharacterReferences:++ + Refactored.+ + Removed unnecessary 'try's for a speed improvement.+ + Removed unnecessary '&' and ';' from the entity table.++ * Build process:++ + Makefile: Get VERSION from cabal file, not Main.hs.+ + Modified MacPorts Portfile:+ - Depend on haddock+ - Build and install libraries and library documentation in+ addition to pandoc executable+ - Added template item for md5 sum in Portfile.in.+ - Incorporated changes from MacPorts repository (r28278).+ + FreeBSD port: Don't try to generate distinfo in Makefile.+ It can be made using 'make makesum' in FreeBSD.+ + Make both freebsd and macports targets depend on tarball.++ * Website and documentation:++ + Updated INSTALL instructions.+ + Added pandocwiki demo to website.+ + Removed local references to Portfile, since pandoc is now in the+ MacPorts repository.++ -- Recai Oktaş <roktas@debian.org> Sun, 02 Sep 2007 15:50:11 +0300++pandoc (0.42) unstable; urgency=low++ [ John MacFarlane ]++ * Main.hs: Use utf8 conversion on the extra files loaded with+ the -H, -C, -B, and -A options. This fixes problems with unicode+ characters in these files.++ * Exposed Text.Pandoc.ASCIIMathML, since it is imported in+ Text.Pandoc.Readers.HTML and without it we get a linking error when+ using the library.++ * Markdown reader:++ + Added new rule for enhanced markdown ordered lists: if the list+ marker is a capital letter followed by a period (including a+ single-letter capital roman numeral), then it must be followed by+ at least two spaces. The point of this is to avoid accidentally+ treating people's initials as list markers: a paragraph might begin,+ "B. Russell was an English philosopher," and this shouldn't be+ treated as a list. Documented change in README.+ + Blocks that start with "p. " and a digit are no longer treated+ as ordered lists (it's a page number).+ + Added a needed 'try' to listItem.+ + Removed check for a following setext header in endline.+ A full test is too inefficient (doubles benchmark time), and the+ substitute we had before is not 100% accurate.+ + Don't use Code elements for autolinks if --strict specified.++ * LaTeX writer: When a footnote ends with a Verbatim environment, the+ close } of the footnote cannot occur on the same line or an error occurs.+ Fixed this by adding a newline before the closing } of every footnote.++ * HTML writer:+ + Removed incorrect "{}" around style information in HTML tables.+ Column widths now work properly in HTML.+ + If --strict option is specified (and --toc is not), don't include+ identifiers in headers, for better Markdown compatibility.++ * Build process:++ + Separated $(web_dest) and website targets.+ + In website, index.txt is now constructed from template index.txt.in.+ + Added freebsd target to Markefile. This creates the freebsd Makefile+ from Makefile.in, and creates distinfo. Removed Makefile and distinfo+ from the repository.+ + Added macport target to Makefile. Portfile is built from template+ Portfile.in.+ + Removed OSX package targets. (Too many difficulties involving+ dependencies on dynamic libraries.)+ + More complete INSTALL instructions for all architectures.++ * Website:+ + Added a programming demo, pandocwiki.++ [ Recai Oktaş ]++ * Do not forget to close pandoc's ITP. Closes: #391666++ -- Recai Oktaş <roktas@debian.org> Sun, 26 Aug 2007 22:51:32 +0300++pandoc (0.41) unstable; urgency=low++ [ John MacFarlane ]++ * Fixed bugs in HTML reader:+ + Skip material at end *only if* </html> is present (previously,+ only part of the document would be parsed if an error was+ found; now a proper error message is given).+ + Added new constant eitherBlockOrInline with elements that may+ count either as block-level or as inline. Modified isInline and+ isBlock to take this into account.+ + Modified rawHtmlBlock to accept any tag (even an inline tag):+ this is innocuous, because rawHtmlBlock is tried only if a regular+ inline element can't be parsed.+ + Added a necessary 'try' in definition of 'para'.++ * Fixed bug in markdown ordered list parsing. The problem was that+ anyOrderedListStart did not check for a space following the+ ordered list marker. So in 'A.B. 2007' the parser would be+ expecting a list item, but would not find one, causing an error.+ Fixed a similar bug in the RST reader. Resolves Issue #22.++ * Refactored RST and Markdown readers using parseFromString.++ * LaTeX reader will now skip anything after \end{document}.++ * Fixed blockquote output in markdown writer: previously, block+ quotes in indented contexts would be indented only in the first+ line.++ * Added note to INSTALL about variations in versions of the xhtml+ library that can lead to failed tests (thanks to Leif LeBaron).++ -- Recai Oktaş <roktas@debian.org> Sun, 19 Aug 2007 23:26:07 +0300++pandoc (0.4) unstable; urgency=low++ [ John MacFarlane ]++ * Added two new output formats: groff man pages and ConTeXt. By+ default, output files with extensions ".ctx" and ".context" are+ assumed to be ConTeXt, and output files with single-digit extensions+ are assumed to be man pages.++ * Enhanced ordered lists (documented in README, under Lists):+ + The OrderedList block element now stores information about+ list number style, list number delimiter, and starting number.+ + The readers parse this information when possible.+ + The writers use this information to style ordered lists.+ + The enhancement can be disabled using the --strict option.++ * Added support for tables (with a new Table block element). Two kinds+ of tables are supported: a simple table with one-line rows, and a+ more complex variety with multiline rows. All output formats are+ supported, but only markdown tables are parsed at the moment. The+ syntax is documented in README.++ * Added support for definition lists (with a new DefinitionList block+ element). All output and input formats are supported. The syntax is+ documented in README.++ * Added support for superscripts and subscripts (with new Superscript+ and Subscript inline elements). All input and output+ formats. The syntax is documented in README.++ * Added support for strikeout (with a new Strikeout inline element).+ All input and output formats are supported. Thanks to Bradley Kuhn,+ who contributed a patch. The syntax is documented in README. Resolves+ Issue #18.++ * Added a --toc|--table-of-contents option. This causes an automatically+ generated table of contents (or an instruction that creates one) to+ be inserted at the beginning of the document. Not supported in S5,+ DocBook, or man page writers.++ * Modified the -m|--asciimathml option:++ + If an optional URL argument is provided, a link is inserted+ instead of the contents of the ASCIIMathML.js script.+ + Nothing is inserted unless the document actually contains+ LaTeX math.++ * Removed Blank block element as unnecessary.++ * Removed Key and Note blocks from the Pandoc data structure. All+ links are now stored as explicit links, and note contents are+ stored with the (inline) notes.++ + All link Targets are now explicit (URL, title) pairs; there+ is no longer a 'Ref' target.+ + Markdown and RST parsers now need to extract data from key and+ note blocks and insert them into the relevant inline elements.+ Other parsers have been simplified, since there is no longer any need+ to construct separate key and note blocks.+ + Markdown, RST, and HTML writers need to construct lists of+ notes; Markdown and RST writers need to construct lists of link+ references (when the --reference-links option is specified); and+ the RST writer needs to construct a list of image substitution+ references. All writers have been rewritten to use the State monad+ when state is required.+ + Several functions (generateReference, keyTable,+ replaceReferenceLinks, replaceRefLinksBlockList, and some auxiliaries+ used by them) have been removed from Text.Pandoc.Shared, since+ they are no longer needed. New functions and data structures+ (Reference, isNoteBlock, isKeyBlock, isLineClump) have been+ added. The functions inTags, selfClosingTag, inTagsSimple, and+ inTagsIndented have been moved to the DocBook writer, since that+ is now the only module that uses them. NoteTable is now exported+ in Text.Pandoc.Shared.+ + Added stateKeys and stateNotes to ParserState; removed stateKeyBlocks,+ stateKeysUsed, stateNoteBlocks, stateNoteIdentifiers, stateInlineLinks.+ + Added writerNotes and writerReferenceLinks to WriterOptions.++ * Added Text.Pandoc module that exports basic readers, writers,+ definitions, and utility functions. This should export everything+ needed for most uses of Pandoc libraries. The haddock documentation+ includes a short example program.++ * Text.Pandoc.ASCIIMathML is no longer an exported module.++ * Added Text.Pandoc.Blocks module to help in printing markdown+ and RST tables. This module provides functions for working with+ fixed-width blocks of text--e.g., placing them side by side, as+ in a table row.++ * Refactored to avoid reliance on Haskell's Text.Regex library, which+ (a) is slow, and (b) does not properly handle unicode. This fixed+ some strange bugs, e.g. in parsing S-cedilla, and improved performance.++ + Replaced 'gsub' with a general list function 'substitute'+ that does not rely on Text.Regex.+ + Rewrote extractTagType in HTML reader so that it doesn't use+ regexs.+ + In Markdown reader, replaced email regex test with a custom email+ autolink parser (autoLinkEmail). Also replaced selfClosingTag regex+ with a custom function isSelfClosingTag.+ + Modified Docbook writer so that it doesn't rely on Text.Regex for+ detecting 'mailto' links.+ + Removed escapePreservingRegex and reamped entity-handling+ functions in Text.Pandoc.Shared and Text.Pandoc.CharacterReferences to+ avoid reliance on Text.Regex (see below on character reference+ handling changes).++ * Renamed Text.Pandoc.Entities as Text.Pandoc.CharacterReferences.++ * Changed handling of XML entities. Entities are now parsed (and unicode+ characters returned) in the Markdown and HTML readers, rather than being+ handled in the writers. In HTML and Docbook writers, UTF-8 is now used+ instead of entities for characters above 128. This makes the HTML and+ DocBook output much more readable and more easily editable.++ + Removed sgmlHexEntity, sgmlDecimalEntity, sgmlNamedEntity, and+ sgmlCharacterEntity regexes from Text.Pandoc.Shared.+ + Renamed escapeSGMLChar to escapeCharForXML. Added escapeStringForXML.+ Moved both functions to Text.Pandoc.Writers.Docbook.+ + Added characterReference parser to Text.Pandoc.CharacterReferences.+ This parses a string and return a unicode character.+ + Rewrote decodeCharacterReferences to use the new parser instead of+ Text.Regex.+ + Added new charRef parser for Markdown and HTML, which replaces the+ old 'entity' parser. Added '&' as a special character in Markdown reader.+ + Modified HTML and Markdown readers to call decodeEntities on all raw+ strings (e.g. authors, dates, link titles), to ensure that no+ unprocessed entities are included in the native representation of+ the document. (In the HTML reader, most of this work is done by a+ change in extractAttributeName.)+ + In XML and Markdown output, escape unicode nonbreaking space as ' ',+ since a unicode non-breaking space is impossible to distinguish visually+ from a regular space. (Resolves Issue #3.)+ + Removed encodeEntitiesNumerical.+ + Use Data.Map for entityTable and (new) reverseEntityTable, for a+ slight performance boost over the old association list.+ + Removed unneeded decodeEntities from 'str' parser in HTML and+ Markdown readers.++ * Text.Pandoc.UTF8: Renamed encodeUTF8 to toUTF8, decodeUTF8 to+ fromUTF8, for clarity.++ * Replaced old haskell98 module names replaced by hierarchical module+ names, e.g. List by Data.List. Removed haskell98 from dependencies+ in pandoc.cabal, and added mtl (needed for state monad). Substituted+ xhtml for html.++ * Refactored and cleaned up character escaping in writers, using+ backslashEscapes and escapeStringUsing functions.++ * Instead of adding "\n\n" to the end of an input string in Main.hs,+ this is now done in the readers. This makes the libraries behave+ the way you'd expect from the pandoc program. Resolves Issue #10.++ * URLs and email addresses in autolinks are now typeset as Code.++ * In Main.hs, changed putStr to putStrLn -- mainly because MacOS X+ doesn't display the whole output unless there's a line ending.++ * Major code cleanup in all modules, for greater consistency, concision,+ and readability.++ * HTML reader:++ + Fixed several bugs (extractTagType, attribute parsing).+ + Remove Null blocks in lists of blocks when possible.+ + Allow HTML comments as raw HTML inline.++ * Markdown reader:++ + Ordered list items may no longer begin with uppercase letters, or+ letters greater than 'n'. (This prevents first initials and page+ reference, e.g. 'p. 400', from being parsed as beginning lists.)+ Also, numbers beginning list items may no longer end with ')',+ which is now allowed only after letters. Note: These changes+ may cause documents to be parsed differently. Users should take+ care in upgrading.+ + Changed autoLink parsing to conform better to Markdown.pl's+ behavior. <google.com> is not treated as a link, but+ <http://google.com>, <ftp://google.com>, and <mailto:google@google.com>+ are.+ + Cleaned up handling of embedded quotes in link titles. Now these are+ stored as a '"' character, not as '"'.+ + Use lookAhead parser for the 'first pass' (looking for reference keys),+ instead of parsing normally, then using setInput to reset input. This+ yields a slight performance boost.+ + Fixed several bugs in smart quote recognition.+ + Fixed bug in indentSpaces (which didn't properly handle+ cases with mixed spaces and tabs).+ + Consolidated 'text', 'special', and 'inline' into 'inline'.+ + Fixed bug which allowed URL and title to be separated by multiple blank+ lines in links and reference keys. They can be on separate lines but+ can't have blank lines between them.+ + Correctly handle bracketed text inside inline footnotes and links,using+ new function inlinesInBalanced. Resolves Issue #14.+ + Fixed bug in footnotes: links in footnotes were not being+ processed. Solution: three-stage parse. First, get all the+ reference keys and add information to state. Next, get all the+ notes and add information to state. (Reference keys may be needed+ at this stage.) Finally, parse everything else.+ + Replaced named constants like 'emphStart' with literals.+ + Removed an extra occurance of escapedChar in definition of inline.++ * RST reader:++ + Allow the URI in a RST hyperlink target to start on the line+ after the reference key.+ + Added 'try' in front of 'string', where needed, or used a different+ parser. This fixes a bug where ````` would not be correctly parsed as+ a verbatim `.+ + Fixed slow performance in parsing inline literals in RST reader. The+ problem was that ``#`` was seen by 'inline' as a potential link or image.+ Fix: inserted 'notFollowedBy (char '`')' in link parsers.+ Resolves Issue #8.+ + Use lookAhead instead of getInput/setInput in RST reader. Removed+ unneeded getState call, since lookAhead automatically saves and+ restores the parser state.+ + Allow hyperlink target URIs to be split over multiple lines, and+ to start on the line after the reference. Resolves Issue #7.+ + Fixed handling of autolinks.++ * LaTeX reader:++ + Replaced 'choice [(try (string ...), ...]' idiom with 'oneOfStrings',+ for clarity.+ + Added clauses for tilde and caret. Tilde is \ensuremath{\sim}, and+ caret is \^{}, not \^ as before.+ + Added parsing for \url.+ + Parse \texttt{} as code, provided there's nothing fancy inside.++ * HTML writer:++ + Modified HTML writer to use the Text.XHtml library. This results+ in cleaner, faster code, and it makes it easier to use Pandoc in+ other projects, like wikis, which use Text.XHtml. Two functions are+ now provided, writeHtml and writeHtmlString: the former outputs an+ Html structure, the latter a rendered string. The S5 writer is also+ changed, in parallel ways (writeS5, writeS5String).+ + The Html header is now written programmatically, so it has been+ removed from the 'headers' directory. The S5 header is still+ needed, but the doctype and some of the meta declarations have+ been removed, since they are written programatically. This change+ introduces a new dependency on the xhtml package.+ + Fixed two bugs in email obfuscation involving improper escaping+ of '&' in the <noscript> section and in --strict mode. Resolves+ Issue #9.+ + Fixed another bug in email obfuscation: If the text to be obfuscated+ contains an entity, this needs to be decoded before obfuscation.+ Thanks to thsutton for the patch. Resolves Issue #15.+ + Changed the way the backlink is displayed in HTML footnotes.+ Instead of appearing on a line by itself, it now generally+ appears on the last line of the note. (Exception: when the+ note does not end with a Plain or Para block.) This saves space+ and looks better.+ + Added automatic unique identifiers to headers:+ - The identifier is derived from the header via a scheme+ documented in README.+ - WriterState now includes a list of header identifiers and a table+ of contents in addition to notes.+ - The function uniqueIdentifiers creates a list of unique identifiers+ from a list of inline lists (e.g. headers).+ - This list is part of WriterState and gets consumed by blockToHtml+ each time a header is encountered.+ + Include CSS for .strikethrough class in header only if strikethrough+ text appears in the document.+ + If the 'strict' option is specified, elements that do not appear in+ standard markdown (like definition lists) are passed through as+ raw HTML.+ + Simplified treatment of autolinks, using pattern matching instead of+ conditionals.++ * Markdown writer:++ + Links in markdown output are now printed as inline links by default,+ rather than reference links. A --reference-links option has been added+ that forces links to be printed as reference links. Resolves Issue #4.+ + Use autolinks when possible. Instead of [site.com](site.com),+ use <site.com>.++ * LaTeX writer:++ + Rewrote to use the State monad. The preamble now includes only those+ packages that are actually required, given the document's content.+ Thus, for example, if strikeout is not used, ulem is not required.+ Modified LaTeXHeader accordingly.+ + Modified LaTeX writer to insert '\,' between consecutive quotes.+ + Removed unused function tableRowColumnWidths.+ + Simplified code for escaping special characters.+ + Leave extra blank line after \maketitle.+ + Include empty '\author{}' when no author specified to avoid LaTeX+ errors.+ + Include fancyvrb code in header only if needed -- that is, only+ if there is actually code in a footnote.+ + Use \url{} for autolinks.+ + Include [mathletters] option in ucs package, so that basic unicode+ Greek letters will work correctly.++ * RST writer: Force blank line before lists, so that sublists will+ be handled correctly.++ * Docbook writer: Fixed a bug: email links with text, like+ [foo](me@bar.baz), were being incorrectly treated as autolinks.++ * Removed Text.ParserCombinators.Pandoc and moved all its functions to+ Text.Pandoc.Shared.++ * Text.Pandoc.Shared:++ + Added defaultWriterOptions.+ + Added writerTableOfContents to WriterOptions.+ + Added writerIgnoreNotes option to WriterOptions. This is needed+ for processing header blocks for a table of contents, since notes on+ headers should not appear in the TOC.+ + Added prettyprinting for native Table format.+ + Removed some unneeded imports.+ + Moved escape and nullBlock parsers from+ Text.ParserCombinators.Pandoc, since the latter is for+ general-purpose parsers that don't depend on Text.Pandoc.Definition.+ + Moved isHeaderBlock from Text.Pandoc.Writers.HTML.+ + Moved Element, headerAtLeast, and hierarchicalize from Docbook+ writer, because HTML writer now uses these in constructing a table+ of contents.+ + Added clauses for new inline elements (Strikeout, Superscript,+ Subscript) to refsMatch.+ + Removed backslashEscape; added new functions escapeStringUsing and+ backslashEscapes.+ + Moved failIfStrict from markdown reader, since it is now used also+ by the HTML reader.+ + Added a 'try' to the definition of indentSpaces.+ + In definition of 'reference', added check to make sure it's not a note+ reference.+ + Added functions: camelCaseToHyphenated, toRomanNumeral,+ anyOrderedListMarker, orderedListmarker, orderedListMarkers,+ charsInBalanced', withHorizDisplacement, romanNumeral+ + Fixed a bug in the anyLine parser. Previously it would parse an empty+ string "", but it should fail on an empty string, or we get an error+ when it is used inside "many" combinators.+ + Removed followedBy' parser, replacing it with the lookAhead parser from+ Parsec.+ + Added some needed 'try's before multicharacter parsers, especially in+ 'option' contexts.+ + Removed the 'try' from the 'end' parser in 'enclosed', so that+ 'enclosed' behaves like 'option', 'manyTill', etc.+ + Added lineClump parser, which parses a raw line block up to and+ including any following blank lines.+ + Renamed parseFromStr to parseFromString.+ + Added a 'try' to the 'end' parser in 'enclosed'. This makes errors in+ the use of 'enclosed' less likely. Removed some now-unnecessary 'try's+ in calling code.+ + Removed unneeded 'try' in blanklines.+ + Removed endsWith function and rewrote calling functions to use+ isSuffixOf instead.+ + Added >>~ combinator.+ + Fixed bug in normalizeSpaces: Space:Str "":Space should compress to+ Space.++ * Refactored runtests.pl; added separate tests for tables.++ * Shell scripts:++ + Added -asxhtml flag to tidy in html2markdown. This will+ perhaps help the parser, which expects closing tags.+ + Modified markdown2pdf to run pdflatex a second time if --toc or+ --table-of-contents was specified; otherwise the table of+ contents won't appear.+ + Modified markdown2pdf to print a helpful message if the 'ulem'+ LaTeX package is required and not found.++ * Changes to build process:++ + Dropped support for compilation with GHC 6.4. GHC 6.6 or higher+ is now required.+ + Removed cabalize and Pandoc.cabal.in. The repository now contains+ pandoc.cabal itself.+ + Pandoc.cabal has been changed to pandoc.cabal, because HackageDB+ likes the cabal file to have the same name as the tarball.+ + Expanded and revised the package description in pandoc.cabal.+ Revised the package synopsis.+ + The tarball built by 'make tarball' now contains files built from+ templates (including man pages and shell scripts), so pandoc can+ be built directly using Cabal tools, without preprocessing.+ + Executable binaries are now stripped before installing.+ + Man pages are now generated from markdown sources, using pandoc's+ man page writer.+ + Use HTML version of README (instead of RTF) in Mac OS X installer.+ + Instead of testing for the existence of a pandoc symlink in build-exec,+ use ln -f.++ * Documentation:++ + Updated README and man pages with information on new features.+ + Updated INSTALL instructions with some useful clarifications and+ links.+ + Updated web content.++ * Added FreeBSD port.++ [ Recai Oktaş ]++ * debian/control:++ + Changed pandoc's Build-Depends to include libghc6-mtl-dev and+ libghc6-xhtml-dev. Removed libghc6-html-dev.+ + Suggest texlive-latex-recommended | tetex-extra instead of+ tetex-bin. This brings in fancyvrb and unicode support.++ -- Recai Oktaş <roktas@debian.org> Tue, 16 Jan 2007 00:37:21 +0200++pandoc (0.3) unstable; urgency=low++ [ John MacFarlane ]++ * Changes in pandoc options:++ + Allow options to follow or precede arguments.+ + Changed '--smartypants' to '--smart' and adjusted symbols accordingly.+ + Added '--strict' option.+ + Added '-o/--output' option.+ + Added '--dump-args' and '--ignore-args' options (for use in wrappers).+ + Modified '-v' and '-h' output to go to STDERR, not STDOUT, and return+ error conditions. This is helpful for writing wrappers.+ + Added copyright message to '-v' output, modeled after FSF messages.+ + Reformatted usage message so that it doesn't wrap illegibly.+ + Removed extra blanks after '-h' and '-D' output.++ * Added docbook writer.++ * Added implicit setting of default input and output format based+ on input and output filename extensions. These defaults are+ overridden if explicit input and output formats are specified using+ '-t', '-f', '-r', or '-w' options. Documented in pandoc(1) man page+ and README.++ * Allow ordered list items to begin with (single) letters, as well+ as numbers. The list item marker may now be terminated either by+ '.' or by ')'. This extension to standard markdown is documented+ in README.++ * Revised footnote syntax. (See README for full details.) The+ '[^1]' format now standard in markdown extensions is supported,+ as are inline footnotes with this syntax: '^[My note.]'.+ The earlier footnote syntax '^(1)' is no longer supported.++ * Improved HTML representation of footnotes. All footnotes+ are now auto-numbered and appear in an ordered list at the+ end of the HTML document. Since the default appearance is now+ acceptable, the old footnote styles have been removed from the+ HTML header.++ * Bug fixes:++ + Fixed a serious bug in the markdown, LaTeX, and RST readers.+ These readers ran 'runParser' on processed chunks of text to handle+ embedded block lists in lists and quotation blocks. But then+ any changes made to the parser state in these chunks was lost,+ as the state is local to the parser. So, for example, footnotes+ didn't work in quotes or list items. The fix: instead of calling+ runParser on some raw text, use setInput to make it the input, then+ parse it, then use setInput to restore the input to what it was+ before. This is shorter and more elegant, and it fixes the problem.+ + Fixed bug in notFollowedBy' combinator (adding 'try' before+ 'parser'). Adjusted code that uses this combinator accordingly.+ + Fixed bug in RTF writer that caused improper indentation on+ footnotes occurring in indented blocks like lists.+ + Fixed parsing of metadata in LaTeX reader. Now the title, author,+ and date are parsed correctly. Everything else in the preamble+ is skipped.+ + Modified escapedChar in LaTeX reader to allow a '\' at the end of a+ line to count as escaped whitespace.+ + Modified LaTeX reader to produce inline links rather than reference+ links. Otherwise, links in footnotes aren't handled properly.+ + Fixed handling of titles in links in Markdown reader, so that+ embedded quotation marks are now handled properly.+ + Fixed Markdown reader's handling of embedded brackets in links.+ + Fixed Markdown reader so that it only parses bracketed material+ as a reference link if there is actually a corresponding key.+ + Revised inline code parsing in Markdown reader to conform to+ markdown standard. Now any number of `s can begin inline code,+ which will end with the same number of `s. For example, to+ have two backticks as code, write ``` `` ```. Modified Markdown+ writer accordingly.+ + Fixed bug in text-wrapping routine in Markdown and RST writers.+ Now LineBreaks no longer cause wrapping problems.+ + Supported hexadecimal numerical entity references as well as+ decimal ones.+ + Fixed bug in Markdown reader's handling of underscores and other+ inline formatting markers inside reference labels: for example,+ in '[A_B]: /url/a_b', the material between underscores was being+ parsed as emphasized inlines.+ + Changed Markdown reader's handling of backslash escapes so that+ only non-alphanumeric characters can be escaped. Strict mode+ follows Markdown.pl in only allowing a select group of punctuation+ characters to be escaped.+ + Modified HTML reader to skip a newline following a <br> tag.+ Otherwise the newline will be treated as a space at the beginning+ of the next line.++ * Made handling of code blocks more consistent. Previously, some+ readers allowed trailing newlines, while others stripped them.+ Now, all readers strip trailing newlines in code blocks. Writers+ insert a newline at the end of code blocks as needed.++ * Modified readers to make spacing at the end of output more consistent.++ * Minor improvements to LaTeX reader:++ + '\thanks' now treated like a footnote.+ + Simplified parsing of LaTeX command arguments and options.+ commandArgs now returns a list of arguments OR options (in+ whatever order they appear). The brackets are included, and+ a new stripFirstAndLast function is provided to strip them off+ when needed. This fixes a problem in dealing with \newcommand+ and \newenvironment.++ * Revised RTF writer:++ + Default font is now Helvetica.+ + An '\f0' is added to each '\pard', so that font resizing works+ correctly.++ * Moved handling of "smart typography" from the writers to the Markdown+ and LaTeX readers. This allows great simplification of the writers+ and more accurate smart quotes, dashes, and ellipses. DocBook can+ now use '<quote>'. The '--smart' option now toggles an option in+ the parser state rather than a writer option. Several new kinds+ of inline elements have been added: Quoted, Ellipses, Apostrophe,+ EmDash, EnDash.++ * Changes in HTML writer:++ + Include title block in header even when title is null.+ + Made javascript obfuscation of emails even more obfuscatory,+ by combining it with entity obfuscation.++ * Changed default ASCIIMathML text color to black.++ * Test suite:++ + Added --strip-trailing-cr option to diff in runtests.pl, for+ compatibility with Windows.+ + Added regression tests with footnotes in quote blocks and lists.++ * Makefile changes:++ + osx-pkg target creates a Mac OS X package (directory). New osx+ directory contains files needed for construction of the package.+ + osx-dmg target creates a compressed disk image containing the package.+ + win-pkg target creates Windows binary package.+ + tarball target creates distribution source tarball.+ + website target generates pandoc's website automatically, including+ demos. New 'web' directory containts files needed for construction+ of the website (which will be created as the 'pandoc' subdirectory+ of 'web').+ + Makefile checks to see if we're running Windows/Cygwin; if so,+ a '.exe' extension is added to each executable in EXECS.++ * Removed all wrappers except markdown2pdf and html2markdown.++ * Added new wrapper hsmarkdown, to be used as a drop-in replacement+ for Markdown.pl. hsmarkdown calls pandoc with the '--strict'+ option and disables other options.++ * Added code to html2markdown that tries to determine the character+ encoding of an HTML file, by parsing the "Content-type" meta tag.++ + If the encoding can't be determined, then if the content is local,+ the local encoding is used; if it comes from a URL, UTF-8 is used+ by default.+ + If input is from STDIN, don't try to determine character encoding.+ + Encoding can be specified explicitly using '-e' option.++ * Improved warning messages in wrappers:++ + Print warning if iconv not available+ + More user-friendly error messages in markdown2pdf, when+ pdflatex fails.++ * Code cleanup:++ + Renamed 'Text/Pandoc/HtmlEntities' module to+ 'Text/Pandoc/Entities'. Also changed function names so as+ not to be HTML-specific.+ + Refactored SGML string escaping functions from HTML and Docbook+ writers into Text/Pandoc/Shared. (escapeSGML, stringToSGML)+ + Removed 'BlockQuoteContext' from ParserContext, as it isn't+ used anywhere.+ + Removed splitBySpace and replaced it with a general, polymorphic+ splitBy function.+ + Refactored LaTeX reader for clarity (added isArg function).+ + Converted some CR's to LF's in src/ui/default/print.css.+ + Added license text to top of source files.+ + Added module data for haddock to source files.+ + Reformatted code for consistency.++ * Rewrote documentation and man pages. Split README into INSTALL+ and README.++ * Split LICENSE into COPYING and COPYRIGHT.++ * Removed TODO, since we now maintain ToDo on the wiki.++ * Made COPYRIGHT in top level a symlink to debian/copyright, to avoid+ duplication.++ [ Recai Oktaş ]++ * Revamped build process to conform to debian standards and created+ a proper debian package. Closes: #391666.++ * Modified build process to support GHC 6.6.++ + The package can still be compiled using GHC 6.4.2, though because+ of dependencies the "make deb" target works only with GHC 6.6+.+ + The script 'cabalize' is used to create an appropriate+ 'Pandoc.cabal' from 'Pandoc.cabal.in', depending on the GHC and+ Cabal versions.++ * Refactored template processing (fillTemplates.pl).++ * Modified wrapper scripts to make them more robust and portable.+ To avoid code duplication and ensure consistency, wrappers are+ generated via a templating system from templates in src/wrappers.++ + Wrappers now accept multiple filenames, when appropriate.+ + Spaces and tabs allowed in filenames.+ + getopts shell builtin is used for portable option parsing.+ + Improved html2markdown's web grabber code, making it more robust,+ configurable and verbose. Added '-e', '-g' options.++ -- Recai Oktaş <roktas@debian.org> Fri, 05 Jan 2007 09:41:19 +0200++pandoc (0.2) unstable; urgency=low++ * Fixed unicode/utf-8 translation++ -- John MacFarlane <jgm@berkeley.edu> Mon, 14 Aug 2006 00:00:00 -0400++pandoc (0.1) unstable; urgency=low++ * Initial creation of debian package++ -- John MacFarlane <jgm@berkeley.edu> Mon, 14 Aug 2006 00:00:00 -0400
+ data/LaTeXMathML.js.comment view
@@ -0,0 +1,16 @@+/*+LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/+Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,+(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.++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.+*/
+ data/LaTeXMathML.js.packed view
@@ -0,0 +1,191 @@++var checkForMathML=true;var notifyIfNoMathML=true;var alertIfNoMathML=false;var mathcolor="";var mathfontfamily="";var showasciiformulaonhover=true;var isIE=document.createElementNS==null;if(document.getElementById==null)+alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")+function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}+function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")+nd.appendChild(AMcreateElementXHTML("p"));nd.appendChild(document.createTextNode("To view the "));var an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("LaTeXMathML"));an.setAttribute("href","http://www.maths.nott.ac.uk/personal/drw/lm.html");nd.appendChild(an);nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("MathPlayer"));an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");nd.appendChild(an);nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));nd.appendChild(AMcreateElementXHTML("p"));return nd;}+function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")+if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")+try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}+else return AMnoMathMLNote();}+var AMcal=[0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];var AMfrk=[0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];var AMbbb=[0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];var CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,TEXT=9,BIG=10,LONG=11,STRETCHY=12,MATRIX=13;var AMsqrt={input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:UNARY},AMroot={input:"\\root",tag:"mroot",output:"root",ttype:BINARY},AMfrac={input:"\\frac",tag:"mfrac",output:"/",ttype:BINARY},AMover={input:"\\stackrel",tag:"mover",output:"stackrel",ttype:BINARY},AMatop={input:"\\atop",tag:"mfrac",output:"",ttype:INFIX},AMchoose={input:"\\choose",tag:"mfrac",output:"",ttype:INFIX},AMsub={input:"_",tag:"msub",output:"_",ttype:INFIX},AMsup={input:"^",tag:"msup",output:"^",ttype:INFIX},AMtext={input:"\\mathrm",tag:"mtext",output:"text",ttype:TEXT},AMmbox={input:"\\mbox",tag:"mtext",output:"mbox",ttype:TEXT};var AMsymbols=[{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:CONST},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:CONST},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:CONST},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:CONST},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:CONST},{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:CONST},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:CONST},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:CONST},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:CONST},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:CONST},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:CONST},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:CONST},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:CONST},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:CONST},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:CONST},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:CONST},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:CONST},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:CONST},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:CONST},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:CONST},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:CONST},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:CONST},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:CONST},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:CONST},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:CONST},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:CONST},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:CONST},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:CONST},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:CONST},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:CONST},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:CONST},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:CONST},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:CONST},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:CONST},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:CONST},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:CONST},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:CONST},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:CONST},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:CONST},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:CONST},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:CONST},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:CONST},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:CONST},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:CONST},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:CONST},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:CONST},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:CONST},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:CONST},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:CONST},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:CONST},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:CONST},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:CONST},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:CONST},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:CONST},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:CONST},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:CONST},{input:"\\mp",tag:"mo",output:"\u2213",ttype:CONST},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:CONST},{input:"\\star",tag:"mo",output:"\u22C6",ttype:CONST},{input:"\\ast",tag:"mo",output:"\u002A",ttype:CONST},{input:"\\times",tag:"mo",output:"\u00D7",ttype:CONST},{input:"\\div",tag:"mo",output:"\u00F7",ttype:CONST},{input:"\\circ",tag:"mo",output:"\u2218",ttype:CONST},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:CONST},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:CONST},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:CONST},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:CONST},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:CONST},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:CONST},{input:"\\odot",tag:"mo",output:"\u2299",ttype:CONST},{input:"\\land",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\lor",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\vee",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\cap",tag:"mo",output:"\u2229",ttype:CONST},{input:"\\cup",tag:"mo",output:"\u222A",ttype:CONST},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:CONST},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:CONST},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:CONST},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:CONST},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:CONST},{input:"\\dag",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:CONST},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:CONST},{input:"\\sum",tag:"mo",output:"\u2211",ttype:UNDEROVER},{input:"\\prod",tag:"mo",output:"\u220F",ttype:UNDEROVER},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:UNDEROVER},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:UNDEROVER},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:UNDEROVER},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:UNDEROVER},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:UNDEROVER},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:UNDEROVER},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:UNDEROVER},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:UNDEROVER},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:UNDEROVER},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:UNDEROVER},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:UNDEROVER},{input:"\\int",tag:"mo",output:"\u222B",ttype:CONST},{input:"\\oint",tag:"mo",output:"\u222E",ttype:CONST},{input:":=",tag:"mo",output:":=",ttype:CONST},{input:"\\lt",tag:"mo",output:"<",ttype:CONST},{input:"\\gt",tag:"mo",output:">",ttype:CONST},{input:"\\ne",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\neq",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\le",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leq",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\ge",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geq",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:CONST},{input:"\\ll",tag:"mo",output:"\u226A",ttype:CONST},{input:"\\gg",tag:"mo",output:"\u226B",ttype:CONST},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:CONST},{input:"\\prec",tag:"mo",output:"\u227A",ttype:CONST},{input:"\\succ",tag:"mo",output:"\u227B",ttype:CONST},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:CONST},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:CONST},{input:"\\subset",tag:"mo",output:"\u2282",ttype:CONST},{input:"\\supset",tag:"mo",output:"\u2283",ttype:CONST},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:CONST},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:CONST},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:CONST},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:CONST},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:CONST},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:CONST},{input:"\\sim",tag:"mo",output:"\u223C",ttype:CONST},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:CONST},{input:"\\approx",tag:"mo",output:"\u2248",ttype:CONST},{input:"\\cong",tag:"mo",output:"\u2245",ttype:CONST},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\in",tag:"mo",output:"\u2208",ttype:CONST},{input:"\\ni",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\owns",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\propto",tag:"mo",output:"\u221D",ttype:CONST},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:CONST},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:CONST},{input:"\\models",tag:"mo",output:"\u22A8",ttype:CONST},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\smile",tag:"mo",output:"\u2323",ttype:CONST},{input:"\\frown",tag:"mo",output:"\u2322",ttype:CONST},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:CONST},{input:"\\notin",tag:"mo",output:"\u2209",ttype:CONST},{input:"\\begin{eqnarray}",output:"X",ttype:MATRIX,invisible:true},{input:"\\begin{array}",output:"X",ttype:MATRIX,invisible:true},{input:"\\\\",output:"}&{",ttype:DEFINITION},{input:"\\end{eqnarray}",output:"}}",ttype:DEFINITION},{input:"\\end{array}",output:"}}",ttype:DEFINITION},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ieval:"2.2",ttype:BIG},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ieval:"2.6",ttype:BIG},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ieval:"3.2",ttype:BIG},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ieval:"3.9",ttype:BIG},{input:"\\left",tag:"mo",output:"X",ttype:LEFTBRACKET},{input:"\\right",tag:"mo",output:"X",ttype:RIGHTBRACKET},{input:"{",output:"{",ttype:LEFTBRACKET,invisible:true},{input:"}",output:"}",ttype:RIGHTBRACKET,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:STRETCHY},{input:"[",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:STRETCHY},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:STRETCHY},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:STRETCHY},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:STRETCHY},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:STRETCHY},{input:"\\setminus",tag:"mo",output:"\\",ttype:CONST},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:SPACE},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:SPACE},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:SPACE},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:SPACE},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:SPACE},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:SPACE},{input:"\\prime",tag:"mo",output:"\u2032",ttype:CONST},{input:"'",tag:"mo",output:"\u02B9",ttype:CONST},{input:"''",tag:"mo",output:"\u02BA",ttype:CONST},{input:"'''",tag:"mo",output:"\u2034",ttype:CONST},{input:"''''",tag:"mo",output:"\u2057",ttype:CONST},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:CONST},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:CONST},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:CONST},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:CONST},{input:"\\forall",tag:"mo",output:"\u2200",ttype:CONST},{input:"\\exists",tag:"mo",output:"\u2203",ttype:CONST},{input:"\\Re",tag:"mo",output:"\u211C",ttype:CONST},{input:"\\Im",tag:"mo",output:"\u2111",ttype:CONST},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:CONST},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:CONST},{input:"\\ell",tag:"mo",output:"\u2113",ttype:CONST},{input:"\\wp",tag:"mo",output:"\u2118",ttype:CONST},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:CONST},{input:"\\infty",tag:"mo",output:"\u221E",ttype:CONST},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:DEFINITION},{input:"\\partial",tag:"mo",output:"\u2202",ttype:CONST},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:CONST},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:CONST},{input:"\\angle",tag:"mo",output:"\u2220",ttype:CONST},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:CONST},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:CONST},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\top",tag:"mo",output:"\u22A4",ttype:CONST},{input:"\\square",tag:"mo",output:"\u25AB",ttype:CONST},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:CONST},{input:"\\wr",tag:"mo",output:"\u2240",ttype:CONST},{input:"\\arccos",tag:"mi",output:"arccos",ttype:UNARY,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:UNARY,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:UNARY,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:UNARY,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:UNARY,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:UNARY,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:UNARY,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:UNARY,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:UNARY,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:UNARY,func:true},{input:"\\det",tag:"mi",output:"det",ttype:UNARY,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:UNARY,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:UNARY,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:UNARY,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:UNARY,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:UNDEROVER},{input:"\\ker",tag:"mi",output:"ker",ttype:UNARY,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:UNARY,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:UNDEROVER},{input:"\\liminf",tag:"mo",output:"liminf",ttype:UNDEROVER},{input:"\\limsup",tag:"mo",output:"limsup",ttype:UNDEROVER},{input:"\\ln",tag:"mi",output:"ln",ttype:UNARY,func:true},{input:"\\log",tag:"mi",output:"log",ttype:UNARY,func:true},{input:"\\max",tag:"mo",output:"max",ttype:UNDEROVER},{input:"\\min",tag:"mo",output:"min",ttype:UNDEROVER},{input:"\\Pr",tag:"mi",output:"Pr",ttype:UNARY,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:UNARY,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:UNARY,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:UNARY,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:UNDEROVER},{input:"\\tan",tag:"mi",output:"tan",ttype:UNARY,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:UNARY,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\to",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:CONST},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:CONST},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:CONST},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:CONST},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:CONST},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:CONST},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:CONST},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:DEFINITION},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:CONST},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:CONST},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:CONST},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:LONG},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:LONG},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:LONG},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:LONG},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:LONG},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:CONST},AMsqrt,AMroot,AMfrac,AMover,AMsub,AMsup,AMtext,AMmbox,AMatop,AMchoose,{input:"\\acute",tag:"mover",output:"\u00B4",ttype:UNARY,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:UNARY,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:UNARY,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:UNARY,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:UNARY,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:UNARY,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:UNARY,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:UNARY,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:UNARY,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:UNARY,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:UNARY,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:UNARY,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:UNARY,acc:true},{input:"\\overbrace",tag:"mover",output:"\uFE37",ttype:UNARY,acc:true},{input:"\\overbracket",tag:"mover",output:"\u23B4",ttype:UNARY,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\underbrace",tag:"munder",output:"\uFE38",ttype:UNARY,acc:true},{input:"\\underbracket",tag:"munder",output:"\u23B5",ttype:UNARY,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:UNARY},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:UNARY},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:UNARY},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:UNARY},{input:"\\textrm",tag:"mstyle",output:"\\mathrm",ttype:DEFINITION},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:UNARY},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:UNARY,codes:AMbbb},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:UNARY,codes:AMcal},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:UNARY,codes:AMfrk},{input:"\\textcolor",tag:"mstyle",atname:"mathvariant",atval:"mathcolor",ttype:BINARY},{input:"\\colorbox",tag:"mstyle",atname:"mathvariant",atval:"background",ttype:BINARY}];function compareNames(s1,s2){if(s1.input>s2.input)return 1+else return-1;}+var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}+var AMmathml="http://www.w3.org/1998/Math/MathML";function AMcreateElementMathML(t){if(isIE)return document.createElement("m:"+t);else return document.createElementNS(AMmathml,t);}+function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}+function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}+function AMremoveCharsAndBlanks(str,n){var st;st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}+function AMposition(arr,str,n){if(n==0){var h,m;n=-1;h=arr.length;while(n+1<h){m=(n+h)>>1;if(arr[m]<str)n=m;else h=m;}+return h;}else+for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}+function AMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=AMposition(AMnames,st,j);if(k<AMnames.length&&str.slice(0,AMnames[k].length)==AMnames[k]){match=AMnames[k];mk=k;i=match.length;}+more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}+AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}+AMcurrentSymbol=CONST;k=1;st=str.slice(0,1);if("0"<=st&&st<="9")tagst="mn";else tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");return{input:st,tag:tagst,output:st,ttype:CONST};}+var AMpreviousSymbol,AMcurrentSymbol;function AMparseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();str=AMremoveCharsAndBlanks(str,0);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)+return[null,str,null];if(symbol.ttype==DEFINITION){str=symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)+return[null,str,null];}+str=AMremoveCharsAndBlanks(str,symbol.input.length);switch(symbol.ttype){case SPACE:node=AMcreateElementMathML(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:if(isIE){if(symbol.input.substr(0,4)=="\\big"){str="\\"+symbol.input.substr(4)+str;symbol=AMgetSymbol(str);symbol.ttype=UNDEROVER;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}+return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")+output="\u2032";else if(symbol.input=="''")+output="\u2033";else if(symbol.input=="'''")+output="\u2033\u2032";else if(symbol.input=="''''")+output="\u2033\u2033";else if(symbol.input=="\\square")+output="\u25A1";else if(symbol.input.substr(0,5)=="\\frac"){var denom=symbol.input.substr(6,1);if(denom=="5"||denom=="6"){str=symbol.input.replace(/\\frac/,"\\frac ")+str;return[node,str,symbol.tag];}}}+node=AMcreateMmlNode(symbol.tag,document.createTextNode(output));return[node,str,symbol.tag];case LONG:node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute("minsize","1.5");node.setAttribute("maxsize","1.5");node=AMcreateMmlNode("mover",node);node.appendChild(AMcreateElementMathML("mspace"));return[node,str,symbol.tag];case STRETCHY:if(isIE&&symbol.input=="\\backslash")+symbol.output="\\";node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input=="|"||symbol.input=="\\vert"||symbol.input=="\\|"||symbol.input=="\\Vert"){node.setAttribute("lspace","0em");node.setAttribute("rspace","0em");}+node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)+return[node,str,symbol.rtag];else+return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)+atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)+return[null,str,null];str=AMremoveCharsAndBlanks(str,symbol.input.length);node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height",atval+"ex");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}else{node.setAttribute("minsize",atval);node.setAttribute("maxsize",atval);}+return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")+symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}+result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))+node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}+return[node,result[1],result[2]];case MATRIX:if(symbol.input=="\\begin{array}"){var mask="";symbol=AMgetSymbol(str);str=AMremoveCharsAndBlanks(str,0);if(symbol==null)+mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")+mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")+mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}+result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);mask=mask.replace(/l/g,"left ");mask=mask.replace(/r/g,"right ");mask=mask.replace(/c/g,"center ");node.setAttribute("columnalign",mask);node.setAttribute("displaystyle","false");if(isIE)+return[node,result[1],null];var lspace=AMcreateElementMathML("mspace");lspace.setAttribute("width","0.167em");var rspace=AMcreateElementMathML("mspace");rspace.setAttribute("width","0.167em");var node1=AMcreateMmlNode("mrow",lspace);node1.appendChild(node);node1.appendChild(rspace);return[node1,result[1],null];}else{result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);if(isIE)+node.setAttribute("columnspacing","0.25em");else+node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}+case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)+i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}+newFrag.appendChild(AMcreateMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}+str=AMremoveCharsAndBlanks(str,i+1);return[AMcreateMmlNode("mrow",newFrag),str,null];case UNARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st==","){return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}else{node=AMcreateMmlNode("mrow",AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node.appendChild(space);}+node.appendChild(result[0]);return[node,result[1],symbol.tag];}}+if(symbol.input=="\\sqrt"){if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height","1.2ex");space.setAttribute("width","0em");node=AMcreateMmlNode(symbol.tag,result[0])+node.appendChild(space);return[node,result[1],symbol.tag];}else+return[AMcreateMmlNode(symbol.tag,result[0]),result[1],symbol.tag];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=AMcreateMmlNode(symbol.tag,result[0]);var output=symbol.output;if(isIE){if(symbol.input=="\\hat")+output="\u0302";else if(symbol.input=="\\widehat")+output="\u005E";else if(symbol.input=="\\bar")+output="\u00AF";else if(symbol.input=="\\grave")+output="\u0300";else if(symbol.input=="\\tilde")+output="\u0303";}+var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")+node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")+node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")+node1.setAttribute("accentunder","true");else+node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")+node.ttype=UNDEROVER;return[node,result[1],symbol.tag];}else{if(!isIE&&typeof symbol.codes!="undefined"){for(i=0;i<result[0].childNodes.length;i++)+if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);var newst=[];for(var j=0;j<st.length;j++)+if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst++String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")+result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}+node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")+node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}+case BINARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];result2=AMparseSexpr(result[1]);if(result2[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];if(symbol.input=="\\textcolor"||symbol.input=="\\colorbox"){var tclr=str.match(/\{\s*([#\w]+)\s*\}/);str=str.replace(/\{\s*[#\w]+\s*\}/,"");if(tclr!=null){if(IsColorName.test(tclr[1].toLowerCase())){tclr=LaTeXColor[tclr[1].toLowerCase()];}else{tclr=tclr[1];}+node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}+if(symbol.input=="\\root"||symbol.input=="\\stackrel")newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="\\frac")newFrag.appendChild(result2[0]);return[AMcreateMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];case INFIX:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str,symbol.tag];default:return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}}+function AMparseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;str=AMremoveCharsAndBlanks(str,0);sym1=AMgetSymbol(str);result=AMparseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)+result[0]=AMcreateMmlNode("mo",document.createTextNode("\u25A1"));str=result[1];tag=result[2];if(symbol.input=="_"||symbol.input=="^"){sym2=AMgetSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if(symbol.input=="_"&&sym2.input=="^"){str=AMremoveCharsAndBlanks(str,sym2.input.length);var res2=AMparseSexpr(str);str=res2[1];tag=res2[2];node=AMcreateMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);}else if(symbol.input=="_"){node=AMcreateMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}else{node=AMcreateMmlNode((underover?"mover":"msup"),node);node.appendChild(result[0]);}+node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")+node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")+node=AMcreateMmlNode("mfenced",node);}}+return[node,str,tag];}+function AMparseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=AMremoveCharsAndBlanks(str,0);result=AMparseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(node!=undefined){if((tag=="mn"||tag=="mi")&&symbol!=null&&typeof symbol.func=="boolean"&&symbol.func){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}+newFrag.appendChild(node);}}while((symbol.ttype!=RIGHTBRACKET)&&symbol!=null&&symbol.output!="");tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input=="\\right"){str=AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol!=null&&symbol.input==".")+symbol.invisible=true;if(symbol!=null)+tag=symbol.rtag;}+if(symbol!=null)+str=AMremoveCharsAndBlanks(str,symbol.input.length);var len=newFrag.childNodes.length;if(matrix&&len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue=="&"){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j<node.childNodes.length;j++)+if(node.childNodes[j].firstChild.nodeValue=="&")+pos[i][pos[i].length]=j;}+var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j<n;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(AMcreateMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}+row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}+table.appendChild(AMcreateMmlNode("mtr",row));}+return[table,str];}+if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}+return[newFrag,str,tag];}+function AMparseMath(str){var result,node=AMcreateElementMathML("mstyle");var cclr=str.match(/\\color\s*\{\s*([#\w]+)\s*\}/);str=str.replace(/\\color\s*\{\s*[#\w]+\s*\}/g,"");if(cclr!=null){if(IsColorName.test(cclr[1].toLowerCase())){cclr=LaTeXColor[cclr[1].toLowerCase()];}else{cclr=cclr[1];}+node.setAttribute("mathcolor",cclr);}else{if(mathcolor!="")node.setAttribute("mathcolor",mathcolor);};if(mathfontfamily!="")node.setAttribute("fontfamily",mathfontfamily);node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false,false)[0]);node=AMcreateMmlNode("math",node);if(showasciiformulaonhover)+node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}+return node;}+function AMstrarr2docFrag(arr,linebreaks){var newFrag=document.createDocumentFragment();var expr=false;for(var i=0;i<arr.length;i++){if(expr)newFrag.appendChild(AMparseMath(arr[i]));else{var arri=(linebreaks?arr[i].split("\n\n"):[arr[i]]);newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[0])));for(var j=1;j<arri.length;j++){newFrag.appendChild(AMcreateElementXHTML("p"));newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[j])));}}+expr=!expr;}+return newFrag;}+function AMprocessNodeR(n,linebreaks){var mtch,str,arr,frg,i;if(n.childNodes.length==0){if((n.nodeType!=8||linebreaks)&&n.parentNode.nodeName!="form"&&n.parentNode.nodeName!="FORM"&&n.parentNode.nodeName!="textarea"&&n.parentNode.nodeName!="TEXTAREA"&&n.parentNode.nodeName!="pre"&&n.parentNode.nodeName!="PRE"){str=n.nodeValue;if(!(str==null)){str=str.replace(/\r\n\r\n/g,"\n\n");str=str.replace(/\x20+/g," ");str=str.replace(/\s*\r\n/g," ");mtch=(str.indexOf("\$")==-1?false:true);str=str.replace(/([^\\])\$/g,"$1 \$");str=str.replace(/^\$/," \$");arr=str.split(" \$");for(i=0;i<arr.length;i++)+arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&¬ifyIfNoMathML)+if(alertIfNoMathML)+alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\nor Firefox/Mozilla/Netscape");else AMbody.insertBefore(nd,AMbody.childNodes[0]);}+if(!AMnoMathML){frg=AMstrarr2docFrag(arr,n.nodeType==8);var len=frg.childNodes.length;n.parentNode.replaceChild(frg,n);return len-1;}else return 0;}}}else return 0;}else if(n.nodeName!="math"){for(i=0;i<n.childNodes.length;i++)+i+=AMprocessNodeR(n.childNodes[i],linebreaks);}+return 0;}+function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")+for(var i=0;i<frag.length;i++)+if(frag[i].className=="AM")+AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}+if(st==null||st.indexOf("\$")!=-1)+AMprocessNodeR(n,linebreaks);}+if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}+var inAppendix=false;var sectionCntr=0;var IEcommentWarning=true;var biblist=[];var bibcntr=0;var LaTeXCounter=[];LaTeXCounter["definition"]=0;LaTeXCounter["proposition"]=0;LaTeXCounter["lemma"]=0;LaTeXCounter["theorem"]=0;LaTeXCounter["corollary"]=0;LaTeXCounter["example"]=0;LaTeXCounter["exercise"]=0;LaTeXCounter["subsection"]=0;LaTeXCounter["subsubsection"]=0;LaTeXCounter["figure"]=0;LaTeXCounter["equation"]=0;LaTeXCounter["table"]=0;var LaTeXColor=[];LaTeXColor["greenyellow"]="#D9FF4F";LaTeXColor["yellow"]="#FFFF00";LaTeXColor["goldenrod"]="#FFE529";LaTeXColor["dandelion"]="#FFB529";LaTeXColor["apricot"]="#FFAD7A";LaTeXColor["peach"]="#FF804D";LaTeXColor["melon"]="#FF8A80";LaTeXColor["yelloworange"]="#FF9400";LaTeXColor["orange"]="#FF6321";LaTeXColor["burntorange"]="#FF7D00";LaTeXColor["bittersweet"]="#C20300";LaTeXColor["redorange"]="#FF3B21";LaTeXColor["mahogany"]="#A60000";LaTeXColor["maroon"]="#AD0000";LaTeXColor["brickred"]="#B80000";LaTeXColor["red"]="#FF0000";LaTeXColor["orangered"]="#FF0080";LaTeXColor["rubinered"]="#FF00DE";LaTeXColor["wildstrawberry"]="#FF0A9C";LaTeXColor["salmon"]="#FF789E";LaTeXColor["carnationpink"]="#FF5EFF";LaTeXColor["magenta"]="#FF00FF";LaTeXColor["violetred"]="#FF30FF";LaTeXColor["rhodamine"]="#FF2EFF";LaTeXColor["mulberry"]="#A314FA";LaTeXColor["redviolet"]="#9600A8";LaTeXColor["fuchsia"]="#7303EB";LaTeXColor["lavender"]="#FF85FF";LaTeXColor["thistle"]="#E069FF";LaTeXColor["orchid"]="#AD5CFF";LaTeXColor["darkorchid"]="#9933CC";LaTeXColor["purple"]="#8C24FF";LaTeXColor["plum"]="#8000FF";LaTeXColor["violet"]="#361FFF";LaTeXColor["royalpurple"]="#401AFF";LaTeXColor["blueviolet"]="#1A0DF5";LaTeXColor["periwinkle"]="#6E73FF";LaTeXColor["cadetblue"]="#616EC4";LaTeXColor["cornflowerblue"]="#59DEFF";LaTeXColor["midnightblue"]="#007091";LaTeXColor["navyblue"]="#0F75FF";LaTeXColor["royalblue"]="#0080FF";LaTeXColor["blue"]="#0000FF";LaTeXColor["cerulean"]="#0FE3FF";LaTeXColor["cyan"]="#00FFFF";LaTeXColor["processblue"]="#0AFFFF";LaTeXColor["skyblue"]="#61FFE0";LaTeXColor["turquoise"]="#26FFCC";LaTeXColor["tealblue"]="#1FFAA3";LaTeXColor["aquamarine"]="#2EFFB2";LaTeXColor["bluegreen"]="#26FFAB";LaTeXColor["emerald"]="#00FF80";LaTeXColor["junglegreen"]="#03FF7A";LaTeXColor["seagreen"]="#4FFF80";LaTeXColor["green"]="#00FF00";LaTeXColor["forestgreen"]="#00E000";LaTeXColor["pinegreen"]="#00BF29";LaTeXColor["limegreen"]="#80FF00";LaTeXColor["yellowgreen"]="#8FFF42";LaTeXColor["springgreen"]="#BDFF3D";LaTeXColor["olivegreen"]="#009900";LaTeXColor["rawsienna"]="#8C0000";LaTeXColor["sepia"]="#4D0000";LaTeXColor["brown"]="#660000";LaTeXColor["tan"]="#DB9470";LaTeXColor["gray"]="#808080";LaTeXColor["grey"]="#808080";LaTeXColor["black"]="#000000";LaTeXColor["white"]="#FFFFFF";var IsColorName=/^(?:greenyellow|yellow|goldenrod|dandelion|apricot|peach|melon|yelloworange|orange|burntorange|bittersweet|redorange|mahogany|maroon|brickred|red|orangered|rubinered|wildstrawberry|salmon|carnationpink|magenta|violetred|rhodamine|mulberry|redviolet|fuchsia|lavender|thistle|orchid|darkorchid|purple|plum|violet|royalpurple|blueviolet|periwinkle|cadetblue|cornflowerblue|midnightblue|navyblue|royalblue|blue|cerulean|cyan|processblue|skyblue|turquoise|tealblue|aquamarine|bluegreen|emerald|junglegreen|seagreen|green|forestgreen|pinegreen|limegreen|yellowgreen|springgreen|olivegreen|rawsienna|sepia|brown|tan|gray|grey|black|white)$/;var IsCounter=/^(?:definition|proposition|lemma|theorem|corollary|example|exercise|subsection|subsubsection|figure|equation|table)$/;var IsLaTeXElement=/^(?:displayequation|title|author|address|date|abstract|keyword|section|subsection|subsubsection|ref|cite|thebibliography|definition|proposition|lemma|theorem|corollary|example|exercise|itemize|enumerate|enddefinition|endproposition|endlemma|endtheorem|endcorollary|endexample|endexercise|enditemize|endenumerate|LaTeXMathMLlabel|LaTeXMathML|smallskip|medskip|bigskip|quote|quotation|endquote|endquotation|center|endcenter|description|enddescription|inlinemath)$/;var IsTextOnlyArea=/^(?:form|textarea|pre)$/i;var tableid=0;function makeNumberString(cntr){if(sectionCntr>0){if(inAppendix){return"A"+sectionCntr+"."+cntr;}else{return sectionCntr+"."+cntr;}}else{return""+cntr;}};function LaTeXpreProcess(thebody){var TheBody=thebody;if(TheBody.hasChildNodes()){if(!(IsLaTeXElement.test(TheBody.className)))+{for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}+else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))+{var str=TheBody.nodeValue;if(!(str==null)){str=str.replace(/\\%/g,"<per>");str=str.replace(/%[^\n]*(?=\n)/g,"");str=str.replace(/%[^\r]*(?=\r)/g,"");str=str.replace(/%[^\n]*$/,"")+if(isIE&&str.match(/%/g)!=null&&IEcommentWarning){alert("Comments may not have parsed properly. Try putting in <pre class='LaTeX><div>..</div></pre> structure.");IEcommentWarning=false;}+str=str.replace(/<per>/g,"%");if(str.match(/XXX[\s\S]*/)!=null){var tmp=str.match(/XXX[\s\S]*/)[0];var tmpstr=tmp.charCodeAt(7)+"::"+tmp.charCodeAt(8)+"::"+tmp.charCodeAt(9)+"::"+tmp.charCodeAt(10)+"::"+tmp.charCodeAt(11)+"::"+tmp.charCodeAt(12)+"::"+tmp.charCodeAt(13);alert(tmpstr);}+str=str.replace(/([^\\])\\(\s)/g,"$1\u00A0$2");str=str.replace(/\\quad/g,"\u2001");str=str.replace(/\\qquad/g,"\u2001\u2001");str=str.replace(/\\enspace/g,"\u2002");str=str.replace(/\\;/g,"\u2004");str=str.replace(/\\:/g,"\u2005");str=str.replace(/\\,/g,"\u2006");str=str.replace(/\\thinspace/g,"\u200A");str=str.replace(/([^\\])~/g,"$1\u00A0");str=str.replace(/\\~/g,"~");str=str.replace(/\\\[/g," <DEQ> $\\displaystyle{");str=str.replace(/\\\]/g,"}$ <DEQ> ");str=str.replace(/\$\$/g,"${$<DEQ>$}$");str=str.replace(/\\begin\s*\{\s*array\s*\}/g,"\\begin{array}");str=str.replace(/\\end\s*\{\s*array\s*\}/g,"\\end{array}");str=str.replace(/\\begin\s*\{\s*eqnarray\s*\}/g," <DEQ>eqno$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*eqnarray\*\s*\}/g," <DEQ>$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\*\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*displaymath\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*displaymath\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\*\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\*\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\}/g," <DEQ>eqno$\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\}/g,"}$ <DEQ> ");str=str.split("<DEQ>");var newFrag=document.createDocumentFragment();for(var i=0;i<str.length;i++){if(i%2){var DEQtable=document.createElement("table");DEQtable.className='displayequation';var DEQtbody=document.createElement("tbody");var DEQtr=document.createElement("tr");var DEQtdeq=document.createElement("td");DEQtdeq.className='eq';str[i]=str[i].replace(/\$\}\$/g,"$\\displaystyle{");str[i]=str[i].replace(/\$\{\$/g,"}");var lbl=str[i].match(/\\label\s*\{\s*(\w+)\s*\}/);var ISeqno=str[i].match(/^eqno/);str[i]=str[i].replace(/^eqno/," ");str[i]=str[i].replace(/\\label\s*\{\s*\w+\s*\}/," ");DEQtdeq.appendChild(document.createTextNode(str[i]));DEQtr.appendChild(DEQtdeq);str[i]=str[i].replace(/\\nonumber/g,"");if(ISeqno!=null||lbl!=null){var DEQtdno=document.createElement("td");DEQtdno.className='eqno';LaTeXCounter["equation"]++;var eqnoString=makeNumberString(LaTeXCounter["equation"]);var DEQanchor=document.createElement("a");if(lbl!=null){DEQanchor.id=lbl[1]};DEQanchor.className="eqno";var anchorSpan=document.createElement("span");anchorSpan.className="eqno";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(eqnoString));DEQanchor.appendChild(anchorSpan);DEQtdno.appendChild(DEQanchor);var DEQspan=document.createElement("span");DEQspan.className="eqno";DEQspan.appendChild(document.createTextNode("("+eqnoString+")"));DEQtdno.appendChild(DEQspan);DEQtr.appendChild(DEQtdno);}+DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}+else{str[i]=str[i].replace(/\$\}\$/g,"");str[i]=str[i].replace(/\$\{\$/g,"");str[i]=str[i].replace(/\\maketitle/g,"");str[i]=str[i].replace(/\\begin\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\end\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\documentclass[^\}]*?\}/g,"");str[i]=str[i].replace(/\\usepackage[^\}]*?\}/g,"");str[i]=str[i].replace(/\\noindent/g,"");str[i]=str[i].replace(/\\notag/g,"");str[i]=str[i].replace(/\\ref\s*\{\s*(\w+)\}/g," \\[ref\\]$1\\[ ");str[i]=str[i].replace(/\\url\s*\{\s*([^\}\n]+)\}/g," \\[url\\]$1\\[ ");str[i]=str[i].replace(/\\href\s*\{\s*([^\}]+)\}\s*\{\s*([^\}]+)\}/g," \\[href\\]$1\\]$2\\[ ");str[i]=str[i].replace(/\\cite\s*\{\s*(\w+)\}/g," \\[cite\\]$1\\[ ");str[i]=str[i].replace(/\\qed/g,"\u220E");str[i]=str[i].replace(/\\endproof/g,"\u220E");str[i]=str[i].replace(/\\proof/g,"\\textbf{Proof: }");str[i]=str[i].replace(/\\n(?=\s)/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\newline/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\linebreak/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\smallskip/g," \\[logicalbreak\\]smallskip\\[ ");str[i]=str[i].replace(/\\medskip/g," \\[logicalbreak\\]medskip\\[ ");str[i]=str[i].replace(/\\bigskip/g," \\[logicalbreak\\]bigskip\\[ ");str[i]=str[i].replace(/[\n\r]+[ \f\n\r\t\v\u2028\u2029]*[\n\r]+/g," \\[logicalbreak\\]LaTeXMathML\\[ ");if(isIE){str[i]=str[i].replace(/\r/g," ");}+str[i]=str[i].replace(/\\bibitem\s*([^\{]*\{\s*\w*\s*\})/g," \\[bibitem\\]$1\\[ ");str[i]=str[i].replace(/\\bibitem\s*/g," \\[bibitem\\] \\[ ");str[i]=str[i].replace(/\\item\s*\[\s*(\w+)\s*\]/g," \\[alistitem\\]$1\\[ ");str[i]=str[i].replace(/\\item\s*/g," \\[alistitem\\] \\[ ");str[i]=str[i].replace(/\\appendix/g," \\[appendix\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*figure\s*\}([\s\S]+?)\\end\s*\{\s*figure\s*\}/g," \\[figure\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*table\s*\}([\s\S]+?)\\end\s*\{\s*table\s*\}/g," \\[table\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*theorem\s*\}/g," \\[theorem\\]Theorem \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*theorem\s*\}/g," \\[endtheorem\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*definition\s*\}/g," \\[definition\\]Definition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*definition\s*\}/g," \\[enddefinition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*lemma\s*\}/g," \\[lemma\\]Lemma \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*lemma\s*\}/g," \\[endlemma\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*corollary\s*\}/g," \\[corollary\\]Corollary \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*corollary\s*\}/g," \\[endcorollary\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proposition\s*\}/g," \\[proposition\\]Proposition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*proposition\s*\}/g," \\[endproposition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*example\s*\}/g," \\[example\\]Example \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*example\s*\}/g," \\[endexample\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*exercise\s*\}/g," \\[exercise\\]Exercise \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*exercise\s*\}/g," \\[endexercise\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}\s*\{\s*\w+\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*thebibliography\s*\}/g," \\[endthebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proof\s*\}/g," \\[proof\\]Proof: \\[ ");if(isIE){str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g,"\u220E \\[endproof\\] \\[ ");}else{str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g," \\[endproof\\] \\[ ");}+str[i]=str[i].replace(/\\title\s*\{\s*([^\}]+)\}/g," \\[title\\] \\[$1 \\[endtitle\\] \\[ ");str[i]=str[i].replace(/\\author\s*\{\s*([^\}]+)\}/g," \\[author\\] \\[$1 \\[endauthor\\] \\[ ");str[i]=str[i].replace(/\\address\s*\{\s*([^\}]+)\}/g," \\[address\\] \\[$1 \\[endaddress\\] \\[ ");str[i]=str[i].replace(/\\date\s*\{\s*([^\}]+)\}/g," \\[date\\] \\[$1 \\[enddate\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*keyword\s*\}/g," \\[keyword\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*keyword\s*\}/g," \\[endkeyword\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*abstract\s*\}/g," \\[abstract\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*abstract\s*\}/g," \\[endabstract\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[$1\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[end$1\\] \\[ ");var sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\section\s*\{/," \\[section\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);}+sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsection\s*\{/," \\[subsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);}+sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsubsection\s*\{/," \\[subsubsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);}+var CatToNextEven="";var strtmp=str[i].split("\\[");for(var j=0;j<strtmp.length;j++){if(j%2){var strtmparray=strtmp[j].split("\\]");switch(strtmparray[0]){case"section":var nodeTmp=document.createElement("H2");nodeTmp.className='section';sectionCntr++;for(var div in LaTeXCounter){LaTeXCounter[div]=0};var nodeAnchor=document.createElement("a");if(inAppendix){nodeAnchor.className='appendixsection';}else{nodeAnchor.className='section';}+var nodeNumString=makeNumberString("");var anchorSpan=document.createElement("span");anchorSpan.className="section";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='section';nodeSpan.appendChild(document.createTextNode(nodeNumString+" "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsection":var nodeTmp=document.createElement("H3");nodeTmp.className='subsection';LaTeXCounter["subsection"]++;LaTeXCounter["subsubsection"]=0;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsubsection":var nodeTmp=document.createElement("H4");nodeTmp.className='subsubsection';LaTeXCounter["subsubsection"]++;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsubsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]+"."+LaTeXCounter["subsubsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsubsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsubsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"href":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"url":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"figure":var nodeTmp=document.createElement("table");nodeTmp.className='figure';var FIGtbody=document.createElement("tbody");var FIGlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var FIGcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;FIGcap=tmp.substring(capstart,pos);break}}}+var FIGtr2=document.createElement("tr");var FIGtd2=document.createElement("td");FIGtd2.className="caption";var FIGanchor=document.createElement("a");FIGanchor.className="figure";if(FIGlbl!=null){FIGanchor.id=FIGlbl[1];}+LaTeXCounter["figure"]++;var fignmbr=makeNumberString(LaTeXCounter["figure"]);var anchorSpan=document.createElement("span");anchorSpan.className="figure";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(fignmbr));FIGanchor.appendChild(anchorSpan);FIGtd2.appendChild(FIGanchor);var FIGspan=document.createElement("span");FIGspan.className="figure";FIGspan.appendChild(document.createTextNode("Figure "+fignmbr+". "));FIGtd2.appendChild(FIGspan);FIGtd2.appendChild(document.createTextNode(""+FIGcap));FIGtr2.appendChild(FIGtd2);FIGtbody.appendChild(FIGtr2);var IsSpecial=false;var FIGinfo=strtmparray[1].match(/\\includegraphics\s*\{([^\}]+)\}/);if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\includegraphics\s*\[[^\]]*\]\s*\{\s*([^\}]+)\s*\}/);}+if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\special\s*\{\s*([^\}]+)\}/);IsSpecial=true};if(FIGinfo!=null){var FIGtr1=document.createElement("tr");var FIGtd1=document.createElement("td");FIGtd1.className="image";var FIGimg=document.createElement("img");var FIGsrc=FIGinfo[1];FIGimg.src=FIGsrc;FIGimg.alt="Figure "+FIGsrc+" did not load";FIGimg.title="Figure "+fignmbr+". "+FIGcap;FIGimg.id="figure"+fignmbr;FIGtd1.appendChild(FIGimg);FIGtr1.appendChild(FIGtd1);FIGtbody.appendChild(FIGtr1);}+nodeTmp.appendChild(FIGtbody);newFrag.appendChild(nodeTmp);break;case"table":var nodeTmp=document.createElement("table");if(strtmparray[1].search(/\\centering/)>=0){nodeTmp.className='LaTeXtable centered';nodeTmp.align="center";}else{nodeTmp.className='LaTeXtable';};tableid++;nodeTmp.id="LaTeXtable"+tableid;var TABlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var TABcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;TABcap=tmp.substring(capstart,pos);break}}}+if(TABcap!=""){var TABtbody=document.createElement("tbody");var TABcaption=document.createElement("caption");TABcaption.className="LaTeXtable centered";var TABanchor=document.createElement("a");TABanchor.className="LaTeXtable";if(TABlbl!=null){TABanchor.id=TABlbl[1];}+LaTeXCounter["table"]++;var tabnmbr=makeNumberString(LaTeXCounter["table"]);var anchorSpan=document.createElement("span");anchorSpan.className="LaTeXtable";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(tabnmbr));TABanchor.appendChild(anchorSpan);TABcaption.appendChild(TABanchor);var TABspan=document.createElement("span");TABspan.className="LaTeXtable";TABspan.appendChild(document.createTextNode("Table "+tabnmbr+". "));TABcaption.appendChild(TABspan);TABcaption.appendChild(document.createTextNode(""+TABcap));nodeTmp.appendChild(TABcaption);}+var TABinfo=strtmparray[1].match(/\\begin\s*\{\s*tabular\s*\}([\s\S]+)\\end\s*\{\s*tabular\s*\}/);if(TABinfo!=null){var TABtbody=document.createElement('tbody');var TABrow=null;var TABcell=null;var row=0;var col=0;var TABalign=TABinfo[1].match(/^\s*\{([^\}]+)\}/);TABinfo=TABinfo[1].replace(/^\s*\{[^\}]+\}/,"");TABinfo=TABinfo.replace(/\\hline/g,"");TABalign[1]=TABalign[1].replace(/\|/g,"");TABalign[1]=TABalign[1].replace(/\s/g,"");TABinfo=TABinfo.split("\\\\");for(row=0;row<TABinfo.length;row++){TABrow=document.createElement("tr");TABinfo[row]=TABinfo[row].split("&");for(col=0;col<TABinfo[row].length;col++){TABcell=document.createElement("td");switch(TABalign[1].charAt(col)){case"l":TABcell.align="left";break;case"c":TABcell.align="center";break;case"r":TABcell.align="right";break;default:TABcell.align="left";};TABcell.appendChild(document.createTextNode(TABinfo[row][col]));TABrow.appendChild(TABcell);}+TABtbody.appendChild(TABrow);}+nodeTmp.appendChild(TABtbody);}+newFrag.appendChild(nodeTmp);break;case"logicalbreak":var nodeTmp=document.createElement("p");nodeTmp.className=strtmparray[1];nodeTmp.appendChild(document.createTextNode("\u00A0"));newFrag.appendChild(nodeTmp);break;case"appendix":inAppendix=true;sectionCntr=0;break;case"alistitem":var EndDiv=document.createElement("div");EndDiv.className="endlistitem";newFrag.appendChild(EndDiv);var BegDiv=document.createElement("div");BegDiv.className="listitem";if(strtmparray[1]!=" "){var BegSpan=document.createElement("span");BegSpan.className="listitemmarker";var boldBegSpan=document.createElement("b");boldBegSpan.appendChild(document.createTextNode(strtmparray[1]+" "));BegSpan.appendChild(boldBegSpan);BegDiv.appendChild(BegSpan);}+newFrag.appendChild(BegDiv);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"bibitem":newFrag.appendChild(document.createElement("br"));var nodeTmp=document.createElement("a");nodeTmp.className='bibitem';var nodeSpan=document.createElement("span");nodeSpan.className='bibitem';bibcntr++;var lbl=strtmparray[1].match(/\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\s*\{\s*\w+\s*\}/g,"");strtmparray[1]=strtmparray[1].replace(/^\s*\[/,"");strtmparray[1]=strtmparray[1].replace(/\s*\]$/,"");strtmparray[1]=strtmparray[1].replace(/^\s+|\s+$/g,"");if(lbl==null){biblist[bibcntr]="bibitem"+bibcntr}else{biblist[bibcntr]=lbl[1];};nodeTmp.name=biblist[bibcntr];nodeTmp.id=biblist[bibcntr];if(strtmparray[1]!=""){nodeSpan.appendChild(document.createTextNode(strtmparray[1]));}else{nodeSpan.appendChild(document.createTextNode("["+bibcntr+"]"));}+nodeTmp.appendChild(nodeSpan);newFrag.appendChild(nodeTmp);break;case"cite":var nodeTmp=document.createElement("a");nodeTmp.className='cite';nodeTmp.name='cite';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;case"ref":var nodeTmp=document.createElement("a");nodeTmp.className='ref';nodeTmp.name='ref';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("div");nodeTmp.className=strtmparray[0];if(IsCounter.test(strtmparray[0])){LaTeXCounter[strtmparray[0]]++;var nodeAnchor=document.createElement("a");nodeAnchor.className=strtmparray[0];var divnum=makeNumberString(LaTeXCounter[strtmparray[0]]);var anchorSpan=document.createElement("span");anchorSpan.className=strtmparray[0];anchorSpan.appendChild(document.createTextNode(divnum));anchorSpan.style.display="none";nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]+" "+divnum+". "));nodeTmp.appendChild(nodeSpan);}+if(isIE){if(strtmparray[0]==("thebibliography"||"abstract"||"keyword"||"proof")){var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]));nodeTmp.appendChild(nodeSpan);}}+if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}+newFrag.appendChild(nodeTmp);if(strtmparray[0]=="enumerate"||strtmparray[0]=="itemize"||strtmparray[0]=="description"){var endDiv=document.createElement("div");endDiv.className="listitem";newFrag.appendChild(endDiv);}}}else{strtmp[j]=strtmp[j].replace(/\\\$/g,"<per>");strtmp[j]=strtmp[j].replace(/\$([^\$]+)\$/g," \\[$1\\[ ");strtmp[j]=strtmp[j].replace(/<per>/g,"\\$");strtmp[j]=strtmp[j].replace(/\\begin\s*\{\s*math\s*\}([\s\S]+?)\\end\s*\{\s*math\s*\}/g," \\[$1\\[ ");var strtmptmp=strtmp[j].split("\\[");for(var jjj=0;jjj<strtmptmp.length;jjj++){if(jjj%2){var nodeTmp=document.createElement("span");nodeTmp.className='inlinemath';nodeTmp.appendChild(document.createTextNode("$"+strtmptmp[jjj]+"$"));newFrag.appendChild(nodeTmp);}else{var TagIndex=strtmptmp[jjj].search(/\\\w+/);var tmpIndex=TagIndex;while(tmpIndex>-1){if(/^\\textcolor/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\textcolor\s*\{\s*(\w+)\s*\}\s*/," \\[textcolor\\]$1\\]|");}else{if(/^\\colorbox/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\colorbox\s*\{\s*(\w+)\s*\}\s*/," \\[colorbox\\]$1\\]|");}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).replace(/\\\s*(\w+)\s*/," \\[$1\\]|");}}+TagIndex+=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\|/);TagIndex++;strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\]\|/,"\\] ");if(strtmptmp[jjj].charAt(TagIndex)=="{"){strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);var delimcnt=1;for(var kk=TagIndex;kk<strtmptmp[jjj].length;kk++){if(strtmptmp[jjj].charAt(kk)=="{"){delimcnt++};if(strtmptmp[jjj].charAt(kk)=="}"){delimcnt--};if(delimcnt==0){break;}}+strtmptmp[jjj]=strtmptmp[jjj].substring(0,kk)+"\\[ "+strtmptmp[jjj].substring(kk+1,strtmptmp[jjj].length);TagIndex=kk+3;}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+"\\[ "+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);TagIndex=TagIndex+3;}+if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}+else{tmpIndex=-1};TagIndex+=tmpIndex;}+strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\\s*\\\\/g,"\\\\");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\/g," \\[br\\] \\[ ");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\label\s*\{\s*(\w+)\s*\}/g," \\[a\\]$1\\[ ");var strlbls=strtmptmp[jjj].split("\\[");for(var jj=0;jj<strlbls.length;jj++){if(jj%2){var strtmparray=strlbls[jj].split("\\]");switch(strtmparray[0]){case"textcolor":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.color=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.color=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"colorbox":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.background=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.background=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"a":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathMLlabel';nodeTmp.id=strtmparray[1];nodeTmp.style.display="none";newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("span");nodeTmp.className=strtmparray[0];nodeTmp.appendChild(document.createTextNode(strtmparray[1]))+newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}+return TheBody;}+function LaTeXDivsAndRefs(thebody){var TheBody=thebody;var EndDivClass=null;var AllDivs=TheBody.getElementsByTagName("div");var lbl2id="";var lblnode=null;for(var i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){EndDivClass=EndDivClass[0];var DivClass=EndDivClass.substring(3,EndDivClass.length);var EndDivNode=AllDivs[i];break;}}+while(EndDivClass!=null){var newFrag=document.createDocumentFragment();var RootNode=EndDivNode.parentNode;var ClassCount=1;while(EndDivNode.previousSibling!=null&&ClassCount>0){switch(EndDivNode.previousSibling.className){case EndDivClass:ClassCount++;newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);break;case DivClass:if(EndDivNode.previousSibling.nodeName=="DIV"){ClassCount--;if(lbl2id!=""){EndDivNode.previousSibling.id=lbl2id;lbl2id=""}+if(ClassCount==0){RootNode=EndDivNode.previousSibling;}else{newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}};break;case'LaTeXMathMLlabel':lbl2id=EndDivNode.previousSibling.id;EndDivNode.parentNode.removeChild(EndDivNode.previousSibling);break;default:newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}}+RootNode.appendChild(newFrag);EndDivNode.parentNode.removeChild(EndDivNode);AllDivs=TheBody.getElementsByTagName("DIV");for(i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){ClassCount=0;EndDivClass=EndDivClass[0];DivClass=EndDivClass.substring(3,EndDivClass.length);EndDivNode=AllDivs[i];RootNode=EndDivNode.parentNode;break;}}}+var AllDivs=TheBody.getElementsByTagName("div");var DIV2LI=null;for(var i=0;i<AllDivs.length;i++){if(AllDivs[i].className=="itemize"||AllDivs[i].className=="enumerate"||AllDivs[i].className=="description"){if(AllDivs[i].className=="itemize"){RootNode=document.createElement("UL");}else{RootNode=document.createElement("OL");}+RootNode.className='LaTeXMathML';if(AllDivs[i].hasChildNodes()){AllDivs[i].removeChild(AllDivs[i].firstChild)};while(AllDivs[i].hasChildNodes()){if(AllDivs[i].firstChild.hasChildNodes()){DIV2LI=document.createElement("LI");while(AllDivs[i].firstChild.hasChildNodes()){DIV2LI.appendChild(AllDivs[i].firstChild.firstChild);}+if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}+RootNode.appendChild(DIV2LI)}+AllDivs[i].removeChild(AllDivs[i].firstChild);}+AllDivs[i].appendChild(RootNode);}}+var AllAnchors=TheBody.getElementsByTagName("a");for(var i=0;i<AllAnchors.length;i++){if(AllAnchors[i].className=="ref"||AllAnchors[i].className=="cite"){var label=AllAnchors[i].href.match(/\#(\w+)/);if(label!=null){var labelNode=document.getElementById(label[1]);if(labelNode!=null){var TheSpans=labelNode.getElementsByTagName("SPAN");if(TheSpans!=null){var refNode=TheSpans[0].cloneNode(true);refNode.style.display="inline"+refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}+return TheBody;}+var AMbody;var AMnoMathML=false,AMtranslated=false;function translate(spanclassAM){if(!AMtranslated){AMtranslated=true;AMinitSymbols();var LaTeXContainers=[];var AllContainers=document.getElementsByTagName('*');var ExtendName="";for(var k=0,l=0;k<AllContainers.length;k++){ExtendName=" "+AllContainers[k].className+" ";if(ExtendName.match(/\sLaTeX\s/)!=null){LaTeXContainers[l]=AllContainers[k];l++;}};if(LaTeXContainers.length>0){for(var m=0;m<LaTeXContainers.length;m++){AMbody=LaTeXContainers[m];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}+if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}+PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}+AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}+AMprocessNode(AMbody,false,spanclassAM);}}}+if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}+function generic()+{translate();};if(typeof window.addEventListener!='undefined')+{window.addEventListener('load',generic,false);}+else if(typeof document.addEventListener!='undefined')+{document.addEventListener('load',generic,false);}+else if(typeof window.attachEvent!='undefined')+{window.attachEvent('onload',generic);}+else+{if(typeof window.onload=='function')+{var existing=onload;window.onload=function()+{existing();generic();};}+else+{window.onload=generic;}}
+ data/headers/ConTeXt.header view
@@ -0,0 +1,70 @@+\enableregime[utf] % use UTF-8++\setupcolors[state=start]+\setupinteraction[state=start, color=middleblue] % needed for hyperlinks++\setuppapersize[letter][letter] % use letter paper+\setuplayout[width=middle, backspace=1.5in, cutspace=1.5in,+ height=middle, header=0.75in, footer=0.75in] % page layout+\setuppagenumbering[location={footer,center}] % number pages+\setupbodyfont[11pt] % 11pt font+\setupwhitespace[medium] % inter-paragraph spacing++\setuphead[section][style=\tfc]+\setuphead[subsection][style=\tfb]+\setuphead[subsubsection][style=\bf]++% define title block commands+\unprotect+\def\doctitle#1{\gdef\@title{#1}}+\def\author#1{\gdef\@author{#1}}+\def\date#1{\gdef\@date{#1}}+\date{\currentdate} % Default to today unless specified otherwise.+\def\maketitle{%+ \startalignment[center]+ \blank[2*big]+ {\tfd \@title}+ \blank[3*medium]+ {\tfa \@author}+ \blank[2*medium]+ {\tfa \@date}+ \blank[3*medium]+ \stopalignment}+\protect++% define descr (for definition lists)+\definedescription[descr][+ headstyle=bold,style=normal,align=left,location=hanging,+ width=broad,margin=1cm]++% prevent orphaned list intros+\setupitemize[autointro]++% define defaults for bulleted lists +\setupitemize[1][symbol=1][indentnext=no]+\setupitemize[2][symbol=2][indentnext=no]+\setupitemize[3][symbol=3][indentnext=no]+\setupitemize[4][symbol=4][indentnext=no]++\setupthinrules[width=15em] % width of horizontal rules++% for block quotations+\unprotect++\startvariables all+blockquote: blockquote+\stopvariables++\definedelimitedtext+[\v!blockquote][\v!quotation]++\setupdelimitedtext+[\v!blockquote]+[\c!left=,+\c!right=,+before={\blank[medium]},+after={\blank[medium]},+]++\protect+
+ data/headers/Docbook.header view
@@ -0,0 +1,3 @@+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
+ data/headers/LaTeX.header view
@@ -0,0 +1,6 @@+\documentclass{article}+\usepackage{amsmath}+\usepackage[mathletters]{ucs}+\usepackage[utf8x]{inputenc}+\setlength{\parindent}{0pt}+\setlength{\parskip}{6pt plus 2pt minus 1pt}
+ data/headers/OpenDocument.header view
@@ -0,0 +1,1 @@+<?xml version="1.0" encoding="utf-8" ?>
+ data/headers/RTF.header view
@@ -0,0 +1,4 @@+{\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 Courier;}}+{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}+\widowctrl\hyphauto+
+ data/headers/S5.header view
@@ -0,0 +1,3 @@+<!-- configuration parameters -->+<meta name="defaultView" content="slideshow" />+<meta name="controlVis" content="hidden" />
+ data/ui/default/framing.css view
@@ -0,0 +1,23 @@+/* The following styles size, place, and layer the slide components.+ Edit these if you want to change the overall slide layout.+ The commented lines can be uncommented (and modified, if necessary) + to help you with the rearrangement process. */++/* target = 1024x768 */++div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}+div#header {top: 0; height: 3em; z-index: 1;}+div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}+.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}+div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;+ margin: 0;}+#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}+html>body #currentSlide {position: fixed;}++/*+div#header {background: #FCC;}+div#footer {background: #CCF;}+div#controls {background: #BBD;}+div#currentSlide {background: #FFC;}+*/
+ data/ui/default/opera.css view
@@ -0,0 +1,7 @@+/* DO NOT CHANGE THESE unless you really want to break Opera Show */+.slide {+ visibility: visible !important;+ position: static !important;+ page-break-before: always;+}+#slide0 {page-break-before: avoid;}
+ data/ui/default/outline.css view
@@ -0,0 +1,15 @@+/* don't change this unless you want the layout stuff to show up in the outline view! */++.layout div, #footer *, #controlForm * {display: none;}+#footer, #controls, #controlForm, #navLinks, #toggle {+ display: block; visibility: visible; margin: 0; padding: 0;}+#toggle {float: right; padding: 0.5em;}+html>body #toggle {position: fixed; top: 0; right: 0;}++/* making the outline look pretty-ish */++#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}+#slide0 h1 {padding-top: 1.5em;}+.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;+ border-top: 1px solid #888; border-bottom: 1px solid #AAA;}+#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
+ data/ui/default/pretty.css view
@@ -0,0 +1,86 @@+/* Following are the presentation styles -- edit away! */++body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}+:link, :visited {text-decoration: none; color: #00C;}+#controls :active {color: #88A !important;}+#controls :focus {outline: 1px dotted #227;}+h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}+ul, pre {margin: 0; line-height: 1em;}+html, body {margin: 0; padding: 0;}++blockquote, q {font-style: italic;}+blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}+blockquote p {margin: 0;}+blockquote i {font-style: normal;}+blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}+blockquote b i {font-style: italic;}++kbd {font-weight: bold; font-size: 1em;}+sup {font-size: smaller; line-height: 1px;}++.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}+.slide code.bad, code del {color: red;}+.slide code.old {color: silver;}+.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}+.slide pre code {display: block;}+.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}+.slide li {margin-top: 0.75em; margin-right: 0;}+.slide ul ul {line-height: 1;}+.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}+.slide img.leader {display: block; margin: 0 auto;}++div#header, div#footer {background: #005; color: #AAB;+ font-family: Verdana, Helvetica, sans-serif;}+div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;+ line-height: 1px;}+div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}+#footer h1, #footer h2 {display: block; padding: 0 1em;}+#footer h2 {font-style: italic;}++div.long {font-size: 0.75em;}+.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;+ margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;+ font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;+ color: #DDE; background: #005;}+.slide h3 {font-size: 130%;}+h1 abbr {font-variant: small-caps;}++div#controls {position: absolute; left: 50%; bottom: 0;+ width: 50%;+ text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}+html>body div#controls {position: fixed; padding: 0 0 1em 0;+ top: auto;}+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;+ margin: 0; padding: 0;}+#controls #navLinks a {padding: 0; margin: 0 0.5em; + background: #005; border: none; color: #779; + cursor: pointer;}+#controls #navList {height: 1em;}+#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}++#currentSlide {text-align: center; font-size: 0.5em; color: #449;}++#slide0 {padding-top: 3.5em; font-size: 90%;}+#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;+ font: bold 2em Helvetica, sans-serif; white-space: normal;+ color: #000; background: transparent;}+#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}+#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}+#slide0 h4 {margin-top: 0; font-size: 1em;}++ul.urls {list-style: none; display: inline; margin: 0;}+.urls li {display: inline; margin: 0;}+.note {display: none;}+.external {border-bottom: 1px dotted gray;}+html>body .external {border-bottom: none;}+.external:after {content: " \274F"; font-size: smaller; color: #77B;}++.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}+img.incremental {visibility: hidden;}+.slide .current {color: #B02;}+++/* diagnostics++li:after {content: " [" attr(class) "]"; color: #F88;}+*/
+ data/ui/default/print.css view
@@ -0,0 +1,24 @@+/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */+.slide, ul {page-break-inside: avoid; visibility: visible !important;}+h1 {page-break-after: avoid;}++body {font-size: 12pt; background: white;}+* {color: black;}++#slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;}+#slide0 h3 {margin: 0; padding: 0;}+#slide0 h4 {margin: 0 0 0.5em; padding: 0;}+#slide0 {margin-bottom: 3em;}++h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;}+.extra {background: transparent !important;}+div.extra, pre.extra, .example {font-size: 10pt; color: #333;}+ul.extra a {font-weight: bold;}+p.example {display: none;}++#header {display: none;}+#footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;}+#footer h2, #controls {display: none;}++/* The following rule keeps the layout stuff out of print. Remove at your own risk! */+.layout, .layout * {display: none !important;}
+ data/ui/default/s5-core.css view
@@ -0,0 +1,9 @@+/* Do not edit or override these styles! The system will likely break if you do. */++div#header, div#footer, div#controls, .slide {position: absolute;}+html>body div#header, html>body div#footer, + html>body div#controls, html>body .slide {position: fixed;}+.handout {display: none;}+.layout {display: block;}+.slide, .hideme, .incremental {visibility: hidden;}+#slide0 {visibility: visible;}
+ data/ui/default/slides.js.comment view
@@ -0,0 +1,4 @@+// S5 v1.1 slides.js -- released into the Public Domain+//+// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information +// about all the wonderful and talented contributors to this code!
+ data/ui/default/slides.js.packed view
@@ -0,0 +1,74 @@+var undef;var slideCSS='';var snum=0;var smax=1;var incpos=0;var number=undef;var s5mode=true;var defaultView='slideshow';var controlVis='visible';var isIE=navigator.appName=='Microsoft Internet Explorer'&&navigator.userAgent.indexOf('Opera')<1?1:0;var isOp=navigator.userAgent.indexOf('Opera')>-1?1:0;var isGe=navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('Safari')<1?1:0;function hasClass(object,className){if(!object.className)return false;return(object.className.search('(^|\\s)'+className+'(\\s|$)')!=-1);}+function hasValue(object,value){if(!object)return false;return(object.search('(^|\\s)'+value+'(\\s|$)')!=-1);}+function removeClass(object,className){if(!object)return;object.className=object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'),RegExp.$1+RegExp.$2);}+function addClass(object,className){if(!object||hasClass(object,className))return;if(object.className){object.className+=' '+className;}else{object.className=className;}}+function GetElementsWithClassName(elementName,className){var allElements=document.getElementsByTagName(elementName);var elemColl=new Array();for(var i=0;i<allElements.length;i++){if(hasClass(allElements[i],className)){elemColl[elemColl.length]=allElements[i];}}+return elemColl;}+function isParentOrSelf(element,id){if(element==null||element.nodeName=='BODY')return false;else if(element.id==id)return true;else return isParentOrSelf(element.parentNode,id);}+function nodeValue(node){var result="";if(node.nodeType==1){var children=node.childNodes;for(var i=0;i<children.length;++i){result+=nodeValue(children[i]);}}+else if(node.nodeType==3){result=node.nodeValue;}+return(result);}+function slideLabel(){var slideColl=GetElementsWithClassName('*','slide');var list=document.getElementById('jumplist');smax=slideColl.length;for(var n=0;n<smax;n++){var obj=slideColl[n];var did='slide'+n.toString();obj.setAttribute('id',did);if(isOp)continue;var otext='';var menu=obj.firstChild;if(!menu)continue;while(menu&&menu.nodeType==3){menu=menu.nextSibling;}+if(!menu)continue;var menunodes=menu.childNodes;for(var o=0;o<menunodes.length;o++){otext+=nodeValue(menunodes[o]);}+list.options[list.length]=new Option(n+' : '+otext,n);}}+function currentSlide(){var cs;if(document.getElementById){cs=document.getElementById('currentSlide');}else{cs=document.currentSlide;}+cs.innerHTML='<span id="csHere">'+snum+'<\/span> '+'<span id="csSep">\/<\/span> '+'<span id="csTotal">'+(smax-1)+'<\/span>';if(snum==0){cs.style.visibility='hidden';}else{cs.style.visibility='visible';}}+function go(step){if(document.getElementById('slideProj').disabled||step==0)return;var jl=document.getElementById('jumplist');var cid='slide'+snum;var ce=document.getElementById(cid);if(incrementals[snum].length>0){for(var i=0;i<incrementals[snum].length;i++){removeClass(incrementals[snum][i],'current');removeClass(incrementals[snum][i],'incremental');}}+if(step!='j'){snum+=step;lmax=smax-1;if(snum>lmax)snum=lmax;if(snum<0)snum=0;}else+snum=parseInt(jl.value);var nid='slide'+snum;var ne=document.getElementById(nid);if(!ne){ne=document.getElementById('slide0');snum=0;}+if(step<0){incpos=incrementals[snum].length}else{incpos=0;}+if(incrementals[snum].length>0&&incpos==0){for(var i=0;i<incrementals[snum].length;i++){if(hasClass(incrementals[snum][i],'current'))+incpos=i+1;else+addClass(incrementals[snum][i],'incremental');}}+if(incrementals[snum].length>0&&incpos>0)+addClass(incrementals[snum][incpos-1],'current');ce.style.visibility='hidden';ne.style.visibility='visible';jl.selectedIndex=snum;currentSlide();number=0;}+function goTo(target){if(target>=smax||target==snum)return;go(target-snum);}+function subgo(step){if(step>0){removeClass(incrementals[snum][incpos-1],'current');removeClass(incrementals[snum][incpos],'incremental');addClass(incrementals[snum][incpos],'current');incpos++;}else{incpos--;removeClass(incrementals[snum][incpos],'current');addClass(incrementals[snum][incpos],'incremental');addClass(incrementals[snum][incpos-1],'current');}}+function toggle(){var slideColl=GetElementsWithClassName('*','slide');var slides=document.getElementById('slideProj');var outline=document.getElementById('outlineStyle');if(!slides.disabled){slides.disabled=true;outline.disabled=false;s5mode=false;fontSize('1em');for(var n=0;n<smax;n++){var slide=slideColl[n];slide.style.visibility='visible';}}else{slides.disabled=false;outline.disabled=true;s5mode=true;fontScale();for(var n=0;n<smax;n++){var slide=slideColl[n];slide.style.visibility='hidden';}+slideColl[snum].style.visibility='visible';}}+function showHide(action){var obj=GetElementsWithClassName('*','hideme')[0];switch(action){case's':obj.style.visibility='visible';break;case'h':obj.style.visibility='hidden';break;case'k':if(obj.style.visibility!='visible'){obj.style.visibility='visible';}else{obj.style.visibility='hidden';}+break;}}+function keys(key){if(!key){key=event;key.which=key.keyCode;}+if(key.which==84){toggle();return;}+if(s5mode){switch(key.which){case 10:case 13:if(window.event&&isParentOrSelf(window.event.srcElement,'controls'))return;if(key.target&&isParentOrSelf(key.target,'controls'))return;if(number!=undef){goTo(number);break;}+case 32:case 34:case 39:case 40:if(number!=undef){go(number);}else if(!incrementals[snum]||incpos>=incrementals[snum].length){go(1);}else{subgo(1);}+break;case 33:case 37:case 38:if(number!=undef){go(-1*number);}else if(!incrementals[snum]||incpos<=0){go(-1);}else{subgo(-1);}+break;case 36:goTo(0);break;case 35:goTo(smax-1);break;case 67:showHide('k');break;}+if(key.which<48||key.which>57){number=undef;}else{if(window.event&&isParentOrSelf(window.event.srcElement,'controls'))return;if(key.target&&isParentOrSelf(key.target,'controls'))return;number=(((number!=undef)?number:0)*10)+(key.which-48);}}+return false;}+function clicker(e){number=undef;var target;if(window.event){target=window.event.srcElement;e=window.event;}else target=e.target;if(target.getAttribute('href')!=null||hasValue(target.rel,'external')||isParentOrSelf(target,'controls')||isParentOrSelf(target,'embed')||isParentOrSelf(target,'object'))return true;if(!e.which||e.which==1){if(!incrementals[snum]||incpos>=incrementals[snum].length){go(1);}else{subgo(1);}}}+function findSlide(hash){var target=null;var slides=GetElementsWithClassName('*','slide');for(var i=0;i<slides.length;i++){var targetSlide=slides[i];if((targetSlide.name&&targetSlide.name==hash)||(targetSlide.id&&targetSlide.id==hash)){target=targetSlide;break;}}+while(target!=null&&target.nodeName!='BODY'){if(hasClass(target,'slide')){return parseInt(target.id.slice(5));}+target=target.parentNode;}+return null;}+function slideJump(){if(window.location.hash==null)return;var sregex=/^#slide(\d+)$/;var matches=sregex.exec(window.location.hash);var dest=null;if(matches!=null){dest=parseInt(matches[1]);}else{dest=findSlide(window.location.hash.slice(1));}+if(dest!=null)+go(dest-snum);}+function fixLinks(){var thisUri=window.location.href;thisUri=thisUri.slice(0,thisUri.length-window.location.hash.length);var aelements=document.getElementsByTagName('A');for(var i=0;i<aelements.length;i++){var a=aelements[i].href;var slideID=a.match('\#slide[0-9]{1,2}');if((slideID)&&(slideID[0].slice(0,1)=='#')){var dest=findSlide(slideID[0].slice(1));if(dest!=null){if(aelements[i].addEventListener){aelements[i].addEventListener("click",new Function("e","if (document.getElementById('slideProj').disabled) return;"+"go("+dest+" - snum); "+"if (e.preventDefault) e.preventDefault();"),true);}else if(aelements[i].attachEvent){aelements[i].attachEvent("onclick",new Function("","if (document.getElementById('slideProj').disabled) return;"+"go("+dest+" - snum); "+"event.returnValue = false;"));}}}}}+function externalLinks(){if(!document.getElementsByTagName)return;var anchors=document.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&hasValue(anchor.rel,'external')){anchor.target='_blank';addClass(anchor,'external');}}}+function createControls(){var controlsDiv=document.getElementById("controls");if(!controlsDiv)return;var hider=' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';var hideDiv,hideList='';if(controlVis=='hidden'){hideDiv=hider;}else{hideList=hider;}+controlsDiv.innerHTML='<form action="#" id="controlForm"'+hideDiv+'>'+'<div id="navLinks">'+'<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>'+'<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>'+'<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>'+'<div id="navList"'+hideList+'><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>'+'<\/div><\/form>';if(controlVis=='hidden'){var hidden=document.getElementById('navLinks');}else{var hidden=document.getElementById('jumplist');}+addClass(hidden,'hideme');}+function fontScale(){if(!s5mode)return false;var vScale=22;var hScale=32;if(window.innerHeight){var vSize=window.innerHeight;var hSize=window.innerWidth;}else if(document.documentElement.clientHeight){var vSize=document.documentElement.clientHeight;var hSize=document.documentElement.clientWidth;}else if(document.body.clientHeight){var vSize=document.body.clientHeight;var hSize=document.body.clientWidth;}else{var vSize=700;var hSize=1024;}+var newSize=Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));fontSize(newSize+'px');if(isGe){var obj=document.getElementsByTagName('body')[0];obj.style.display='none';obj.style.display='block';}}+function fontSize(value){if(!(s5ss=document.getElementById('s5ss'))){if(!isIE){document.getElementsByTagName('head')[0].appendChild(s5ss=document.createElement('style'));s5ss.setAttribute('media','screen, projection');s5ss.setAttribute('id','s5ss');}else{document.createStyleSheet();document.s5ss=document.styleSheets[document.styleSheets.length-1];}}+if(!isIE){while(s5ss.lastChild)s5ss.removeChild(s5ss.lastChild);s5ss.appendChild(document.createTextNode('body {font-size: '+value+' !important;}'));}else{document.s5ss.addRule('body','font-size: '+value+' !important;');}}+function notOperaFix(){slideCSS=document.getElementById('slideProj').href;var slides=document.getElementById('slideProj');var outline=document.getElementById('outlineStyle');slides.setAttribute('media','screen');outline.disabled=true;if(isGe){slides.setAttribute('href','null');slides.setAttribute('href',slideCSS);}+if(isIE&&document.styleSheets&&document.styleSheets[0]){document.styleSheets[0].addRule('img','behavior: url(ui/default/iepngfix.htc)');document.styleSheets[0].addRule('div','behavior: url(ui/default/iepngfix.htc)');document.styleSheets[0].addRule('.slide','behavior: url(ui/default/iepngfix.htc)');}}+function getIncrementals(obj){var incrementals=new Array();if(!obj)+return incrementals;var children=obj.childNodes;for(var i=0;i<children.length;i++){var child=children[i];if(hasClass(child,'incremental')){if(child.nodeName=='OL'||child.nodeName=='UL'){removeClass(child,'incremental');for(var j=0;j<child.childNodes.length;j++){if(child.childNodes[j].nodeType==1){addClass(child.childNodes[j],'incremental');}}}else{incrementals[incrementals.length]=child;removeClass(child,'incremental');}}+if(hasClass(child,'show-first')){if(child.nodeName=='OL'||child.nodeName=='UL'){removeClass(child,'show-first');if(child.childNodes[isGe].nodeType==1){removeClass(child.childNodes[isGe],'incremental');}}else{incrementals[incrementals.length]=child;}}+incrementals=incrementals.concat(getIncrementals(child));}+return incrementals;}+function createIncrementals(){var incrementals=new Array();for(var i=0;i<smax;i++){incrementals[i]=getIncrementals(document.getElementById('slide'+i));}+return incrementals;}+function defaultCheck(){var allMetas=document.getElementsByTagName('meta');for(var i=0;i<allMetas.length;i++){if(allMetas[i].name=='defaultView'){defaultView=allMetas[i].content;}+if(allMetas[i].name=='controlVis'){controlVis=allMetas[i].content;}}}+function trap(e){if(!e){e=event;e.which=e.keyCode;}+try{modifierKey=e.ctrlKey||e.altKey||e.metaKey;}+catch(e){modifierKey=false;}+return modifierKey||e.which==0;}+function startup(){defaultCheck();if(!isOp)+createControls();slideLabel();fixLinks();externalLinks();fontScale();if(!isOp){notOperaFix();incrementals=createIncrementals();slideJump();if(defaultView=='outline'){toggle();}+document.onkeyup=keys;document.onkeypress=trap;document.onclick=clicker;}}+window.onload=startup;window.onresize=function(){setTimeout('fontScale()',50);}
− debian/changelog
@@ -1,1366 +0,0 @@-pandoc (0.46) unstable; urgency=low-- [ John MacFarlane ]-- * Made -H, -A, and -B options cumulative: if they are specified- multiple times, multiple files will be included.-- * Added optional HTML sanitization using a whitelist.- When this option is specified (--sanitize-html on the command line),- unsafe HTML tags will be replaced by HTML comments, and unsafe HTML- attributes will be removed. This option should be especially useful- for those who want to use pandoc libraries in web applications, where- users will provide the input.- - + Main.hs: Added --sanitize-html option.-- + Text.Pandoc.Shared: Added stateSanitizeHTML to ParserState.-- + Text.Pandoc.Readers.HTML:- - Added whitelists of sanitaryTags and sanitaryAttributes.- - Added parsers to check these lists (and state) to see if a given- tag or attribute should be counted unsafe.- - Modified anyHtmlTag and anyHtmlEndTag to replace unsafe tags- with comments.- - Modified htmlAttribute to remove unsafe attributes.- - Modified htmlScript and htmlStyle to remove these elements if- unsafe.-- + Modified README and man pages to document new option.-- * Improved handling of email addresses in markdown and reStructuredText.- Consolidated uri and email address parsers. (Resolves Issue #37.)-- + New emailAddress and uri parsers in Text.Pandoc.Shared.- - uri parser uses parseURI from Network.URI.- - emailAddress parser properly handles email addresses with periods- in them.-- + Removed uri and emailAddress parsers from Text.Pandoc.Readers.RST- and Text.Pandoc.Readers.Markdown.-- * Markdown reader:-- + Fixed emph parser so that "*hi **there***" is parsed as a Strong- nested in an Emph. (A '*' is only recognized as the end of the- emphasis if it's not the beginning of a strong emphasis.)-- + Moved blockQuote parser before list parsers for performance.-- + Modified 'source' parser to allow backslash-escapes in URLs.- So, for example, [my](/url\(1\)) yields a link to /url(1).- Resolves Issue #34.-- + Disallowed links within links. (Resolves Issue #35.)- - Replaced inlinesInBalanced with inlinesInBalancedBrackets, which - instead of hard-coding the inline parser takes an inline parser- as a parameter.- - Modified reference and inlineNote to use inlinesInBalancedBrackets.- - Removed unneeded inlineString function.- - Added inlineNonLink parser, which is now used in the definition of- reference.- - Added inlineParsers list and redefined inline and inlineNonLink parsers- in terms of it.- - Added failIfLink parser.- - + Better handling of parentheses in URLs and quotation marks in titles.- - 'source' parser first tries to parse URL with balanced parentheses;- if that doesn't work, it tries to parse everything beginning with- '(' and ending with ')'.- - source parser now uses an auxiliary function source'.- - linkTitle parser simplified and improved, under assumption that it- will be called in context of source'.-- + Make 'block' conditional on strictness state, instead of using- failIfStrict in block parsers. Use a different ordering of parsers- in strict mode (raw HTML block before paragraph) for performance.- In non-strict mode use rawHtmlBlocks instead of htmlBlock.- Simplified htmlBlock, since we know it's only called in strict- mode.-- + Improved handling of raw HTML. (Resolves Issue #36.)- - Tags that can be either block or inline (e.g. <ins>) should- be treated as block when appropriate and as inline when- appropriate. Thus, for example,- <ins>hi</ins>- should be treated as a paragraph with inline <ins> tags, while- <ins>- hi- </ins>- should be treated as a paragraph within <ins> tags.- - Moved htmlBlock after para in list of block parsers. This ensures- that tags that can be either block or inline get parsed as inline- when appropriate.- - Modified rawHtmlInline' so that block elements aren't treated as- inline.- - Modified para parser so that paragraphs containing only HTML tags and- blank space are not allowed. Treat these as raw HTML blocks instead.-- + Fixed bug wherein HTML preceding a code block could cause it to- be parsed as a paragraph. The problem is that the HTML parser- used to eat all blank space after an HTML block, including the- indentation of the code block. (Resolves Issue #39.)- - In Text.Pandoc.Readers.HTML, removed parsing of following space- from rawHtmlBlock.- - In Text.Pandoc.Readers.Markdown, modified rawHtmlBlocks so that- indentation is eaten *only* on the first line after the HTML- block. This means that in- <div>- foo- <div>- the foo won't be treated as a code block, but in- <div>- - foo- - </div>- it will. This seems the right approach for least surprise.-- * RST reader:-- + Fixed bug in parsing explicit links (resolves Issue #44).- The problem was that we were looking for inlines until a '<' character- signaled the start of the URL; so, if you hit a reference-style link,- it would keep looking til the end of the document. Fix: change- inline => (notFollowedBy (char '`') >> inline). Note that this won't- allow code inlines in links, but these aren't allowed in resT anyway.-- + Cleaned up parsing of reference names in key blocks and links.- Allow nonquoted reference links to contain isolated '.', '-', '_', so- so that strings like 'a_b_' count as links.-- + Removed unnecessary check for following link in str.- This is unnecessary now that link is above str in the definition of- 'inline'.- - * HTML reader:-- + Modified rawHtmlBlock so it parses </html> and </body> tags.- This allows these tags to be handled correctly in Markdown.- HTML reader now uses rawHtmlBlock', which excludes </html> and </body>,- since these are handled in parseHtml. (Resolves Issue #38.)-- + Fixed bug (emph parser was looking for <IT> tag, not <I>).-- + Don't interpret contents of style tags as markdown.- (Resolves Issue #40.)- - Added htmlStyle, analagous to htmlScript.- - Use htmlStyle in htmlBlockElement and rawHtmlInline.- - Moved "script" from the list of tags that can be either block or- inline to the list of block tags.-- + Modified rawHtmlBlock to use anyHtmlBlockTag instead of anyHtmlTag- and anyHtmlEndTag. This fixes a bug in markdown parsing, where- inline tags would be included in raw HTML blocks.-- + Modified anyHtmlBlockTag to test for (not inline) rather than- directly for block. This allows us to handle e.g. docbook in- the markdown reader.-- * LaTeX reader: Properly recognize --parse-raw in rawLaTeXInline.- Updated LaTeX reader test to use --parse-raw.-- * HTML writer:-- + Modified rules for automatic HTML header identifiers to- ensure that identifiers begin with an alphabetic character.- The new rules are described in README. (Resolves Issue #33.)-- + Changed handling of titles in HTML writer so you don't get- "titleprefix - " followed by nothing.-- * ConTeXt writer: Use wrappers around Doc elements to ensure proper- spacing. Each block element is wrapped with either Pad or Reg.- Pad'ed elements are guaranteed to have a blank line in between.-- * RST writer:-- + Refactored RST writer to use a record instead of a tuple for state,- and to include options in state so it doesn't need to be passed as- a parameter.-- + Use an interpreted text role to render math in restructuredText.- See http://www.american.edu/econ/itex2mml/mathhack.rst for the- strategy.- - [ Recai Oktaş ]-- * Debian packaging changes:-- + Remove the empty 'include' directory in -dev package, which lintian- complains about.- + Bump Standarts-Version to 3.7.3.- + Use new 'Homepage:' field to specify the upstream URL on suggestion of- lintian.-- -- Recai Oktaş <roktas@debian.org> Tue, 08 Jan 2008 05:13:31 +0200--pandoc (0.45) unstable; urgency=low-- [ John MacFarlane ]-- * Simplified parsing of reference keys and notes in markdown and RST- readers: The Reference data structure from Text.Pandoc.Shared is no- longer needed, since referenceKey and noteBlock parses return strings- (as many blank lines as were occupied by the key or note) and update- state themselves. getPosition and setPosition are now used to ensure- that error messages will give the correct line number. This yields- cleaner (and slightly faster) code, with more accurate parsing error- messages.-- * Added new Math inline element:-- + Markdown and LaTeX readers now convert TeX math into Math elements,- not TeX.- + This allows math to be treated differently from raw TeX in output.- TeX elements are no longer printed in output formats other than- Markdown, LaTeX, and ConTeXt. But Math elements are always printed.-- * New default handling of math in writers:-- + New module Text.Pandoc.Readers.TeXMath exports readTeXMath, which- parses raw TeX math and outputs a string of Pandoc inlines that- tries to render it as far as possible using unicode characters,- lapsing into literal TeX when needed.- + readTeXMath is now used for default HTML output in HTML, S5, RTF,- and Docbook, if no other method for displaying math in HTML is- specified. Enclosing $'s are no longer printed by default.- + By default, math is put inside <span class="math">. This way it can be- distinguished from the surrounding text, e.g. put in a different- font.-- * New --gladtex and --mimetex options for display of math in HTML:-- + If --gladtex is specified, math is output between <eq> tags, so- it can be processed by gladTeX.- + If --mimetex is specified, math is put in <img> tags with a link- to the mimetex CGI script (or any other script that takes TeX math- as input and outputs an image). The URL of the script may be- specified, but defaults to /cgi-bin/mimetex.cgi.- + HTMLMathMethod structure in WriterOptions keeps track of how to- display math in HTML output.- + Updated README with a description of the four options for displaying- math in HTML.-- * HTML reader:- - + Fixed bug: parser for minimized attributes should not swallow- trailing spaces.- + Simplified HTML attribute parsing.- + Changed parsing of code blocks in HTML reader: <code> tag is no- longer needed. <pre> suffices. All HTML tags in the code block- (e.g. for syntax highlighting) are skipped, because they are not- portable to other output formats. A <code>...</code> block not- surrounded by <pre> now counts as inline HTML, not a code block.- + Remove just one leading and one trailing newline from contents of- <pre>...</pre> in codeBlock parser.- - * Markdown reader:-- + Removed support for box-style block quotes.- + Require space before title in links and references.- This fixes a bug in parsing URLs like http://silly/url(withparen).- + Improved and simplified setextHeader parser.- + Fixed logic in smart quote parsing, adding some needed 'try'- statements.- + Fixed smart quote parsing so that unicode characters 8216 and 8217- are recognized as single quotes, and 8220 and 8221 as double quotes.-- * RST reader:-- + Fixed bug in parsing of code blocks. Previously a full tab indent- was required, but RST allows code to be indented any amount.- Resolves Issue #27.- + Allow field lists to be indented.- + Parse the contents of field lists instead of treating as a raw string.- + Represent field lists as definition lists instead of blockquotes. - + Fixed bug in which metadata would be overridden if the document- contained multiple field lists.- + Parse fields associated with '.. image::' blocks, and use 'alt'- field, if given, for image alt and title attributes. -- * LaTeX reader: -- + Modified specialChar so that '"' characters are parsed.- + Fixed a bug in parsing of \[ \] math blocks (thanks to Mark Kalderon).-- * HTML writer:-- + Changes in handling of math (see above).- + Don't produce HTML for table of contents if there are- no headers. (This would be an empty list, which is invalid XHTML.)-- * Markdown writer:- - + Don't print title attribute if title is empty. (This differs from- the behavior of Markdown.pl, and agrees with PHP Markdown. But John- Gruber has indicated that he prefers this behavior.) Adjusted test- suite accordingly.- + Fixed incorrect line wrapping in paragraphs including hard line- breaks. Resolves Issue #25.- + Fixed bug in markdown writer: If an ordered list item began with- a marker greater than 3 characters in width, and the item took more- than one line, it would appear on the line after the list marker,- e.g.:- - (12)- My list item.- Multiline.- - Now it works as follows:- - (12) My list item.- Multiline.- - * RST writer- - + Fixed bug in RST writer's handling of ordered lists. Previously,- list items with multiple lines would not always line up with- single-line list items. Now, list items are nested the length of- the list marker + 1. This looks better and ensures that list items- all line up. (Note that list markers are padded to the length of- the longest list marker in the series.)- + Use 3-space indent for unordered lists.- + If label for a link reference contains a colon, surround it by `- signs so it won't be interpreted as the end of the link label.-- * LaTeX writer:-- + Cleaner output for footnotes. Footnotes now always begin on a new- line, and the final } is on a line by itself only when it needs to- be (i.e. only when the note ends with a Verbatim environment).- + Added writer options to state, so state doesn't need to be passed as- a parameter.- + Text wrapping now provided, using wrapTeXIfNeeded.-- * ConTeXt writer: many improvements for more idiomatic ConTeXt output- (thanks to Idris Samawi Hamid for suggestions).-- + PrettyPrint module now used for output.- + Writer options are now in state, so they don't have to be passed as- a parameter.- + Text wrapping now provided, using wrapTeXIfNeeded.- + Better treatment of footnotes: footnotes are always on lines by- themselves, and the final } is on a line by itself only when- it needs to be (after \stoptyping).- + Use \subject, \subsubject, ... or \section, \subsection, ... for headings,- depending on whether --number-sections option is selected.- + Extra blank line inserted after \stopitemize- + Use new, "official" definition of blockquote environment. Also, use- blank line after \startblockquote to balance blank line at the end.- + Both itemized and enumerated lists are now generated using- \start-stopitemize, with appropriate options. Removed definitions- of ltxenum and ltxitem, which are no longer needed. Provided- defaults for itemized lists in the preamble. State keeps track of- ordered list level, so that when default numbering is specified,- the appropriate scheme can be used.- + Changed \useurl to \useURL.- + Changed link color from red to blue.- + Use \subsubsubsubsection etc., since these are supported - (up to at least sub x 5).-- * Text.Pandoc.Shared:-- + Save and restore position in parseFromString, so that accurate- error messages can be given.- + Improved efficiency of romanNumeral parser.- + Added wrappedTeX and wrapTeXIfNeeded functions. These ensure- that footnotes occur on lines by themselves (to make them- easier to see and move) and do not screw up line wrapping.-- * Text.Pandoc.UTF8: modified fromUTF8 to strip out the BOM- if present. Windows Notepad and other applications insert a- BOM at the beginning of a UTF8 file.-- * Main.hs (tabFilter): Treat '\r' at end of line as newline (in- addition to "\r\n" and '\n').-- * Added a writer option for wrapped text and a command-line option- '--no-wrap', which disables text wrapping and minimizes whitespace- in HTML. (Resolves Issue #26.)-- + Added support for '--no-wrap' to Main.hs.- + Added wrapIfNeeded function to Text.Pandoc.Shared.- + Use wrapIfNeeded instead of wrapped in the RST, Man, Docbook, and- Markdown writers.- + Added render and renderFragment helpers to HTML writer.-- * Modified html2markdown to run tidy only if the HTML cannot be- parsed. Previously html2markdown piped all input through tidy- before passing it to pandoc. This caused problems on certain pages- (e.g. http://daringfireball.com/markdown) which have well-formed- XHTML that causes tidy to choke. The solution is to pipe through- tidy only if pandoc cannot parse the input by itself. This means- that a temp file is now always used, even when input comes from a- local file or standard input.-- * Removed 'version' constant from Main.hs; added 'pandocVersion' to- Text.Pandoc library.-- * pandoc.cabal:-- + Modified to work with GHC 6.8 and Cabal configurations. (For GHC- 6.8, pretty and containers must be added to Build-Depends, and it- is desirable to use the -O2 compiler option.) Cabal configurations- allows one to select options depending on the compiler version.- For GHC 6.6, the splitBase option can be disabled.- + pandoc.cabal.ghc66 is provided for users with older versions of- Cabal, which do not support configurations.- + Use Ghc-Prof-Options to ensure that '-auto-all' is used when- '--enable-(executable|library)-profiling' is specified. Updated- PROFILING instructions accordingly.-- * Makefile:-- + Makefile now checks GHC version. If GHC is 6.6, pandoc.cabal.ghc66- is copied to pandoc.cabal, and the old pandoc.cabal is copied- to pandoc.cabal.orig. Otherwise, pandoc.cabal is copied to- pandoc.cabal.orig but otherwise unmodified. This way, the Makefile- will work properly with either GHC 6.6 or 6.8.- + Changed BUILDCONF to point to dist/setup-config, not .setup-config.- This is where current versions of Cabal put it. - + Added $(BUILDCMD) target, so setup doesn't get compiled every time.- + Removed dependency of templates on ./templates, which is circular- now that templates is a subdirectory of the top-level.-- * MacPorts Portfile:-- + Modified to install the pandoc library in addition to programs. - + Installation must be done manually rather than using Makefile's- install-all.- + Note that the library must be registered in the activate phase,- after the library files have been copied out of the destroot.- Cabal generates a 'register.sh' script that will do this.-- * debian/control: Added libghc6-network-dev, libghc6-xhtml-dev, and- libghc6-mtl-dev as dependencies for libghc6-pandoc-dev.- Closes: #445235-- * debian/rules: Converted to UTF-8.-- * Changed pandoc home page to http://johnmacfarlane.net/pandoc/.-- * Updated ASCIIMathML.js to latest version.-- * Directory structure:-- + Moved everything from src into the top-level directory.- + Changed references to source directory in Makefile and- pandoc.cabal.*.- + Moved ASCIIMathML.js, headers, and ui into templates directory.- + Modified fillTemplates.pl to reflect new paths.-- [ Recai Oktaş ]-- * Makefile: Fixed the issue of having two copies of the library- documentation under some usage scenarios.-- * Replaced 'ghc' with '$(GHC)' in Makefile, and made GHC- and GHC_PKG configurable through the environment, to support- unusual ghc installations. For example:- GHC=/opt/ghc/bin/ghc GHC_PKG=/opt/ghc/bin/ghc-pkg make-- -- Recai Oktaş <roktas@debian.org> Sun, 07 Oct 2007 20:51:43 +0300--pandoc (0.44) unstable; urgency=low-- [ John MacFarlane ]-- * Fixed bug in HTML writer: when --toc was used, anchors were put around- headers, which is invalid XHTML (block content within inline element).- Now the anchors are put inside the header tags. Resolves Issue #23.-- * Added xmlns attribute to html element in html writer tests.- This attribute is added by more recent versions of the- xhtml library (>= 3000), and is required for valid XHTML.-- [ Recai Oktaş ]-- * On configure, compile 'Setup.hs' to 'setup' and use 'setup' as the build- command instead of 'runhaskell', which, on some platforms (such as s390,- alpha, m68k), throws the following error:-- runhaskell Setup.hs configure --prefix=/usr- ghc-6.6.1: not built for interactive use-- This causes a serious FTBFS bug. Closes: #440668.-- -- Recai Oktaş <roktas@debian.org> Mon, 03 Sep 2007 18:24:02 +0300--pandoc (0.43) unstable; urgency=low-- [ John MacFarlane ]-- * The focus of this release is performance. The markdown parser- is about five times faster than in 0.42, based on benchmarks- with the TextMate manual. -- * Main.hs: Replaced CRFilter and tabFilter with single function- tabFilter, which operates on the whole string rather than breaking- it into lines, and handles dos-style line-endings as well as tabs.-- * Added separate LaTeX reader and native reader tests; removed- round-trip tests.-- * Text.Pandoc.Shared:-- + Removed tabsToSpaces and tabsInLine (they were used only in Main.hs.)- + General code cleanup (to elimante warnings when compiling with -Wall.)- + Added 'wrapped' function, which helps wrap text into paragraphs,- using the prettyprinting library.- + Rewrote charsInBalanced and charsInBalanced'.- - Documented restriction: open and close must be distinct characters.- - Rearranged options for greater efficiency.- - Bug fix: Changed inner call to charsInBalanced inside- charsInBalanced' to charsInBalanced'.- + anyLine now requires that the line end with a newline (not eof).- This is a harmless assumption, since we always add newlines to the- end of a block before parsing with anyLine, and it yields a 10% speed- boost.- + Removed unnecessary 'try' in anyLine.- + Removed unneeded 'try' from romanNumeral parser.- + Use notFollowedBy instead of notFollowedBy' in charsInBalanced.- + Removed unneeded 'try' in parseFromString.- + Removed unneeded 'try' from stringAnyCase. (Now it behaves- like 'string'.)- + Changed definition of 'enclosed' in Text.Pandoc.Shared so that- 'try' is not automatically applied to the 'end' parser. Added- 'try' in calls to 'enclosed' where needed. Slight speed increase.-- * Writers:-- + Replaced individual wrapping routines in RST, Man, and Markdown- writers with 'wrapped' from Text.Pandoc.Shared.- + Rewrote LaTeX writer to use the prettyprinting library,- so we get word wrapping, etc.- + Modified latex writer tests for new latex writer using prettyprinter.- + Fixed bug in LaTeX writer: autolinks would not cause- '\usepackage{url}' to be put in the document header. Also, changes- to state in enumerated list items would be overwritten.- + In Markdown writer, escape paragraphs that begin with ordered list- markers, so they don't get interpreted as ordered lists.-- * Text.Pandoc.Reades.LaTeX:-- + Fixed bug in LaTeX reader, which wrongly assumed that the roman- numeral after "enum" in "setcounter" would consist entirely of- "i"s. 'enumiv' is legitimate.- + LaTeX command and environment names can't contain numbers.- + Rearranged order of parsers in inline for slight speed improvement.- + Added '`' to special characters and 'unescapedChar'.-- * Text.Pandoc.Readers.RST:-- + Removed unneeded try's in RST reader; also minor code cleanup.- + Removed tabchar.- + Rearranged parsers in inline (doubled speed).-- * Text.Pandoc.Readers.Markdown:-- + Skip notes parsing if running in strict mode. (This yields a nice- speed improvement in strict mode.)- + Simplify autolink parsing code, using Network.URI to test for- URIs. Added dependency on network library to debian/control and- pandoc.cabal.- + More perspicuous definition of nonindentSpaces.- + Removed unneeded 'try' in 'rawLine'.- + Combined linebreak and whitespace into a new whitespace parser, to- avoid unnecessary reparsing of space characters.- + Removed unnecessary 'try' in 'codeBlock', 'ellipses', 'noteMarker',- 'multilineRow', 'dashedLine', 'rawHtmlBlocks'.- + Use lookAhead in parsers for setext headers and definition lists- to see if the next line begins appropriately; if not, don't waste- any more time parsing.- + Don't require blank lines after code block. (It's sufficient to- end code block with a nonindented line.)- + Changed definition of 'emph': italics with '_' must not- be followed by an alphanumeric character. This is to help- prevent interpretation of e.g. [LC_TYPE]: my_type as- '[LC<em>TYPE]:my</em>type'.- + Improved Markdown.pl-compatibility in referenceLink: the two parts- of a reference-style link may be separated by one space, but not- more... [a] [link], [not] [a link].- + Fixed markdown inline code parsing so it better accords with- Markdown.pl: the marker for the end of the code section is a clump- of the same number of `'s with which the section began, followed- by a non-` character. So, for example,- ` h ``` i ` -> <code>h ``` i</code>.- + Split 'title' into 'linkTitle' and 'referenceTitle', since the- rules are slightly different.- + Rewrote 'para' for greater efficiency.- + Rewrote link parsers for greater efficiency.- + Removed redundant 'referenceLink' in definition of inline (it's- already in 'link').- + Refactored escapeChar so it doesn't need 'try'.- + Refactored hrule for performance in Markdown reader.- + More intelligent rearranging of 'inline' so that most frequently- used parsers are tried first.- + Removed tabchar parser, as whitespace handles tabs anyway.-- * Text.Pandoc.CharacterReferences:-- + Refactored.- + Removed unnecessary 'try's for a speed improvement.- + Removed unnecessary '&' and ';' from the entity table.-- * Build process:-- + Makefile: Get VERSION from cabal file, not Main.hs.- + Modified MacPorts Portfile:- - Depend on haddock- - Build and install libraries and library documentation in- addition to pandoc executable- - Added template item for md5 sum in Portfile.in.- - Incorporated changes from MacPorts repository (r28278).- + FreeBSD port: Don't try to generate distinfo in Makefile.- It can be made using 'make makesum' in FreeBSD.- + Make both freebsd and macports targets depend on tarball.-- * Website and documentation:-- + Updated INSTALL instructions.- + Added pandocwiki demo to website.- + Removed local references to Portfile, since pandoc is now in the- MacPorts repository.-- -- Recai Oktaş <roktas@debian.org> Sun, 02 Sep 2007 15:50:11 +0300--pandoc (0.42) unstable; urgency=low-- [ John MacFarlane ]-- * Main.hs: Use utf8 conversion on the extra files loaded with- the -H, -C, -B, and -A options. This fixes problems with unicode- characters in these files.-- * Exposed Text.Pandoc.ASCIIMathML, since it is imported in- Text.Pandoc.Readers.HTML and without it we get a linking error when- using the library.-- * Markdown reader:-- + Added new rule for enhanced markdown ordered lists: if the list- marker is a capital letter followed by a period (including a- single-letter capital roman numeral), then it must be followed by- at least two spaces. The point of this is to avoid accidentally- treating people's initials as list markers: a paragraph might begin,- "B. Russell was an English philosopher," and this shouldn't be- treated as a list. Documented change in README.- + Blocks that start with "p. " and a digit are no longer treated- as ordered lists (it's a page number).- + Added a needed 'try' to listItem.- + Removed check for a following setext header in endline.- A full test is too inefficient (doubles benchmark time), and the- substitute we had before is not 100% accurate.- + Don't use Code elements for autolinks if --strict specified. -- * LaTeX writer: When a footnote ends with a Verbatim environment, the- close } of the footnote cannot occur on the same line or an error occurs.- Fixed this by adding a newline before the closing } of every footnote.-- * HTML writer:- + Removed incorrect "{}" around style information in HTML tables.- Column widths now work properly in HTML.- + If --strict option is specified (and --toc is not), don't include- identifiers in headers, for better Markdown compatibility.-- * Build process:-- + Separated $(web_dest) and website targets.- + In website, index.txt is now constructed from template index.txt.in.- + Added freebsd target to Markefile. This creates the freebsd Makefile- from Makefile.in, and creates distinfo. Removed Makefile and distinfo- from the repository.- + Added macport target to Makefile. Portfile is built from template- Portfile.in.- + Removed OSX package targets. (Too many difficulties involving- dependencies on dynamic libraries.)- + More complete INSTALL instructions for all architectures.-- * Website:- + Added a programming demo, pandocwiki.-- [ Recai Oktaş ]-- * Do not forget to close pandoc's ITP. Closes: #391666-- -- Recai Oktaş <roktas@debian.org> Sun, 26 Aug 2007 22:51:32 +0300--pandoc (0.41) unstable; urgency=low-- [ John MacFarlane ]-- * Fixed bugs in HTML reader:- + Skip material at end *only if* </html> is present (previously,- only part of the document would be parsed if an error was- found; now a proper error message is given).- + Added new constant eitherBlockOrInline with elements that may- count either as block-level or as inline. Modified isInline and- isBlock to take this into account.- + Modified rawHtmlBlock to accept any tag (even an inline tag):- this is innocuous, because rawHtmlBlock is tried only if a regular- inline element can't be parsed.- + Added a necessary 'try' in definition of 'para'.-- * Fixed bug in markdown ordered list parsing. The problem was that- anyOrderedListStart did not check for a space following the- ordered list marker. So in 'A.B. 2007' the parser would be- expecting a list item, but would not find one, causing an error.- Fixed a similar bug in the RST reader. Resolves Issue #22.-- * Refactored RST and Markdown readers using parseFromString.-- * LaTeX reader will now skip anything after \end{document}.-- * Fixed blockquote output in markdown writer: previously, block- quotes in indented contexts would be indented only in the first- line.-- * Added note to INSTALL about variations in versions of the xhtml- library that can lead to failed tests (thanks to Leif LeBaron).-- -- Recai Oktaş <roktas@debian.org> Sun, 19 Aug 2007 23:26:07 +0300--pandoc (0.4) unstable; urgency=low-- [ John MacFarlane ]-- * Added two new output formats: groff man pages and ConTeXt. By- default, output files with extensions ".ctx" and ".context" are- assumed to be ConTeXt, and output files with single-digit extensions- are assumed to be man pages.-- * Enhanced ordered lists (documented in README, under Lists):- + The OrderedList block element now stores information about- list number style, list number delimiter, and starting number.- + The readers parse this information when possible.- + The writers use this information to style ordered lists.- + The enhancement can be disabled using the --strict option. -- * Added support for tables (with a new Table block element). Two kinds- of tables are supported: a simple table with one-line rows, and a- more complex variety with multiline rows. All output formats are- supported, but only markdown tables are parsed at the moment. The- syntax is documented in README.-- * Added support for definition lists (with a new DefinitionList block- element). All output and input formats are supported. The syntax is- documented in README.-- * Added support for superscripts and subscripts (with new Superscript- and Subscript inline elements). All input and output- formats. The syntax is documented in README.-- * Added support for strikeout (with a new Strikeout inline element).- All input and output formats are supported. Thanks to Bradley Kuhn,- who contributed a patch. The syntax is documented in README. Resolves- Issue #18.-- * Added a --toc|--table-of-contents option. This causes an automatically- generated table of contents (or an instruction that creates one) to- be inserted at the beginning of the document. Not supported in S5,- DocBook, or man page writers.-- * Modified the -m|--asciimathml option:-- + If an optional URL argument is provided, a link is inserted- instead of the contents of the ASCIIMathML.js script.- + Nothing is inserted unless the document actually contains- LaTeX math.-- * Removed Blank block element as unnecessary.-- * Removed Key and Note blocks from the Pandoc data structure. All- links are now stored as explicit links, and note contents are- stored with the (inline) notes.-- + All link Targets are now explicit (URL, title) pairs; there- is no longer a 'Ref' target.- + Markdown and RST parsers now need to extract data from key and- note blocks and insert them into the relevant inline elements.- Other parsers have been simplified, since there is no longer any need- to construct separate key and note blocks.- + Markdown, RST, and HTML writers need to construct lists of- notes; Markdown and RST writers need to construct lists of link- references (when the --reference-links option is specified); and- the RST writer needs to construct a list of image substitution- references. All writers have been rewritten to use the State monad- when state is required.- + Several functions (generateReference, keyTable,- replaceReferenceLinks, replaceRefLinksBlockList, and some auxiliaries- used by them) have been removed from Text.Pandoc.Shared, since- they are no longer needed. New functions and data structures- (Reference, isNoteBlock, isKeyBlock, isLineClump) have been- added. The functions inTags, selfClosingTag, inTagsSimple, and- inTagsIndented have been moved to the DocBook writer, since that- is now the only module that uses them. NoteTable is now exported- in Text.Pandoc.Shared.- + Added stateKeys and stateNotes to ParserState; removed stateKeyBlocks,- stateKeysUsed, stateNoteBlocks, stateNoteIdentifiers, stateInlineLinks. - + Added writerNotes and writerReferenceLinks to WriterOptions.-- * Added Text.Pandoc module that exports basic readers, writers,- definitions, and utility functions. This should export everything- needed for most uses of Pandoc libraries. The haddock documentation- includes a short example program.-- * Text.Pandoc.ASCIIMathML is no longer an exported module.-- * Added Text.Pandoc.Blocks module to help in printing markdown- and RST tables. This module provides functions for working with- fixed-width blocks of text--e.g., placing them side by side, as- in a table row.-- * Refactored to avoid reliance on Haskell's Text.Regex library, which- (a) is slow, and (b) does not properly handle unicode. This fixed- some strange bugs, e.g. in parsing S-cedilla, and improved performance.-- + Replaced 'gsub' with a general list function 'substitute'- that does not rely on Text.Regex.- + Rewrote extractTagType in HTML reader so that it doesn't use- regexs.- + In Markdown reader, replaced email regex test with a custom email- autolink parser (autoLinkEmail). Also replaced selfClosingTag regex- with a custom function isSelfClosingTag.- + Modified Docbook writer so that it doesn't rely on Text.Regex for- detecting 'mailto' links.- + Removed escapePreservingRegex and reamped entity-handling- functions in Text.Pandoc.Shared and Text.Pandoc.CharacterReferences to- avoid reliance on Text.Regex (see below on character reference- handling changes).-- * Renamed Text.Pandoc.Entities as Text.Pandoc.CharacterReferences.-- * Changed handling of XML entities. Entities are now parsed (and unicode- characters returned) in the Markdown and HTML readers, rather than being- handled in the writers. In HTML and Docbook writers, UTF-8 is now used- instead of entities for characters above 128. This makes the HTML and - DocBook output much more readable and more easily editable.-- + Removed sgmlHexEntity, sgmlDecimalEntity, sgmlNamedEntity, and- sgmlCharacterEntity regexes from Text.Pandoc.Shared.- + Renamed escapeSGMLChar to escapeCharForXML. Added escapeStringForXML.- Moved both functions to Text.Pandoc.Writers.Docbook.- + Added characterReference parser to Text.Pandoc.CharacterReferences.- This parses a string and return a unicode character.- + Rewrote decodeCharacterReferences to use the new parser instead of - Text.Regex.- + Added new charRef parser for Markdown and HTML, which replaces the- old 'entity' parser. Added '&' as a special character in Markdown reader.- + Modified HTML and Markdown readers to call decodeEntities on all raw- strings (e.g. authors, dates, link titles), to ensure that no - unprocessed entities are included in the native representation of- the document. (In the HTML reader, most of this work is done by a - change in extractAttributeName.)- + In XML and Markdown output, escape unicode nonbreaking space as ' ', - since a unicode non-breaking space is impossible to distinguish visually- from a regular space. (Resolves Issue #3.)- + Removed encodeEntitiesNumerical.- + Use Data.Map for entityTable and (new) reverseEntityTable, for a- slight performance boost over the old association list.- + Removed unneeded decodeEntities from 'str' parser in HTML and- Markdown readers.-- * Text.Pandoc.UTF8: Renamed encodeUTF8 to toUTF8, decodeUTF8 to- fromUTF8, for clarity.-- * Replaced old haskell98 module names replaced by hierarchical module- names, e.g. List by Data.List. Removed haskell98 from dependencies- in pandoc.cabal, and added mtl (needed for state monad). Substituted- xhtml for html.-- * Refactored and cleaned up character escaping in writers, using- backslashEscapes and escapeStringUsing functions.-- * Instead of adding "\n\n" to the end of an input string in Main.hs,- this is now done in the readers. This makes the libraries behave- the way you'd expect from the pandoc program. Resolves Issue #10.-- * URLs and email addresses in autolinks are now typeset as Code.-- * In Main.hs, changed putStr to putStrLn -- mainly because MacOS X- doesn't display the whole output unless there's a line ending.-- * Major code cleanup in all modules, for greater consistency, concision,- and readability.-- * HTML reader:-- + Fixed several bugs (extractTagType, attribute parsing).- + Remove Null blocks in lists of blocks when possible.- + Allow HTML comments as raw HTML inline.-- * Markdown reader:-- + Ordered list items may no longer begin with uppercase letters, or- letters greater than 'n'. (This prevents first initials and page- reference, e.g. 'p. 400', from being parsed as beginning lists.)- Also, numbers beginning list items may no longer end with ')',- which is now allowed only after letters. Note: These changes- may cause documents to be parsed differently. Users should take- care in upgrading.- + Changed autoLink parsing to conform better to Markdown.pl's- behavior. <google.com> is not treated as a link, but - <http://google.com>, <ftp://google.com>, and <mailto:google@google.com>- are.- + Cleaned up handling of embedded quotes in link titles. Now these are - stored as a '"' character, not as '"'.- + Use lookAhead parser for the 'first pass' (looking for reference keys),- instead of parsing normally, then using setInput to reset input. This- yields a slight performance boost.- + Fixed several bugs in smart quote recognition.- + Fixed bug in indentSpaces (which didn't properly handle- cases with mixed spaces and tabs).- + Consolidated 'text', 'special', and 'inline' into 'inline'.- + Fixed bug which allowed URL and title to be separated by multiple blank- lines in links and reference keys. They can be on separate lines but- can't have blank lines between them.- + Correctly handle bracketed text inside inline footnotes and links,using- new function inlinesInBalanced. Resolves Issue #14. - + Fixed bug in footnotes: links in footnotes were not being- processed. Solution: three-stage parse. First, get all the- reference keys and add information to state. Next, get all the- notes and add information to state. (Reference keys may be needed- at this stage.) Finally, parse everything else.- + Replaced named constants like 'emphStart' with literals.- + Removed an extra occurance of escapedChar in definition of inline.-- * RST reader:-- + Allow the URI in a RST hyperlink target to start on the line- after the reference key.- + Added 'try' in front of 'string', where needed, or used a different- parser. This fixes a bug where ````` would not be correctly parsed as- a verbatim `.- + Fixed slow performance in parsing inline literals in RST reader. The - problem was that ``#`` was seen by 'inline' as a potential link or image.- Fix: inserted 'notFollowedBy (char '`')' in link parsers.- Resolves Issue #8.- + Use lookAhead instead of getInput/setInput in RST reader. Removed- unneeded getState call, since lookAhead automatically saves and- restores the parser state.- + Allow hyperlink target URIs to be split over multiple lines, and- to start on the line after the reference. Resolves Issue #7.- + Fixed handling of autolinks.-- * LaTeX reader:-- + Replaced 'choice [(try (string ...), ...]' idiom with 'oneOfStrings',- for clarity.- + Added clauses for tilde and caret. Tilde is \ensuremath{\sim}, and- caret is \^{}, not \^ as before.- + Added parsing for \url.- + Parse \texttt{} as code, provided there's nothing fancy inside.-- * HTML writer:-- + Modified HTML writer to use the Text.XHtml library. This results- in cleaner, faster code, and it makes it easier to use Pandoc in- other projects, like wikis, which use Text.XHtml. Two functions are- now provided, writeHtml and writeHtmlString: the former outputs an- Html structure, the latter a rendered string. The S5 writer is also- changed, in parallel ways (writeS5, writeS5String). - + The Html header is now written programmatically, so it has been- removed from the 'headers' directory. The S5 header is still- needed, but the doctype and some of the meta declarations have- been removed, since they are written programatically. This change- introduces a new dependency on the xhtml package.- + Fixed two bugs in email obfuscation involving improper escaping- of '&' in the <noscript> section and in --strict mode. Resolves- Issue #9.- + Fixed another bug in email obfuscation: If the text to be obfuscated- contains an entity, this needs to be decoded before obfuscation.- Thanks to thsutton for the patch. Resolves Issue #15.- + Changed the way the backlink is displayed in HTML footnotes.- Instead of appearing on a line by itself, it now generally- appears on the last line of the note. (Exception: when the- note does not end with a Plain or Para block.) This saves space- and looks better.- + Added automatic unique identifiers to headers:- - The identifier is derived from the header via a scheme- documented in README.- - WriterState now includes a list of header identifiers and a table- of contents in addition to notes.- - The function uniqueIdentifiers creates a list of unique identifiers- from a list of inline lists (e.g. headers).- - This list is part of WriterState and gets consumed by blockToHtml- each time a header is encountered.- + Include CSS for .strikethrough class in header only if strikethrough- text appears in the document.- + If the 'strict' option is specified, elements that do not appear in- standard markdown (like definition lists) are passed through as- raw HTML.- + Simplified treatment of autolinks, using pattern matching instead of- conditionals.-- * Markdown writer:-- + Links in markdown output are now printed as inline links by default,- rather than reference links. A --reference-links option has been added- that forces links to be printed as reference links. Resolves Issue #4.- + Use autolinks when possible. Instead of [site.com](site.com), - use <site.com>.-- * LaTeX writer:-- + Rewrote to use the State monad. The preamble now includes only those- packages that are actually required, given the document's content.- Thus, for example, if strikeout is not used, ulem is not required.- Modified LaTeXHeader accordingly.- + Modified LaTeX writer to insert '\,' between consecutive quotes.- + Removed unused function tableRowColumnWidths.- + Simplified code for escaping special characters.- + Leave extra blank line after \maketitle.- + Include empty '\author{}' when no author specified to avoid LaTeX- errors.- + Include fancyvrb code in header only if needed -- that is, only- if there is actually code in a footnote.- + Use \url{} for autolinks.- + Include [mathletters] option in ucs package, so that basic unicode- Greek letters will work correctly.-- * RST writer: Force blank line before lists, so that sublists will- be handled correctly.-- * Docbook writer: Fixed a bug: email links with text, like- [foo](me@bar.baz), were being incorrectly treated as autolinks.-- * Removed Text.ParserCombinators.Pandoc and moved all its functions to- Text.Pandoc.Shared.-- * Text.Pandoc.Shared:-- + Added defaultWriterOptions.- + Added writerTableOfContents to WriterOptions.- + Added writerIgnoreNotes option to WriterOptions. This is needed- for processing header blocks for a table of contents, since notes on- headers should not appear in the TOC.- + Added prettyprinting for native Table format.- + Removed some unneeded imports. - + Moved escape and nullBlock parsers from- Text.ParserCombinators.Pandoc, since the latter is for- general-purpose parsers that don't depend on Text.Pandoc.Definition.- + Moved isHeaderBlock from Text.Pandoc.Writers.HTML.- + Moved Element, headerAtLeast, and hierarchicalize from Docbook- writer, because HTML writer now uses these in constructing a table- of contents.- + Added clauses for new inline elements (Strikeout, Superscript,- Subscript) to refsMatch.- + Removed backslashEscape; added new functions escapeStringUsing and- backslashEscapes.- + Moved failIfStrict from markdown reader, since it is now used also- by the HTML reader.- + Added a 'try' to the definition of indentSpaces.- + In definition of 'reference', added check to make sure it's not a note- reference.- + Added functions: camelCaseToHyphenated, toRomanNumeral,- anyOrderedListMarker, orderedListmarker, orderedListMarkers,- charsInBalanced', withHorizDisplacement, romanNumeral- + Fixed a bug in the anyLine parser. Previously it would parse an empty- string "", but it should fail on an empty string, or we get an error- when it is used inside "many" combinators.- + Removed followedBy' parser, replacing it with the lookAhead parser from- Parsec. - + Added some needed 'try's before multicharacter parsers, especially in - 'option' contexts.- + Removed the 'try' from the 'end' parser in 'enclosed', so that- 'enclosed' behaves like 'option', 'manyTill', etc.- + Added lineClump parser, which parses a raw line block up to and- including any following blank lines.- + Renamed parseFromStr to parseFromString.- + Added a 'try' to the 'end' parser in 'enclosed'. This makes errors in- the use of 'enclosed' less likely. Removed some now-unnecessary 'try's- in calling code.- + Removed unneeded 'try' in blanklines.- + Removed endsWith function and rewrote calling functions to use- isSuffixOf instead.- + Added >>~ combinator.- + Fixed bug in normalizeSpaces: Space:Str "":Space should compress to- Space.-- * Refactored runtests.pl; added separate tests for tables. -- * Shell scripts:-- + Added -asxhtml flag to tidy in html2markdown. This will- perhaps help the parser, which expects closing tags.- + Modified markdown2pdf to run pdflatex a second time if --toc or- --table-of-contents was specified; otherwise the table of - contents won't appear.- + Modified markdown2pdf to print a helpful message if the 'ulem'- LaTeX package is required and not found.- - * Changes to build process:-- + Dropped support for compilation with GHC 6.4. GHC 6.6 or higher- is now required.- + Removed cabalize and Pandoc.cabal.in. The repository now contains- pandoc.cabal itself.- + Pandoc.cabal has been changed to pandoc.cabal, because HackageDB- likes the cabal file to have the same name as the tarball. - + Expanded and revised the package description in pandoc.cabal.- Revised the package synopsis.- + The tarball built by 'make tarball' now contains files built from- templates (including man pages and shell scripts), so pandoc can- be built directly using Cabal tools, without preprocessing.- + Executable binaries are now stripped before installing.- + Man pages are now generated from markdown sources, using pandoc's- man page writer.- + Use HTML version of README (instead of RTF) in Mac OS X installer.- + Instead of testing for the existence of a pandoc symlink in build-exec,- use ln -f.-- * Documentation:-- + Updated README and man pages with information on new features.- + Updated INSTALL instructions with some useful clarifications and- links. - + Updated web content.-- * Added FreeBSD port.-- [ Recai Oktaş ]-- * debian/control:-- + Changed pandoc's Build-Depends to include libghc6-mtl-dev and- libghc6-xhtml-dev. Removed libghc6-html-dev.- + Suggest texlive-latex-recommended | tetex-extra instead of- tetex-bin. This brings in fancyvrb and unicode support.-- -- Recai Oktaş <roktas@debian.org> Tue, 16 Jan 2007 00:37:21 +0200--pandoc (0.3) unstable; urgency=low-- [ John MacFarlane ]-- * Changes in pandoc options:-- + Allow options to follow or precede arguments.- + Changed '--smartypants' to '--smart' and adjusted symbols accordingly.- + Added '--strict' option.- + Added '-o/--output' option.- + Added '--dump-args' and '--ignore-args' options (for use in wrappers).- + Modified '-v' and '-h' output to go to STDERR, not STDOUT, and return- error conditions. This is helpful for writing wrappers.- + Added copyright message to '-v' output, modeled after FSF messages.- + Reformatted usage message so that it doesn't wrap illegibly.- + Removed extra blanks after '-h' and '-D' output.-- * Added docbook writer.-- * Added implicit setting of default input and output format based- on input and output filename extensions. These defaults are- overridden if explicit input and output formats are specified using- '-t', '-f', '-r', or '-w' options. Documented in pandoc(1) man page- and README.-- * Allow ordered list items to begin with (single) letters, as well- as numbers. The list item marker may now be terminated either by- '.' or by ')'. This extension to standard markdown is documented- in README.-- * Revised footnote syntax. (See README for full details.) The- '[^1]' format now standard in markdown extensions is supported,- as are inline footnotes with this syntax: '^[My note.]'.- The earlier footnote syntax '^(1)' is no longer supported.-- * Improved HTML representation of footnotes. All footnotes- are now auto-numbered and appear in an ordered list at the- end of the HTML document. Since the default appearance is now- acceptable, the old footnote styles have been removed from the- HTML header.-- * Bug fixes:-- + Fixed a serious bug in the markdown, LaTeX, and RST readers.- These readers ran 'runParser' on processed chunks of text to handle- embedded block lists in lists and quotation blocks. But then- any changes made to the parser state in these chunks was lost,- as the state is local to the parser. So, for example, footnotes- didn't work in quotes or list items. The fix: instead of calling- runParser on some raw text, use setInput to make it the input, then- parse it, then use setInput to restore the input to what it was- before. This is shorter and more elegant, and it fixes the problem.- + Fixed bug in notFollowedBy' combinator (adding 'try' before- 'parser'). Adjusted code that uses this combinator accordingly.- + Fixed bug in RTF writer that caused improper indentation on- footnotes occurring in indented blocks like lists.- + Fixed parsing of metadata in LaTeX reader. Now the title, author,- and date are parsed correctly. Everything else in the preamble- is skipped.- + Modified escapedChar in LaTeX reader to allow a '\' at the end of a- line to count as escaped whitespace.- + Modified LaTeX reader to produce inline links rather than reference- links. Otherwise, links in footnotes aren't handled properly.- + Fixed handling of titles in links in Markdown reader, so that- embedded quotation marks are now handled properly.- + Fixed Markdown reader's handling of embedded brackets in links.- + Fixed Markdown reader so that it only parses bracketed material- as a reference link if there is actually a corresponding key.- + Revised inline code parsing in Markdown reader to conform to- markdown standard. Now any number of `s can begin inline code,- which will end with the same number of `s. For example, to- have two backticks as code, write ``` `` ```. Modified Markdown- writer accordingly.- + Fixed bug in text-wrapping routine in Markdown and RST writers.- Now LineBreaks no longer cause wrapping problems.- + Supported hexadecimal numerical entity references as well as- decimal ones.- + Fixed bug in Markdown reader's handling of underscores and other- inline formatting markers inside reference labels: for example,- in '[A_B]: /url/a_b', the material between underscores was being- parsed as emphasized inlines.- + Changed Markdown reader's handling of backslash escapes so that- only non-alphanumeric characters can be escaped. Strict mode- follows Markdown.pl in only allowing a select group of punctuation- characters to be escaped.- + Modified HTML reader to skip a newline following a <br> tag.- Otherwise the newline will be treated as a space at the beginning- of the next line.-- * Made handling of code blocks more consistent. Previously, some- readers allowed trailing newlines, while others stripped them.- Now, all readers strip trailing newlines in code blocks. Writers- insert a newline at the end of code blocks as needed.-- * Modified readers to make spacing at the end of output more consistent.-- * Minor improvements to LaTeX reader:-- + '\thanks' now treated like a footnote. - + Simplified parsing of LaTeX command arguments and options.- commandArgs now returns a list of arguments OR options (in- whatever order they appear). The brackets are included, and- a new stripFirstAndLast function is provided to strip them off- when needed. This fixes a problem in dealing with \newcommand- and \newenvironment.-- * Revised RTF writer:-- + Default font is now Helvetica.- + An '\f0' is added to each '\pard', so that font resizing works- correctly.-- * Moved handling of "smart typography" from the writers to the Markdown- and LaTeX readers. This allows great simplification of the writers- and more accurate smart quotes, dashes, and ellipses. DocBook can- now use '<quote>'. The '--smart' option now toggles an option in- the parser state rather than a writer option. Several new kinds- of inline elements have been added: Quoted, Ellipses, Apostrophe,- EmDash, EnDash.-- * Changes in HTML writer:-- + Include title block in header even when title is null.- + Made javascript obfuscation of emails even more obfuscatory,- by combining it with entity obfuscation.-- * Changed default ASCIIMathML text color to black.-- * Test suite:-- + Added --strip-trailing-cr option to diff in runtests.pl, for- compatibility with Windows.- + Added regression tests with footnotes in quote blocks and lists.-- * Makefile changes:-- + osx-pkg target creates a Mac OS X package (directory). New osx- directory contains files needed for construction of the package.- + osx-dmg target creates a compressed disk image containing the package.- + win-pkg target creates Windows binary package.- + tarball target creates distribution source tarball.- + website target generates pandoc's website automatically, including- demos. New 'web' directory containts files needed for construction- of the website (which will be created as the 'pandoc' subdirectory- of 'web').- + Makefile checks to see if we're running Windows/Cygwin; if so,- a '.exe' extension is added to each executable in EXECS.-- * Removed all wrappers except markdown2pdf and html2markdown.-- * Added new wrapper hsmarkdown, to be used as a drop-in replacement- for Markdown.pl. hsmarkdown calls pandoc with the '--strict'- option and disables other options.-- * Added code to html2markdown that tries to determine the character - encoding of an HTML file, by parsing the "Content-type" meta tag.-- + If the encoding can't be determined, then if the content is local,- the local encoding is used; if it comes from a URL, UTF-8 is used - by default.- + If input is from STDIN, don't try to determine character encoding.- + Encoding can be specified explicitly using '-e' option.-- * Improved warning messages in wrappers:-- + Print warning if iconv not available- + More user-friendly error messages in markdown2pdf, when- pdflatex fails.-- * Code cleanup:-- + Renamed 'Text/Pandoc/HtmlEntities' module to - 'Text/Pandoc/Entities'. Also changed function names so as- not to be HTML-specific.- + Refactored SGML string escaping functions from HTML and Docbook- writers into Text/Pandoc/Shared. (escapeSGML, stringToSGML)- + Removed 'BlockQuoteContext' from ParserContext, as it isn't- used anywhere.- + Removed splitBySpace and replaced it with a general, polymorphic- splitBy function.- + Refactored LaTeX reader for clarity (added isArg function).- + Converted some CR's to LF's in src/ui/default/print.css.- + Added license text to top of source files.- + Added module data for haddock to source files.- + Reformatted code for consistency.-- * Rewrote documentation and man pages. Split README into INSTALL- and README.-- * Split LICENSE into COPYING and COPYRIGHT.-- * Removed TODO, since we now maintain ToDo on the wiki.-- * Made COPYRIGHT in top level a symlink to debian/copyright, to avoid- duplication.-- [ Recai Oktaş ]-- * Revamped build process to conform to debian standards and created- a proper debian package. Closes: #391666.-- * Modified build process to support GHC 6.6.-- + The package can still be compiled using GHC 6.4.2, though because- of dependencies the "make deb" target works only with GHC 6.6+.- + The script 'cabalize' is used to create an appropriate- 'Pandoc.cabal' from 'Pandoc.cabal.in', depending on the GHC and- Cabal versions.-- * Refactored template processing (fillTemplates.pl).-- * Modified wrapper scripts to make them more robust and portable.- To avoid code duplication and ensure consistency, wrappers are - generated via a templating system from templates in src/wrappers.-- + Wrappers now accept multiple filenames, when appropriate.- + Spaces and tabs allowed in filenames.- + getopts shell builtin is used for portable option parsing.- + Improved html2markdown's web grabber code, making it more robust,- configurable and verbose. Added '-e', '-g' options.-- -- Recai Oktaş <roktas@debian.org> Fri, 05 Jan 2007 09:41:19 +0200--pandoc (0.2) unstable; urgency=low-- * Fixed unicode/utf-8 translation-- -- John MacFarlane <jgm@berkeley.edu> Mon, 14 Aug 2006 00:00:00 -0400--pandoc (0.1) unstable; urgency=low-- * Initial creation of debian package -- -- John MacFarlane <jgm@berkeley.edu> Mon, 14 Aug 2006 00:00:00 -0400
− debian/compat
@@ -1,1 +0,0 @@-4
− debian/control
@@ -1,88 +0,0 @@-Source: pandoc-Section: text-Priority: optional-Maintainer: Recai Oktaş <roktas@debian.org>-Build-Depends: debhelper (>= 4.0.0), haskell-devscripts (>=0.5.12), ghc6 (>= 6.6-1), libghc6-xhtml-dev, libghc6-mtl-dev, libghc6-network-dev, perl-Build-Depends-Indep: haddock-Build-Conflicts: ghc6 (>= 6.8), ghc6 (<= 6.4)-Standards-Version: 3.7.3-Homepage: http://johnmacfarlane.net/pandoc/-XS-Vcs-Svn: http://pandoc.googlecode.com/svn/trunk-XS-Vcs-Browser: http://pandoc.googlecode.com/svn/trunk--Package: pandoc-Section: text-Architecture: any-Depends: ${shlibs:Depends}-Suggests: texlive-latex-recommended | tetex-extra, tidy, wget | w3m-Description: general markup converter- Pandoc is a Haskell library for converting from one markup format to- another, and a command-line tool that uses this library. It can read- markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it- can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook,- RTF, groff man pages, and S5 HTML slide shows.- .- Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,- tables, definition lists, and other features. A compatibility mode is- provided for those who need a drop-in replacement for Markdown.pl.- Included wrapper scripts make it easy to convert markdown documents to- PDFs and to convert web pages to markdown documents.- .- In contrast to existing tools for converting markdown to HTML, which- use regex substitutions, pandoc has a modular design: it consists of a- set of readers, which parse text in a given format and produce a native- representation of the document, and a set of writers, which convert- this native representation into a target format. Thus, adding an input- or output format requires only adding a reader or writer.--Package: libghc6-pandoc-dev-Section: libdevel-Architecture: any-Depends: ${haskell:Depends}, libghc6-xhtml-dev, libghc6-mtl-dev, libghc6-network-dev-Suggests: pandoc-doc-Description: general markup converter- Pandoc is a Haskell library for converting from one markup format to- another, and a command-line tool that uses this library. It can read- markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it- can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook,- RTF, groff man pages, and S5 HTML slide shows.- .- Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,- tables, definition lists, and other features. A compatibility mode is- provided for those who need a drop-in replacement for Markdown.pl.- Included wrapper scripts make it easy to convert markdown documents to- PDFs and to convert web pages to markdown documents.- .- In contrast to existing tools for converting markdown to HTML, which- use regex substitutions, pandoc has a modular design: it consists of a- set of readers, which parse text in a given format and produce a native- representation of the document, and a set of writers, which convert- this native representation into a target format. Thus, adding an input- or output format requires only adding a reader or writer.- .- This package contains the libraries compiled for GHC 6.--Package: pandoc-doc-Section: doc-Architecture: all-Description: general markup converter- Pandoc is a Haskell library for converting from one markup format to- another, and a command-line tool that uses this library. It can read- markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it- can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, DocBook,- RTF, groff man pages, and S5 HTML slide shows.- .- Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,- tables, definition lists, and other features. A compatibility mode is- provided for those who need a drop-in replacement for Markdown.pl.- Included wrapper scripts make it easy to convert markdown documents to- PDFs and to convert web pages to markdown documents.- .- In contrast to existing tools for converting markdown to HTML, which- use regex substitutions, pandoc has a modular design: it consists of a- set of readers, which parse text in a given format and produce a native- representation of the document, and a set of writers, which convert- this native representation into a target format. Thus, adding an input- or output format requires only adding a reader or writer.- .- This package contains the library documentation for Pandoc.
− debian/copyright
@@ -1,82 +0,0 @@-Pandoc-Copyright (C) 2006-7 John MacFarlane <jgm at berkeley dot edu>--This code is released under the [GPL], version 2 or later:-- 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA--The GNU General Public License is available in the file COPYING in-the source distribution. On Debian systems, the complete text of the-GPL can be found in `/usr/share/common-licenses/GPL`.--[GPL]: http://www.gnu.org/copyleft/gpl.html--Pandoc's complete source code is available from the [Pandoc home page].--[Pandoc home page]: http://johnmacfarlane.net/pandoc/--Pandoc includes some code from other authors. The copyright and license-statements for these sources are included below. All are GPL-compatible-licenses.-------------------------------------------------------------------------UTF8.hs -Copyright (c) 2003, OGI School of Science & Engineering, Oregon Health &-Science University, All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions-are met:--- Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.--- Redistributions in binary form must reproduce the above- copyright notice, this list of conditions and the following- disclaimer in the documentation and/or other materials provided- with the distribution.--- Neither the name of OGI or OHSU nor the names of its- contributors may be used to endorse or promote products derived- from this software without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--This version of UTF8.hs was Modified by Martin Norbäck, to pass illegal-utf-8 sequences through unchanged.-------------------------------------------------------------------------ASCIIMathML.js-Copyright 2005, Peter Jipsen, Chapman University-<http://www1.chapman.edu/~jipsen/mathml/asciimath.html>--Released under the GPL.-------------------------------------------------------------------------S5 slides.js and css files -by Eric A. Meyer-<http://meyerweb.com/eric/tools/s5--Released under an explicit Public Domain License
− debian/pandoc-doc.doc-base
@@ -1,11 +0,0 @@-Document: pandoc-doc-Title: Pandoc documentation-Author: John MacFarlane-Abstract: This is the documentation of Pandoc, which includes the API- documentation of the Pandoc library and documentation for the Pandoc- tools. -Section: Apps/Programming--Format: html-Index: /usr/share/doc/pandoc-doc/html/index.html-Files: /usr/share/doc/pandoc-doc/html/*.html
− debian/pandoc-doc.docs
@@ -1,1 +0,0 @@-html
− debian/pandoc.dirs
@@ -1,1 +0,0 @@-usr/bin
− debian/rules
@@ -1,126 +0,0 @@-#!/usr/bin/make -f-#-# debian/rules for pandoc.-# Copyright © 2006 Recai Oktaş <roktasATdebian.org>-#-# This file is based on John Goerzen's Cabal Debian template.-# See http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/-#-# Licensed under the GNU General Public License, version 2.-# See the file 'http://www.gnu.org/copyleft/gpl.txt'.--THIS := $(shell sed -ne 's/^Source: \(.*\)/\1/p' debian/control)-PREFIX := /usr-DESTDIR := debian/$(THIS)-DATADIR := $(THIS)-DOCDIR := doc/$(THIS)--# Uncomment this to turn on verbose mode.-#export DH_VERBOSE=1--ifeq (1,$(DH_VERBOSE))-HCFLAGS+=-v-endif--# Handle noopt in DEB_BUILD_OPTIONS. Emulate CFLAGS (as HCFLAGS).-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))-HCFLAGS+=-O0-else-# No optimisation seems optimum.-HCFLAGS+=-O0-endif--# Export all variables which will be used in various stages of build process.-export PREFIX DESTDIR DATADIR DOCDIR HCFLAGS--configure: configure-stamp-configure-stamp:- dh_testdir- $(MAKE) configure-- touch configure-stamp--build: build-stamp-build-stamp: configure-stamp - dh_testdir-- touch build-stamp--clean:- dh_testdir- dh_testroot- $(MAKE) clean- rm -rf setup Setup.hi Setup.ho Setup.o .*config* dist html- rm -f build-stamp configure-stamp-- dh_clean --install: build- dh_testdir- dh_testroot- dh_clean -k - dh_installdirs -a -- dh_haskell -a-- # Remove empty directories, which lintian complains about.- find debian/libghc6-$(THIS)-dev -type d -name 'include' -empty -delete- # Hack! Cabal builds executables while building libraries. Move these- # files to top dir where the Makefile install target expects to find.- # See "BUGS" section at the following document:- # http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/INSTRUCTIONS.txt- find debian/libghc6-$(THIS)-dev -type d -name 'bin' -true | \- while read bin; do mv $$bin/* .; rm -rf $$bin; done- $(MAKE) install-program--build-indep: build-indep-stamp-build-indep-stamp:- dh_testdir- $(MAKE) build-lib-doc--install-indep: build-indep- dh_testdir- dh_testroot- dh_clean -k- dh_installdirs -i-- dh_haskell -i--# Build architecture-independent files here.-binary-indep: build-indep install-indep- dh_testdir- dh_testroot- dh_installchangelogs -i- dh_installdocs -i- dh_installexamples -i- dh_installman -i- dh_link -i- dh_strip -i- dh_compress -i- dh_fixperms -i- dh_installdeb -i- dh_shlibdeps -i- dh_gencontrol -i- dh_md5sums -i- dh_builddeb -i--# Build architecture-dependent files here.-binary-arch: build install- dh_testdir- dh_testroot- dh_installchangelogs -a- dh_installdocs -a- dh_installexamples -a- dh_installman -a- dh_link -a- dh_strip -a -Xhtml2 -Xmarkdown2 -Xlatex2 -Xrst2- dh_compress -a- dh_fixperms -a- dh_installdeb -a- dh_shlibdeps -a- dh_gencontrol -a- dh_md5sums -a- dh_builddeb -a--binary: binary-indep binary-arch-.PHONY: build clean binary-indep binary-arch binary install build-indep install-indep
− freebsd/Makefile.in
@@ -1,44 +0,0 @@-# New ports collection makefile for: pandoc-# Date created: 9 February 2007-# Whom: John MacFarlane <jgm@berkeley.edu>-#-# $FreeBSD: ports/textproc/pandoc/Makefile,v 1.2 2007/05/19 20:24:07 flz Exp $-#--PORTNAME= pandoc-PORTVERSION= @VERSION@-CATEGORIES= textproc haskell-MASTER_SITES= http://pandoc.googlecode.com/files/-DISTNAME= pandoc-${PORTVERSION}--MAINTAINER= jgm@berkeley.edu-COMMENT= A general markup converter--BUILD_DEPENDS= ghc>=6.6:${PORTSDIR}/lang/ghc--MANCOMPRESSED= no-MAN1= pandoc.1 markdown2pdf.1 html2markdown.1 hsmarkdown.1--USE_GMAKE= yes-USE_PERL5= yes--PLIST_FILES= bin/pandoc bin/markdown2pdf bin/html2markdown bin/hsmarkdown-PORTDOCS= BUGS README README.html-SCRIPTS= hsmarkdown html2markdown markdown2pdf--do-install:- @${INSTALL_PROGRAM} ${WRKSRC}/dist/build/pandoc/pandoc ${PREFIX}/bin-.for script in ${SCRIPTS}- @${INSTALL_SCRIPT} ${WRKSRC}/${script} ${PREFIX}/bin-.endfor-.for man in ${MAN1}- @${INSTALL_MAN} ${WRKSRC}/man/man1/${man} ${PREFIX}/man/man1-.endfor-.if !defined(NOPORTDOCS)- @${MKDIR} ${DOCSDIR}-.for doc in ${PORTDOCS}- @${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR}-.endfor-.endif--.include <bsd.port.mk>
− freebsd/pkg-descr
@@ -1,19 +0,0 @@-Pandoc is a command-line tool for converting from one markup format-to another. It can read markdown and (subsets of) reStructuredText,-HTML, and LaTeX, and it can write markdown, reStructuredText, HTML,-LaTeX, ConTeXt, DocBook, RTF, groff man pages, and S5 HTML slide shows.--Pandoc extends standard markdown syntax with footnotes, embedded LaTeX,-and other features. A compatibility mode is provided for those who-need a drop-in replacement for Markdown.pl. Included wrapper scripts-make it easy to convert markdown documents to PDFs and to convert web-pages to markdown documents.--In contrast to existing tools for converting markdown to HTML, which-use regex substitutions, pandoc has a modular design: it consists of a-set of readers, which parse text in a given format and produce a native-representation of the document, and a set of writers, which convert-this native representation into a target format. Thus, adding an input-or output format requires only adding a reader or writer.--WWW: http://johnmacfarlane.net/pandoc/
− macports/Portfile.in
@@ -1,59 +0,0 @@-# $Id$--PortSystem 1.0--name pandoc-version @VERSION@-categories textproc-maintainers jgm@berkeley.edu-description General markup converter-long_description \- Pandoc is a command-line tool for converting from one markup format \- to another. It can read markdown and (subsets of) reStructuredText, \- HTML, and LaTeX, and it can write markdown, reStructuredText, HTML, \- LaTeX, ConTeXt, DocBook, RTF, groff man pages, and S5 HTML slide shows.--homepage http://johnmacfarlane.net/pandoc/-platforms darwin-master_sites http://pandoc.googlecode.com/files/-checksums md5 @TARBALLMD5SUM@-depends_build port:ghc port:haddock-depends_lib port:gmp--use_configure no-build.args PREFIX=${prefix}-build.target build-all--destroot { - # install pandoc executable, libraries, and library documentation:- system "(cd ${worksrcpath}; ./setup copy --destdir=${destroot})"- # strip the pandoc binary:- system "strip ${destroot}${prefix}/bin/pandoc"- # create scripts to register libraries in post-activate phase:- system "(cd ${worksrcpath}; ./setup register --gen-script)"- system "(cd ${worksrcpath}; ./setup unregister --gen-script)"- # install register/unregister scripts:- xinstall -d ${destroot}${prefix}/libexec/${name}-${version}- xinstall -m 755 ${worksrcpath}/register.sh \- ${destroot}${prefix}/libexec/${name}-${version}- xinstall -m 755 ${worksrcpath}/unregister.sh \- ${destroot}${prefix}/libexec/${name}-${version}- # install shell scripts:- xinstall -m 755 -W ${worksrcpath} html2markdown hsmarkdown markdown2pdf \- ${destroot}${prefix}/bin- # install user documentation and man pages:- xinstall -d ${destroot}${prefix}/share/doc/${name}- xinstall -m 644 -W ${worksrcpath} README README.html COPYRIGHT BUGS \- ${destroot}${prefix}/share/doc/${name}- xinstall -m 644 -W ${worksrcpath}/man/man1 pandoc.1 hsmarkdown.1 \- markdown2pdf.1 html2markdown.1 ${destroot}${prefix}/share/man/man1-}- -post-activate { - # Register the library with the ghc package database:- system "${prefix}/libexec/${name}-${version}/register.sh" -}--#pre-deactivate {-# system "${prefix}/libexec/${name}-${version}/unregister.sh" -#}
man/man1/hsmarkdown.1.md view
@@ -15,9 +15,9 @@ `hsmarkdown` converts markdown-formatted text to HTML. It is designed to be usable as a drop-in replacement for John Gruber's `Markdown.pl`. -If no *input-file* is specified, input is read from STDIN.+If no *input-file* is specified, input is read from *stdin*. Otherwise, the *input-files* are concatenated (with a blank-line between each) and used as input. Output goes to STDOUT by+line between each) and used as input. Output goes to *stdout* by default. For output to a file, use shell redirection: hsmarkdown input.txt > output.html
man/man1/html2markdown.1.md view
@@ -14,15 +14,15 @@ # DESCRIPTION `html2markdown` converts *input-file* or *URL* (or text-from STDIN) from HTML to markdown-formatted plain text. +from *stdin*) from HTML to markdown-formatted plain text. If a URL is specified, `html2markdown` uses an available program (e.g. wget, w3m, lynx or curl) to fetch its contents. Output is sent-to STDOUT unless an output file is specified using the `-o`+to *stdout* unless an output file is specified using the `-o` option. `html2markdown` uses the character encoding specified in the "Content-type" meta tag. If this is not present, or if input comes-from STDIN, UTF-8 is assumed. A character encoding may be specified+from *stdin*, UTF-8 is assumed. A character encoding may be specified explicitly using the `-e` special option. # OPTIONS@@ -36,7 +36,7 @@ top of markdown output. -o *FILE*, \--output=*FILE*-: Write output to *FILE* instead of STDOUT. +: Write output to *FILE* instead of *stdout*. \--strict : Use strict markdown syntax, with no extensions or variants.@@ -51,10 +51,6 @@ \--no-wrap : Disable text wrapping in output. (Default is to wrap text.) -\--sanitize-html-: Sanitizes HTML using a whitelist. Unsafe tags are replaced by HTML- comments; unsafe attributes are omitted.- -H *FILE*, \--include-in-header=*FILE* : Include contents of *FILE* at the end of the header. Implies `-s`.@@ -84,9 +80,9 @@ (Note: *encoding* will be passed to `iconv`; a list of available encodings may be obtained using `iconv -l`.) If this option is not specified and input is not from- STDIN, `html2markdown` will try to extract the character encoding+ *stdin*, `html2markdown` will try to extract the character encoding from the "Content-type" meta tag. If no character encoding is- specified in this way, or if input is from STDIN, UTF-8 will be+ specified in this way, or if input is from *stdin*, UTF-8 will be assumed. -g *command*, \--grabber=*command*
man/man1/markdown2pdf.1.md view
@@ -23,10 +23,10 @@ and the name of the output file will be derived from the first input file. Input is assumed to be in the UTF-8 character encoding. If your-local character encoding is not UTF-8, you should pipe input and-output through `iconv`:+local character encoding is not UTF-8, you should pipe input+through `iconv`: - iconv -t utf-8 input.txt | pandoc | iconv -f utf-8+ iconv -t utf-8 input.txt | markdown2pdf `markdown2pdf` assumes that the `unicode`, `array`, `fancyvrb`, `graphicx`, and `ulem` packages are in latex's search path. If these
man/man1/pandoc.1.md view
@@ -14,13 +14,15 @@ Pandoc converts files from one markup format to another. It can read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and-it can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, groff man,-RTF, DocBook XML, and S5 HTML slide shows.+it can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, Texinfo,+groff man, MediaWiki markup, RTF, OpenDocument XML, ODT, DocBook XML,+and S5 HTML slide shows. -If no *input-file* is specified, input is read from STDIN.+If no *input-file* is specified, input is read from *stdin*. Otherwise, the *input-files* are concatenated (with a blank-line between each) and used as input. Output goes to STDOUT by-default. For output to a file, use the `-o` option:+line between each) and used as input. Output goes to *stdout* by+default (though output to *stdout* is disabled for the `odt` output+format). For output to a file, use the `-o` option: pandoc -o output.html input.txt @@ -28,7 +30,7 @@ (see **OPTIONS**, below, for details). If these formats are not specified explicitly, Pandoc will attempt to determine them from the extensions of the input and output filenames. If input comes-from STDIN or from a file with an unknown extension, the input is assumed+from *stdin* or from a file with an unknown extension, the input is assumed to be markdown. If no output filename is specified using the `-o` option, or if a filename is specified but its extension is unknown, the output will default to HTML. Thus, for example,@@ -65,19 +67,23 @@ -t *FORMAT*, -w *FORMAT*, \--to=*FORMAT*, \--write=*FORMAT* : Specify output format. *FORMAT* can be `native` (native Haskell),- `man` (groff man page), `markdown` (markdown or plain text), `rst` (reStructuredText), `html` (HTML), `latex` (LaTeX), `context` (ConTeXt), `man` (groff man), - `docbook` (DocBook XML), `s5` (S5 HTML and javascript slide show),- or `rtf` (rich text format).+ `mediawiki` (MediaWiki markup), `texinfo` (GNU Texinfo),+ `docbook` (DocBook XML), `opendocument` (OpenDocument XML),+ `odt` (OpenOffice text document), `s5` (S5 HTML and javascript slide+ show), `pdf` (Portable Document Format), or `rtf` (rich text+ format). Note that for `odt` and `pdf` output, output will not be+ directed to *stdout*; an output filename must be specified using the+ `-o/--output` option. -s, \--standalone : Produce output with an appropriate header and footer (e.g. a standalone HTML, LaTeX, or RTF file, not a fragment). -o *FILE*, \--output=*FILE*-: Write output to *FILE* instead of STDOUT. If *FILE* is- \``-`', output will go to STDOUT.+: Write output to *FILE* instead of *stdout*. If *FILE* is+ \``-`', output will go to *stdout*. -p, \--preserve-tabs : Preserve tabs instead of converting them to spaces.@@ -101,9 +107,9 @@ only when the input format is `markdown`. It is selected automatically when the output format is `latex` or `context`.) --m*URL*, \--asciimathml=*URL*-: Use ASCIIMathML to display embedded TeX math in HTML output.- To insert a link to a local copy of the `ASCIIMathML.js` script,+-m*URL*, \--latexmathml=*URL*+: Use LaTeXMathML to display embedded TeX math in HTML output.+ To insert a link to a local copy of the `LaTeXMathML.js` script, provide a *URL*. If no *URL* is provided, the contents of the script will be inserted directly into the HTML header. @@ -129,7 +135,8 @@ \--sanitize-html : Sanitizes HTML (in markdown or HTML input) using a whitelist. Unsafe tags are replaced by HTML comments; unsafe attributes- are omitted.+ are omitted. URIs in links and images are also checked against a+ whitelist of URI schemes. \--toc, \--table-of-contents : Include an automatically generated table of contents (HTML, markdown,@@ -155,15 +162,16 @@ -D *FORMAT*, \--print-default-header=*FORMAT* : Print the default header for *FORMAT* (`html`, `s5`, `latex`,- `context`, `docbook`, `man`, `markdown`, `rst`, `rtf`).+ `context`, `docbook`, `man`, `markdown`, `opendocument`,+ `rst`, `rtf`). -T *STRING*, \--title-prefix=*STRING* : Specify *STRING* as a prefix to the HTML window title. \--dump-args-: Print information about command-line arguments to STDOUT, then exit.+: Print information about command-line arguments to *stdout*, then exit. The first line of output contains the name of the output file specified- with the `-o` option, or \``-`' (for STDOUT) if no output file was+ with the `-o` option, or \``-`' (for *stdout*) if no output file was specified. The remaining lines contain the command-line arguments, one per line, in the order they appear. These do not include regular Pandoc options and their arguments, but do include any options appearing@@ -188,8 +196,9 @@ # SEE ALSO +`hsmarkdown`(1), `html2markdown`(1),-`markdown2pdf`(1).+`markdown2pdf` (1). The *README* file distributed with Pandoc contains full documentation. The Pandoc source code and all documentation may be downloaded from
+ odt-styles/META-INF/manifest.xml view
@@ -0,0 +1,22 @@+<?xml version="1.0" encoding="UTF-8"?>+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">+ <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text" manifest:full-path="/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/statusbar/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/accelerator/current.xml"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/accelerator/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/floater/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/popupmenu/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/progressbar/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/menubar/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/toolbar/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/images/Bitmaps/"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Configurations2/images/"/>+ <manifest:file-entry manifest:media-type="application/vnd.sun.xml.ui.configuration" manifest:full-path="Configurations2/"/>+ <manifest:file-entry manifest:media-type="application/binary" manifest:full-path="layout-cache"/>+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/thumbnail.png"/>+ <manifest:file-entry manifest:media-type="" manifest:full-path="Thumbnails/"/>+ <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml"/>+</manifest:manifest>
+ odt-styles/Thumbnails/thumbnail.png view
binary file changed (absent → 1943 bytes)
+ odt-styles/meta.xml view
@@ -0,0 +1,1 @@+<?xml version="1.0" encoding="UTF-8"?><office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.1"><office:meta><meta:generator></meta:generator><dc:title></dc:title><dc:subject></dc:subject><meta:creation-date></meta:creation-date><dc:date></dc:date><meta:editing-cycles></meta:editing-cycles><meta:editing-duration></meta:editing-duration><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="0" meta:paragraph-count="0" meta:word-count="0" meta:character-count="0"/></office:meta></office:document-meta>
+ odt-styles/mimetype view
@@ -0,0 +1,1 @@+application/vnd.oasis.opendocument.text
+ odt-styles/settings.xml view
@@ -0,0 +1,2 @@+<?xml version="1.0" encoding="UTF-8"?>+<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.1"><office:settings><config:config-item-set config:name="ooo:view-settings"><config:config-item config:name="ViewAreaTop" config:type="int">40640</config:config-item><config:config-item config:name="ViewAreaLeft" config:type="int">-1058</config:config-item><config:config-item config:name="ViewAreaWidth" config:type="int">25693</config:config-item><config:config-item config:name="ViewAreaHeight" config:type="int">15242</config:config-item><config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item><config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item><config:config-item-map-indexed config:name="Views"><config:config-item-map-entry><config:config-item config:name="ViewId" config:type="string">view2</config:config-item><config:config-item config:name="ViewLeft" config:type="int">8936</config:config-item><config:config-item config:name="ViewTop" config:type="int">54975</config:config-item><config:config-item config:name="VisibleLeft" config:type="int">-1058</config:config-item><config:config-item config:name="VisibleTop" config:type="int">40640</config:config-item><config:config-item config:name="VisibleRight" config:type="int">24633</config:config-item><config:config-item config:name="VisibleBottom" config:type="int">55880</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item><config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item></config:config-item-map-entry></config:config-item-map-indexed></config:config-item-set><config:config-item-set config:name="ooo:configuration-settings"><config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item><config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item><config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item><config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item><config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item><config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item><config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item><config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item><config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item><config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item><config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/><config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item><config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item><config:config-item config:name="PrinterSetup" config:type="base64Binary"/><config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item><config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item><config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item><config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item><config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item><config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item><config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item><config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item><config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item><config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item><config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/><config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item><config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item><config:config-item config:name="PrinterName" config:type="string"/><config:config-item config:name="PrintFaxName" config:type="string"/><config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item><config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item><config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item><config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item><config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item><config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item><config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item><config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item><config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item><config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item><config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item><config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item><config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item><config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item><config:config-item config:name="CurrentDatabaseCommand" config:type="string"/><config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item><config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item><config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item></config:config-item-set></office:settings></office:document-settings>
+ odt-styles/styles.xml view
@@ -0,0 +1,2 @@+<?xml version="1.0" encoding="UTF-8"?>+<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" office:version="1.1"><office:font-face-decls><style:font-face style:name="StarSymbol" svg:font-family="StarSymbol"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Lucida Sans Unicode" svg:font-family="'Lucida Sans Unicode'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:styles><style:default-style style:family="graphic"><style:graphic-properties draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/><style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"><style:tab-stops/></style:paragraph-properties><style:text-properties style:use-window-font-color="true" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/></style:default-style><style:default-style style:family="paragraph"><style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/><style:text-properties style:use-window-font-color="true" style:font-name="Times New Roman" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="12pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Tahoma" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/></style:default-style><style:default-style style:family="table"><style:table-properties table:border-model="collapsing"/></style:default-style><style:default-style style:family="table-row"><style:table-row-properties fo:keep-together="auto"/></style:default-style><style:style style:name="Standard" style:family="paragraph" style:class="text"/><style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text"><style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" fo:keep-with-next="always"/><style:text-properties style:font-name="Arial" fo:font-size="14pt" style:font-name-asian="Lucida Sans Unicode" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/></style:style><style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"><style:paragraph-properties fo:margin-top="0.0598in" fo:margin-bottom="0.0598in"/></style:style><style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list"><style:text-properties style:font-name-complex="Tahoma1"/></style:style><style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"><style:paragraph-properties fo:margin-top="0.0835in" fo:margin-bottom="0.0835in" text:number-lines="false" text:line-number="0"/><style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Tahoma1" style:font-size-complex="12pt" style:font-style-complex="italic"/></style:style><style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index"><style:paragraph-properties text:number-lines="false" text:line-number="0"/><style:text-properties style:font-name-complex="Tahoma1"/></style:style><style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="1"><style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/></style:style><style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="2"><style:text-properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-style-complex="italic" style:font-weight-complex="bold"/></style:style><style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="3"><style:text-properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold"/></style:style><style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="4"><style:text-properties fo:font-size="85%" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="85%" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="85%" style:font-style-complex="italic" style:font-weight-complex="bold"/></style:style><style:style style:name="Heading_20_5" style:display-name="Heading 5" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="5"><style:text-properties fo:font-size="85%" fo:font-weight="bold" style:font-size-asian="85%" style:font-weight-asian="bold" style:font-size-complex="85%" style:font-weight-complex="bold"/></style:style><style:style style:name="Heading_20_6" style:display-name="Heading 6" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text" style:default-outline-level="6"><style:text-properties fo:font-size="75%" fo:font-weight="bold" style:font-size-asian="75%" style:font-weight-asian="bold" style:font-size-complex="75%" style:font-weight-complex="bold"/></style:style><style:style style:name="Quotations" style:family="paragraph" style:parent-style-name="Standard" style:class="html"><style:paragraph-properties fo:margin-left="0.3937in" fo:margin-right="0.3937in" fo:margin-top="0.1in" fo:margin-bottom="0.1in" fo:text-indent="0in" style:auto-text-indent="false"/></style:style><style:style style:name="Preformatted_20_Text" style:display-name="Preformatted Text" style:family="paragraph" style:parent-style-name="Standard" style:class="html"><style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0in"/><style:text-properties style:font-name="Courier New" fo:font-size="10pt" style:font-name-asian="Courier New" style:font-size-asian="10pt" style:font-name-complex="Courier New" style:font-size-complex="10pt"/></style:style><style:style style:name="Definition_20_Term" style:display-name="Definition Term" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Definition_20_Definition"><style:paragraph-properties fo:margin-top="0.0598in" fo:margin-bottom="0.0598in"/></style:style><style:style style:name="Definition_20_Definition" style:display-name="Definition Definition" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body"><style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false"/></style:style><style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"><style:paragraph-properties fo:margin-left="0.0299in" fo:margin-right="0.0299in" fo:text-indent="0in" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/></style:style><style:style style:name="Table_20_Heading" style:display-name="Table Heading" style:family="paragraph" style:parent-style-name="Table_20_Contents" style:class="extra"><style:paragraph-properties fo:margin-left="0.0299in" fo:margin-right="0.0299in" fo:text-align="start" style:justify-single-word="false" fo:text-indent="0in" style:auto-text-indent="false" style:shadow="none" text:number-lines="false" text:line-number="0"/><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"><style:paragraph-properties fo:margin-left="0.1965in" fo:margin-right="0in" fo:text-indent="-0.1965in" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/><style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/></style:style><style:style style:name="Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"><style:paragraph-properties text:number-lines="false" text:line-number="0"><style:tab-stops><style:tab-stop style:position="3.25in" style:type="center"/><style:tab-stop style:position="6.5in" style:type="right"/></style:tab-stops></style:paragraph-properties></style:style><style:style style:name="Defnition_20_Term_20_Tight" style:display-name="Defnition Term Tight" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Definition_20_Definition_20_Tight"><style:paragraph-properties fo:margin-top="0.0799in" fo:margin-bottom="0.0799in"/></style:style><style:style style:name="Definition_20_Definition_20_Tight" style:display-name="Definition Definition Tight" style:family="paragraph" style:parent-style-name="Standard"><style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:margin-top="0in" fo:margin-bottom="0in" fo:text-indent="0in" style:auto-text-indent="false"/></style:style><style:style style:name="Date" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body"><style:text-properties fo:font-style="italic"/></style:style><style:style style:name="Author" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Date" style:master-page-name=""><style:paragraph-properties style:page-number="auto"/><style:text-properties fo:font-style="italic"/></style:style><style:style style:name="Numbering_20_Symbols" style:display-name="Numbering Symbols" style:family="text"/><style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text"><style:text-properties style:font-name="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-size-complex="9pt"/></style:style><style:style style:name="Emphasis" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style><style:style style:name="Strong_20_Emphasis" style:display-name="Strong Emphasis" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="Strikeout" style:family="text"><style:text-properties style:text-line-through-style="solid"/></style:style><style:style style:name="Superscript" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style><style:style style:name="Subscript" style:family="text"><style:text-properties style:text-position="sub 58%"/></style:style><style:style style:name="Citation" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style><style:style style:name="Teletype" style:family="text"><style:text-properties style:font-name="Courier New" style:font-name-asian="Courier New" style:font-name-complex="Courier New"/></style:style><style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text"><style:text-properties fo:color="#000080" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/></style:style><style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/><style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style><style:style style:name="Definition" style:family="text"/><text:outline-style><text:outline-level-style text:level="1" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="2" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="3" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="4" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="5" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="6" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="7" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="8" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="9" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style><text:outline-level-style text:level="10" style:num-format=""><style:list-level-properties text:min-label-distance="0.15in"/></text:outline-level-style></text:outline-style><text:list-style style:name="Numbering_20_1" style:display-name="Numbering 1"><text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="0.1972in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="0.3937in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="4" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="0.5909in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="5" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="0.7874in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="6" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="0.9846in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="7" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="1.1815in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="8" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="1.3787in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="9" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="1.5752in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="10" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:space-before="1.7724in" text:min-label-width="0.1965in"/></text:list-level-style-number></text:list-style><text:list-style style:name="Numbering_20_2" style:display-name="Numbering 2"><text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1"><style:list-level-properties text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="2"><style:list-level-properties text:space-before="0.1965in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="3"><style:list-level-properties text:space-before="0.3929in" text:min-label-width="0.3937in"/></text:list-level-style-number><text:list-level-style-number text:level="4" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="4"><style:list-level-properties text:space-before="0.7866in" text:min-label-width="0.4925in"/></text:list-level-style-number><text:list-level-style-number text:level="5" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="5"><style:list-level-properties text:space-before="1.2791in" text:min-label-width="0.5902in"/></text:list-level-style-number><text:list-level-style-number text:level="6" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="6"><style:list-level-properties text:space-before="1.8693in" text:min-label-width="0.7091in"/></text:list-level-style-number><text:list-level-style-number text:level="7" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="7"><style:list-level-properties text:space-before="2.5783in" text:min-label-width="0.9055in"/></text:list-level-style-number><text:list-level-style-number text:level="8" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="8"><style:list-level-properties text:space-before="3.4839in" text:min-label-width="1.0236in"/></text:list-level-style-number><text:list-level-style-number text:level="9" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="9"><style:list-level-properties text:space-before="4.5075in" text:min-label-width="1.1028in"/></text:list-level-style-number><text:list-level-style-number text:level="10" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="10"><style:list-level-properties text:space-before="5.6102in" text:min-label-width="1.2209in"/></text:list-level-style-number></text:list-style><text:list-style style:name="Numbering_20_3" style:display-name="Numbering 3"><text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1"><style:list-level-properties text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="2"><style:list-level-properties text:space-before="1.1815in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="3"><style:list-level-properties text:space-before="2.3626in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="4" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="4"><style:list-level-properties text:space-before="3.5441in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="5" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="5"><style:list-level-properties text:space-before="4.7252in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="6" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="6"><style:list-level-properties text:space-before="5.9063in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="7" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="7"><style:list-level-properties text:space-before="7.0878in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="8" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="8"><style:list-level-properties text:space-before="8.2689in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="9" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="9"><style:list-level-properties text:space-before="9.45in" text:min-label-width="1.1811in"/></text:list-level-style-number><text:list-level-style-number text:level="10" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="10"><style:list-level-properties text:space-before="10.6315in" text:min-label-width="1.1811in"/></text:list-level-style-number></text:list-style><text:list-style style:name="Numbering_20_4" style:display-name="Numbering 4"><text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I"><style:list-level-properties text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="2"><style:list-level-properties text:space-before="0.1972in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="3"><style:list-level-properties text:space-before="0.3937in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="4" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="4"><style:list-level-properties text:space-before="0.5909in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="5" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="5"><style:list-level-properties text:space-before="0.7874in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="6" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="6"><style:list-level-properties text:space-before="0.9846in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="7" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="7"><style:list-level-properties text:space-before="1.1815in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="8" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="8"><style:list-level-properties text:space-before="1.3787in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="9" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="9"><style:list-level-properties text:space-before="1.5752in" text:min-label-width="0.1965in"/></text:list-level-style-number><text:list-level-style-number text:level="10" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="I" text:start-value="10"><style:list-level-properties text:space-before="1.7724in" text:min-label-width="0.1965in"/></text:list-level-style-number></text:list-style><text:list-style style:name="Numbering_20_5" style:display-name="Numbering 5"><text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1"><style:list-level-properties text:min-label-width="0.1575in"/></text:list-level-style-number><text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-suffix="." style:num-format="1" text:start-value="2" text:display-levels="2"><style:list-level-properties text:space-before="0.1772in" text:min-label-width="0.2563in"/></text:list-level-style-number><text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-suffix=")" style:num-format="a" text:start-value="3"><style:list-level-properties text:space-before="0.4331in" text:min-label-width="0.1772in"/></text:list-level-style-number><text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.6319in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.7874in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.9429in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="1.0988in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="1.2543in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="1.4098in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="1.5654in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet></text:list-style><text:list-style style:name="List_20_1" style:display-name="List 1"><text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.1579in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.3146in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.4724in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.6299in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.7878in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="0.9445in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="1.1024in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="1.2598in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="•"><style:list-level-properties text:space-before="1.4177in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet></text:list-style><text:list-style style:name="List_20_2" style:display-name="List 2"><text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.1181in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.2362in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.3539in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.472in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.5902in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.7091in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.8272in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="0.9453in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="–"><style:list-level-properties text:space-before="1.063in" text:min-label-width="0.1181in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet></text:list-style><text:list-style style:name="List_20_3" style:display-name="List 3"><text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"><style:list-level-properties text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="□"><style:list-level-properties text:space-before="0.1555in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"><style:list-level-properties text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="□"><style:list-level-properties text:space-before="0.1555in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"><style:list-level-properties text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="□"><style:list-level-properties text:space-before="0.1555in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"><style:list-level-properties text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="□"><style:list-level-properties text:space-before="0.1555in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="☑"><style:list-level-properties text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="□"><style:list-level-properties text:space-before="0.1555in" text:min-label-width="0.1555in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet></text:list-style><text:list-style style:name="List_20_4" style:display-name="List 4"><text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="➢"><style:list-level-properties text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="0.1579in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="0.3146in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="0.4724in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="0.6299in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="0.7878in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="0.9445in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="1.1024in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="1.2598in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char=""><style:list-level-properties text:space-before="1.4177in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet></text:list-style><text:list-style style:name="List_20_5" style:display-name="List 5"><text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="0.1579in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="0.3146in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="4" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="0.4724in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="0.6299in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="0.7878in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="0.9445in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="1.1024in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="1.2598in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Numbering_20_Symbols" text:bullet-char="✗"><style:list-level-properties text:space-before="1.4177in" text:min-label-width="0.1575in"/><style:text-properties style:font-name="StarSymbol"/></text:list-level-style-bullet></text:list-style><text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/><text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/><text:linenumbering-configuration text:number-lines="false" text:offset="0.1965in" style:num-format="1" text:number-position="left" text:increment="5"/></office:styles><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Footer"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/></style:style><style:page-layout style:name="pm1"><style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1in" fo:margin-bottom="1in" fo:margin-left="1in" fo:margin-right="1in" style:writing-mode="lr-tb" style:footnote-max-height="0in"><style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:adjustment="left" style:rel-width="25%" style:color="#000000"/></style:page-layout-properties><style:header-style/><style:footer-style><style:header-footer-properties fo:min-height="0.4in" fo:margin-left="0in" fo:margin-right="0in" fo:margin-top="0.2in" style:dynamic-spacing="false"/></style:footer-style></style:page-layout></office:automatic-styles><office:master-styles><style:master-page style:name="Standard" style:page-layout-name="pm1"><style:footer><text:p text:style-name="P1"><text:page-number text:select-page="current">1</text:page-number> </text:p></style:footer></style:master-page></office:master-styles></office:document-styles>
pandoc.cabal view
@@ -1,6 +1,7 @@ Name: pandoc-Version: 0.46+Version: 1.0 Cabal-Version: >= 1.2+Build-Type: Custom License: GPL License-File: COPYING Copyright: (c) 2006-2008 John MacFarlane@@ -8,7 +9,7 @@ Maintainer: John MacFarlane <jgm@berkeley.edu> Stability: alpha Homepage: http://johnmacfarlane.net/pandoc-Package-URL: http://pandoc.googlecode.com/files/pandoc-0.4.tar.gz+Package-URL: http://pandoc.googlecode.com/files/pandoc-0.47.tar.gz Category: Text Tested-With: GHC Synopsis: Conversion between markup formats@@ -17,7 +18,8 @@ this library. It can read markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it can write markdown, reStructuredText, HTML, LaTeX, ConTeXt, Docbook,- RTF, groff man pages, and S5 HTML slide shows.+ OpenDocument, ODT, RTF, MediaWiki, groff man pages, and+ S5 HTML slide shows. . Pandoc extends standard markdown syntax with footnotes, embedded LaTeX, definition lists, tables, and other@@ -32,44 +34,171 @@ which convert this native representation into a target format. Thus, adding an input or output format requires only adding a reader or writer.-Flag splitBase- Description: Choose the new, smaller, split-up base package.+Extra-Source-Files:+ -- documentation+ README, INSTALL, COPYRIGHT, changelog,+ -- sources for man pages+ man/man1/pandoc.1.md, man/man1/markdown2pdf.1.md,+ man/man1/html2markdown.1.md, man/man1/hsmarkdown.1.md,+ -- Makefile+ Makefile,+ -- wrappers+ markdown2pdf, html2markdown, hsmarkdown,+ -- data for DefaultHeaders.hs+ data/headers/ConTeXt.header,+ data/headers/Docbook.header,+ data/headers/LaTeX.header,+ data/headers/OpenDocument.header,+ data/headers/RTF.header,+ data/headers/S5.header,+ -- data for LaTeXMathML writer+ data/LaTeXMathML.js.comment,+ data/LaTeXMathML.js.packed,+ -- data for S5 writer+ data/ui/default/slides.js.comment,+ data/ui/default/slides.js.packed,+ data/ui/default/s5-core.css,+ data/ui/default/framing.css,+ data/ui/default/pretty.css,+ data/ui/default/opera.css,+ data/ui/default/outline.css,+ data/ui/default/print.css,+ -- data for ODT writer+ odt-styles/meta.xml,+ odt-styles/settings.xml,+ odt-styles/META-INF/manifest.xml,+ odt-styles/Thumbnails/thumbnail.png,+ odt-styles/styles.xml,+ odt-styles/mimetype,+ -- tests+ tests/bodybg.gif,+ tests/writer.latex,+ tests/html-reader.html,+ tests/html-reader.native,+ tests/insert,+ tests/lalune.jpg,+ tests/movie.jpg,+ tests/latex-reader.latex,+ tests/latex-reader.native,+ tests/markdown-reader-more.txt,+ tests/markdown-reader-more.native,+ tests/rst-reader.native,+ tests/rst-reader.rst,+ tests/s5.basic.html,+ tests/s5.fancy.html,+ tests/s5.fragment.html,+ tests/s5.inserts.html,+ tests/s5.native,+ tests/tables.context,+ tests/tables.docbook,+ tests/tables.html,+ tests/tables.latex,+ tests/tables.man,+ tests/tables.markdown,+ tests/tables.mediawiki,+ tests/tables.native,+ tests/tables.opendocument,+ tests/tables.texinfo,+ tests/tables.rst,+ tests/tables.rtf,+ tests/tables.txt,+ tests/testsuite.native,+ tests/testsuite.txt,+ tests/writer.context,+ tests/writer.docbook,+ tests/writer.html,+ tests/writer.man,+ tests/writer.markdown,+ tests/writer.mediawiki,+ tests/writer.native,+ tests/writer.opendocument,+ tests/writer.rst,+ tests/writer.rtf,+ tests/writer.texinfo,+ tests/Diff.hs,+ tests/RunTests.hs+Extra-Tmp-Files: man/man1/pandoc.1, man/man1/hsmarkdown.1,+ man/man1/html2markdown.1++Flag highlighting+ Description: Compile in support for syntax highlighting of code blocks.+ Default: False+Flag executable+ Description: Build the pandoc executable. Default: True+Flag library+ Description: Build the pandoc library.+ Default: True+Flag citeproc+ Description: Compile in support for citeproc-hs bibliographic formatting.+ Default: False Library- if flag(splitBase)- Build-Depends: base >= 3, pretty, containers- else- Build-Depends: base < 3- Build-Depends: parsec, xhtml, mtl, regex-compat, network+ Build-Depends: base >= 3, pretty >= 1, containers >= 0.1,+ parsec >= 2.1 && < 3, xhtml >= 3000.0,+ mtl >= 1.1, network >= 2, filepath >= 1.1,+ process >= 1, directory >= 1, template-haskell >= 2.2,+ bytestring >= 0.9, zip-archive >= 0.1.1,+ utf8-string >= 0.3, old-time >= 1+ if flag(highlighting)+ Build-depends: highlighting-kate >= 0.2.3+ cpp-options: -D_HIGHLIGHTING+ if flag(citeproc)+ Build-depends: citeproc-hs+ Exposed-Modules: Text.Pandoc.Biblio+ cpp-options: -D_CITEPROC 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.ODT,+ Text.Pandoc.LaTeXMathML,+ Text.Pandoc.DefaultHeaders,+ Text.Pandoc.Highlighting, Text.Pandoc.Readers.HTML, Text.Pandoc.Readers.LaTeX, Text.Pandoc.Readers.Markdown, Text.Pandoc.Readers.RST, Text.Pandoc.Readers.TeXMath,- Text.Pandoc.Writers.DefaultHeaders, Text.Pandoc.Writers.Docbook, Text.Pandoc.Writers.HTML, Text.Pandoc.Writers.LaTeX, Text.Pandoc.Writers.ConTeXt,+ Text.Pandoc.Writers.OpenDocument,+ Text.Pandoc.Writers.Texinfo, Text.Pandoc.Writers.Man, Text.Pandoc.Writers.Markdown, Text.Pandoc.Writers.RST,+ Text.Pandoc.Writers.MediaWiki, Text.Pandoc.Writers.RTF, Text.Pandoc.Writers.S5- Ghc-Options: -O2+ Other-Modules: Text.Pandoc.XML,+ Text.Pandoc.TH+ Extensions: CPP, TemplateHaskell, FlexibleInstances+ Ghc-Options: -O2 -Wall -threaded Ghc-Prof-Options: -auto-all + if flag(library)+ Buildable: True+ else+ Buildable: False+ Executable pandoc- Hs-Source-Dirs: .- Main-Is: Main.hs- Ghc-Options: -O2- Ghc-Prof-Options: -auto-all+ Hs-Source-Dirs: .+ Main-Is: Main.hs+ Ghc-Options: -O2 -Wall -threaded+ Ghc-Prof-Options: -auto-all+ Extensions: CPP++ if flag(highlighting)+ cpp-options: -D_HIGHLIGHTING+ if flag(citeproc)+ Build-depends: citeproc-hs+ cpp-options: -D_CITEPROC+ if flag(executable)+ Buildable: True+ else+ Buildable: False+
− pandoc.cabal.ghc66
@@ -1,63 +0,0 @@-Name: pandoc-Version: 0.46-License: GPL-License-File: COPYING-Copyright: (c) 2006-2007 John MacFarlane-Author: John MacFarlane <jgm@berkeley.edu>-Maintainer: John MacFarlane <jgm@berkeley.edu>-Stability: alpha-Homepage: http://johnmacfarlane.net/pandoc-Package-URL: http://pandoc.googlecode.com/files/pandoc-0.4.tar.gz-Category: Text-Tested-With: GHC-Synopsis: Conversion between markup formats-Description: Pandoc is a Haskell library for converting from one markup- format to another, and a command-line tool that uses- this library. It can read markdown and (subsets of)- reStructuredText, HTML, and LaTeX, and it can write- markdown, reStructuredText, HTML, LaTeX, ConTeXt, Docbook,- RTF, groff man pages, and S5 HTML slide shows.- .- Pandoc extends standard markdown syntax with footnotes,- embedded LaTeX, definition lists, tables, and other- features. A compatibility mode is provided for those- who need a drop-in replacement for Markdown.pl.- .- In contrast to existing tools for converting markdown- to HTML, which use regex substitutions, pandoc has- a modular design: it consists of a set of readers,- which parse text in a given format and produce a native- representation of the document, and a set of writers,- 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: .-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,- Text.Pandoc.Readers.RST,- Text.Pandoc.Readers.TeXMath,- Text.Pandoc.Writers.DefaultHeaders,- Text.Pandoc.Writers.Docbook,- Text.Pandoc.Writers.HTML,- Text.Pandoc.Writers.LaTeX,- Text.Pandoc.Writers.ConTeXt,- Text.Pandoc.Writers.Man,- Text.Pandoc.Writers.Markdown,- Text.Pandoc.Writers.RST,- Text.Pandoc.Writers.RTF,- Text.Pandoc.Writers.S5-Ghc-Options: -O0--Executable: pandoc-Hs-Source-Dirs: .-Main-Is: Main.hs-Ghc-Options: -O0
− templates/ASCIIMathML.hs
@@ -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"
− templates/ASCIIMathML.js
@@ -1,3363 +0,0 @@-/*-ASCIIMathML.js-==============-This file contains JavaScript functions to convert ASCII math notation-and LaTeX to Presentation MathML. Simple graphics commands are also-translated to SVG images. The conversion is done while the (X)HTML -page loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet -Explorer 6/7 + MathPlayer (http://www.dessci.com/en/products/mathplayer/) +-Adobe SVGview 3.03 (http://www.adobe.com/svg/viewer/install/).--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>--(using the graphics in IE also requires the file "d.svg" in the same folder).-This is a convenient and inexpensive solution for authoring MathML and SVG.--Version 2.0.9 Nov 3, 2007, (c) Peter Jipsen http://www.chapman.edu/~jipsen-This version extends ASCIIMathML.js with LaTeXMathML.js and ASCIIsvg.js.-Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js-If you use it on a webpage, please send the URL to jipsen@chapman.edu--The LaTeXMathML modifications were made by Douglas Woodall, June 2006.-(for details see header on the LaTeXMathML part in middle of file)-Extensive clean-up and improvements by Paulo Soares, Oct 2007.--This program is free software; you can redistribute it and/or modify-it under the terms of the GNU Lesser General Public License as published by-the Free Software Foundation; either version 2.1 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 Lesser General Public License -(at http://www.gnu.org/licences/lgpl.html) for more details.-*/--var mathcolor = ""; // change it to "" (to inherit) or another color-var mathfontsize = "1em"; // change to e.g. 1.2em for larger math-var mathfontfamily = "serif"; // change to "" to inherit (works in IE) - // or another family (e.g. "arial")-var automathrecognize = false; // writing "amath" on page makes this true-var checkForMathML = true; // check if browser can display MathML-var notifyIfNoMathML = true; // display note at top if no MathML capability-var alertIfNoMathML = false; // show alert box if no MathML capability-var translateOnLoad = true; // set to false to do call translators from js -var translateLaTeX = true; // false to preserve $..$, $$..$$-var translateLaTeXformatting = true; // false to preserve \emph,\begin{},\end{}-var translateASCIIMath = true; // false to preserve `..`-var translateASCIIsvg = true; // false to preserve agraph.., \begin{graph}..-var avoidinnerHTML = false; // set true if assigning to innerHTML gives error-var displaystyle = true; // puts limits above and below large operators-var showasciiformulaonhover = true; // helps students learn ASCIIMath-var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!-var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters-var AMdocumentId = "wikitext" // PmWiki element containing math (default=body)-var checkforprocessasciimathinmoodle = false; // true for systems like Moodle-var dsvglocation = ""; // path to d.svg (blank if same as ASCIIMathML.js loc)--/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/--var isIE = document.createElementNS==null;-var noMathML = false, translated = false;--if (isIE) { // avoid adding MathPlayer info explicitly to each webpage- document.write("<object id=\"mathplayer\"\- classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");- document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");-}--// Add a stylesheet, replacing any previous custom stylesheet (adapted from TW)-function setStylesheet(s) {- var id = "AMMLcustomStyleSheet";- var n = document.getElementById(id);- if(document.createStyleSheet) {- // Test for IE's non-standard createStyleSheet method- if(n)- n.parentNode.removeChild(n);- // This failed without the - document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd"," <style id='" + id + "'>" + s + "</style>");- } else {- if(n) {- n.replaceChild(document.createTextNode(s),n.firstChild);- } else {- n = document.createElement("style");- n.type = "text/css";- n.id = id;- n.appendChild(document.createTextNode(s));- document.getElementsByTagName("head")[0].appendChild(n);- }- }-}--setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}");--function init(){- var msg, warnings = new Array();- if (document.getElementById==null){- alert("This webpage requires a recent browser such as Mozilla Firefox/Netscape 7+ or Internet Explorer 6+ with MathPlayer and Adobe SVGviewer");- return null;- }- if (checkForMathML && (msg = checkMathML())) warnings.push(msg);- if (checkIfSVGavailable && (msg = checkSVG())) warnings.push(msg);- if (warnings.length>0) displayWarnings(warnings);- if (!noMathML) initSymbols();- return true;-}--function checkMathML(){- if (navigator.appName.slice(0,8)=="Netscape") - if (navigator.appVersion.slice(0,1)>="5") noMathML = null;- else noMathML = true;- else if (navigator.appName.slice(0,9)=="Microsoft")- try {- var ActiveX = new ActiveXObject("MathPlayer.Factory.1");- noMathML = null;- } catch (e) {- noMathML = true;- }- else noMathML = true;-//noMathML = true; //uncomment to check- if (noMathML && notifyIfNoMathML) {- var msg = "To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later.";- if (alertIfNoMathML)- alert(msg);- else return msg;- }-}--function hideWarning(){- var body = document.getElementsByTagName("body")[0];- body.removeChild(document.getElementById('AMMLwarningBox'));- body.onclick = null;-}--function displayWarnings(warnings) {- var i, frag, nd = createElementXHTML("div");- var body = document.getElementsByTagName("body")[0];- body.onclick=hideWarning;- nd.id = 'AMMLwarningBox';- for (i=0; i<warnings.length; i++) {- frag = createElementXHTML("div");- frag.appendChild(document.createTextNode(warnings[i]));- frag.style.paddingBottom = "1.0em";- nd.appendChild(frag);- }- nd.appendChild(createElementXHTML("p"));- nd.appendChild(document.createTextNode("For instructions see the "));- var an = createElementXHTML("a");- an.appendChild(document.createTextNode("ASCIIMathML"));- an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");- nd.appendChild(an);- nd.appendChild(document.createTextNode(" homepage"));- an = createElementXHTML("div");- an.id = 'AMMLcloseDiv';- an.appendChild(document.createTextNode('(click anywhere to close this warning)'));- nd.appendChild(an);- var body = document.getElementsByTagName("body")[0];- body.insertBefore(nd,body.childNodes[0]);-}--function translate(spanclassAM) {- if (!translated) { // run this only once- translated = true;- var body = document.getElementsByTagName("body")[0];- var processN = document.getElementById(AMdocumentId);- if (translateLaTeX) LMprocessNode((processN!=null?processN:body));- if (translateASCIIMath) AMprocessNode((processN!=null?processN:body), false, spanclassAM);- }-}--function createElementXHTML(t) {- if (isIE) return document.createElement(t);- else return document.createElementNS("http://www.w3.org/1999/xhtml",t);-}--function createMmlNode(t,frag) {- if (isIE) var node = document.createElement("m:"+t);- else var node = document.createElementNS("http://www.w3.org/1998/Math/MathML",t);- if (frag) node.appendChild(frag);- return node;-}--// character lists for Mozilla/Netscape fonts-var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];-var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];-var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];--var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,- RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,- LEFTRIGHT = 9, TEXT = 10, BIG = 11, LONG = 12, STRETCHY = 13,- MATRIX = 14;; // token types--var AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT};--var AMsymbols = [-//some greek symbols-{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST},-{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},-{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},-{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},-{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},-{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST},-{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},-{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST},-{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST},-{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST},-{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST},-{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST},-{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST},-{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST},-{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST},-{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST},-{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST},-{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST},-{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST},-{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST},-{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST},-{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST},-{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST},-{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST},-{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST},-{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST},-{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST},-{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST},-{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST},-{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST},-{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST},-{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST},-{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST},-{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST},-{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST},-{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST},--//binary operation symbols-//{input:"-", tag:"mo", output:"\u0096", tex:null, ttype:CONST},-{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST},-{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST},-{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST},-{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST},-{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},-{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST},-{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST},-{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST},-{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST},-{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST},-{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST},-{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER},-{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER},-{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST},-{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER},-{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST},-{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER},-{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST},-{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER},-{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST},-{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER},--//binary relation symbols-{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST},-{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST},-{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST},-{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST},-{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST},-{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST},-{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST},-{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST},-{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST},-{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST},-{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST},-{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST},-{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST},-{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST},-{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST},-{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST},-{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST},-{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST},-{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST},-{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST},-{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST},-{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST},--//logical symbols-{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},-{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE},-{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST},-{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST},-{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE},-{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST},-{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST},-{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST},-{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST},-{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST},-{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST},-{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST},--//grouping brackets-{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET},-{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET},-{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET},-{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET},-{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET},-{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET},-{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT},-//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT},-{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},-{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},-{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET},-{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET},-{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true},-{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true},--//miscellaneous symbols-{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST},-{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION},-{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION},-{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION},-{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION},-{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST},-{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST},-{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST},-{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST},-{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST},-{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST},-{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST},-{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST},-{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST},-{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST},-{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST},-{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST},-{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST},-{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST},-{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST},-{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST},-{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST},-{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},-{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST},-{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST},-{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST},-{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST},-{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST},-{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST},-{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST},-{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST},-{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST},-{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true},-{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true},--//standard functions-{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},-{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER},-{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},-{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},-{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true},-{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true},-{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true},-{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true},-{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true},-{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true},-{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true},-{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true},-{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true},-{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true},-{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST},-{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST},-{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true},-{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true},-{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST},-{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST},-{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER},-{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER},--//arrows-{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST},-{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST},-{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST},-{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST},-{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST},-{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST},-{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST},-{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST},-{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST},-{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST},-{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},-{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST},-{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},-//commands with argument-{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY},-{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY},-{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},-{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX},-{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},-{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},-{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},-{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true},-{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true},-{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true},-{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true},-{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true},-{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true},-{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT},-{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT},-AMquote,-{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY},-{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY},-{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY},-{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY},-{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb},-{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb},-{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal},-{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal},-{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY},-{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY},-{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk},-{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk}-];--function compareNames(s1,s2) {- if (s1.input > s2.input) return 1- else return -1;-}--var AMnames = []; //list of input symbols--function initSymbols() {- var texsymbols = [], i;- for (i=0; i<AMsymbols.length; i++)- if (AMsymbols[i].tex) - texsymbols[texsymbols.length] = {input:AMsymbols[i].tex, - tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};- AMsymbols = AMsymbols.concat(texsymbols);- refreshSymbols();-}--function refreshSymbols(){- var i;- AMsymbols.sort(compareNames);- for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;- LMsymbols.sort(compareNames);- for (i=0; i<LMsymbols.length; i++) LMnames[i] = LMsymbols[i].input;-}--function define(oldstr,newstr) {- if(oldstr.substr(0,1)=="\\")- LMsymbols = LMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,- ttype:DEFINITION}]);- else- AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr, - tex:null, ttype:DEFINITION}]);- refreshSymbols(); // this may be a problem if many symbols are defined!-}--function AMremoveCharsAndBlanks(str,n) {-//remove n characters and any following blanks- var st;- if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ") - st = str.slice(n+1);- else st = str.slice(n);- for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);- return st.slice(i);-}--function position(arr, str, n) { -// return position >=n where str appears or would be inserted-// assumes arr is sorted- if (n==0) {- var h,m;- n = -1;- h = arr.length;- while (n+1<h) {- m = (n+h) >> 1;- if (arr[m]<str) n = m; else h = m;- }- return h;- } else- for (var i=n; i<arr.length && arr[i]<str; i++);- return i; // i=arr.length || arr[i]>=str-}--function AMgetSymbol(str) {-//return maximal initial substring of str that appears in names-//return null if there is none- var k = 0; //new pos- var j = 0; //old pos- var mk; //match pos- var st;- var tagst;- var match = "";- var more = true;- for (var i=1; i<=str.length && more; i++) {- st = str.slice(0,i); //initial substring of length i- j = k;- k = position(AMnames, st, j);- if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){- match = AMnames[k];- mk = k;- i = match.length;- }- more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];- }- AMpreviousSymbol=AMcurrentSymbol;- if (match!=""){- AMcurrentSymbol=AMsymbols[mk].ttype;- return AMsymbols[mk]; - }-// if str[0] is a digit or - return maxsubstring of digits.digits- AMcurrentSymbol=CONST;- k = 1;- st = str.slice(0,1);- var integ = true;- while ("0"<=st && st<="9" && k<=str.length) {- st = str.slice(k,k+1);- k++;- }- if (st == decimalsign) {- st = str.slice(k,k+1);- if ("0"<=st && st<="9") {- integ = false;- k++;- while ("0"<=st && st<="9" && k<=str.length) {- st = str.slice(k,k+1);- k++;- }- }- }- if ((integ && k>1) || k>2) {- st = str.slice(0,k-1);- tagst = "mn";- } else {- k = 2;- st = str.slice(0,1); //take 1 character- tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");- }- if (st=="-" && AMpreviousSymbol==INFIX) {- AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse- return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};- }- return {input:st, tag:tagst, output:st, ttype:CONST};-}--function AMremoveBrackets(node) {- var st;- if (node.nodeName=="mrow") {- st = node.firstChild.firstChild.nodeValue;- if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);- }- if (node.nodeName=="mrow") {- st = node.lastChild.firstChild.nodeValue;- if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);- }-}--/*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;--function AMparseSexpr(str) { //parses str and returns [node,tailstr]- var symbol, node, result, i, st,// rightvert = false,- newFrag = document.createDocumentFragment();- str = AMremoveCharsAndBlanks(str,0);- symbol = AMgetSymbol(str); //either a token or a bracket or empty- if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {- return [null,str];- }- if (symbol.ttype == DEFINITION) {- str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); - symbol = AMgetSymbol(str);- }- switch (symbol.ttype) { case UNDEROVER:- case CONST:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode(symbol.tag, //its a constant- document.createTextNode(symbol.output)),str];- case LEFTBRACKET: //read (expr+)- AMnestingDepth++;- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseExpr(str,true);- AMnestingDepth--;- if (typeof symbol.invisible == "boolean" && symbol.invisible) - node = createMmlNode("mrow",result[0]);- else {- node = createMmlNode("mo",document.createTextNode(symbol.output));- node = createMmlNode("mrow",node);- node.appendChild(result[0]);- }- return [node,result[1]];- case TEXT:- if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);- if (str.charAt(0)=="{") i=str.indexOf("}");- else if (str.charAt(0)=="(") i=str.indexOf(")");- else if (str.charAt(0)=="[") i=str.indexOf("]");- else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;- else i = 0;- if (i==-1) i = str.length;- st = str.slice(1,i);- if (st.charAt(0) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- }- newFrag.appendChild(- createMmlNode(symbol.tag,document.createTextNode(st)));- if (st.charAt(st.length-1) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- }- str = AMremoveCharsAndBlanks(str,i+1);- return [createMmlNode("mrow",newFrag),str];- case UNARY:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseSexpr(str);- if (result[0]==null) return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str];- if (typeof symbol.func == "boolean" && symbol.func) { // functions hack- st = str.charAt(0);- if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {- return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str];- } else {- node = createMmlNode("mrow",- createMmlNode(symbol.tag,document.createTextNode(symbol.output)));- node.appendChild(result[0]);- return [node,result[1]];- }- }- AMremoveBrackets(result[0]);- if (symbol.input == "sqrt") { // sqrt- return [createMmlNode(symbol.tag,result[0]),result[1]];- } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent- node = createMmlNode(symbol.tag,result[0]);- node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output)));- return [node,result[1]];- } else { // font change command- if (!isIE && typeof symbol.codes != "undefined") {- for (i=0; i<result[0].childNodes.length; i++)- if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {- st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:- result[0].childNodes[i].firstChild.nodeValue);- var newst = [];- for (var j=0; j<st.length; j++)- if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +- String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);- else newst = newst + st.charAt(j);- if (result[0].nodeName=="mi")- result[0]=createMmlNode("mo").- appendChild(document.createTextNode(newst));- else result[0].replaceChild(createMmlNode("mo").- appendChild(document.createTextNode(newst)),- result[0].childNodes[i]);- }- }- node = createMmlNode(symbol.tag,result[0]);- node.setAttribute(symbol.atname,symbol.atval);- return [node,result[1]];- }- case BINARY:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseSexpr(str);- if (result[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str];- AMremoveBrackets(result[0]);- var result2 = AMparseSexpr(result[1]);- if (result2[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str];- AMremoveBrackets(result2[0]);- if (symbol.input=="root" || symbol.input=="stackrel") - newFrag.appendChild(result2[0]);- newFrag.appendChild(result[0]);- if (symbol.input=="frac") newFrag.appendChild(result2[0]);- return [createMmlNode(symbol.tag,newFrag),result2[1]];- case INFIX:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode("mo",document.createTextNode(symbol.output)),str];- case SPACE:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- newFrag.appendChild(- createMmlNode(symbol.tag,document.createTextNode(symbol.output)));- node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- return [createMmlNode("mrow",newFrag),str];- case LEFTRIGHT:-// if (rightvert) return [null,str]; else rightvert = true;- AMnestingDepth++;- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseExpr(str,false);- AMnestingDepth--;- var st = "";- if (result[0].lastChild!=null)- st = result[0].lastChild.firstChild.nodeValue;- if (st == "|") { // its an absolute value subterm- node = createMmlNode("mo",document.createTextNode(symbol.output));- node = createMmlNode("mrow",node);- node.appendChild(result[0]);- return [node,result[1]];- } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing- node = createMmlNode("mo",document.createTextNode("\u2223"));- node = createMmlNode("mrow",node);- return [node,str];- }- default:-//alert("default");- str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode(symbol.tag, //its a constant- document.createTextNode(symbol.output)),str];- }-}--function AMparseIexpr(str) {- var symbol, sym1, sym2, node, result, underover;- str = AMremoveCharsAndBlanks(str,0);- sym1 = AMgetSymbol(str);- result = AMparseSexpr(str);- node = result[0];- str = result[1];- symbol = AMgetSymbol(str);- if (symbol.ttype == INFIX && symbol.input != "/") {- str = AMremoveCharsAndBlanks(str,symbol.input.length);-// if (symbol.input == "/") result = AMparseIexpr(str); else ...- result = AMparseSexpr(str);- if (result[0] == null) // show box in place of missing argument- result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));- else AMremoveBrackets(result[0]);- str = result[1];-// if (symbol.input == "/") AMremoveBrackets(node);- if (symbol.input == "_") {- sym2 = AMgetSymbol(str);- underover = (sym1.ttype == UNDEROVER);- if (sym2.input == "^") {- str = AMremoveCharsAndBlanks(str,sym2.input.length);- var res2 = AMparseSexpr(str);- AMremoveBrackets(res2[0]);- str = res2[1];- node = createMmlNode((underover?"munderover":"msubsup"),node);- node.appendChild(result[0]);- node.appendChild(res2[0]);- node = createMmlNode("mrow",node); // so sum does not stretch- } else {- node = createMmlNode((underover?"munder":"msub"),node);- node.appendChild(result[0]);- }- } else {- node = createMmlNode(symbol.tag,node);- node.appendChild(result[0]);- }- }- return [node,str];-}--function AMparseExpr(str,rightbracket) {- var symbol, node, result, i, nodeList = [],- newFrag = document.createDocumentFragment();- do {- str = AMremoveCharsAndBlanks(str,0);- result = AMparseIexpr(str);- node = result[0];- str = result[1];- symbol = AMgetSymbol(str);- if (symbol.ttype == INFIX && symbol.input == "/") {- str = AMremoveCharsAndBlanks(str,symbol.input.length);- result = AMparseIexpr(str);- if (result[0] == null) // show box in place of missing argument- result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));- else AMremoveBrackets(result[0]);- str = result[1];- AMremoveBrackets(node);- node = createMmlNode(symbol.tag,node);- node.appendChild(result[0]);- newFrag.appendChild(node);- symbol = AMgetSymbol(str);- } - else if (node!=undefined) newFrag.appendChild(node);- } while ((symbol.ttype != RIGHTBRACKET && - (symbol.ttype != LEFTRIGHT || rightbracket)- || AMnestingDepth == 0) && symbol!=null && symbol.output!="");- if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {-// if (AMnestingDepth > 0) AMnestingDepth--;- var len = newFrag.childNodes.length;- if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&- newFrag.childNodes[len-2].nodeName == "mo" &&- newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix- var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;- if (right==")" || right=="]") {- var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;- if (left=="(" && right==")" && symbol.output != "}" || - left=="[" && right=="]") {- var pos = []; // positions of commas- var matrix = true;- var m = newFrag.childNodes.length;- for (i=0; matrix && i<m; i=i+2) {- pos[i] = [];- node = newFrag.childNodes[i];- if (matrix) matrix = node.nodeName=="mrow" && - (i==m-1 || node.nextSibling.nodeName=="mo" && - node.nextSibling.firstChild.nodeValue==",")&&- node.firstChild.firstChild.nodeValue==left &&- node.lastChild.firstChild.nodeValue==right;- if (matrix) - for (var j=0; j<node.childNodes.length; j++)- if (node.childNodes[j].firstChild.nodeValue==",")- pos[i][pos[i].length]=j;- if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;- }- if (matrix) {- var row, frag, n, k, table = document.createDocumentFragment();- for (i=0; i<m; i=i+2) {- row = document.createDocumentFragment();- frag = document.createDocumentFragment();- node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>- n = node.childNodes.length;- k = 0;- node.removeChild(node.firstChild); //remove (- for (j=1; j<n-1; j++) {- if (typeof pos[i][k] != "undefined" && j==pos[i][k]){- node.removeChild(node.firstChild); //remove ,- row.appendChild(createMmlNode("mtd",frag));- k++;- } else frag.appendChild(node.firstChild);- }- row.appendChild(createMmlNode("mtd",frag));- if (newFrag.childNodes.length>2) {- newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>- newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>- }- table.appendChild(createMmlNode("mtr",row));- }- node = createMmlNode("mtable",table);- if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");- newFrag.replaceChild(node,newFrag.firstChild);- }- }- }- }- str = AMremoveCharsAndBlanks(str,symbol.input.length);- if (typeof symbol.invisible != "boolean" || !symbol.invisible) {- node = createMmlNode("mo",document.createTextNode(symbol.output));- newFrag.appendChild(node);- }- }- return [newFrag,str];-}--function parseMath(str,latex) {- var frag, node;- AMnestingDepth = 0;- frag = latex ? LMparseExpr(str.replace(/^\s+/g,""),false,false)[0] : AMparseExpr(str.replace(/^\s+/g,""),false)[0];- node = createMmlNode("mstyle",frag);- node.setAttribute("mathcolor",mathcolor);- node.setAttribute("fontfamily",mathfontfamily);- node.setAttribute("mathsize",mathfontsize);- if (displaystyle) node.setAttribute("displaystyle","true");- node = createMmlNode("math",node);- if (showasciiformulaonhover) //fixed by djhsu so newline- node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko- return node;-}--function strarr2docFrag(arr, linebreaks, latex) {- var newFrag=document.createDocumentFragment();- var expr = false;- for (var i=0; i<arr.length; i++) {- if (expr) newFrag.appendChild(parseMath(arr[i],latex));- else {- var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);- newFrag.appendChild(createElementXHTML("span").- appendChild(document.createTextNode(arri[0])));- for (var j=1; j<arri.length; j++) {- newFrag.appendChild(createElementXHTML("p"));- newFrag.appendChild(createElementXHTML("span").- appendChild(document.createTextNode(arri[j])));- }- }- expr = !expr;- }- return newFrag;-}--function AMautomathrec(str) {-//formula is a space (or start of str) followed by a maximal sequence of *two* or more tokens, possibly separated by runs of digits and/or space.-//tokens are single letters (except a, A, I) and ASCIIMathML tokens- var texcommand = "\\\\[a-zA-Z]+|\\\\\\s|";- var ambigAMtoken = "\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|";- var englishAMtoken = "\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|";- var secondenglishAMtoken = "|\\bI\\b|\\bin\\b|\\btext\\b"; // took if and or not out- var simpleAMtoken = "NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta"; // uuu nnn?- var letter = "[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|";- var token = letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken;- var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g");- str = str.replace(re," `$2`$7");- var arr = str.split(AMdelimiter1);- var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g");- var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now- for (i=0; i<arr.length; i++) //single nonenglish tokens- if (i%2==0) {- arr[i] = arr[i].replace(re1," `$2`$3");- arr[i] = arr[i].replace(re2," `$2`$3");- arr[i] = arr[i].replace(/([{}[\]])/,"`$1`");- }- str = arr.join(AMdelimiter1);- str = str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)"); //fix parentheses- str = str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3"); //fix parentheses- str = str.replace(/\sin`/g,"` in");- str = str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`");- str = str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2");- str = str.replace(/`([0-9.]+:)`/g,"$1");- return str;-}--function processNodeR(n, linebreaks,latex) {- var mtch, str, arr, frg, i;- if (n.childNodes.length == 0) {- if ((n.nodeType!=8 || linebreaks) &&- n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&- n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" /*&&- n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE"*/) {- str = n.nodeValue;- if (!(str == null)) {- str = str.replace(/\r\n\r\n/g,"\n\n");- str = str.replace(/\x20+/g," ");- str = str.replace(/\s*\r\n/g," ");- if(latex) {-// DELIMITERS:- mtch = (str.indexOf("\$")==-1 ? false : true);- str = str.replace(/([^\\])\$/g,"$1 \$");- str = str.replace(/^\$/," \$"); // in case \$ at start of string- arr = str.split(" \$");- for (i=0; i<arr.length; i++)- arr[i]=arr[i].replace(/\\\$/g,"\$");- } else {- mtch = false;- str = str.replace(new RegExp(AMescape1, "g"),- function(){mtch = true; return "AMescape1"});- str = str.replace(/\\?end{?a?math}?/i,- function(){automathrecognize = false; mtch = true; return ""});- str = str.replace(/amath\b|\\begin{a?math}/i,- function(){automathrecognize = true; mtch = true; return ""});- arr = str.split(AMdelimiter1);- if (automathrecognize)- for (i=0; i<arr.length; i++)- if (i%2==0) arr[i] = AMautomathrec(arr[i]);- str = arr.join(AMdelimiter1);- arr = str.split(AMdelimiter1);- for (i=0; i<arr.length; i++) // this is a problem ************- arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);- }- if (arr.length>1 || mtch) {- if (!noMathML) {- frg = strarr2docFrag(arr,n.nodeType==8,latex);- var len = frg.childNodes.length;- n.parentNode.replaceChild(frg,n);- return len-1;- } else return 0;- }- }- } else return 0;- } else if (n.nodeName!="math") {- for (i=0; i<n.childNodes.length; i++)- i += processNodeR(n.childNodes[i], linebreaks,latex);- }- return 0;-}--function AMprocessNode(n, linebreaks, spanclassAM) {- var frag,st;- if (spanclassAM!=null) {- frag = document.getElementsByTagName("span")- for (var i=0;i<frag.length;i++)- if (frag[i].className == "AM") - processNodeR(frag[i],linebreaks,false);- } else {- try {- st = n.innerHTML; // look for AMdelimiter on page- } catch(err) {}-//alert(st)- if (st==null || /amath\b|\\begin{a?math}/i.test(st) ||- st.indexOf(AMdelimiter1+" ")!=-1 || st.slice(-1)==AMdelimiter1 ||- st.indexOf(AMdelimiter1+"<")!=-1 || st.indexOf(AMdelimiter1+"\n")!=-1) {- processNodeR(n,linebreaks,false);- }- }-/* if (isIE) { //needed to match size and font of formula to surrounding text- frag = document.getElementsByTagName('math');- for (var i=0;i<frag.length;i++) frag[i].update() //What is this?- }*/-}--/*-LaTeXMathML.js-==============--Version 1.1, July 20, 2007 (c) modifications by Peter Jipsen--(changes: renamed global variables from AM... to LM... so that-LaTeXMathML and ASCIIMathML can be used simultaneously)--Previous header notice:-This file (Version 1.0), is due to Douglas Woodall, June 2006.-It contains JavaScript functions to convert (most simple) LaTeX-math notation to Presentation MathML. It was obtained by-downloading the file ASCIIMathML.js from- http://www1.chapman.edu/~jipsen/mathml/asciimathdownload/-and modifying it so that it carries out ONLY those conversions-that would be carried out in LaTeX. A description of the original-file, with examples, can be found at- www1.chapman.edu/~jipsen/mathml/asciimath.html- ASCIIMathML: Math on the web for everyone--Here is the header notice from the original file:--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--This program is free software; you can redistribute it and/or modify-it under the terms of the GNU Lesser General Public License as published by-the Free Software Foundation; either version 2.1 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 Lesser-General Public License (at http://www.gnu.org/license/lgpl.html)-for more details.--LaTeXMathML.js (ctd)-==============--Content between $...$ and $$...$$ is converted by this part of the file-*/--// all further global variables start with "LM"--// Commented out by DRW to prevent 1/2 turning into a 2-line fraction-// LMdiv = {input:"/", tag:"mfrac", output:"/", ttype:INFIX},-// Commented out by DRW so that " prints literally in equations-// LMquote = {input:"\"", tag:"mtext", output:"mbox", ttype:TEXT};--var LMsymbols = [-//Greek letters-{input:"\\alpha", tag:"mi", output:"\u03B1", ttype:CONST},-{input:"\\beta", tag:"mi", output:"\u03B2", ttype:CONST},-{input:"\\gamma", tag:"mi", output:"\u03B3", ttype:CONST},-{input:"\\delta", tag:"mi", output:"\u03B4", ttype:CONST},-{input:"\\epsilon", tag:"mi", output:"\u03B5", ttype:CONST},-{input:"\\varepsilon", tag:"mi", output:"\u025B", ttype:CONST},-{input:"\\zeta", tag:"mi", output:"\u03B6", ttype:CONST},-{input:"\\eta", tag:"mi", output:"\u03B7", ttype:CONST},-{input:"\\theta", tag:"mi", output:"\u03B8", ttype:CONST},-{input:"\\vartheta", tag:"mi", output:"\u03D1", ttype:CONST},-{input:"\\iota", tag:"mi", output:"\u03B9", ttype:CONST},-{input:"\\kappa", tag:"mi", output:"\u03BA", ttype:CONST},-{input:"\\lambda", tag:"mi", output:"\u03BB", ttype:CONST},-{input:"\\mu", tag:"mi", output:"\u03BC", ttype:CONST},-{input:"\\nu", tag:"mi", output:"\u03BD", ttype:CONST},-{input:"\\xi", tag:"mi", output:"\u03BE", ttype:CONST},-{input:"\\pi", tag:"mi", output:"\u03C0", ttype:CONST},-{input:"\\varpi", tag:"mi", output:"\u03D6", ttype:CONST},-{input:"\\rho", tag:"mi", output:"\u03C1", ttype:CONST},-{input:"\\varrho", tag:"mi", output:"\u03F1", ttype:CONST},-{input:"\\varsigma", tag:"mi", output:"\u03C2", ttype:CONST},-{input:"\\sigma", tag:"mi", output:"\u03C3", ttype:CONST},-{input:"\\tau", tag:"mi", output:"\u03C4", ttype:CONST},-{input:"\\upsilon", tag:"mi", output:"\u03C5", ttype:CONST},-{input:"\\phi", tag:"mi", output:"\u03C6", ttype:CONST},-{input:"\\varphi", tag:"mi", output:"\u03D5", ttype:CONST},-{input:"\\chi", tag:"mi", output:"\u03C7", ttype:CONST},-{input:"\\psi", tag:"mi", output:"\u03C8", ttype:CONST},-{input:"\\omega", tag:"mi", output:"\u03C9", ttype:CONST},-{input:"\\Gamma", tag:"mo", output:"\u0393", ttype:CONST},-{input:"\\Delta", tag:"mo", output:"\u0394", ttype:CONST},-{input:"\\Theta", tag:"mo", output:"\u0398", ttype:CONST},-{input:"\\Lambda", tag:"mo", output:"\u039B", ttype:CONST},-{input:"\\Xi", tag:"mo", output:"\u039E", ttype:CONST},-{input:"\\Pi", tag:"mo", output:"\u03A0", ttype:CONST},-{input:"\\Sigma", tag:"mo", output:"\u03A3", ttype:CONST},-{input:"\\Upsilon", tag:"mo", output:"\u03A5", ttype:CONST},-{input:"\\Phi", tag:"mo", output:"\u03A6", ttype:CONST},-{input:"\\Psi", tag:"mo", output:"\u03A8", ttype:CONST},-{input:"\\Omega", tag:"mo", output:"\u03A9", ttype:CONST},--//fractions-{input:"\\frac12", tag:"mo", output:"\u00BD", ttype:CONST},-{input:"\\frac14", tag:"mo", output:"\u00BC", ttype:CONST},-{input:"\\frac34", tag:"mo", output:"\u00BE", ttype:CONST},-{input:"\\frac13", tag:"mo", output:"\u2153", ttype:CONST},-{input:"\\frac23", tag:"mo", output:"\u2154", ttype:CONST},-{input:"\\frac15", tag:"mo", output:"\u2155", ttype:CONST},-{input:"\\frac25", tag:"mo", output:"\u2156", ttype:CONST},-{input:"\\frac35", tag:"mo", output:"\u2157", ttype:CONST},-{input:"\\frac45", tag:"mo", output:"\u2158", ttype:CONST},-{input:"\\frac16", tag:"mo", output:"\u2159", ttype:CONST},-{input:"\\frac56", tag:"mo", output:"\u215A", ttype:CONST},-{input:"\\frac18", tag:"mo", output:"\u215B", ttype:CONST},-{input:"\\frac38", tag:"mo", output:"\u215C", ttype:CONST},-{input:"\\frac58", tag:"mo", output:"\u215D", ttype:CONST},-{input:"\\frac78", tag:"mo", output:"\u215E", ttype:CONST},--//binary operation symbols-{input:"\\pm", tag:"mo", output:"\u00B1", ttype:CONST},-{input:"\\mp", tag:"mo", output:"\u2213", ttype:CONST},-{input:"\\triangleleft",tag:"mo", output:"\u22B2", ttype:CONST},-{input:"\\triangleright",tag:"mo",output:"\u22B3", ttype:CONST},-{input:"\\cdot", tag:"mo", output:"\u22C5", ttype:CONST},-{input:"\\star", tag:"mo", output:"\u22C6", ttype:CONST},-{input:"\\ast", tag:"mo", output:"\u002A", ttype:CONST},-{input:"\\times", tag:"mo", output:"\u00D7", ttype:CONST},-{input:"\\div", tag:"mo", output:"\u00F7", ttype:CONST},-{input:"\\circ", tag:"mo", output:"\u2218", ttype:CONST},-//{input:"\\bullet", tag:"mo", output:"\u2219", ttype:CONST},-{input:"\\bullet", tag:"mo", output:"\u2022", ttype:CONST},-{input:"\\oplus", tag:"mo", output:"\u2295", ttype:CONST},-{input:"\\ominus", tag:"mo", output:"\u2296", ttype:CONST},-{input:"\\otimes", tag:"mo", output:"\u2297", ttype:CONST},-{input:"\\bigcirc", tag:"mo", output:"\u25CB", ttype:CONST},-{input:"\\oslash", tag:"mo", output:"\u2298", ttype:CONST},-{input:"\\odot", tag:"mo", output:"\u2299", ttype:CONST},-{input:"\\land", tag:"mo", output:"\u2227", ttype:CONST},-{input:"\\wedge", tag:"mo", output:"\u2227", ttype:CONST},-{input:"\\lor", tag:"mo", output:"\u2228", ttype:CONST},-{input:"\\vee", tag:"mo", output:"\u2228", ttype:CONST},-{input:"\\cap", tag:"mo", output:"\u2229", ttype:CONST},-{input:"\\cup", tag:"mo", output:"\u222A", ttype:CONST},-{input:"\\sqcap", tag:"mo", output:"\u2293", ttype:CONST},-{input:"\\sqcup", tag:"mo", output:"\u2294", ttype:CONST},-{input:"\\uplus", tag:"mo", output:"\u228E", ttype:CONST},-{input:"\\amalg", tag:"mo", output:"\u2210", ttype:CONST},-{input:"\\bigtriangleup",tag:"mo",output:"\u25B3", ttype:CONST},-{input:"\\bigtriangledown",tag:"mo",output:"\u25BD", ttype:CONST},-{input:"\\dag", tag:"mo", output:"\u2020", ttype:CONST},-{input:"\\dagger", tag:"mo", output:"\u2020", ttype:CONST},-{input:"\\ddag", tag:"mo", output:"\u2021", ttype:CONST},-{input:"\\ddagger", tag:"mo", output:"\u2021", ttype:CONST},-{input:"\\lhd", tag:"mo", output:"\u22B2", ttype:CONST},-{input:"\\rhd", tag:"mo", output:"\u22B3", ttype:CONST},-{input:"\\unlhd", tag:"mo", output:"\u22B4", ttype:CONST},-{input:"\\unrhd", tag:"mo", output:"\u22B5", ttype:CONST},---//BIG Operators-{input:"\\sum", tag:"mo", output:"\u2211", ttype:UNDEROVER},-{input:"\\prod", tag:"mo", output:"\u220F", ttype:UNDEROVER},-{input:"\\bigcap", tag:"mo", output:"\u22C2", ttype:UNDEROVER},-{input:"\\bigcup", tag:"mo", output:"\u22C3", ttype:UNDEROVER},-{input:"\\bigwedge", tag:"mo", output:"\u22C0", ttype:UNDEROVER},-{input:"\\bigvee", tag:"mo", output:"\u22C1", ttype:UNDEROVER},-{input:"\\bigsqcap", tag:"mo", output:"\u2A05", ttype:UNDEROVER},-{input:"\\bigsqcup", tag:"mo", output:"\u2A06", ttype:UNDEROVER},-{input:"\\coprod", tag:"mo", output:"\u2210", ttype:UNDEROVER},-{input:"\\bigoplus", tag:"mo", output:"\u2A01", ttype:UNDEROVER},-{input:"\\bigotimes", tag:"mo", output:"\u2A02", ttype:UNDEROVER},-{input:"\\bigodot", tag:"mo", output:"\u2A00", ttype:UNDEROVER},-{input:"\\biguplus", tag:"mo", output:"\u2A04", ttype:UNDEROVER},-{input:"\\int", tag:"mo", output:"\u222B", ttype:CONST},-{input:"\\oint", tag:"mo", output:"\u222E", ttype:CONST},--//binary relation symbols-{input:":=", tag:"mo", output:":=", ttype:CONST},-{input:"\\lt", tag:"mo", output:"<", ttype:CONST},-{input:"\\gt", tag:"mo", output:">", ttype:CONST},-{input:"\\ne", tag:"mo", output:"\u2260", ttype:CONST},-{input:"\\neq", tag:"mo", output:"\u2260", ttype:CONST},-{input:"\\le", tag:"mo", output:"\u2264", ttype:CONST},-{input:"\\leq", tag:"mo", output:"\u2264", ttype:CONST},-{input:"\\leqslant", tag:"mo", output:"\u2264", ttype:CONST},-{input:"\\ge", tag:"mo", output:"\u2265", ttype:CONST},-{input:"\\geq", tag:"mo", output:"\u2265", ttype:CONST},-{input:"\\geqslant", tag:"mo", output:"\u2265", ttype:CONST},-{input:"\\equiv", tag:"mo", output:"\u2261", ttype:CONST},-{input:"\\ll", tag:"mo", output:"\u226A", ttype:CONST},-{input:"\\gg", tag:"mo", output:"\u226B", ttype:CONST},-{input:"\\doteq", tag:"mo", output:"\u2250", ttype:CONST},-{input:"\\prec", tag:"mo", output:"\u227A", ttype:CONST},-{input:"\\succ", tag:"mo", output:"\u227B", ttype:CONST},-{input:"\\preceq", tag:"mo", output:"\u227C", ttype:CONST},-{input:"\\succeq", tag:"mo", output:"\u227D", ttype:CONST},-{input:"\\subset", tag:"mo", output:"\u2282", ttype:CONST},-{input:"\\supset", tag:"mo", output:"\u2283", ttype:CONST},-{input:"\\subseteq", tag:"mo", output:"\u2286", ttype:CONST},-{input:"\\supseteq", tag:"mo", output:"\u2287", ttype:CONST},-{input:"\\sqsubset", tag:"mo", output:"\u228F", ttype:CONST},-{input:"\\sqsupset", tag:"mo", output:"\u2290", ttype:CONST},-{input:"\\sqsubseteq", tag:"mo", output:"\u2291", ttype:CONST},-{input:"\\sqsupseteq", tag:"mo", output:"\u2292", ttype:CONST},-{input:"\\sim", tag:"mo", output:"\u223C", ttype:CONST},-{input:"\\simeq", tag:"mo", output:"\u2243", ttype:CONST},-{input:"\\approx", tag:"mo", output:"\u2248", ttype:CONST},-{input:"\\cong", tag:"mo", output:"\u2245", ttype:CONST},-{input:"\\Join", tag:"mo", output:"\u22C8", ttype:CONST},-{input:"\\bowtie", tag:"mo", output:"\u22C8", ttype:CONST},-{input:"\\in", tag:"mo", output:"\u2208", ttype:CONST},-{input:"\\ni", tag:"mo", output:"\u220B", ttype:CONST},-{input:"\\owns", tag:"mo", output:"\u220B", ttype:CONST},-{input:"\\propto", tag:"mo", output:"\u221D", ttype:CONST},-{input:"\\vdash", tag:"mo", output:"\u22A2", ttype:CONST},-{input:"\\dashv", tag:"mo", output:"\u22A3", ttype:CONST},-{input:"\\models", tag:"mo", output:"\u22A8", ttype:CONST},-{input:"\\perp", tag:"mo", output:"\u22A5", ttype:CONST},-{input:"\\smile", tag:"mo", output:"\u2323", ttype:CONST},-{input:"\\frown", tag:"mo", output:"\u2322", ttype:CONST},-{input:"\\asymp", tag:"mo", output:"\u224D", ttype:CONST},-{input:"\\notin", tag:"mo", output:"\u2209", ttype:CONST},--//matrices-{input:"\\begin{eqnarray}", output:"X", ttype:MATRIX, invisible:true},-{input:"\\begin{array}", output:"X", ttype:MATRIX, invisible:true},-{input:"\\\\", output:"}&{", ttype:DEFINITION},-{input:"\\end{eqnarray}", output:"}}", ttype:DEFINITION},-{input:"\\end{array}", output:"}}", ttype:DEFINITION},--//grouping and literal brackets -- ieval is for IE-{input:"\\big", tag:"mo", output:"X", atval:"1.2", ieval:"2.2", ttype:BIG},-{input:"\\Big", tag:"mo", output:"X", atval:"1.6", ieval:"2.6", ttype:BIG},-{input:"\\bigg", tag:"mo", output:"X", atval:"2.2", ieval:"3.2", ttype:BIG},-{input:"\\Bigg", tag:"mo", output:"X", atval:"2.9", ieval:"3.9", ttype:BIG},-{input:"\\left", tag:"mo", output:"X", ttype:LEFTBRACKET},-{input:"\\right", tag:"mo", output:"X", ttype:RIGHTBRACKET},-{input:"{", output:"{", ttype:LEFTBRACKET, invisible:true},-{input:"}", output:"}", ttype:RIGHTBRACKET, invisible:true},--{input:"(", tag:"mo", output:"(", atval:"1", ttype:STRETCHY},-{input:"[", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},-{input:"\\lbrack", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},-{input:"\\{", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},-{input:"\\lbrace", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},-{input:"\\langle", tag:"mo", output:"\u2329", atval:"1", ttype:STRETCHY},-{input:"\\lfloor", tag:"mo", output:"\u230A", atval:"1", ttype:STRETCHY},-{input:"\\lceil", tag:"mo", output:"\u2308", atval:"1", ttype:STRETCHY},--// rtag:"mi" causes space to be inserted before a following sin, cos, etc.-// (see function LMparseExpr() )-{input:")", tag:"mo",output:")", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"]", tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rbrack",tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\}", tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1",ttype:STRETCHY},--// "|", "\\|", "\\vert" and "\\Vert" modified later: lspace = rspace = 0em-{input:"|", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},-{input:"\\|", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},-{input:"\\vert", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},-{input:"\\Vert", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},-{input:"\\mid", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},-{input:"\\parallel", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},-{input:"/", tag:"mo", output:"/", atval:"1.01", ttype:STRETCHY},-{input:"\\backslash", tag:"mo", output:"\u2216", atval:"1", ttype:STRETCHY},-{input:"\\setminus", tag:"mo", output:"\\", ttype:CONST},--//miscellaneous symbols-{input:"\\!", tag:"mspace", atname:"width", atval:"-0.167em", ttype:SPACE},-{input:"\\,", tag:"mspace", atname:"width", atval:"0.167em", ttype:SPACE},-{input:"\\>", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},-{input:"\\:", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},-{input:"\\;", tag:"mspace", atname:"width", atval:"0.278em", ttype:SPACE},-{input:"~", tag:"mspace", atname:"width", atval:"0.333em", ttype:SPACE},-{input:"\\quad", tag:"mspace", atname:"width", atval:"1em", ttype:SPACE},-{input:"\\qquad", tag:"mspace", atname:"width", atval:"2em", ttype:SPACE},-//{input:"{}", tag:"mo", output:"\u200B", ttype:CONST}, // zero-width-{input:"\\prime", tag:"mo", output:"\u2032", ttype:CONST},-{input:"'", tag:"mo", output:"\u02B9", ttype:CONST},-{input:"''", tag:"mo", output:"\u02BA", ttype:CONST},-{input:"'''", tag:"mo", output:"\u2034", ttype:CONST},-{input:"''''", tag:"mo", output:"\u2057", ttype:CONST},-{input:"\\ldots", tag:"mo", output:"\u2026", ttype:CONST},-{input:"\\cdots", tag:"mo", output:"\u22EF", ttype:CONST},-{input:"\\vdots", tag:"mo", output:"\u22EE", ttype:CONST},-{input:"\\ddots", tag:"mo", output:"\u22F1", ttype:CONST},-{input:"\\forall", tag:"mo", output:"\u2200", ttype:CONST},-{input:"\\exists", tag:"mo", output:"\u2203", ttype:CONST},-{input:"\\Re", tag:"mo", output:"\u211C", ttype:CONST},-{input:"\\Im", tag:"mo", output:"\u2111", ttype:CONST},-{input:"\\aleph", tag:"mo", output:"\u2135", ttype:CONST},-{input:"\\hbar", tag:"mo", output:"\u210F", ttype:CONST},-{input:"\\ell", tag:"mo", output:"\u2113", ttype:CONST},-{input:"\\wp", tag:"mo", output:"\u2118", ttype:CONST},-{input:"\\emptyset", tag:"mo", output:"\u2205", ttype:CONST},-{input:"\\infty", tag:"mo", output:"\u221E", ttype:CONST},-{input:"\\surd", tag:"mo", output:"\\sqrt{}", ttype:DEFINITION},-{input:"\\partial", tag:"mo", output:"\u2202", ttype:CONST},-{input:"\\nabla", tag:"mo", output:"\u2207", ttype:CONST},-{input:"\\triangle", tag:"mo", output:"\u25B3", ttype:CONST},-{input:"\\therefore", tag:"mo", output:"\u2234", ttype:CONST},-{input:"\\angle", tag:"mo", output:"\u2220", ttype:CONST},-//{input:"\\\\ ", tag:"mo", output:"\u00A0", ttype:CONST},-{input:"\\diamond", tag:"mo", output:"\u22C4", ttype:CONST},-//{input:"\\Diamond", tag:"mo", output:"\u25CA", ttype:CONST},-{input:"\\Diamond", tag:"mo", output:"\u25C7", ttype:CONST},-{input:"\\neg", tag:"mo", output:"\u00AC", ttype:CONST},-{input:"\\lnot", tag:"mo", output:"\u00AC", ttype:CONST},-{input:"\\bot", tag:"mo", output:"\u22A5", ttype:CONST},-{input:"\\top", tag:"mo", output:"\u22A4", ttype:CONST},-{input:"\\square", tag:"mo", output:"\u25AB", ttype:CONST},-{input:"\\Box", tag:"mo", output:"\u25A1", ttype:CONST},-{input:"\\wr", tag:"mo", output:"\u2240", ttype:CONST},--//standard functions-//Note UNDEROVER *must* have tag:"mo" to work properly-{input:"\\arccos", tag:"mi", output:"arccos", ttype:UNARY, func:true},-{input:"\\arcsin", tag:"mi", output:"arcsin", ttype:UNARY, func:true},-{input:"\\arctan", tag:"mi", output:"arctan", ttype:UNARY, func:true},-{input:"\\arg", tag:"mi", output:"arg", ttype:UNARY, func:true},-{input:"\\cos", tag:"mi", output:"cos", ttype:UNARY, func:true},-{input:"\\cosh", tag:"mi", output:"cosh", ttype:UNARY, func:true},-{input:"\\cot", tag:"mi", output:"cot", ttype:UNARY, func:true},-{input:"\\coth", tag:"mi", output:"coth", ttype:UNARY, func:true},-{input:"\\csc", tag:"mi", output:"csc", ttype:UNARY, func:true},-{input:"\\deg", tag:"mi", output:"deg", ttype:UNARY, func:true},-{input:"\\det", tag:"mi", output:"det", ttype:UNARY, func:true},-{input:"\\dim", tag:"mi", output:"dim", ttype:UNARY, func:true}, //CONST?-{input:"\\exp", tag:"mi", output:"exp", ttype:UNARY, func:true},-{input:"\\gcd", tag:"mi", output:"gcd", ttype:UNARY, func:true}, //CONST?-{input:"\\hom", tag:"mi", output:"hom", ttype:UNARY, func:true},-{input:"\\inf", tag:"mo", output:"inf", ttype:UNDEROVER},-{input:"\\ker", tag:"mi", output:"ker", ttype:UNARY, func:true},-{input:"\\lg", tag:"mi", output:"lg", ttype:UNARY, func:true},-{input:"\\lim", tag:"mo", output:"lim", ttype:UNDEROVER},-{input:"\\liminf", tag:"mo", output:"liminf", ttype:UNDEROVER},-{input:"\\limsup", tag:"mo", output:"limsup", ttype:UNDEROVER},-{input:"\\ln", tag:"mi", output:"ln", ttype:UNARY, func:true},-{input:"\\log", tag:"mi", output:"log", ttype:UNARY, func:true},-{input:"\\max", tag:"mo", output:"max", ttype:UNDEROVER},-{input:"\\min", tag:"mo", output:"min", ttype:UNDEROVER},-{input:"\\Pr", tag:"mi", output:"Pr", ttype:UNARY, func:true},-{input:"\\sec", tag:"mi", output:"sec", ttype:UNARY, func:true},-{input:"\\sin", tag:"mi", output:"sin", ttype:UNARY, func:true},-{input:"\\sinh", tag:"mi", output:"sinh", ttype:UNARY, func:true},-{input:"\\sup", tag:"mo", output:"sup", ttype:UNDEROVER},-{input:"\\tan", tag:"mi", output:"tan", ttype:UNARY, func:true},-{input:"\\tanh", tag:"mi", output:"tanh", ttype:UNARY, func:true},--//arrows-{input:"\\gets", tag:"mo", output:"\u2190", ttype:CONST},-{input:"\\leftarrow", tag:"mo", output:"\u2190", ttype:CONST},-{input:"\\to", tag:"mo", output:"\u2192", ttype:CONST},-{input:"\\rightarrow", tag:"mo", output:"\u2192", ttype:CONST},-{input:"\\leftrightarrow", tag:"mo", output:"\u2194", ttype:CONST},-{input:"\\uparrow", tag:"mo", output:"\u2191", ttype:CONST},-{input:"\\downarrow", tag:"mo", output:"\u2193", ttype:CONST},-{input:"\\updownarrow", tag:"mo", output:"\u2195", ttype:CONST},-{input:"\\Leftarrow", tag:"mo", output:"\u21D0", ttype:CONST},-{input:"\\Rightarrow", tag:"mo", output:"\u21D2", ttype:CONST},-{input:"\\Leftrightarrow", tag:"mo", output:"\u21D4", ttype:CONST},-{input:"\\iff", tag:"mo", output:"~\\Longleftrightarrow~", ttype:DEFINITION},-{input:"\\Uparrow", tag:"mo", output:"\u21D1", ttype:CONST},-{input:"\\Downarrow", tag:"mo", output:"\u21D3", ttype:CONST},-{input:"\\Updownarrow", tag:"mo", output:"\u21D5", ttype:CONST},-{input:"\\mapsto", tag:"mo", output:"\u21A6", ttype:CONST},-{input:"\\longleftarrow", tag:"mo", output:"\u2190", ttype:LONG},-{input:"\\longrightarrow", tag:"mo", output:"\u2192", ttype:LONG},-{input:"\\longleftrightarrow", tag:"mo", output:"\u2194", ttype:LONG},-{input:"\\Longleftarrow", tag:"mo", output:"\u21D0", ttype:LONG},-{input:"\\Longrightarrow", tag:"mo", output:"\u21D2", ttype:LONG},-{input:"\\implies", tag:"mo", output:"\u21D2", ttype:LONG},-{input:"\\Longleftrightarrow", tag:"mo", output:"\u21D4", ttype:LONG},-{input:"\\longmapsto", tag:"mo", output:"\u21A6", ttype:CONST},- // disaster if LONG--//commands with argument--{input:"\\sqrt", tag:"msqrt", output:"sqrt", ttype:UNARY},-{input:"\\root", tag:"mroot", output:"root", ttype:BINARY},-{input:"\\frac", tag:"mfrac", output:"/", ttype:BINARY},-{input:"\\stackrel", tag:"mover", output:"stackrel", ttype:BINARY},-{input:"\\atop", tag:"mfrac", output:"", ttype:INFIX},-{input:"\\choose", tag:"mfrac", output:"", ttype:INFIX},-{input:"_", tag:"msub", output:"_", ttype:INFIX},-{input:"^", tag:"msup", output:"^", ttype:INFIX},-{input:"\\mathrm", tag:"mtext", output:"text", ttype:TEXT},-{input:"\\mbox", tag:"mtext", output:"mbox", ttype:TEXT},--//diacritical marks-{input:"\\acute", tag:"mover", output:"\u00B4", ttype:UNARY, acc:true},-//{input:"\\acute", tag:"mover", output:"\u0317", ttype:UNARY, acc:true},-//{input:"\\acute", tag:"mover", output:"\u0301", ttype:UNARY, acc:true},-//{input:"\\grave", tag:"mover", output:"\u0300", ttype:UNARY, acc:true},-//{input:"\\grave", tag:"mover", output:"\u0316", ttype:UNARY, acc:true},-{input:"\\grave", tag:"mover", output:"\u0060", ttype:UNARY, acc:true},-{input:"\\breve", tag:"mover", output:"\u02D8", ttype:UNARY, acc:true},-{input:"\\check", tag:"mover", output:"\u02C7", ttype:UNARY, acc:true},-{input:"\\dot", tag:"mover", output:".", ttype:UNARY, acc:true},-{input:"\\ddot", tag:"mover", output:"..", ttype:UNARY, acc:true},-//{input:"\\ddot", tag:"mover", output:"\u00A8", ttype:UNARY, acc:true},-{input:"\\mathring", tag:"mover", output:"\u00B0", ttype:UNARY, acc:true},-{input:"\\vec", tag:"mover", output:"\u20D7", ttype:UNARY, acc:true},-{input:"\\overrightarrow",tag:"mover",output:"\u20D7", ttype:UNARY, acc:true},-{input:"\\overleftarrow",tag:"mover", output:"\u20D6", ttype:UNARY, acc:true},-{input:"\\hat", tag:"mover", output:"\u005E", ttype:UNARY, acc:true},-{input:"\\widehat", tag:"mover", output:"\u0302", ttype:UNARY, acc:true},-{input:"\\tilde", tag:"mover", output:"~", ttype:UNARY, acc:true},-//{input:"\\tilde", tag:"mover", output:"\u0303", ttype:UNARY, acc:true},-{input:"\\widetilde", tag:"mover", output:"\u02DC", ttype:UNARY, acc:true},-{input:"\\bar", tag:"mover", output:"\u203E", ttype:UNARY, acc:true},-{input:"\\overbrace", tag:"mover", output:"\u23B4", ttype:UNARY, acc:true},-{input:"\\overline", tag:"mover", output:"\u00AF", ttype:UNARY, acc:true},-{input:"\\underbrace", tag:"munder", output:"\u23B5", ttype:UNARY, acc:true},-{input:"\\underline", tag:"munder", output:"\u00AF", ttype:UNARY, acc:true},-//{input:"underline", tag:"munder", output:"\u0332", ttype:UNARY, acc:true},--//typestyles and fonts-{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", ttype:UNARY},-{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", ttype:UNARY},-{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", ttype:UNARY},-{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", ttype:UNARY},-{input:"\\textrm", tag:"mstyle", output:"\\mathrm", ttype: DEFINITION},-{input:"\\mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},-{input:"\\textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},-{input:"\\mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},-{input:"\\textit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},-{input:"\\mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},-{input:"\\texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},-{input:"\\mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", ttype:UNARY},-{input:"\\mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", ttype:UNARY, codes:AMbbb},-{input:"\\mathcal",tag:"mstyle", atname:"mathvariant", atval:"script", ttype:UNARY, codes:AMcal},-{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant", atval:"fraktur",ttype:UNARY, codes:AMfrk}-];--var LMnames = []; //list of input symbols--function LMremoveCharsAndBlanks(str,n) {-//remove n characters and any following blanks- var st;- st = str.slice(n);- for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);- return st.slice(i);-}--function LMgetSymbol(str) {-//return maximal initial substring of str that appears in names-//return null if there is none- var k = 0; //new pos- var j = 0; //old pos- var mk; //match pos- var st;- var tagst;- var match = "";- var more = true;- for (var i=1; i<=str.length && more; i++) {- st = str.slice(0,i); //initial substring of length i- j = k;- k = position(LMnames, st, j);- if (k<LMnames.length && str.slice(0,LMnames[k].length)==LMnames[k]){- match = LMnames[k];- mk = k;- i = match.length;- }- more = k<LMnames.length && str.slice(0,LMnames[k].length)>=LMnames[k];- }- LMpreviousSymbol=LMcurrentSymbol;- if (match!=""){- LMcurrentSymbol=LMsymbols[mk].ttype;- return LMsymbols[mk];- }- LMcurrentSymbol=CONST;- k = 1;- st = str.slice(0,1); //take 1 character- if ("0"<=st && st<="9") tagst = "mn";- else tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");-/*-// Commented out by DRW (not fully understood, but probably to do with-// use of "/" as an INFIX version of "\\frac", which we don't want):-//}-//if (st=="-" && LMpreviousSymbol==INFIX) {-// LMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse-// return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};-//}-*/- return {input:st, tag:tagst, output:st, ttype:CONST};-}---/*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 left brackets-r ::= } | \right 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 LMpreviousSymbol,LMcurrentSymbol;--function LMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag]- var symbol, node, result, result2, i, st,// rightvert = false,- newFrag = document.createDocumentFragment();- str = LMremoveCharsAndBlanks(str,0);- symbol = LMgetSymbol(str); //either a token or a bracket or empty- if (symbol == null || symbol.ttype == RIGHTBRACKET)- return [null,str,null];- if (symbol.ttype == DEFINITION) {- str = symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length);- symbol = LMgetSymbol(str);- if (symbol == null || symbol.ttype == RIGHTBRACKET)- return [null,str,null];- }- str = LMremoveCharsAndBlanks(str,symbol.input.length);- switch (symbol.ttype) {- case SPACE:- node = createMmlNode(symbol.tag);- node.setAttribute(symbol.atname,symbol.atval);- return [node,str,symbol.tag];- case UNDEROVER:- if (isIE) {- if (symbol.input.substr(0,4) == "\\big") { // botch for missing symbols- str = "\\"+symbol.input.substr(4)+str; // make \bigcup = \cup etc.- symbol = LMgetSymbol(str);- symbol.ttype = UNDEROVER;- str = LMremoveCharsAndBlanks(str,symbol.input.length);- }- }- return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str,symbol.tag];- case CONST:- var output = symbol.output;- if (isIE) {- if (symbol.input == "'")- output = "\u2032";- else if (symbol.input == "''")- output = "\u2033";- else if (symbol.input == "'''")- output = "\u2033\u2032";- else if (symbol.input == "''''")- output = "\u2033\u2033";- else if (symbol.input == "\\square")- output = "\u25A1"; // same as \Box- else if (symbol.input.substr(0,5) == "\\frac") {- // botch for missing fractions- var denom = symbol.input.substr(6,1);- if (denom == "5" || denom == "6") {- str = symbol.input.replace(/\\frac/,"\\frac ")+str;- return [node,str,symbol.tag];- }- }- }- node = createMmlNode(symbol.tag,document.createTextNode(output));- return [node,str,symbol.tag];- case LONG: // added by DRW- node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));- node.setAttribute("minsize","1.5");- node.setAttribute("maxsize","1.5");- node = createMmlNode("mover",node);- node.appendChild(createMmlNode("mspace"));- return [node,str,symbol.tag];- case STRETCHY: // added by DRW- if (isIE && symbol.input == "\\backslash")- symbol.output = "\\"; // doesn't expand, but then nor does "\u2216"- node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));- if (symbol.input == "|" || symbol.input == "\\vert" ||- symbol.input == "\\|" || symbol.input == "\\Vert") {- node.setAttribute("lspace","0em");- node.setAttribute("rspace","0em");- }- node.setAttribute("maxsize",symbol.atval); // don't allow to stretch here- if (symbol.rtag != null)- return [node,str,symbol.rtag];- else- return [node,str,symbol.tag];- case BIG: // added by DRW- var atval = symbol.atval;- if (isIE)- atval = symbol.ieval;- symbol = LMgetSymbol(str);- if (symbol == null)- return [null,str,null];- str = LMremoveCharsAndBlanks(str,symbol.input.length);- node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));- if (isIE) { // to get brackets to expand- var space = createMmlNode("mspace");- space.setAttribute("height",atval+"ex");- node = createMmlNode("mrow",node);- node.appendChild(space);- } else { // ignored in IE- node.setAttribute("minsize",atval);- node.setAttribute("maxsize",atval);- }- return [node,str,symbol.tag];- case LEFTBRACKET: //read (expr+)- if (symbol.input == "\\left") { // left what?- symbol = LMgetSymbol(str);- if (symbol != null) {- if (symbol.input == ".")- symbol.invisible = true;- str = LMremoveCharsAndBlanks(str,symbol.input.length);- }- }- result = LMparseExpr(str,true,false);- if (symbol==null ||- (typeof symbol.invisible == "boolean" && symbol.invisible))- node = createMmlNode("mrow",result[0]);- else {- node = createMmlNode("mo",document.createTextNode(symbol.output));- node = createMmlNode("mrow",node);- node.appendChild(result[0]);- }- return [node,result[1],result[2]];- case MATRIX: //read (expr+)- if (symbol.input == "\\begin{array}") {- var mask = "";- symbol = LMgetSymbol(str);- str = LMremoveCharsAndBlanks(str,0);- if (symbol == null)- mask = "l";- else {- str = LMremoveCharsAndBlanks(str,symbol.input.length);- if (symbol.input != "{")- mask = "l";- else do {- symbol = LMgetSymbol(str);- if (symbol != null) {- str = LMremoveCharsAndBlanks(str,symbol.input.length);- if (symbol.input != "}")- mask = mask+symbol.input;- }- } while (symbol != null && symbol.input != "" && symbol.input != "}");- }- result = LMparseExpr("{"+str,true,true);-// if (result[0]==null) return [createMmlNode("mo",-// document.createTextNode(symbol.input)),str];- node = createMmlNode("mtable",result[0]);- mask = mask.replace(/l/g,"left ");- mask = mask.replace(/r/g,"right ");- mask = mask.replace(/c/g,"center ");- node.setAttribute("columnalign",mask);- node.setAttribute("displaystyle","false");- if (isIE)- return [node,result[1],null];-// trying to get a *little* bit of space around the array-// (IE already includes it)- var lspace = createMmlNode("mspace");- lspace.setAttribute("width","0.167em");- var rspace = createMmlNode("mspace");- rspace.setAttribute("width","0.167em");- var node1 = createMmlNode("mrow",lspace);- node1.appendChild(node);- node1.appendChild(rspace);- return [node1,result[1],null];- } else { // eqnarray- result = LMparseExpr("{"+str,true,true);- node = createMmlNode("mtable",result[0]);- if (isIE)- node.setAttribute("columnspacing","0.25em"); // best in practice?- else- node.setAttribute("columnspacing","0.167em"); // correct (but ignored?)- node.setAttribute("columnalign","right center left");- node.setAttribute("displaystyle","true");- node = createMmlNode("mrow",node);- return [node,result[1],null];- }- case TEXT:- if (str.charAt(0)=="{") i=str.indexOf("}");- else i = 0;- if (i==-1)- i = str.length;- st = str.slice(1,i);- if (st.charAt(0) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","0.33em"); // was 1ex- newFrag.appendChild(node);- }- newFrag.appendChild(- createMmlNode(symbol.tag,document.createTextNode(st)));- if (st.charAt(st.length-1) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","0.33em"); // was 1ex- newFrag.appendChild(node);- }- str = LMremoveCharsAndBlanks(str,i+1);- return [createMmlNode("mrow",newFrag),str,null];- case UNARY:- result = LMparseSexpr(str);- if (result[0]==null) return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str];- if (typeof symbol.func == "boolean" && symbol.func) { // functions hack- st = str.charAt(0);-// if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {- if (st=="^" || st=="_" || st==",") {- return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str,symbol.tag];- } else {- node = createMmlNode("mrow",- createMmlNode(symbol.tag,document.createTextNode(symbol.output)));- if (isIE) {- var space = createMmlNode("mspace");- space.setAttribute("width","0.167em");- node.appendChild(space);- }- node.appendChild(result[0]);- return [node,result[1],symbol.tag];- }- }- if (symbol.input == "\\sqrt") { // sqrt- if (isIE) { // set minsize, for \surd- var space = createMmlNode("mspace");- space.setAttribute("height","1.2ex");- space.setAttribute("width","0em"); // probably no effect- node = createMmlNode(symbol.tag,result[0])-// node.setAttribute("minsize","1"); // ignored-// node = createMmlNode("mrow",node); // hopefully unnecessary- node.appendChild(space);- return [node,result[1],symbol.tag];- } else- return [createMmlNode(symbol.tag,result[0]),result[1],symbol.tag];- } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent- node = createMmlNode(symbol.tag,result[0]);- var output = symbol.output;- if (isIE) {- if (symbol.input == "\\hat")- output = "\u0302";- else if (symbol.input == "\\widehat")- output = "\u005E";- else if (symbol.input == "\\bar")- output = "\u00AF";- else if (symbol.input == "\\grave")- output = "\u0300";- else if (symbol.input == "\\tilde")- output = "\u0303";- }- var node1 = createMmlNode("mo",document.createTextNode(output));- if (symbol.input == "\\vec" || symbol.input == "\\check")- // don't allow to stretch- node1.setAttribute("maxsize","1.2");- // why doesn't "1" work? \vec nearly disappears in firefox- if (isIE && symbol.input == "\\bar")- node1.setAttribute("maxsize","0.5");- if (symbol.input == "\\underbrace" || symbol.input == "\\underline")- node1.setAttribute("accentunder","true");- else- node1.setAttribute("accent","true");- node.appendChild(node1);- if (symbol.input == "\\overbrace" || symbol.input == "\\underbrace")- node.ttype = UNDEROVER;- return [node,result[1],symbol.tag];- } else { // font change or displaystyle command- if (!isIE && typeof symbol.codes != "undefined") {- for (i=0; i<result[0].childNodes.length; i++)- if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {- st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:- result[0].childNodes[i].firstChild.nodeValue);- var newst = [];- for (var j=0; j<st.length; j++)- if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +- String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);- else newst = newst + st.charAt(j);- if (result[0].nodeName=="mi")- result[0]=createMmlNode("mo").- appendChild(document.createTextNode(newst));- else result[0].replaceChild(createMmlNode("mo").- appendChild(document.createTextNode(newst)),result[0].childNodes[i]);- }- }- node = createMmlNode(symbol.tag,result[0]);- node.setAttribute(symbol.atname,symbol.atval);- if (symbol.input == "\\scriptstyle" ||- symbol.input == "\\scriptscriptstyle")- node.setAttribute("displaystyle","false");- return [node,result[1],symbol.tag];- }- case BINARY:- result = LMparseSexpr(str);- if (result[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str,null];- result2 = LMparseSexpr(result[1]);- if (result2[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str,null];- if (symbol.input=="\\root" || symbol.input=="\\stackrel")- newFrag.appendChild(result2[0]);- newFrag.appendChild(result[0]);- if (symbol.input=="\\frac") newFrag.appendChild(result2[0]);- return [createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];- case INFIX:- str = LMremoveCharsAndBlanks(str,symbol.input.length);- return [createMmlNode("mo",document.createTextNode(symbol.output)),- str,symbol.tag];- default:- return [createMmlNode(symbol.tag, //its a constant- document.createTextNode(symbol.output)),str,symbol.tag];- }-}--function LMparseIexpr(str) {- var symbol, sym1, sym2, node, result, tag, underover;- str = LMremoveCharsAndBlanks(str,0);- sym1 = LMgetSymbol(str);- result = LMparseSexpr(str);- node = result[0];- str = result[1];- tag = result[2];- symbol = LMgetSymbol(str);- if (symbol.ttype == INFIX) {- str = LMremoveCharsAndBlanks(str,symbol.input.length);- result = LMparseSexpr(str);- if (result[0] == null) // show box in place of missing argument- result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));- str = result[1];- tag = result[2];- if (symbol.input == "_" || symbol.input == "^") {- sym2 = LMgetSymbol(str);- tag = null; // no space between x^2 and a following sin, cos, etc.-// This is for \underbrace and \overbrace- underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER));-// underover = (sym1.ttype == UNDEROVER);- if (symbol.input == "_" && sym2.input == "^") {- str = LMremoveCharsAndBlanks(str,sym2.input.length);- var res2 = LMparseSexpr(str);- str = res2[1];- tag = res2[2]; // leave space between x_1^2 and a following sin etc.- node = createMmlNode((underover?"munderover":"msubsup"),node);- node.appendChild(result[0]);- node.appendChild(res2[0]);- } else if (symbol.input == "_") {- node = createMmlNode((underover?"munder":"msub"),node);- node.appendChild(result[0]);- } else {- node = createMmlNode((underover?"mover":"msup"),node);- node.appendChild(result[0]);- }- node = createMmlNode("mrow",node); // so sum does not stretch- } else {- node = createMmlNode(symbol.tag,node);- if (symbol.input == "\\atop" || symbol.input == "\\choose")- node.setAttribute("linethickness","0ex");- node.appendChild(result[0]);- if (symbol.input == "\\choose")- node = createMmlNode("mfenced",node);- }- }- return [node,str,tag];-}--function LMparseExpr(str,rightbracket,matrix) {- var symbol, node, result, i, tag,- newFrag = document.createDocumentFragment();- do {- str = LMremoveCharsAndBlanks(str,0);- result = LMparseIexpr(str);- node = result[0];- str = result[1];- tag = result[2];- symbol = LMgetSymbol(str);- if (node!=undefined) {- if ((tag == "mn" || tag == "mi") && symbol!=null &&- typeof symbol.func == "boolean" && symbol.func) {- // Add space before \sin in 2\sin x or x\sin x- var space = createMmlNode("mspace");- space.setAttribute("width","0.167em");- node = createMmlNode("mrow",node);- node.appendChild(space);- }- newFrag.appendChild(node);- }- } while ((symbol.ttype != RIGHTBRACKET)- && symbol!=null && symbol.output!="");- tag = null;- if (symbol.ttype == RIGHTBRACKET) {- if (symbol.input == "\\right") { // right what?- str = LMremoveCharsAndBlanks(str,symbol.input.length);- symbol = LMgetSymbol(str);- if (symbol != null && symbol.input == ".")- symbol.invisible = true;- if (symbol != null)- tag = symbol.rtag;- }- if (symbol!=null)- str = LMremoveCharsAndBlanks(str,symbol.input.length); // ready to return- var len = newFrag.childNodes.length;- if (matrix &&- len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&- newFrag.childNodes[len-2].nodeName == "mo" &&- newFrag.childNodes[len-2].firstChild.nodeValue == "&") { //matrix- var pos = []; // positions of ampersands- var m = newFrag.childNodes.length;- for (i=0; matrix && i<m; i=i+2) {- pos[i] = [];- node = newFrag.childNodes[i];- for (var j=0; j<node.childNodes.length; j++)- if (node.childNodes[j].firstChild.nodeValue=="&")- pos[i][pos[i].length]=j;- }- var row, frag, n, k, table = document.createDocumentFragment();- for (i=0; i<m; i=i+2) {- row = document.createDocumentFragment();- frag = document.createDocumentFragment();- node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow>- n = node.childNodes.length;- k = 0;- for (j=0; j<n; j++) {- if (typeof pos[i][k] != "undefined" && j==pos[i][k]){- node.removeChild(node.firstChild); //remove &- row.appendChild(createMmlNode("mtd",frag));- k++;- } else frag.appendChild(node.firstChild);- }- row.appendChild(createMmlNode("mtd",frag));- if (newFrag.childNodes.length>2) {- newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow>- newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo>- }- table.appendChild(createMmlNode("mtr",row));- }- return [table,str];- }- if (typeof symbol.invisible != "boolean" || !symbol.invisible) {- node = createMmlNode("mo",document.createTextNode(symbol.output));- newFrag.appendChild(node);- }- }- return [newFrag,str,tag];-}--var tcnt = 0, dcnt = 0; //theorem and definition counters--function simpleLaTeXformatting(st) {- st = st.replace(/\$\$((.|\n)*?)\$\$/g,"<p align=\"center\">$\\displaystyle{$1}$</p>");- st = st.replace(/\\begin{(theorem|lemma|proposition|corollary)}((.|\n)*?)\\end{\1}/g,function(r,s,t){tcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+tcnt+".</b> <i>"+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+"</i>"});- st = st.replace(/\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\n)*?)\\end{\1}/g,function(r,s,t){dcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+dcnt+".</b> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")});- st = st.replace(/\\begin{proof}((.|\n)*?)\\end{proof}/g,function(s,t){return "<i>Proof:</i> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+" □"});- st = st.replace(/\\emph{(.*?)}/g,"<em>$1</em>");- st = st.replace(/\\textbf{(.*?)}/g,"<b>$1</b>");- st = st.replace(/\\cite{(.*?)}/g,"[$1]");- st = st.replace(/\\chapter{(.*?)}/g,"<h2>$1</h2>");- st = st.replace(/\\section{(.*?)}(\s*<\/?(br|p)\s?\/?>)?/g,"<h3>$1</h3>");- st = st.replace(/\\subsection{((.|\n)*?)}/g,"<h4>$1</h4>");- st = st.replace(/\\begin{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"<ul>");- st = st.replace(/\\item\s((.|\n)*?)(?=(\\item|\\end))/g,"<li>$1</li>");- st = st.replace(/\\end{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"</ul>");- st = st.replace(/\\begin{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"<ol>");- st = st.replace(/\\end{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"</ol>");- st = st.replace(/\\item\[(.*?)]{(.*?)}/g,"<dt>$1</dt><dd>$2</dd>");- st = st.replace(/\\begin{description}/g,"<dl>");- st = st.replace(/\\end{description}/g,"</dl>");- st = st.replace(/\\newline\b/g,"<br/>");- st = st.replace(/\\newpage\b/g,"<br style=\"page-break-after:always;\">");- st = st.replace(/\\par\b/g,"<p> </p>");- st = st.replace(/\\bigskip/g,"<p style=\"margin-bottom:0.5in\"> </p>");- st = st.replace(/\\medskip/g,"<p style=\"margin-bottom:0.3in\"> </p>");- st = st.replace(/\\smallskip/g,"<p style=\"margin-bottom:0.15in\"> </p>");- st = st.replace(/\\begin{center}((.|\n)*?)\\end{center}/g,"<center>$1</center>");- return st-}--function ASCIIandgraphformatting(st) {- st = st.replace(/<sup>(.*?)<\/sup>(\s|(\S))/gi,"^{$1} $3");-//st = st.replace(/<\/?font.*?>/gi,""); // do this only in amath...endamath- st = st.replace(/(Proof:)/g,"<i>$1</i>");- st = st.replace(/QED/g," □");- st = st.replace(/(\\?end{?a?math}?)/ig,"<span></span>$1");- st = st.replace(/(\bamath\b|\\begin{a?math})/ig,"<span></span>$1");- st = st.replace(/([>\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\W\W?(\w|\s|-|\.)*?\W?:)/g,"$1<b>$2$3</b>");- st = st.replace(/<embed\s+class\s?=\s?"?ASCIIsvg"?/gi,"<embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\"");- st = st.replace(/(?:\\begin{a?graph}|\bagraph|\(:graph\s)((.|\n)*?)(?:\\end{a?graph}|enda?graph|:\))/g,function(s,t){return "<table><tr><td><div class=\"ASCIIsvg\"><embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\" script=\'"+t.replace(/<\/?(br|p|pre)\s?\/?>/gi,"\n")+"\'/></div></td></tr></table>"});- st = st.replace(/insertASCIIMathCalculator/g,"<div class=\"ASCIIMathCalculator\"></div>");-//alert(dsvglocation)- return st-}--function LMprocessNode(n) {- var frag,st;- try {- st = n.innerHTML;- } catch(err) {}- var am = /amath\b|graph/i.test(st);- if ((st==null || st.indexOf("\$ ")!=-1 || st.indexOf("\$<")!=-1 || - st.indexOf("\\begin")!=-1 || am || st.slice(-1)=="$" ||- st.indexOf("\$\n")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){- if (!avoidinnerHTML && translateLaTeXformatting) - st = simpleLaTeXformatting(st);- if (st!=null && am && !avoidinnerHTML) {- st = ASCIIandgraphformatting(st);- }- st = st.replace(/%7E/g,"~"); // else PmWiki has url issues-//alert(st)- if (!avoidinnerHTML) n.innerHTML = st;- processNodeR(n,false,true);- }-/* if (isIE) { //needed to match size and font of formula to surrounding text- frag = document.getElementsByTagName('math');- for (var i=0;i<frag.length;i++) frag[i].update() //is this really needed?- }*/-}--/* ASCIIsvg.js-==============-JavaScript routines to dynamically generate Scalable Vector Graphics-using a mathematical xy-coordinate system (y increases upwards) and-very intuitive JavaScript commands (no programming experience required).-ASCIIsvg.js is good for learning math and illustrating online math texts.-Works with Internet Explorer+Adobe SVGviewer and SVG enabled Mozilla/Firefox.--Ver 1.2.9 July 31, 2007 (c) Peter Jipsen http://www.chapman.edu/~jipsen-Latest version at http://math.chapman.edu/~jipsen/math/pub/ASCIIsvg.js-If you use it on a webpage, please send the URL to jipsen@chapman.edu--This program is free software; you can redistribute it and/or modify-it under the terms of the GNU Lesser General Public License as published by-the Free Software Foundation; either version 2.1 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 Lesser-General Public License (at http://www.gnu.org/license/lgpl.html) -for more details.*/--// you can change these-var checkIfSVGavailable = true;-var notifyIfNoSVG = true;-var alertIfNoSVG = false;-var noSVG = false;--// global defaults used if not specified by graph (you can change these)-var defaultwidth = 300; defaultheight = 200; // in pixels-var defaultxmin = -5.5; defaultxmax = 5.5; // in usercoords-var defaultborder = 0; border = defaultborder; // in pixel-var defaultstrokewidth = "1"; // default line width in pixel-var defaultstroke = "blue"; // default line color-var defaultstrokeopacity = 1; // transparent = 0, solid =1-var defaultstrokedasharray = null; // "10,10" gives 10px long dashes-var defaultfill = "none"; // default fill color-var defaultfillopacity = 1; // transparent = 0, solid =1-var defaultfontstyle = "normal"; // default text shape normal|italic|inherit-var defaultfontfamily = "times"; // default font times|ariel|helvetica|...-var defaultfontsize = "16"; // default size (scaled automatically)-var defaultfontweight = "normal";// normal|bold|bolder|lighter|100|...|900-var defaultfontstroke = "none"; // default font outline color-var defaultfontfill = "none"; // default font color-var defaultmarker = "none"; // "dot" | "arrow" | "+" | "-" | "|"-var defaultendpoints = ""; // "c-d" where c is <|o|* and d is >|o|*--// global values used for all pictures (you can change these)-var showcoordinates = true;-var markerstrokewidth = "1";-var markerstroke = "black";-var markerfill = "yellow";-var markersize = 4;-var arrowfill = stroke;-var dotradius = 4;-var ticklength = 4;-var axesstroke = "black";-var gridstroke = "grey";-var backgroundstyle = "fill-opacity:0; fill:white";-var singlelettersitalic = true;--// internal variables (probably no need to change these)-var picturepos = null; // position of picture relative to top of HTML page-var xunitlength; // in pixels, used to convert to user coordinates-var yunitlength; // in pixels-var origin = [0,0]; // in pixels (default is bottom left corner)-var above = "above"; // shorthands (to avoid typing quotes)-var below = "below";-var left = "left";-var right = "right";-var aboveleft = "aboveleft";-var aboveright = "aboveright";-var belowleft = "belowleft";-var belowright = "belowright";-var xmin, xmax, ymin, ymax, xscl, yscl, - xgrid, ygrid, xtick, ytick, initialized;-var strokewidth, strokedasharray, stroke, fill, strokeopacity, fillopacity;-var fontstyle, fontfamily, fontsize, fontweight, fontstroke, fontfill;-var marker, endpoints, dynamic = {};-var picture, svgpicture, doc, width, height;-var isIE = document.createElementNS==null;--//this is not used! var cpi = "\u03C0", ctheta = "\u03B8"; // character for pi, theta-var log = function(x) { return ln(x)/ln(10) };-var pi = Math.PI, e = Math.E, ln = Math.log, sqrt = Math.sqrt;-var floor = Math.floor, ceil = Math.ceil, abs = Math.abs;-var sin = Math.sin, cos = Math.cos, tan = Math.tan;-var arcsin = Math.asin, arccos = Math.acos, arctan = Math.atan;-var sec = function(x) { return 1/Math.cos(x) };-var csc = function(x) { return 1/Math.sin(x) };-var cot = function(x) { return 1/Math.tan(x) };-var arcsec = function(x) { return arccos(1/x) };-var arccsc = function(x) { return arcsin(1/x) };-var arccot = function(x) { return arctan(1/x) };-var sinh = function(x) { return (Math.exp(x)-Math.exp(-x))/2 };-var cosh = function(x) { return (Math.exp(x)+Math.exp(-x))/2 };-var tanh = - function(x) { return (Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)) };-var sech = function(x) { return 1/cosh(x) };-var csch = function(x) { return 1/sinh(x) };-var coth = function(x) { return 1/tanh(x) };-var arcsinh = function(x) { return ln(x+Math.sqrt(x*x+1)) };-var arccosh = function(x) { return ln(x+Math.sqrt(x*x-1)) };-var arctanh = function(x) { return ln((1+x)/(1-x))/2 };-var sech = function(x) { return 1/cosh(x) };-var csch = function(x) { return 1/sinh(x) };-var coth = function(x) { return 1/tanh(x) };-var arcsech = function(x) { return arccosh(1/x) };-var arccsch = function(x) { return arcsinh(1/x) };-var arccoth = function(x) { return arctanh(1/x) };-var sign = function(x) { return (x==0?0:(x<0?-1:1)) };--function factorial(x,n) { // Factorial function- if (n==null) n=1;- if (Math.abs(x-Math.round(x*1000000)/1000000)<1e-15)- x = Math.round(x*1000000)/1000000;- if (x-Math.floor(x)!=0) return NaN;- for (var i=x-n; i>0; i-=n) x*=i;- return (x<0?NaN:(x==0?1:x));-}--function C(x,k) { // Binomial coefficient function- var res=1;- for (var i=0; i<k; i++) res*=(x-i)/(k-i);- return res;-}--function chop(x,n) { // Truncate decimal number to n places after decimal point- if (n==null) n=0;- return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);-}--function ran(a,b,n) { // Generate random number in [a,b] with n digits after .- if (n==null) n=0;- return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);-}--function myCreateElementSVG(t) {- if (isIE) return doc.createElement(t);- else return doc.createElementNS("http://www.w3.org/2000/svg",t);-}--function getElementsByClass(container, tagName, clsName){- var list = new Array(0);- var collection = container.getElementsByTagName(tagName);- for(var i = 0; i < collection.length; i++)- if(collection[i].className.slice(0,clsName.length)==clsName)- list[list.length] = collection[i];- return list;-}--function showobj(obj) {- var st="", i;- for (i in obj) - st += (obj.getAttribute(i)==null?"":" "+i+":"+obj.getAttribute(i));- return st;-}--function findPos(obj) { // top-left corner of obj on HTML page in pixel- var curleft = curtop = 0;- if (obj.offsetParent) {- curleft = obj.offsetLeft- curtop = obj.offsetTop- while (obj = obj.offsetParent) {- curleft += obj.offsetLeft- curtop += obj.offsetTop-//alert(showobj(obj)+[curleft,curtop])- }- }- return [curleft,curtop];-}--function checkSVG(){- if (navigator.appName.slice(0,8)=="Netscape") - if (window['SVGElement']) noSVG = null;- else noSVG = true;- else if (navigator.appName.slice(0,9)=="Microsoft")- try {- var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');");- noSVG = null;- } catch (e) {- noSVG = true;- }- else if (navigator.appName.slice(0,5)=="Opera") // works only for 9.50b1- noSVG = null;- else noSVG = true;-//noSVG = true; //uncomment to check- if (noSVG && notifyIfNoSVG) {- var msg = "To view the ASCIIsvg images use Internet Explorer + Adobe SVGviewer or Mozilla Firefox 2.0 or later."- if (alertIfNoSVG)- alert(msg);- else return msg;- }-}--function setText(st,id) { // add text to an existing node with given id- var node = document.getElementById(id);- if (node!=null)- if (node.childNodes.length!=0) node.childNodes[0].nodeValue = st;- else node.appendChild(document.createTextNode(st));-}--function getX(evt) { // return mouse x-coord in user coordinate system- var svgroot = evt.target.parentNode;- pos = findPos(svgroot.parentNode);- return (evt.clientX+(isIE?0:window.pageXOffset)-pos[0]-svgroot.getAttribute("ox"))/parseFloat(svgroot.getAttribute("xunitlength"));-}--function getY(evt) { // return mouse y-coord in user coordinate system- var svgroot = evt.target.parentNode;- pos = findPos(svgroot.parentNode);-//alert(showobj(svgroot)+svgroot.getAttribute("mytop"))- return (svgroot.getAttribute("height")-svgroot.getAttribute("oy")-(evt.clientY+(isIE?0:window.pageYOffset)-pos[1]))/parseFloat(svgroot.getAttribute("yunitlength"));-}--function translateandeval(src) { //modify user input to JavaScript syntax- var errstr;- // replace plot(f(x),...) with plot("f(x)",...) - src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+?)\,/g,"plot\(\"$1\",");- src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+)\)/g,"plot(\"$1\")");-- // replace (expr,expr) by [expr,expr] where expr has no (,) in it- src = src.replace(/([=[(,]\x20*)\(([-a-z0-9./+*]+?),([-a-z0-9./+*]+?)\)/g,"$1[$2,$3]");-//alert(src)- // insert * between digit and letter e.g. 2x --> 2*x- src = src.replace(/([0-9])([a-df-zA-Z]|e^)/g,"$1*$2");- src = src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");-- try {- with (Math) eval(src); // here the svgpicture object is created- } catch(err) {- if (err!="wait") {-//alert(dsvglocation)- if (typeof err=="object") - errstr = err.name+" "+err.message+" "+err.number+" "+err.description;- else errstr = err;- alert(errstr+"\n"+src)- }- }-}--var lastSlot = 0;--function drawPictures() { // main routine; called after webpage has loaded- var src, id, dsvg, nd, node, ht, index, cols, arr, i, node2;- var ASbody = document.getElementsByTagName("body")[0];- pictures = getElementsByClass(ASbody,"embed","ASCIIsvg");- var len = pictures.length;- if(len==0) return;- for (index = lastSlot; index < len+lastSlot; index++) {- width = null; height = null; - xmin = null; xmax = null; ymin = null; ymax = null;- xscl = null; xgrid = null; yscl = null; ygrid = null;- initialized = false;- picture = pictures[index-lastSlot]; // current picture object- src = picture.getAttribute("script"); // get the ASCIIsvg code- if (src==null) src = "";- // insert "axes()" if not present ******** experimental- if (!/axes\b|initPicture/.test(src)) {- var i = 0;- while (/((yscl|ymax|ymin|xscl|xmax|xmin|\bwidth|\bheight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/.test(src.slice(i))) i++;- src = (i==0?"axes(); "+src: src.slice(0,i)+src.slice(i).replace(/((scl|max|min|idth|eight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/,"$1\naxes();"));- }- ht = picture.getAttribute("height");- if (isIE) {- picture.setAttribute("wmode","transparent");-//alert("*"+picture.getAttribute("src")+dsvglocation);-//adding d.svg dynamically greates problems in IE...-// if (picture.getAttribute("src")=="") picture.setAttribute("src",dsvglocation+"d.svg");- }- if (document.getElementById("picture"+(index+1)+"mml")==null) {- picture.parentNode.style.position = "relative";- node = createElementXHTML("div");- node.style.position = "absolute";- node.style.top = "0px";- node.style.left = "0px";- node.setAttribute("id","picture"+(index+1)+"mml");- picture.parentNode.insertBefore(node,picture.nextSibling);- }- if (ht==null) ht ="";-// if (ht!="") defaultborder = 25;- if (ht=="" || src=="") - if (document.getElementById("picture"+(index+1)+"input")==null) {- node = createElementXHTML("textarea");- arr = src.split("\n");- cols = 0;- for (i=0;i<arr.length;i++) cols = Math.max(cols,arr[i].length);- node.setAttribute("rows",Math.min(10,arr.length)+1);- node.setAttribute("cols",Math.max(Math.min(60,cols),20)+5);-// node.setAttribute("style","display:block");- if (isIE) src = src.replace(/([^\r])\n/g,"$1\r");- node.appendChild(document.createTextNode(src));- if (src.indexOf("showcode()")==-1) node.style.display = "none";- node.setAttribute("id","picture"+(index+1)+"input");- picture.parentNode.insertBefore(node,picture.nextSibling);- picture.parentNode.insertBefore(createElementXHTML("br"),node);- node2 = createElementXHTML("button");- node2.setAttribute("id","picture"+(index+1)+"button");- if (isIE) node2.onclick = function() {updatePicture(this)};- else node2.setAttribute("onclick","updatePicture(this)");- node2.appendChild(document.createTextNode("Update"));- if (src.indexOf("showcode()")==-1) node2.style.display = "none";- picture.parentNode.insertBefore(node2,node);-// picture.parentNode.insertBefore(document.createTextNode("ASCII"),node);- picture.parentNode.insertBefore(createElementXHTML("br"),node);- } else src = document.getElementById("picture"+(index+1)+"input").value;- id = picture.getAttribute("id");- dsvg = picture.getAttribute("src");- if (id == null || id == "") {- id = "picture"+(index+1);- picture.setAttribute("id",id);- }- translateandeval(src);- }- lastSlot+=len;-}--function setdefaults() { //called before each graph is evaluated- strokewidth = defaultstrokewidth;- stroke = defaultstroke;- strokeopacity = defaultstrokeopacity;- strokedasharray = defaultstrokedasharray;- fill = defaultfill;- fillopacity = defaultfillopacity;- fontstyle = defaultfontstyle;- fontfamily = defaultfontfamily;- fontsize = defaultfontsize;- fontweight = defaultfontweight;- fontstroke = defaultfontstroke;- fontfill = defaultfontfill;- marker = defaultmarker;- endpoints = defaultendpoints;-}--function switchTo(id) { // used by dynamic code to select appropriate graph- if (id==undefined) return;- var name = id;- if (typeof name!="string") name = id.target.parentNode.getAttribute("name");- picture = document.getElementById(name);- width = picture.getAttribute("width")-0;- height = picture.getAttribute("height")-0;- setdefaults();- if ((picture.nodeName == "EMBED" || picture.nodeName == "embed") && isIE) {- svgpicture = picture.getSVGDocument().getElementById("root");- doc = picture.getSVGDocument();- } else {- svgpicture = picture;- doc = document;- }- xunitlength = parseFloat(svgpicture.getAttribute("xunitlength"));- yunitlength = parseFloat(svgpicture.getAttribute("yunitlength"));- xmin = parseFloat(svgpicture.getAttribute("xmin"));- xmax = parseFloat(svgpicture.getAttribute("xmax"));- ymin = parseFloat(svgpicture.getAttribute("ymin"));- ymax = parseFloat(svgpicture.getAttribute("ymax"));- origin = [svgpicture.getAttribute("ox")-0,svgpicture.getAttribute("oy")-0];-}--function updatePicture(obj) {- var node, src, id, top, left;- if (typeof obj=="object") id = obj.id.slice(0,-6);- else id = (typeof obj=="string"?obj:"picture"+(obj+1));- src = document.getElementById(id+"input").value;- xmin = null; xmax = null; ymin = null; ymax = null;- xscl = null; xgrid = null; yscl = null; ygrid = null;- initialized = false;- picture = document.getElementById(id);- translateandeval(src)-}--function changepicturesize(evt,factor) {- var obj = evt.target;- var name = obj.parentNode.getAttribute("name");- var pic = document.getElementById(name);- var src = document.getElementById(name+"input").value;- if (!/height/.test(src)) src = "height=0; "+src;- if (!/width/.test(src)) src = "width=0; "+src;- src = src.replace(/width\s*=\s*\d+/,"width="+(factor*(pic.getAttribute("width")-0)));- src = src.replace(/height\s*=\s*\d+/,"height="+(factor*(pic.getAttribute("height")-0)));- document.getElementById(name+"input").value = src;-//alert(getKey(evt.keycode))- updatePicture(name);-}--function zoom(evt,factor) {- switchTo(evt);- var obj = evt.target;- var name = obj.parentNode.getAttribute("name");- var pic = document.getElementById(name);- var src = document.getElementById(name+"input").value;- var xlen = (xmax-xmin)/2;- var ylen = (ymax-ymin)/2;- var xcen = getX(evt), ycen = getY(evt);- if (!/ymax/.test(src)) src = "ymax=0; "+src;- if (!/ymin/.test(src)) src = "ymin=0; "+src;- if (!/xmax/.test(src)) src = "xmax=0; "+src;- if (!/xmin/.test(src)) src = "xmin=0; "+src;- src = src.replace(/xmin\s*=\s*[-\d.e]+/,"xmin="+(xcen-factor*xlen));- src = src.replace(/xmax\s*=\s*[-\d.e]+/,"xmax="+(xcen+factor*xlen));- src = src.replace(/ymin\s*=\s*[-\d.e]+/,"ymin="+(ycen-factor*ylen));- src = src.replace(/ymax\s*=\s*[-\d.e]+/,"ymax="+(ycen+factor*ylen));- document.getElementById(name+"input").value = src;- updatePicture(name);-}--var sinceFirstClick = 0; // ondblclick simulation from -var dblClkTimer; // http://www.enja.org/david/?cat=13 Thanks!-function timer() {- if(sinceFirstClick<60) {- sinceFirstClick++;- setTimeout("timer()",10);- } else {- clearTimeout(dblClkTimer);- dblClkTimer = "";- }-}-function mClick(evt) {- if(sinceFirstClick!=0) {- if(sinceFirstClick <= 40) {- if (evt.shiftKey) {- if (evt.altKey) changepicturesize(evt,2);- else zoom(evt,.5);- } else if (evt.altKey) zoom(evt,2);//changepicturesize(evt,.5);- else showHideCode(evt); // do this on dblclick- clearTimeout(dblClkTimer);- dblClkTimer = "";- } else {- clearTimeout(dblClkTimer);- sinceFirstClick = 0;- dblClkTimer = setTimeout("timer()",10);- } - } else {- sinceFirstClick = 0;- dblClkTimer = setTimeout("timer()",10);- }-}--function showHideCode(evt) { // called by onclick event-// if (evt.getDetail()==2) {//getDetail unfortunately not in Firefox- var obj=evt.target;- var name = obj.parentNode.getAttribute("name");- var node = document.getElementById(name+"input");- node.style.display = (node.style.display == "none"?"":"none");- var node = document.getElementById(name+"button");- node.style.display = (node.style.display == "none"?"":"none");-// }-}--function showcode() {} // do nothing--function setBorder(x) { border = x } //deprecate--function initPicture(x_min,x_max,y_min,y_max) { // set up the graph-// usually called by axes() or noaxes(), but can be used directly- if (!initialized) {- setdefaults();- initialized = true;- if (x_min!=null) xmin = x_min;- if (x_max!=null) xmax = x_max;- if (y_min!=null) ymin = y_min;- if (y_max!=null) ymax = y_max;- if (xmin==null) xmin = defaultxmin;- if (xmax==null) xmax = defaultxmax;- if (typeof xmin != "number" || typeof xmax != "number" || xmin >= xmax) - alert("Picture requires at least two numbers: xmin < xmax");- else if (y_max != null && (typeof y_min != "number" || - typeof y_max != "number" || y_min >= y_max))- alert("initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax");- else {- if (width==null) {- width = picture.getAttribute("width");- if (width==null || width=="") width=defaultwidth;- }- picture.setAttribute("width",width);- if (height==null) { - height = picture.getAttribute("height");- if (height==null || height=="") height=defaultheight;- }- picture.setAttribute("height",height);- xunitlength = (width-2*border)/(xmax-xmin);- yunitlength = xunitlength;-//alert(xmin+" "+xmax+" "+ymin+" "+ymax)- if (ymin==null) {- origin = [-xmin*xunitlength+border,height/2];- ymin = -(height-2*border)/(2*yunitlength);- ymax = -ymin;- } else {- if (ymax!=null) yunitlength = (height-2*border)/(ymax-ymin);- else ymax = (height-2*border)/yunitlength + ymin;- origin = [-xmin*xunitlength+border,-ymin*yunitlength+border];- }- if (isIE) {- if (picture.FULLSCREEN==undefined) {- setTimeout('drawPictures()',50);- throw "wait";- }- svgpicture = picture.getSVGDocument().getElementById("root");- if (svgpicture==null) {- setTimeout('drawPictures()',50);- throw "wait";- }- svgpicture = picture.getSVGDocument().getElementById("root");- while (svgpicture.childNodes.length>0) - svgpicture.removeChild(svgpicture.lastChild); - svgpicture.setAttribute("width",width);- svgpicture.setAttribute("height",height);- svgpicture.setAttribute("name",picture.getAttribute("id"));- doc = picture.getSVGDocument();- } else {- var qnode = document.createElementNS("http://www.w3.org/2000/svg","svg");- qnode.setAttribute("id",picture.getAttribute("id"));- qnode.setAttribute("name",picture.getAttribute("id"));-// qnode.setAttribute("style","display:inline");- qnode.setAttribute("width",picture.getAttribute("width"));- qnode.setAttribute("height",picture.getAttribute("height"));- picturepos = findPos(picture);-// qnode.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");- if (picture.parentNode!=null) {- picture.parentNode.replaceChild(qnode,picture);- } else {- svgpicture.parentNode.replaceChild(qnode,svgpicture);- }- svgpicture = qnode;- doc = document;- }- var nd = document.getElementById(picture.getAttribute("id")+"mml");- if (nd!=null) // clear out MathML layer- while (nd.childNodes.length>0) nd.removeChild(nd.lastChild); - svgpicture.setAttribute("xunitlength",xunitlength);- svgpicture.setAttribute("yunitlength",yunitlength);- svgpicture.setAttribute("xmin",xmin);- svgpicture.setAttribute("xmax",xmax);- svgpicture.setAttribute("ymin",ymin);- svgpicture.setAttribute("ymax",ymax);- svgpicture.setAttribute("ox",origin[0]);- svgpicture.setAttribute("oy",origin[1]);- var node = myCreateElementSVG("rect");- node.setAttribute("x","0");- node.setAttribute("y","0");- node.setAttribute("width",width);- node.setAttribute("height",height);- node.setAttribute("style",backgroundstyle);- svgpicture.appendChild(node);- svgpicture.setAttribute("onmousemove","displayCoord(evt)");- svgpicture.setAttribute("onmouseout","removeCoord(evt)");- svgpicture.setAttribute("onclick","mClick(evt)");- node = myCreateElementSVG("text"); // used for displayCoord- node.appendChild(doc.createTextNode(" "));- node.setAttribute("id","coords");- svgpicture.appendChild(node);- node = myCreateElementSVG("text"); // used for text display- node.appendChild(doc.createTextNode(" "));- node.setAttribute("id","coords");- svgpicture.appendChild(node);- border = defaultborder;- }- }-}--//////////////////////////user graphics commands start/////////////////////////--function line(p,q,id,endpts) { // segment connecting points p,q (coordinates in units)- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("d","M"+(p[0]*xunitlength+origin[0])+","+- (height-p[1]*yunitlength-origin[1])+" "+- (q[0]*xunitlength+origin[0])+","+(height-q[1]*yunitlength-origin[1]));- node.setAttribute("stroke-width", strokewidth);- if (strokedasharray!=null) - node.setAttribute("stroke-dasharray", strokedasharray);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- if (marker=="dot" || marker=="arrowdot") {- ASdot(p,markersize,markerstroke,markerfill);- if (marker=="arrowdot") arrowhead(p,q);- ASdot(q,markersize,markerstroke,markerfill);- } else if (marker=="arrow") arrowhead(p,q);- if (endpts==null && endpoints!="") endpts = endpoints;- if (endpts!=null) {- if (endpts.indexOf("<-") != -1) arrowhead(q,p);- if (endpts.indexOf("o-") != -1) dot(p, "open");- if (endpts.indexOf("*-") != -1) dot(p, "closed");- if (endpts.indexOf("->") != -1) arrowhead(p,q);- if (endpts.indexOf("-o") != -1) dot(q, "open");- if (endpts.indexOf("-*") != -1) dot(q, "closed");- }-}--function path(plist,id,c,endpts) {- if (c==null) c="";- var node, st, i;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- if (typeof plist == "string") st = plist;- else {- st = "M";- st += (plist[0][0]*xunitlength+origin[0])+","+- (height-plist[0][1]*yunitlength-origin[1])+" "+c;- for (i=1; i<plist.length; i++)- st += (plist[i][0]*xunitlength+origin[0])+","+- (height-plist[i][1]*yunitlength-origin[1])+" ";- }- node.setAttribute("d", st);- node.setAttribute("stroke-width", strokewidth);- if (strokedasharray!=null) - node.setAttribute("stroke-dasharray", strokedasharray);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- if (marker=="dot" || marker=="arrowdot")- for (i=0; i<plist.length; i++)- if (c!="C" && c!="T" || i!=1 && i!=2)- ASdot(plist[i],markersize,markerstroke,markerfill);- if (endpts==null && endpoints!="") endpts = endpoints;- if (endpts!=null) {- if (endpts.indexOf("<-") != -1) arrowhead(plist[1],plist[0]);- if (endpts.indexOf("o-") != -1) dot(plist[0], "open");- if (endpts.indexOf("*-") != -1) dot(plist[0], "closed");- if (endpts.indexOf("->") != -1) arrowhead(plist[plist.length-2],plist[plist.length-1]);- if (endpts.indexOf("-o") != -1) dot(plist[plist.length-1], "open");- if (endpts.indexOf("-*") != -1) dot(plist[plist.length-1], "closed");- }-}--function curve(plist,id,endpts) {- path(plist,id,"T",endpts);-}--function vector(p,q,id) {- line(p,q,id,"","->");-}--function circle(center,radius,id) { // coordinates in units- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("circle");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("cx",center[0]*xunitlength+origin[0]);- node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);- node.setAttribute("r",radius*xunitlength);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);-}--function loop(p,d,id) { -// d is a direction vector e.g. [1,0] means loop starts in that direction- if (d==null) d=[1,0];- path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C");- if (marker=="arrow" || marker=="arrowdot") - arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],- p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);-}--function arc(start,end,radius,id,largearc) { // coordinates in units- var node, v;-//alert([fill, stroke, origin, xunitlength, yunitlength, height])- if (id!=null) node = doc.getElementById(id);- if (largearc==null) largearc=0;- if (radius==null) {- v=[end[0]-start[0],end[1]-start[1]];- radius = Math.sqrt(v[0]*v[0]+v[1]*v[1]);- }- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("d","M"+(start[0]*xunitlength+origin[0])+","+- (height-start[1]*yunitlength-origin[1])+" A"+radius*xunitlength+","+- radius*yunitlength+" 0 "+largearc+",0 "+(end[0]*xunitlength+origin[0])+","+- (height-end[1]*yunitlength-origin[1]));- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- if (marker=="arrow" || marker=="arrowdot") {- u = [(end[1]-start[1])/4,(start[0]-end[0])/4];- v = [(end[0]-start[0])/2,(end[1]-start[1])/2];-//alert([u,v])- v = [start[0]+v[0]+u[0],start[1]+v[1]+u[1]];- } else v=[start[0],start[1]];- if (marker=="dot" || marker=="arrowdot") {- ASdot(start,markersize,markerstroke,markerfill);- if (marker=="arrowdot") arrowhead(v,end);- ASdot(end,markersize,markerstroke,markerfill);- } else if (marker=="arrow") arrowhead(v,end);-}--function sector(center,start,end,id) { // center,start,end should be isoceles- var rx = start[0]-center[0], ry = start[1]-center[1];- arc(start,end,Math.sqrt(rx*rx+ry*ry),id+"arc");- path([end,center,start],id+"path");-}--function ellipse(center,rx,ry,id) { // coordinates in units- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("ellipse");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("cx",center[0]*xunitlength+origin[0]);- node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);- node.setAttribute("rx",rx*xunitlength);- node.setAttribute("ry",ry*yunitlength);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);-}--function triangle(p,q,r,id) {- path([p,q,r,p],id)-}--function rect(p,q,id,rx,ry) { // opposite corners in units, rounded by radii- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("rect");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("x",p[0]*xunitlength+origin[0]);- node.setAttribute("y",height-q[1]*yunitlength-origin[1]);- node.setAttribute("width",(q[0]-p[0])*xunitlength);- node.setAttribute("height",(q[1]-p[1])*yunitlength);- if (rx!=null) node.setAttribute("rx",rx*xunitlength);- if (ry!=null) node.setAttribute("ry",ry*yunitlength);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);-}--function text(p,st,pos,id,fontsty) {- var dnode, node, dx = 0, dy = fontsize/3, str = st.toString();- if (/(`|\$)/.test(str)) { // layer for ASCIIMathML and LaTeXMathML- dnode = document.getElementById(svgpicture.getAttribute("name")+"mml");- if (dnode!=null) {- if (id!=null) node = document.getElementById(id);- if (node==null) {-//alert(dnode.childNodes.length)- node = createElementXHTML("div");- node.setAttribute("id", id);- node.style.position = "absolute";- dnode.appendChild(node);- }- while (node.childNodes.length>0) node.removeChild(node.lastChild); - node.appendChild(document.createTextNode(str));- if (/`/.test(str)) AMprocessNode(node); else LMprocessNode(node);- dx = -node.offsetWidth/2;- dy = -node.offsetHeight/2;- if (pos!=null) {- if (/above/.test(pos)) dy = -node.offsetHeight;- if (/below/.test(pos)) dy = 0;- if (/right/.test(pos)) dx = 0;- if ( /left/.test(pos)) dx = -node.offsetWidth;- }- node.style.left = ""+(p[0]*xunitlength+origin[0]+dx)+"px";- node.style.top = ""+(height-p[1]*yunitlength-origin[1]+dy)+"px";- }- return p;- }- var textanchor = "middle"; // regular text goes into SVG- if (pos!=null) {- if (/above/.test(pos)) dy = -fontsize/2;- if (/below/.test(pos)) dy = fontsize-0;- if (/right/.test(pos)) {textanchor = "start"; dx = fontsize/4;}- if ( /left/.test(pos)) {textanchor = "end"; dx = -fontsize/4;}- }- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("text");- node.setAttribute("id", id);- svgpicture.appendChild(node);- node.appendChild(doc.createTextNode(str));- }- while (node.childNodes.length>1) node.removeChild(node.lastChild); - node.lastChild.nodeValue = "\xA0"+str+"\xA0";- node.setAttribute("x",p[0]*xunitlength+origin[0]+dx);- node.setAttribute("y",height-p[1]*yunitlength-origin[1]+dy);- node.setAttribute("font-style",(fontsty!=null?fontsty:- (str.search(/^[a-zA-Z]$/)!=-1?"italic":fontstyle)));- node.setAttribute("font-family",fontfamily);- node.setAttribute("font-size",fontsize);- node.setAttribute("font-weight",fontweight);- node.setAttribute("text-anchor",textanchor);- if (fontstroke!="none") node.setAttribute("stroke",fontstroke);- if (fontfill!="none") node.setAttribute("fill",fontfill);- return p;-}--function mtext(p,st,pos,fontsty,fontsz) { // method for updating text on an svg-// "this" is the text object or the svgpicture object- var textanchor = "middle";- var dx = 0; var dy = fontsize/3;- if (pos!=null) {- if (pos.slice(0,5)=="above") dy = -fontsize/2;- if (pos.slice(0,5)=="below") dy = fontsize-0;- if (pos.slice(0,5)=="right" || pos.slice(5,10)=="right") {- textanchor = "start";- dx = fontsize/2;- }- if (pos.slice(0,4)=="left" || pos.slice(5,9)=="left") {- textanchor = "end";- dx = -fontsize/2;- }- }- var node = this;- if (this.nodeName=="svg") {- node = myCreateElementSVG("text");- this.appendChild(node);- node.appendChild(doc.createTextNode(st));- }- node.lastChild.nodeValue = st;- node.setAttribute("x",p[0]+dx);- node.setAttribute("y",p[1]+dy);- node.setAttribute("font-style",(fontsty!=null?fontsty:fontstyle));- node.setAttribute("font-family",fontfamily);- node.setAttribute("font-size",(fontsz!=null?fontsz:fontsize));- node.setAttribute("font-weight",fontweight);- node.setAttribute("text-anchor",textanchor);- if (fontstroke!="none") node.setAttribute("stroke",fontstroke);- if (fontfill!="none") node.setAttribute("fill",fontfill);-}--function image(imgurl,p,w,h,id) { // not working yet- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("image");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("x",p[0]*xunitlength+origin[0]);- node.setAttribute("y",height-p[1]*yunitlength-origin[1]);- node.setAttribute("width",w);- node.setAttribute("height",h);- node.setAttribute("xlink:href", imgurl);-}--function ASdot(center,radius,s,f) { // coordinates in units, radius in pixel- if (s==null) s = stroke; if (f==null) f = fill;- var node = myCreateElementSVG("circle");- node.setAttribute("cx",center[0]*xunitlength+origin[0]);- node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);- node.setAttribute("r",radius);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", s);- node.setAttribute("fill", f);- svgpicture.appendChild(node);-}--function dot(center, typ, label, pos, id) {- var node;- var cx = center[0]*xunitlength+origin[0];- var cy = height-center[1]*yunitlength-origin[1];- if (id!=null) node = doc.getElementById(id);- if (typ=="+" || typ=="-" || typ=="|") {- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- if (typ=="+") {- node.setAttribute("d",- " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy+- " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));- node.setAttribute("stroke-width", .5);- node.setAttribute("stroke", axesstroke);- } else {- if (typ=="-") node.setAttribute("d",- " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy);- else node.setAttribute("d",- " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- }- } else {- if (node==null) {- node = myCreateElementSVG("circle");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("cx",cx);- node.setAttribute("cy",cy);- node.setAttribute("r",dotradius);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", (typ=="open"?"white":- (typ=="closed"?stroke:markerfill)));- }- if (label!=null) - text(center,label,(pos==null?"below":pos),(id==null?id:id+"label"))-}--point = dot; //alternative name--function arrowhead(p,q) { // draw arrowhead at q (in units) add size param- var up;- var v = [p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]];- var w = [q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]];- var u = [w[0]-v[0],w[1]-v[1]];- var d = Math.sqrt(u[0]*u[0]+u[1]*u[1]);- if (d > 0.00000001) {- u = [u[0]/d, u[1]/d];- up = [-u[1],u[0]];- var node = myCreateElementSVG("path");- node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+- (w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+- (w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z");- node.setAttribute("stroke-width", markerstrokewidth);- node.setAttribute("stroke", stroke); /*was markerstroke*/- node.setAttribute("fill", stroke); /*was arrowfill*/- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- svgpicture.appendChild(node); - }-}--function chopZ(st) {- var k = st.indexOf(".");- if (k==-1) return st;- for (var i=st.length-1; i>k && st.charAt(i)=="0"; i--);- if (i==k) i--;- return st.slice(0,i+1);-}--function grid(dx,dy) { // for backward compatibility- axes(dx,dy,null,dx,dy)-}--function noaxes() {- if (!initialized) initPicture();-}--function axes(dx,dy,labels,gdx,gdy) {-//xscl=x is equivalent to xtick=x; xgrid=x; labels=true;- var x, y, ldx, ldy, lx, ly, lxp, lyp, pnode, st;- if (!initialized) initPicture();- if (typeof dx=="string") { labels = dx; dx = null; }- if (typeof dy=="string") { gdx = dy; dy = null; }- if (xscl!=null) {dx = xscl; gdx = xscl; labels = dx}- if (yscl!=null) {dy = yscl; gdy = yscl}- if (xtick!=null) {dx = xtick}- if (ytick!=null) {dy = ytick}- dx = (dx==null?xunitlength:dx*xunitlength);- dy = (dy==null?dx:dy*yunitlength);- fontsize = Math.min(dx/2,dy/2,16); //alert(fontsize)- ticklength = fontsize/4;- if (xgrid!=null) gdx = xgrid;- if (ygrid!=null) gdy = ygrid;- if (gdx!=null) {- gdx = (typeof gdx=="string"?dx:gdx*xunitlength);- gdy = (gdy==null?dy:gdy*yunitlength);- pnode = myCreateElementSVG("path");- st="";- for (x = origin[0]; x<width; x = x+gdx)- st += " M"+x+",0"+" "+x+","+height;- for (x = origin[0]-gdx; x>0; x = x-gdx)- st += " M"+x+",0"+" "+x+","+height;- for (y = height-origin[1]; y<height; y = y+gdy)- st += " M0,"+y+" "+width+","+y;- for (y = height-origin[1]-gdy; y>0; y = y-gdy)- st += " M0,"+y+" "+width+","+y;- pnode.setAttribute("d",st);- pnode.setAttribute("stroke-width", .5);- pnode.setAttribute("stroke", gridstroke);- pnode.setAttribute("fill", fill);- svgpicture.appendChild(pnode);- }- pnode = myCreateElementSVG("path");- st="M0,"+(height-origin[1])+" "+width+","+- (height-origin[1])+" M"+origin[0]+",0 "+origin[0]+","+height;- for (x = origin[0]+dx; x<width; x = x+dx)- st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+- (height-origin[1]-ticklength);- for (x = origin[0]-dx; x>0; x = x-dx)- st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+- (height-origin[1]-ticklength);- for (y = height-origin[1]+dy; y<height; y = y+dy)- st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;- for (y = height-origin[1]-dy; y>0; y = y-dy)- st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;- if (labels!=null) with (Math) {- ldx = dx/xunitlength;- ldy = dy/yunitlength;- lx = (xmin>0 || xmax<0?xmin:0);- ly = (ymin>0 || ymax<0?ymin:0);- lxp = (ly==0?"below":"above");- lyp = (lx==0?"left":"right");- var ddx = floor(1.1-log(ldx)/log(10))+1;- var ddy = floor(1.1-log(ldy)/log(10))+1;- for (x = ldx; x<=xmax; x = x+ldx)- text([x,ly],chopZ(x.toFixed(ddx)),lxp);- for (x = -ldx; xmin<=x; x = x-ldx)- text([x,ly],chopZ(x.toFixed(ddx)),lxp);- for (y = ldy; y<=ymax; y = y+ldy)- text([lx,y],chopZ(y.toFixed(ddy)),lyp);- for (y = -ldy; ymin<=y; y = y-ldy)- text([lx,y],chopZ(y.toFixed(ddy)),lyp);- }- fontsize = defaultfontsize;- pnode.setAttribute("d",st);- pnode.setAttribute("stroke-width", .5);- pnode.setAttribute("stroke", axesstroke);- pnode.setAttribute("fill", fill);- pnode.setAttribute("stroke-opacity", strokeopacity);- pnode.setAttribute("fill-opacity", fillopacity);- svgpicture.appendChild(pnode);-}--function mathjs(st) {- //translate a math formula to js function notation- // a^b --> pow(a,b)- // na --> n*a- // (...)d --> (...)*d- // n! --> factorial(n)- // sin^-1 --> arcsin etc.- //while ^ in string, find term on left and right- //slice and concat new formula string- st = st.replace(/\s/g,"");- if (st.indexOf("^-1")!=-1) {- st = st.replace(/sin\^-1/g,"arcsin");- st = st.replace(/cos\^-1/g,"arccos");- st = st.replace(/tan\^-1/g,"arctan");- st = st.replace(/sec\^-1/g,"arcsec");- st = st.replace(/csc\^-1/g,"arccsc");- st = st.replace(/cot\^-1/g,"arccot");- st = st.replace(/sinh\^-1/g,"arcsinh");- st = st.replace(/cosh\^-1/g,"arccosh");- st = st.replace(/tanh\^-1/g,"arctanh");- st = st.replace(/sech\^-1/g,"arcsech");- st = st.replace(/csch\^-1/g,"arccsch");- st = st.replace(/coth\^-1/g,"arccoth");- }- st = st.replace(/^e$/g,"(Math.E)");- st = st.replace(/^e([^a-zA-Z])/g,"(Math.E)$1");- st = st.replace(/([^a-zA-Z])e/g,"$1(Math.E)");-// st = st.replace(/([^a-zA-Z])e([^a-zA-Z])/g,"$1(Math.E)$2");- st = st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2");- st = st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");- var i,j,k, ch, nested;- while ((i=st.indexOf("^"))!=-1) {- //find left argument- if (i==0) return "Error: missing argument";- j = i-1;- ch = st.charAt(j);- if (ch>="0" && ch<="9") {// look for (decimal) number- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- if (ch==".") {- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- }- } else if (ch==")") {// look for matching opening bracket and function name- nested = 1;- j--;- while (j>=0 && nested>0) {- ch = st.charAt(j);- if (ch=="(") nested--;- else if (ch==")") nested++;- j--;- }- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable- j--;- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else { - return "Error: incorrect syntax in "+st+" at position "+j;- }- //find right argument- if (i==st.length-1) return "Error: missing argument";- k = i+1;- ch = st.charAt(k);- if (ch>="0" && ch<="9" || ch=="-") {// look for signed (decimal) number- k++;- while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;- if (ch==".") {- k++;- while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;- }- } else if (ch=="(") {// look for matching closing bracket and function name- nested = 1;- k++;- while (k<st.length && nested>0) {- ch = st.charAt(k);- if (ch=="(") nested++;- else if (ch==")") nested--;- k++;- }- } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable- k++;- while (k<st.length && (ch=st.charAt(k))>="a" && ch<="z" ||- ch>="A" && ch<="Z") k++;- } else { - return "Error: incorrect syntax in "+st+" at position "+k;- }- st = st.slice(0,j+1)+"Math.pow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+- st.slice(k);- }- while ((i=st.indexOf("!"))!=-1) {- //find left argument- if (i==0) return "Error: missing argument";- j = i-1;- ch = st.charAt(j);- if (ch>="0" && ch<="9") {// look for (decimal) number- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- if (ch==".") {- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- }- } else if (ch==")") {// look for matching opening bracket and function name- nested = 1;- j--;- while (j>=0 && nested>0) {- ch = st.charAt(j);- if (ch=="(") nested--;- else if (ch==")") nested++;- j--;- }- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable- j--;- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else { - return "Error: incorrect syntax in "+st+" at position "+j;- }- st = st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1);- }- return st;-}--function plot(fun,x_min,x_max,points,id,endpts) {- var pth = [];- var f = function(x) { return x }, g = fun;- var name = null;- if (typeof fun=="string") - eval("g = function(x){ with(Math) return "+mathjs(fun)+" }");- else if (typeof fun=="object") {- eval("f = function(t){ with(Math) return "+mathjs(fun[0])+" }");- eval("g = function(t){ with(Math) return "+mathjs(fun[1])+" }");- }- if (typeof x_min=="string") { name = x_min; x_min = xmin }- else name = id;- var min = (x_min==null?xmin:x_min);- var max = (x_max==null?xmax:x_max);- var inc = max-min-0.000001*(max-min);- inc = (points==null?inc/200:inc/points);- var gt;-//alert(typeof g(min))- for (var t = min; t <= max; t += inc) {- gt = g(t);- if (!(isNaN(gt)||Math.abs(gt)=="Infinity")) pth[pth.length] = [f(t), gt];- }- path(pth,name,null,endpts);- return pth;-}--// make polar plot--// make Riemann sums--function slopefield(fun,dx,dy) {- var g = fun;- if (typeof fun=="string") - eval("g = function(x,y){ with(Math) return "+mathjs(fun)+" }");- var gxy,x,y,u,v,dz;- if (dx==null) dx=1;- if (dy==null) dy=1;- dz = Math.sqrt(dx*dx+dy*dy)/6;- var x_min = Math.ceil(xmin/dx);- var y_min = Math.ceil(ymin/dy);- for (x = x_min; x <= xmax; x += dx)- for (y = y_min; y <= ymax; y += dy) {- gxy = g(x,y);- if (!isNaN(gxy)) {- if (Math.abs(gxy)=="Infinity") {u = 0; v = dz;}- else {u = dz/Math.sqrt(1+gxy*gxy); v = gxy*u;}- line([x-u,y-v],[x+u,y+v]);- }- }-}--///////////////////////user graphics commands end here/////////////////////////--function show_props(obj) {- var result = "";- for (var i=0; i< obj.childNodes.length; i++)- result += obj.childNodes.item(i) + "\n";- return result;-}--function displayCoord(evt) {- if (showcoordinates) {- var svgroot = evt.target.parentNode;- var nl = svgroot.childNodes;- for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++);- var cnode = nl.item(i);- cnode.mtext = mtext;- cnode.mtext([svgroot.getAttribute("width")-(-7),svgroot.getAttribute("height")-7],"("+getX(evt).toFixed(2)+", "+getY(evt).toFixed(2)+")", "left", "", "11");-/* var dnode = nl.item(i+1);- dnode.mtext = mtext;- dnode.mtext([0,svgroot.getAttribute("height")-6],"Try (shift/alt)-dblclick", "right", "", "8");-*/ }-}--function removeCoord(evt) {- var svgroot = evt.target.parentNode;- var nl = svgroot.childNodes;- for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++);- var cnode = nl.item(i);- cnode.mtext = mtext;- cnode.mtext([svgroot.getAttribute("width")-0,svgroot.getAttribute("height")-0],"", "aboveleft", "");-/* var dnode = nl.item(i+1);- dnode.mtext = mtext;- dnode.mtext([0,svgroot.getAttribute("height")-0],"", "aboveright", "");-*/}--function initASCIIMathCalculators(li) {- var i;- for (i=0; i<li.length; i++) {- li[i].innerHTML = calcstr;- AMprocessNode(li[i]);- }- li = document.getElementsByTagName("textarea");- var st;- for (i=0; i<li.length; i++) {- st = li[i].getAttribute("onkeyup");- if (st!=null) eval(String(st).replace(/function anonymous\(\)/,""));- }-}--function calculate(inputId,outputId) {- var str = document.getElementById(inputId).value;- var err = "";- var ind = str.lastIndexOf("\n");- if (ind==str.length-1) str = str.slice(0,ind);- str = str.slice(str.lastIndexOf("\n")+1);- try {- var res = eval(mathjs(str));- } catch(e) {- err = "syntax incomplete";- }- if (!isNaN(res) && res!="Infinity") - str = "`"+str+" =` "+(Math.abs(res-Math.round(res*1000000)/1000000)<1e-15?Math.round(res*1000000)/1000000:res)+err; - else if (str!="") str = "`"+str+"` = undefined"; //debug:+mathjs(str);- var outnode = document.getElementById(outputId);- var n = outnode.childNodes.length;- for (var i=0; i<n; i++)- outnode.removeChild(outnode.firstChild);- outnode.appendChild(document.createTextNode(str));- AMprocessNode(outnode);-}--function append(st){- document.getElementById('in').value+=st;- calculate('in','out');- document.getElementById('in').scrollTop = 1000;- document.getElementById('in').focus();-}--function clearTextArea(){- document.getElementById('in').value="";- calculate('in','out');- document.getElementById('in').focus();-}--var calcstr = "<table align=\"center\">\n<tr><th>\nASCIIMath Scientific Calculator\n</th></tr>\n<tr><td>\nClick in the box to use your keyboard or use the buttons\n</td></tr>\n<tr><td>\n<textarea id=\"in\" rows=\"3\" cols=\"40\" onkeyup=\"calculate('in','out')\"></textarea></td></tr>\n<tr><td height=\"50\">Result: <span id=\"out\"></span></td></tr>\n</table>\n<table align=\"center\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody align=\"center\">\n<tr>\n<td colspan=\"4\">\n<button onclick=\"append('sin^-1(')\"><font size=2>`sin^-1`</font></button><button onclick=\"append('cos^-1(')\"><font size=2>`cos^-1`</font></button><button onclick=\"append('tan^-1(')\"><font size=2>`tan^-1`</font></button></td>\n<td><button onclick=\"clearTextArea()\"> `C` </button></td>\n\n</tr>\n<tr>\n<td><button onclick=\"append('pi')\"> `pi` </button></td>\n<td><button onclick=\"append('sin(')\"> `sin`</button></td>\n<td><button onclick=\"append('cos(')\"> `cos`</button></td>\n<td><button onclick=\"append('tan(')\"> `tan`</button></td>\n<td><button onclick=\"append('^')\">`x^y`</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('!')\"> `!` </button></td>\n\n<td><button onclick=\"append('(')\"><font size=2> `(` </font></button></td>\n<td><button onclick=\"append(')')\"><font size=2> `)` </font></button></td>\n<td><button onclick=\"append('sqrt(')\"><font size=2>`sqrt({::}^\ )`</font></button></td>\n<td><button onclick=\"append('/')\"> `-:\ `</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('log(')\">`log`</button></td>\n<td><button onclick=\"append('7')\"> `7` </button></td>\n<td><button onclick=\"append('8')\"> `8` </button></td>\n\n<td><button onclick=\"append('9')\"> `9` </button></td>\n<td><button onclick=\"append('*')\"> `times` </button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('ln(')\"> `ln` </button></td>\n<td><button onclick=\"append('4')\"> `4` </button></td>\n<td><button onclick=\"append('5')\"> `5` </button></td>\n<td><button onclick=\"append('6')\"> `6` </button></td>\n\n<td><button onclick=\"append('-')\"> `-{::}` </button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('e')\"> `e` </button></td>\n<td><button onclick=\"append('1')\"> `1` </button></td>\n<td><button onclick=\"append('2')\"> `2` </button></td>\n<td><button onclick=\"append('3')\"> `3` </button></td>\n<td><button onclick=\"append('+')\"> `+{::}` </button></td>\n\n</tr>\n<tr>\n<td> <!--button onclick=\"append('pi')\"> `pi` </button--></td>\n<td><button onclick=\"append('0')\"> `0` </button></td>\n<td><button onclick=\"append('.')\"> `.` </button></td>\n<td><button onclick=\"append('\\n')\"> `\"ent\"`</button></td>\n</tr>\n</tbody>\n</table>";--// GO1.1 Generic onload by Brothercake-// http://www.brothercake.com/-//onload function (replaces the onload="translate()" in the <body> tag)-function generic()-{- if(!init()) return;- if (translateOnLoad) {- var nd = document.getElementById("processasciimathinmoodle");- if (nd!=null) dsvglocation = nd.className;- if (nd!=null || !checkforprocessasciimathinmoodle) {- translate();- if (!noSVG && translateASCIIsvg) drawPictures();- }- var li = getElementsByClass(document,"div","ASCIIMathCalculator");- if (!noMathML && li.length>0) initASCIIMathCalculators(li);- }-};-//setup onload function-if(typeof window.addEventListener != 'undefined')-{- //.. gecko, safari, konqueror and standard- window.addEventListener('load', generic, false);-}-else if(typeof document.addEventListener != 'undefined')-{- //.. opera 7- document.addEventListener('load', generic, false);-}-else if(typeof window.attachEvent != 'undefined')-{- //.. win/ie- window.attachEvent('onload', generic);-}-//** remove this condition to degrade older browsers-else-{- //.. mac/ie5 and anything else that gets this far- //if there's an existing onload function- if(typeof window.onload == 'function')- {- //store it- var existing = onload;- //add new onload handler- window.onload = function()- {- //call existing onload function- existing();- //call generic onload function- generic();- };- }- else- {- //setup onload function- window.onload = generic;- }-}
− templates/DefaultHeaders.hs
@@ -1,52 +0,0 @@-{--Copyright (C) 2006-7 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.Writers.DefaultHeaders- Copyright : Copyright (C) 2006-7 John MacFarlane- License : GNU GPL, version 2 or above -- Maintainer : John MacFarlane <jgm@berkeley.edu>- Stability : alpha- Portability : portable--Default headers for Pandoc writers.--}-module Text.Pandoc.Writers.DefaultHeaders (- defaultLaTeXHeader,- defaultConTeXtHeader,- defaultDocbookHeader,- defaultS5Header,- defaultRTFHeader- ) where-import Text.Pandoc.Writers.S5--defaultLaTeXHeader :: String-defaultLaTeXHeader = "@LaTeXHeader@"--defaultConTeXtHeader :: String-defaultConTeXtHeader = "@ConTeXtHeader@"--defaultDocbookHeader :: String-defaultDocbookHeader = "@DocbookHeader@"--defaultS5Header :: String-defaultS5Header = s5Meta ++ s5CSS ++ s5Javascript--defaultRTFHeader :: String-defaultRTFHeader = "@RTFHeader@"
− templates/Makefile
@@ -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) ASCIIMathML.js- perl $(PROCESSOR) $@ $(VPATH)--Text/Pandoc/Writers/S5.hs: S5.hs $(PROCESSOR) ui/default/*- perl $(PROCESSOR) $@ $(VPATH)--Text/Pandoc/Writers/DefaultHeaders.hs: DefaultHeaders.hs $(PROCESSOR) headers/*- perl $(PROCESSOR) $@ $(VPATH)--.PHONY: clean-clean:- cd $(VPATH); rm -f $(TARGETS)
− templates/S5.hs
@@ -1,133 +0,0 @@-{--Copyright (C) 2006-7 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.Writers.S5- Copyright : Copyright (C) 2006-7 John MacFarlane- License : GNU GPL, version 2 or above -- Maintainer : John MacFarlane <jgm@berkeley.edu>- Stability : alpha- Portability : portable--Definitions for creation of S5 powerpoint-like HTML.-(See <http://meyerweb.com/eric/tools/s5/>.)--}-module Text.Pandoc.Writers.S5 (- -- * Strings- s5Meta,- s5Javascript,- s5CSS,- s5Links,- -- * Functions- writeS5,- writeS5String,- insertS5Structure- ) where-import Text.Pandoc.Shared ( joinWithSep, WriterOptions )-import Text.Pandoc.Writers.HTML ( writeHtml, writeHtmlString )-import Text.Pandoc.Definition-import Text.XHtml.Strict--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" --s5CoreCSS :: String-s5CoreCSS = "@s5-core.css@"--s5FramingCSS :: String-s5FramingCSS = "@framing.css@"--s5PrettyCSS :: String-s5PrettyCSS = "@pretty.css@"--s5OperaCSS :: String-s5OperaCSS = "@opera.css@"--s5OutlineCSS :: String-s5OutlineCSS = "@outline.css@"--s5PrintCSS :: String-s5PrintCSS = "@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"--s5Links :: String-s5Links = "<!-- style sheet links -->\n<link rel=\"stylesheet\" href=\"ui/default/slides.css\" type=\"text/css\" media=\"projection\" id=\"slideProj\" />\n<link rel=\"stylesheet\" href=\"ui/default/outline.css\" type=\"text/css\" media=\"screen\" id=\"outlineStyle\" />\n<link rel=\"stylesheet\" href=\"ui/default/print.css\" type=\"text/css\" media=\"print\" id=\"slidePrint\" />\n<link rel=\"stylesheet\" href=\"ui/default/opera.css\" type=\"text/css\" media=\"projection\" id=\"operaFix\" />\n<!-- S5 JS -->\n<script src=\"ui/default/slides.js\" type=\"text/javascript\"></script>\n"---- | Converts Pandoc document to an S5 HTML presentation (Html structure).-writeS5 :: WriterOptions -> Pandoc -> Html-writeS5 options = (writeHtml options) . insertS5Structure---- | Converts Pandoc document to an S5 HTML presentation (string).-writeS5String :: WriterOptions -> Pandoc -> String-writeS5String options = (writeHtmlString options) . insertS5Structure---- | Inserts HTML needed for an S5 presentation (e.g. around slides).-layoutDiv :: [Inline] -- ^ Title of document (for header or footer)- -> String -- ^ Date of document (for header or footer)- -> [Block] -- ^ List of block elements returned-layoutDiv title date = [(RawHtml "<div class=\"layout\">\n<div id=\"controls\"></div>\n<div id=\"currentSlide\"></div>\n<div id=\"header\"></div>\n<div id=\"footer\">\n"), (Header 1 [Str date]), (Header 2 title), (RawHtml "</div>\n</div>\n")]--presentationStart = RawHtml "<div class=\"presentation\">\n\n"--presentationEnd = RawHtml "</div>\n"--slideStart = RawHtml "<div class=\"slide\">\n"--slideEnd = RawHtml "</div>\n"---- | Returns 'True' if block is a Header 1.-isH1 :: Block -> Bool-isH1 (Header 1 _) = True-isH1 _ = False ---- | Insert HTML around sections to make individual slides.-insertSlides :: Bool -> [Block] -> [Block]-insertSlides beginning blocks = - let (beforeHead, rest) = break isH1 blocks in- if (null rest) then - if beginning then- beforeHead - else- beforeHead ++ [slideEnd]- else- if beginning then- beforeHead ++ - slideStart:(head rest):(insertSlides False (tail rest))- else- beforeHead ++ - slideEnd:slideStart:(head rest):(insertSlides False (tail rest)) ---- | Insert blocks into 'Pandoc' for slide structure.-insertS5Structure :: Pandoc -> Pandoc-insertS5Structure (Pandoc meta []) = Pandoc meta []-insertS5Structure (Pandoc (Meta title authors date) blocks) = - let slides = insertSlides True blocks - firstSlide = if not (null title)- then [slideStart, (Header 1 title), - (Header 3 [Str (joinWithSep ", " authors)]),- (Header 4 [Str date]), slideEnd]- else []- newBlocks = (layoutDiv title date) ++ presentationStart:firstSlide ++- slides ++ [presentationEnd]- in Pandoc (Meta title authors date) newBlocks
− templates/fillTemplates.pl
@@ -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 "templates/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 "templates/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 templates/headers`);- foreach my $header (@headers) {- my ($replacement) = escape_for_haskell(slurp "templates/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;
− templates/headers/ConTeXtHeader
@@ -1,67 +0,0 @@-\enableregime[utf] % use UTF-8--\setupcolors[state=start]-\setupinteraction[state=start, color=middleblue] % needed for hyperlinks--\setuppapersize[letter][letter] % use letter paper-\setuplayout[width=middle, backspace=1.5in, cutspace=1.5in,- height=middle, header=0.75in, footer=0.75in] % page layout-\setuppagenumbering[location={footer,center}] % number pages-\setupbodyfont[11pt] % 11pt font-\setupwhitespace[medium] % inter-paragraph spacing--\setuphead[section][style=\tfc]-\setuphead[subsection][style=\tfb]-\setuphead[subsubsection][style=\bf]--% define title block commands-\unprotect-\def\doctitle#1{\gdef\@title{#1}}-\def\author#1{\gdef\@author{#1}}-\def\date#1{\gdef\@date{#1}}-\date{\currentdate} % Default to today unless specified otherwise.-\def\maketitle{%- \startalignment[center]- \blank[2*big]- {\tfd \@title}- \blank[3*medium]- {\tfa \@author}- \blank[2*medium]- {\tfa \@date}- \blank[3*medium]- \stopalignment}-\protect--% define descr (for definition lists)-\definedescription[descr][- headstyle=bold,style=normal,align=left,location=hanging,- width=broad,margin=1cm]--% define defaults for bulleted lists -\setupitemize[1][symbol=1][indentnext=no]-\setupitemize[2][symbol=2][indentnext=no]-\setupitemize[3][symbol=3][indentnext=no]-\setupitemize[4][symbol=4][indentnext=no]--\setupthinrules[width=15em] % width of horizontal rules--% for block quotations-\unprotect--\startvariables all-blockquote: blockquote-\stopvariables--\definedelimitedtext-[\v!blockquote][\v!quotation]--\setupdelimitedtext-[\v!blockquote]-[\c!left=,-\c!right=,-before={\blank[medium]},-after={\blank[medium]},-]--\protect-
− templates/headers/DocbookHeader
@@ -1,3 +0,0 @@-<?xml version="1.0" encoding="utf-8" ?>-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"- "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
− templates/headers/LaTeXHeader
@@ -1,5 +0,0 @@-\documentclass{article}-\usepackage[mathletters]{ucs}-\usepackage[utf8x]{inputenc}-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt}
− templates/headers/RTFHeader
@@ -1,4 +0,0 @@-{\rtf1\ansi\deff0{\fonttbl{\f0 \fswiss Helvetica;}{\f1 Courier;}}-{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}-\widowctrl\hyphauto-
− templates/headers/S5Header
@@ -1,3 +0,0 @@-<!-- configuration parameters -->-<meta name="defaultView" content="slideshow" />-<meta name="controlVis" content="hidden" />
− templates/ui/default/blank.gif
binary file changed (49 → absent bytes)
− templates/ui/default/bodybg.gif
binary file changed (10119 → absent bytes)
− templates/ui/default/framing.css
@@ -1,23 +0,0 @@-/* The following styles size, place, and layer the slide components.- Edit these if you want to change the overall slide layout.- The commented lines can be uncommented (and modified, if necessary) - to help you with the rearrangement process. */--/* target = 1024x768 */--div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}-div#header {top: 0; height: 3em; z-index: 1;}-div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}-.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}-div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}-div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;- margin: 0;}-#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}-html>body #currentSlide {position: fixed;}--/*-div#header {background: #FCC;}-div#footer {background: #CCF;}-div#controls {background: #BBD;}-div#currentSlide {background: #FFC;}-*/
− templates/ui/default/iepngfix.htc
@@ -1,42 +0,0 @@-<public:component> -<public:attach event="onpropertychange" onevent="doFix()" /> - -<script> - -// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com -// Free usage permitted as long as this notice remains intact. - -// This must be a path to a blank image. That's all the configuration you need here. -var blankImg = 'ui/default/blank.gif'; - -var f = 'DXImageTransform.Microsoft.AlphaImageLoader'; - -function filt(s, m) { - if (filters[f]) { - filters[f].enabled = s ? true : false; - if (s) with (filters[f]) { src = s; sizingMethod = m } - } else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")'; -} - -function doFix() { - if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) || - (event && !/(background|src)/.test(event.propertyName))) return; - - if (tagName == 'IMG') { - if ((/\.png$/i).test(src)) { - filt(src, 'image'); // was 'scale' - src = blankImg; - } else if (src.indexOf(blankImg) < 0) filt(); - } else if (style.backgroundImage) { - if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) { - var s = RegExp.$1; - style.backgroundImage = ''; - filt(s, 'crop'); - } else filt(); - } -} - -doFix(); - -</script> -</public:component>
− templates/ui/default/opera.css
@@ -1,7 +0,0 @@-/* DO NOT CHANGE THESE unless you really want to break Opera Show */-.slide {- visibility: visible !important;- position: static !important;- page-break-before: always;-}-#slide0 {page-break-before: avoid;}
− templates/ui/default/outline.css
@@ -1,15 +0,0 @@-/* don't change this unless you want the layout stuff to show up in the outline view! */--.layout div, #footer *, #controlForm * {display: none;}-#footer, #controls, #controlForm, #navLinks, #toggle {- display: block; visibility: visible; margin: 0; padding: 0;}-#toggle {float: right; padding: 0.5em;}-html>body #toggle {position: fixed; top: 0; right: 0;}--/* making the outline look pretty-ish */--#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}-#slide0 h1 {padding-top: 1.5em;}-.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;- border-top: 1px solid #888; border-bottom: 1px solid #AAA;}-#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
− templates/ui/default/pretty.css
@@ -1,86 +0,0 @@-/* Following are the presentation styles -- edit away! */--body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}-:link, :visited {text-decoration: none; color: #00C;}-#controls :active {color: #88A !important;}-#controls :focus {outline: 1px dotted #227;}-h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}-ul, pre {margin: 0; line-height: 1em;}-html, body {margin: 0; padding: 0;}--blockquote, q {font-style: italic;}-blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}-blockquote p {margin: 0;}-blockquote i {font-style: normal;}-blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}-blockquote b i {font-style: italic;}--kbd {font-weight: bold; font-size: 1em;}-sup {font-size: smaller; line-height: 1px;}--.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}-.slide code.bad, code del {color: red;}-.slide code.old {color: silver;}-.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}-.slide pre code {display: block;}-.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}-.slide li {margin-top: 0.75em; margin-right: 0;}-.slide ul ul {line-height: 1;}-.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}-.slide img.leader {display: block; margin: 0 auto;}--div#header, div#footer {background: #005; color: #AAB;- font-family: Verdana, Helvetica, sans-serif;}-div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;- line-height: 1px;}-div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}-#footer h1, #footer h2 {display: block; padding: 0 1em;}-#footer h2 {font-style: italic;}--div.long {font-size: 0.75em;}-.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;- margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;- font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;- color: #DDE; background: #005;}-.slide h3 {font-size: 130%;}-h1 abbr {font-variant: small-caps;}--div#controls {position: absolute; left: 50%; bottom: 0;- width: 50%;- text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}-html>body div#controls {position: fixed; padding: 0 0 1em 0;- top: auto;}-div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;- margin: 0; padding: 0;}-#controls #navLinks a {padding: 0; margin: 0 0.5em; - background: #005; border: none; color: #779; - cursor: pointer;}-#controls #navList {height: 1em;}-#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}--#currentSlide {text-align: center; font-size: 0.5em; color: #449;}--#slide0 {padding-top: 3.5em; font-size: 90%;}-#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;- font: bold 2em Helvetica, sans-serif; white-space: normal;- color: #000; background: transparent;}-#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}-#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}-#slide0 h4 {margin-top: 0; font-size: 1em;}--ul.urls {list-style: none; display: inline; margin: 0;}-.urls li {display: inline; margin: 0;}-.note {display: none;}-.external {border-bottom: 1px dotted gray;}-html>body .external {border-bottom: none;}-.external:after {content: " \274F"; font-size: smaller; color: #77B;}--.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}-img.incremental {visibility: hidden;}-.slide .current {color: #B02;}---/* diagnostics--li:after {content: " [" attr(class) "]"; color: #F88;}- */
− templates/ui/default/print.css
@@ -1,24 +0,0 @@-/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */-.slide, ul {page-break-inside: avoid; visibility: visible !important;}-h1 {page-break-after: avoid;}--body {font-size: 12pt; background: white;}-* {color: black;}--#slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;}-#slide0 h3 {margin: 0; padding: 0;}-#slide0 h4 {margin: 0 0 0.5em; padding: 0;}-#slide0 {margin-bottom: 3em;}--h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;}-.extra {background: transparent !important;}-div.extra, pre.extra, .example {font-size: 10pt; color: #333;}-ul.extra a {font-weight: bold;}-p.example {display: none;}--#header {display: none;}-#footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;}-#footer h2, #controls {display: none;}--/* The following rule keeps the layout stuff out of print. Remove at your own risk! */-.layout, .layout * {display: none !important;}
− templates/ui/default/s5-core.css
@@ -1,9 +0,0 @@-/* Do not edit or override these styles! The system will likely break if you do. */--div#header, div#footer, div#controls, .slide {position: absolute;}-html>body div#header, html>body div#footer, - html>body div#controls, html>body .slide {position: fixed;}-.handout {display: none;}-.layout {display: block;}-.slide, .hideme, .incremental {visibility: hidden;}-#slide0 {visibility: visible;}
− templates/ui/default/slides.css
@@ -1,3 +0,0 @@-@import url(s5-core.css); /* required to make the slide show run at all */-@import url(framing.css); /* sets basic placement and size of slide components */-@import url(pretty.css); /* stuff that makes the slides look better than blah */
− templates/ui/default/slides.js
@@ -1,553 +0,0 @@-// S5 v1.1 slides.js -- released into the Public Domain-//-// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information -// about all the wonderful and talented contributors to this code!--var undef;-var slideCSS = '';-var snum = 0;-var smax = 1;-var incpos = 0;-var number = undef;-var s5mode = true;-var defaultView = 'slideshow';-var controlVis = 'visible';--var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;-var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;-var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;--function hasClass(object, className) {- if (!object.className) return false;- return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);-}--function hasValue(object, value) {- if (!object) return false;- return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);-}--function removeClass(object,className) {- if (!object) return;- object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);-}--function addClass(object,className) {- if (!object || hasClass(object, className)) return;- if (object.className) {- object.className += ' '+className;- } else {- object.className = className;- }-}--function GetElementsWithClassName(elementName,className) {- var allElements = document.getElementsByTagName(elementName);- var elemColl = new Array();- for (var i = 0; i< allElements.length; i++) {- if (hasClass(allElements[i], className)) {- elemColl[elemColl.length] = allElements[i];- }- }- return elemColl;-}--function isParentOrSelf(element, id) {- if (element == null || element.nodeName=='BODY') return false;- else if (element.id == id) return true;- else return isParentOrSelf(element.parentNode, id);-}--function nodeValue(node) {- var result = "";- if (node.nodeType == 1) {- var children = node.childNodes;- for (var i = 0; i < children.length; ++i) {- result += nodeValue(children[i]);- } - }- else if (node.nodeType == 3) {- result = node.nodeValue;- }- return(result);-}--function slideLabel() {- var slideColl = GetElementsWithClassName('*','slide');- var list = document.getElementById('jumplist');- smax = slideColl.length;- for (var n = 0; n < smax; n++) {- var obj = slideColl[n];-- var did = 'slide' + n.toString();- obj.setAttribute('id',did);- if (isOp) continue;-- var otext = '';- var menu = obj.firstChild;- if (!menu) continue; // to cope with empty slides- while (menu && menu.nodeType == 3) {- menu = menu.nextSibling;- }- if (!menu) continue; // to cope with slides with only text nodes-- var menunodes = menu.childNodes;- for (var o = 0; o < menunodes.length; o++) {- otext += nodeValue(menunodes[o]);- }- list.options[list.length] = new Option(n + ' : ' + otext, n);- }-}--function currentSlide() {- var cs;- if (document.getElementById) {- cs = document.getElementById('currentSlide');- } else {- cs = document.currentSlide;- }- cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' + - '<span id="csSep">\/<\/span> ' + - '<span id="csTotal">' + (smax-1) + '<\/span>';- if (snum == 0) {- cs.style.visibility = 'hidden';- } else {- cs.style.visibility = 'visible';- }-}--function go(step) {- if (document.getElementById('slideProj').disabled || step == 0) return;- var jl = document.getElementById('jumplist');- var cid = 'slide' + snum;- var ce = document.getElementById(cid);- if (incrementals[snum].length > 0) {- for (var i = 0; i < incrementals[snum].length; i++) {- removeClass(incrementals[snum][i], 'current');- removeClass(incrementals[snum][i], 'incremental');- }- }- if (step != 'j') {- snum += step;- lmax = smax - 1;- if (snum > lmax) snum = lmax;- if (snum < 0) snum = 0;- } else- snum = parseInt(jl.value);- var nid = 'slide' + snum;- var ne = document.getElementById(nid);- if (!ne) {- ne = document.getElementById('slide0');- snum = 0;- }- if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}- if (incrementals[snum].length > 0 && incpos == 0) {- for (var i = 0; i < incrementals[snum].length; i++) {- if (hasClass(incrementals[snum][i], 'current'))- incpos = i + 1;- else- addClass(incrementals[snum][i], 'incremental');- }- }- if (incrementals[snum].length > 0 && incpos > 0)- addClass(incrementals[snum][incpos - 1], 'current');- ce.style.visibility = 'hidden';- ne.style.visibility = 'visible';- jl.selectedIndex = snum;- currentSlide();- number = 0;-}--function goTo(target) {- if (target >= smax || target == snum) return;- go(target - snum);-}--function subgo(step) {- if (step > 0) {- removeClass(incrementals[snum][incpos - 1],'current');- removeClass(incrementals[snum][incpos], 'incremental');- addClass(incrementals[snum][incpos],'current');- incpos++;- } else {- incpos--;- removeClass(incrementals[snum][incpos],'current');- addClass(incrementals[snum][incpos], 'incremental');- addClass(incrementals[snum][incpos - 1],'current');- }-}--function toggle() {- var slideColl = GetElementsWithClassName('*','slide');- var slides = document.getElementById('slideProj');- var outline = document.getElementById('outlineStyle');- if (!slides.disabled) {- slides.disabled = true;- outline.disabled = false;- s5mode = false;- fontSize('1em');- for (var n = 0; n < smax; n++) {- var slide = slideColl[n];- slide.style.visibility = 'visible';- }- } else {- slides.disabled = false;- outline.disabled = true;- s5mode = true;- fontScale();- for (var n = 0; n < smax; n++) {- var slide = slideColl[n];- slide.style.visibility = 'hidden';- }- slideColl[snum].style.visibility = 'visible';- }-}--function showHide(action) {- var obj = GetElementsWithClassName('*','hideme')[0];- switch (action) {- case 's': obj.style.visibility = 'visible'; break;- case 'h': obj.style.visibility = 'hidden'; break;- case 'k':- if (obj.style.visibility != 'visible') {- obj.style.visibility = 'visible';- } else {- obj.style.visibility = 'hidden';- }- break;- }-}--// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)-function keys(key) {- if (!key) {- key = event;- key.which = key.keyCode;- }- if (key.which == 84) {- toggle();- return;- }- if (s5mode) {- switch (key.which) {- case 10: // return- case 13: // enter- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;- if (key.target && isParentOrSelf(key.target, 'controls')) return;- if(number != undef) {- goTo(number);- break;- }- case 32: // spacebar- case 34: // page down- case 39: // rightkey- case 40: // downkey- if(number != undef) {- go(number);- } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {- go(1);- } else {- subgo(1);- }- break;- case 33: // page up- case 37: // leftkey- case 38: // upkey- if(number != undef) {- go(-1 * number);- } else if (!incrementals[snum] || incpos <= 0) {- go(-1);- } else {- subgo(-1);- }- break;- case 36: // home- goTo(0);- break;- case 35: // end- goTo(smax-1);- break;- case 67: // c- showHide('k');- break;- }- if (key.which < 48 || key.which > 57) {- number = undef;- } else {- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;- if (key.target && isParentOrSelf(key.target, 'controls')) return;- number = (((number != undef) ? number : 0) * 10) + (key.which - 48);- }- }- return false;-}--function clicker(e) {- number = undef;- var target;- if (window.event) {- target = window.event.srcElement;- e = window.event;- } else target = e.target;- if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;- if (!e.which || e.which == 1) {- if (!incrementals[snum] || incpos >= incrementals[snum].length) {- go(1);- } else {- subgo(1);- }- }-}--function findSlide(hash) {- var target = null;- var slides = GetElementsWithClassName('*','slide');- for (var i = 0; i < slides.length; i++) {- var targetSlide = slides[i];- if ( (targetSlide.name && targetSlide.name == hash)- || (targetSlide.id && targetSlide.id == hash) ) {- target = targetSlide;- break;- }- }- while(target != null && target.nodeName != 'BODY') {- if (hasClass(target, 'slide')) {- return parseInt(target.id.slice(5));- }- target = target.parentNode;- }- return null;-}--function slideJump() {- if (window.location.hash == null) return;- var sregex = /^#slide(\d+)$/;- var matches = sregex.exec(window.location.hash);- var dest = null;- if (matches != null) {- dest = parseInt(matches[1]);- } else {- dest = findSlide(window.location.hash.slice(1));- }- if (dest != null)- go(dest - snum);-}--function fixLinks() {- var thisUri = window.location.href;- thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);- var aelements = document.getElementsByTagName('A');- for (var i = 0; i < aelements.length; i++) {- var a = aelements[i].href;- var slideID = a.match('\#slide[0-9]{1,2}');- if ((slideID) && (slideID[0].slice(0,1) == '#')) {- var dest = findSlide(slideID[0].slice(1));- if (dest != null) {- if (aelements[i].addEventListener) {- aelements[i].addEventListener("click", new Function("e",- "if (document.getElementById('slideProj').disabled) return;" +- "go("+dest+" - snum); " +- "if (e.preventDefault) e.preventDefault();"), true);- } else if (aelements[i].attachEvent) {- aelements[i].attachEvent("onclick", new Function("",- "if (document.getElementById('slideProj').disabled) return;" +- "go("+dest+" - snum); " +- "event.returnValue = false;"));- }- }- }- }-}--function externalLinks() {- if (!document.getElementsByTagName) return;- var anchors = document.getElementsByTagName('a');- for (var i=0; i<anchors.length; i++) {- var anchor = anchors[i];- if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {- anchor.target = '_blank';- addClass(anchor,'external');- }- }-}--function createControls() {- var controlsDiv = document.getElementById("controls");- if (!controlsDiv) return;- var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';- var hideDiv, hideList = '';- if (controlVis == 'hidden') {- hideDiv = hider;- } else {- hideList = hider;- }- controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +- '<div id="navLinks">' +- '<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>' +- '<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>' +- '<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>' +- '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +- '<\/div><\/form>';- if (controlVis == 'hidden') {- var hidden = document.getElementById('navLinks');- } else {- var hidden = document.getElementById('jumplist');- }- addClass(hidden,'hideme');-}--function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers- if (!s5mode) return false;- var vScale = 22; // both yield 32 (after rounding) at 1024x768- var hScale = 32; // perhaps should auto-calculate based on theme's declared value?- if (window.innerHeight) {- var vSize = window.innerHeight;- var hSize = window.innerWidth;- } else if (document.documentElement.clientHeight) {- var vSize = document.documentElement.clientHeight;- var hSize = document.documentElement.clientWidth;- } else if (document.body.clientHeight) {- var vSize = document.body.clientHeight;- var hSize = document.body.clientWidth;- } else {- var vSize = 700; // assuming 1024x768, minus chrome and such- var hSize = 1024; // these do not account for kiosk mode or Opera Show- }- var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));- fontSize(newSize + 'px');- if (isGe) { // hack to counter incremental reflow bugs- var obj = document.getElementsByTagName('body')[0];- obj.style.display = 'none';- obj.style.display = 'block';- }-}--function fontSize(value) {- if (!(s5ss = document.getElementById('s5ss'))) {- if (!isIE) {- document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));- s5ss.setAttribute('media','screen, projection');- s5ss.setAttribute('id','s5ss');- } else {- document.createStyleSheet();- document.s5ss = document.styleSheets[document.styleSheets.length - 1];- }- }- if (!isIE) {- while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);- s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));- } else {- document.s5ss.addRule('body','font-size: ' + value + ' !important;');- }-}--function notOperaFix() {- slideCSS = document.getElementById('slideProj').href;- var slides = document.getElementById('slideProj');- var outline = document.getElementById('outlineStyle');- slides.setAttribute('media','screen');- outline.disabled = true;- if (isGe) {- slides.setAttribute('href','null'); // Gecko fix- slides.setAttribute('href',slideCSS); // Gecko fix- }- if (isIE && document.styleSheets && document.styleSheets[0]) {- document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');- document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');- document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');- }-}--function getIncrementals(obj) {- var incrementals = new Array();- if (!obj) - return incrementals;- var children = obj.childNodes;- for (var i = 0; i < children.length; i++) {- var child = children[i];- if (hasClass(child, 'incremental')) {- if (child.nodeName == 'OL' || child.nodeName == 'UL') {- removeClass(child, 'incremental');- for (var j = 0; j < child.childNodes.length; j++) {- if (child.childNodes[j].nodeType == 1) {- addClass(child.childNodes[j], 'incremental');- }- }- } else {- incrementals[incrementals.length] = child;- removeClass(child,'incremental');- }- }- if (hasClass(child, 'show-first')) {- if (child.nodeName == 'OL' || child.nodeName == 'UL') {- removeClass(child, 'show-first');- if (child.childNodes[isGe].nodeType == 1) {- removeClass(child.childNodes[isGe], 'incremental');- }- } else {- incrementals[incrementals.length] = child;- }- }- incrementals = incrementals.concat(getIncrementals(child));- }- return incrementals;-}--function createIncrementals() {- var incrementals = new Array();- for (var i = 0; i < smax; i++) {- incrementals[i] = getIncrementals(document.getElementById('slide'+i));- }- return incrementals;-}--function defaultCheck() {- var allMetas = document.getElementsByTagName('meta');- for (var i = 0; i< allMetas.length; i++) {- if (allMetas[i].name == 'defaultView') {- defaultView = allMetas[i].content;- }- if (allMetas[i].name == 'controlVis') {- controlVis = allMetas[i].content;- }- }-}--// Key trap fix, new function body for trap()-function trap(e) {- if (!e) {- e = event;- e.which = e.keyCode;- }- try {- modifierKey = e.ctrlKey || e.altKey || e.metaKey;- }- catch(e) {- modifierKey = false;- }- return modifierKey || e.which == 0;-}--function startup() {- defaultCheck();- if (!isOp) - createControls();- slideLabel();- fixLinks();- externalLinks();- fontScale();- if (!isOp) {- notOperaFix();- incrementals = createIncrementals();- slideJump();- if (defaultView == 'outline') {- toggle();- }- document.onkeyup = keys;- document.onkeypress = trap;- document.onclick = clicker;- }-}--window.onload = startup;-window.onresize = function(){setTimeout('fontScale()', 50);}
+ tests/Diff.hs view
@@ -0,0 +1,76 @@+-----------------------------------------------------------------------------+-- |+-- Module : Data.Algorithm.Diff+-- Copyright : (c) Sterling Clover 2008+-- License : BSD 3 Clause+-- Maintainer : s.clover@gmail.com+-- Stability : experimental+-- Portability : portable+--+-- This is an implementation of the O(ND) diff algorithm as described in+-- \"An O(ND) Difference Algorithm and Its Variations (1986)\"+-- <http://citeseer.ist.psu.edu/myers86ond.html>. It is O(mn) in space.+-- The algorithm is the same one used by standared Unix diff.+-- The assumption is that users of this library will want to diff over+-- interesting things or peform interesting tasks with the results+-- (given that, otherwise, they would simply use the standard Unix diff+-- utility). Thus no attempt is made to present a fancier API to aid+-- in doing standard and uninteresting things with the results.+-----------------------------------------------------------------------------++module Diff (DI(..), getDiff, getGroupedDiff) where+import Data.Array+import Data.List++-- | Difference Indicator. A value is either from the First list, the Second+-- or from Both.+data DI = F | S | B deriving (Show, Eq)++data DL = DL {poi::Int, poj::Int, path::[DI]} deriving (Show, Eq)++instance Ord DL where x <= y = poi x <= poi y++canDiag :: (Eq a) => [a] -> [a] -> Int -> Int -> (Int, Int) -> Bool+canDiag as bs lena lenb = \(i,j) ->+ if i < lena && j < lenb then arAs ! i == arBs ! j else False+ where arAs = listArray (0,lena - 1) as+ arBs = listArray (0,lenb - 1) bs++chunk :: Int -> [a] -> [[a]]+chunk x = unfoldr (\a -> case splitAt x a of ([],[]) -> Nothing; a' -> Just a')++dstep :: ((Int,Int)->Bool) -> [DL] -> [DL]+dstep cd dls = map maximum $ [hd]:(chunk 2 rst)+ where (hd:rst) = concatMap extend dls+ extend dl = let pdl = path dl+ in [addsnake cd $ dl {poi=poi dl + 1, path=(F : pdl)},+ addsnake cd $ dl {poj=poj dl + 1, path=(S : pdl)}]++addsnake :: ((Int,Int)->Bool) -> DL -> DL+addsnake cd dl+ | cd (pi, pj) = addsnake cd $+ dl {poi = pi + 1, poj = pj + 1, path=(B : path dl)}+ | otherwise = dl+ where pi = poi dl; pj = poj dl++lcs :: (Eq a) => [a] -> [a] -> [DI]+lcs as bs = path . head . dropWhile (\dl -> poi dl /= lena || poj dl /= lenb) .+ concat . iterate (dstep cd) . (:[]) . addsnake cd $+ DL {poi=0,poj=0,path=[]}+ where cd = canDiag as bs lena lenb+ lena = length as; lenb = length bs++-- | Takes two lists and returns a list indicating the differences+-- between them.+getDiff :: (Eq t) => [t] -> [t] -> [(DI, t)]+getDiff a b = markup a b . reverse $ lcs a b+ where markup (x:xs) ys (F:ds) = (F, x) : markup xs ys ds+ markup xs (y:ys) (S:ds) = (S, y) : markup xs ys ds+ markup (x:xs) (_:ys) (B:ds) = (B, x) : markup xs ys ds+ markup _ _ _ = []++-- | Takes two lists and returns a list indicating the differences+-- between them, grouped into chunks.+getGroupedDiff :: (Eq t) => [t] -> [t] -> [(DI, [t])]+getGroupedDiff a b = map go . groupBy (\x y -> fst x == fst y) $ getDiff a b+ where go ((d,x) : xs) = (d, x : map snd xs)
− tests/MarkdownTest_1.0.3/MarkdownTest.pl
@@ -1,176 +0,0 @@-#!/usr/bin/perl--#-# MarkdownTester -- Run tests for Markdown implementations-#-# Copyright (c) 2004-2005 John Gruber-# <http://daringfireball.net/projects/markdown/>-#--use strict;-use warnings;-use Getopt::Long;-use Benchmark;--our $VERSION = '1.0.2';-# Sat 24 Dec 2005--my $time_start = new Benchmark;-my $test_dir = "Tests";-my $script = "./Markdown.pl";-my $use_tidy = 0;-my ($flag_version);--GetOptions (- "script=s" => \$script,- "testdir=s" => \$test_dir,- "tidy" => \$use_tidy,- "version" => \$flag_version,- );--if($flag_version) {- my $progname = $0;- $progname =~ s{.*/}{};- die "$progname version $VERSION\n";-}--unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; }-unless (-f $script) { die "$script does not exist.\n"; }-unless (-x $script) { die "$script is not executable.\n"; }--my $tests_passed = 0;-my $tests_failed = 0;--TEST:-foreach my $testfile (glob "$test_dir/*.text") {- my $testname = $testfile;- $testname =~ s{.*/(.+)\.text$}{$1}i; - print "$testname ... ";-- # Look for a corresponding .html file for each .text file:- my $resultfile = $testfile;- $resultfile =~ s{\.text$}{\.html}i;- unless (-f $resultfile) {- print "'$resultfile' does not exist.\n\n";- next TEST;- }- - # open(TEST, $testfile) || die("Can't open testfile: $!");- open(RESULT, $resultfile) || die("Can't open resultfile: $!");- undef $/;- # my $t_input = <TEST>;- my $t_result = <RESULT>;-- my $t_output = `'$script' '$testfile'`;-- # Normalize the output and expected result strings:- $t_result =~ s/\s+\z//; # trim trailing whitespace- $t_output =~ s/\s+\z//; # trim trailing whitespace- if ($use_tidy) {- # Escape the strings, pass them through to CLI tidy tool for tag-level equivalency- $t_result =~ s{'}{'\\''}g; # escape ' chars for shell- $t_output =~ s{'}{'\\''}g;- $t_result = `echo '$t_result' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;- $t_output = `echo '$t_output' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;- }-- if ($t_output eq $t_result) {- print "OK\n";- $tests_passed++;- }- else {- print "FAILED\n\n";-# This part added by JM to print diffs- open(OUT, '>tmp1') or die $!;- print OUT $t_output or die $!;- open(RES, '>tmp2') or die $!;- print RES $t_result or die $!;- print `diff tmp1 tmp2`;- close RES;- close OUT;- print "\n";- `rm tmp?`;-# End of added part- $tests_failed++;- }-}--print "\n\n";-print "$tests_passed passed; $tests_failed failed.\n";--my $time_end = new Benchmark;-my $time_diff = timediff($time_end, $time_start);-print "Benchmark: ", timestr($time_diff), "\n";---__END__--=pod--=head1 NAME--B<MarkdownTest>---=head1 SYNOPSIS--B<MarkdownTest.pl> [ B<--options> ] [ I<file> ... ]---=head1 DESCRIPTION---=head1 OPTIONS--Use "--" to end switch parsing. For example, to open a file named "-z", use:-- MarkdownTest.pl -- -z--=over 4--=item B<--script>--Specify the path to the Markdown script to test. Defaults to-"./Markdown.pl". Example:-- ./MarkdownTest.pl --script ./PHP-Markdown/php-markdown--=item B<--testdir>--Specify the path to a directory containing test data. Defaults to "Tests".--=item B<--tidy>--Flag to turn on using the command line 'tidy' tool to normalize HTML-output before comparing script output to the expected test result.-Assumes that the 'tidy' command is available in your PATH. Defaults to-off.--=back----=head1 BUGS----=head1 VERSION HISTORY--1.0 Mon 13 Dec 2004-2005--1.0.1 Mon 19 Sep 2005-- + Better handling of case when foo.text exists, but foo.html doesn't.- It now prints a message and moves on, rather than dying.---=head1 COPYRIGHT AND LICENSE--Copyright (c) 2004-2005 John Gruber -<http://daringfireball.net/> -All rights reserved.--This is free software; you may redistribute it and/or modify it under-the same terms as Perl itself.--=cut
− tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html
@@ -1,17 +0,0 @@-<p>AT&T has an ampersand in their name.</p>--<p>AT&T is another way to write it.</p>--<p>This & that.</p>--<p>4 < 5.</p>--<p>6 > 5.</p>--<p>Here's a <a href="http://example.com/?foo=1&bar=2">link</a> with an ampersand in the URL.</p>--<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&T</a>.</p>--<p>Here's an inline <a href="/script?foo=1&bar=2">link</a>.</p>--<p>Here's an inline <a href="/script?foo=1&bar=2">link</a>.</p>
− tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text
@@ -1,21 +0,0 @@-AT&T has an ampersand in their name.--AT&T is another way to write it.--This & that.--4 < 5.--6 > 5.--Here's a [link] [1] with an ampersand in the URL.--Here's a link with an amersand in the link text: [AT&T] [2].--Here's an inline [link](/script?foo=1&bar=2).--Here's an inline [link](</script?foo=1&bar=2>).---[1]: http://example.com/?foo=1&bar=2-[2]: http://att.com/ "AT&T"
− tests/MarkdownTest_1.0.3/Tests/Auto links.html
@@ -1,18 +0,0 @@-<p>Link: <a href="http://example.com/">http://example.com/</a>.</p>--<p>With an ampersand: <a href="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</a></p>--<ul>-<li>In a list?</li>-<li><a href="http://example.com/">http://example.com/</a></li>-<li>It should.</li>-</ul>--<blockquote>- <p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>-</blockquote>--<p>Auto-links should not occur here: <code><http://example.com/></code></p>--<pre><code>or here: <http://example.com/>-</code></pre>
− tests/MarkdownTest_1.0.3/Tests/Auto links.text
@@ -1,13 +0,0 @@-Link: <http://example.com/>.--With an ampersand: <http://example.com/?foo=1&bar=2>--* In a list?-* <http://example.com/>-* It should.--> Blockquoted: <http://example.com/>--Auto-links should not occur here: `<http://example.com/>`-- or here: <http://example.com/>
− tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html
@@ -1,118 +0,0 @@-<p>These should all get escaped:</p>--<p>Backslash: \</p>--<p>Backtick: `</p>--<p>Asterisk: *</p>--<p>Underscore: _</p>--<p>Left brace: {</p>--<p>Right brace: }</p>--<p>Left bracket: [</p>--<p>Right bracket: ]</p>--<p>Left paren: (</p>--<p>Right paren: )</p>--<p>Greater-than: ></p>--<p>Hash: #</p>--<p>Period: .</p>--<p>Bang: !</p>--<p>Plus: +</p>--<p>Minus: -</p>--<p>These should not, because they occur within a code block:</p>--<pre><code>Backslash: \\--Backtick: \`--Asterisk: \*--Underscore: \_--Left brace: \{--Right brace: \}--Left bracket: \[--Right bracket: \]--Left paren: \(--Right paren: \)--Greater-than: \>--Hash: \#--Period: \.--Bang: \!--Plus: \+--Minus: \--</code></pre>--<p>Nor should these, which occur in code spans:</p>--<p>Backslash: <code>\\</code></p>--<p>Backtick: <code>\`</code></p>--<p>Asterisk: <code>\*</code></p>--<p>Underscore: <code>\_</code></p>--<p>Left brace: <code>\{</code></p>--<p>Right brace: <code>\}</code></p>--<p>Left bracket: <code>\[</code></p>--<p>Right bracket: <code>\]</code></p>--<p>Left paren: <code>\(</code></p>--<p>Right paren: <code>\)</code></p>--<p>Greater-than: <code>\></code></p>--<p>Hash: <code>\#</code></p>--<p>Period: <code>\.</code></p>--<p>Bang: <code>\!</code></p>--<p>Plus: <code>\+</code></p>--<p>Minus: <code>\-</code></p>---<p>These should get escaped, even though they're matching pairs for-other Markdown constructs:</p>--<p>*asterisks*</p>--<p>_underscores_</p>--<p>`backticks`</p>--<p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>--<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>--<p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>
− tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text
@@ -1,120 +0,0 @@-These should all get escaped:--Backslash: \\--Backtick: \`--Asterisk: \*--Underscore: \_--Left brace: \{--Right brace: \}--Left bracket: \[--Right bracket: \]--Left paren: \(--Right paren: \)--Greater-than: \>--Hash: \#--Period: \.--Bang: \!--Plus: \+--Minus: \-----These should not, because they occur within a code block:-- Backslash: \\-- Backtick: \`-- Asterisk: \*-- Underscore: \_-- Left brace: \{-- Right brace: \}-- Left bracket: \[-- Right bracket: \]-- Left paren: \(-- Right paren: \)-- Greater-than: \>-- Hash: \#-- Period: \.-- Bang: \!-- Plus: \+-- Minus: \----Nor should these, which occur in code spans:--Backslash: `\\`--Backtick: `` \` ``--Asterisk: `\*`--Underscore: `\_`--Left brace: `\{`--Right brace: `\}`--Left bracket: `\[`--Right bracket: `\]`--Left paren: `\(`--Right paren: `\)`--Greater-than: `\>`--Hash: `\#`--Period: `\.`--Bang: `\!`--Plus: `\+`--Minus: `\-`---These should get escaped, even though they're matching pairs for-other Markdown constructs:--\*asterisks\*--\_underscores\_--\`backticks\`--This is a code span with a literal backslash-backtick sequence: `` \` ``--This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.--This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.
− tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html
@@ -1,15 +0,0 @@-<blockquote>- <p>Example:</p>--<pre><code>sub status {- print "working";-}-</code></pre>- - <p>Or:</p>--<pre><code>sub status {- return "working";-}-</code></pre>-</blockquote>
− tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text
@@ -1,11 +0,0 @@-> Example:-> -> sub status {-> print "working";-> }-> -> Or:-> -> sub status {-> return "working";-> }
− tests/MarkdownTest_1.0.3/Tests/Code Blocks.html
@@ -1,18 +0,0 @@-<pre><code>code block on the first line-</code></pre>--<p>Regular text.</p>--<pre><code>code block indented by spaces-</code></pre>--<p>Regular text.</p>--<pre><code>the lines in this block -all contain trailing spaces -</code></pre>--<p>Regular Text.</p>--<pre><code>code block on the last line-</code></pre>
− tests/MarkdownTest_1.0.3/Tests/Code Blocks.text
@@ -1,14 +0,0 @@- code block on the first line- -Regular text.-- code block indented by spaces--Regular text.-- the lines in this block - all contain trailing spaces --Regular Text.-- code block on the last line
− tests/MarkdownTest_1.0.3/Tests/Code Spans.html
@@ -1,6 +0,0 @@-<p><code><test a="</code> content of attribute <code>"></code></p>--<p>Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span></p>--<p>Here's how you put <code>`backticks`</code> in a code span.</p>-
− tests/MarkdownTest_1.0.3/Tests/Code Spans.text
@@ -1,6 +0,0 @@-`<test a="` content of attribute `">`--Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span>--Here's how you put `` `backticks` `` in a code span.-
− tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html
@@ -1,8 +0,0 @@-<p>In Markdown 1.0.0 and earlier. Version-8. This line turns into a list item.-Because a hard-wrapped line in the-middle of a paragraph looked like a-list item.</p>--<p>Here's one with a bullet.-* criminey.</p>
− tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text
@@ -1,8 +0,0 @@-In Markdown 1.0.0 and earlier. Version-8. This line turns into a list item.-Because a hard-wrapped line in the-middle of a paragraph looked like a-list item.--Here's one with a bullet.-* criminey.
− tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html
@@ -1,71 +0,0 @@-<p>Dashes:</p>--<hr />--<hr />--<hr />--<hr />--<pre><code>----</code></pre>--<hr />--<hr />--<hr />--<hr />--<pre><code>- - --</code></pre>--<p>Asterisks:</p>--<hr />--<hr />--<hr />--<hr />--<pre><code>***-</code></pre>--<hr />--<hr />--<hr />--<hr />--<pre><code>* * *-</code></pre>--<p>Underscores:</p>--<hr />--<hr />--<hr />--<hr />--<pre><code>___-</code></pre>--<hr />--<hr />--<hr />--<hr />--<pre><code>_ _ _-</code></pre>
− tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text
@@ -1,67 +0,0 @@-Dashes:------- ---- - ----- ----- ------ - --- - - -- - - - --- - - --- - - ----Asterisks:--***-- ***- - ***-- ***-- ***--* * *-- * * *- - * * *-- * * *-- * * *---Underscores:--___-- ___- - ___-- ___-- ___--_ _ _-- _ _ _- - _ _ _-- _ _ _-- _ _ _
− tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html
@@ -1,15 +0,0 @@-<p>Simple block on one line:</p>--<div>foo</div>--<p>And nested without indentation:</p>--<div>-<div>-<div>-foo-</div>-<div style=">"/>-</div>-<div>bar</div>-</div>
− tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text
@@ -1,15 +0,0 @@-Simple block on one line:--<div>foo</div>--And nested without indentation:--<div>-<div>-<div>-foo-</div>-<div style=">"/>-</div>-<div>bar</div>-</div>
− tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html
@@ -1,72 +0,0 @@-<p>Here's a simple block:</p>--<div>- foo-</div>--<p>This should be a code block, though:</p>--<pre><code><div>- foo-</div>-</code></pre>--<p>As should this:</p>--<pre><code><div>foo</div>-</code></pre>--<p>Now, nested:</p>--<div>- <div>- <div>- foo- </div>- </div>-</div>--<p>This should just be an HTML comment:</p>--<!-- Comment -->--<p>Multiline:</p>--<!---Blah-Blah--->--<p>Code block:</p>--<pre><code><!-- Comment -->-</code></pre>--<p>Just plain comment, with trailing spaces on the line:</p>--<!-- foo --> --<p>Code:</p>--<pre><code><hr />-</code></pre>--<p>Hr's:</p>--<hr>--<hr/>--<hr />--<hr> --<hr/> --<hr /> --<hr class="foo" id="bar" />--<hr class="foo" id="bar"/>--<hr class="foo" id="bar" >
− tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text
@@ -1,69 +0,0 @@-Here's a simple block:--<div>- foo-</div>--This should be a code block, though:-- <div>- foo- </div>--As should this:-- <div>foo</div>--Now, nested:--<div>- <div>- <div>- foo- </div>- </div>-</div>--This should just be an HTML comment:--<!-- Comment -->--Multiline:--<!---Blah-Blah--->--Code block:-- <!-- Comment -->--Just plain comment, with trailing spaces on the line:--<!-- foo --> --Code:-- <hr />- -Hr's:--<hr>--<hr/>--<hr />--<hr> --<hr/> --<hr /> --<hr class="foo" id="bar" />--<hr class="foo" id="bar"/>--<hr class="foo" id="bar" >-
− tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html
@@ -1,13 +0,0 @@-<p>Paragraph one.</p>--<!-- This is a simple comment -->--<!--- This is another comment.--->--<p>Paragraph two.</p>--<!-- one comment block -- -- with two comments -->--<p>The end.</p>
− tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text
@@ -1,13 +0,0 @@-Paragraph one.--<!-- This is a simple comment -->--<!--- This is another comment.--->--Paragraph two.--<!-- one comment block -- -- with two comments -->--The end.
− tests/MarkdownTest_1.0.3/Tests/Links, inline style.html
@@ -1,11 +0,0 @@-<p>Just a <a href="/url/">URL</a>.</p>--<p><a href="/url/" title="title">URL and title</a>.</p>--<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p>--<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p>--<p><a href="/url/" title="title has spaces afterward">URL and title</a>.</p>--<p><a href="">Empty</a>.</p>
− tests/MarkdownTest_1.0.3/Tests/Links, inline style.text
@@ -1,12 +0,0 @@-Just a [URL](/url/).--[URL and title](/url/ "title").--[URL and title](/url/ "title preceded by two spaces").--[URL and title](/url/ "title preceded by a tab").--[URL and title](/url/ "title has spaces afterward" ).---[Empty]().
− tests/MarkdownTest_1.0.3/Tests/Links, reference style.html
@@ -1,52 +0,0 @@-<p>Foo <a href="/url/" title="Title">bar</a>.</p>--<p>Foo <a href="/url/" title="Title">bar</a>.</p>--<p>Foo <a href="/url/" title="Title">bar</a>.</p>--<p>With <a href="/url/">embedded [brackets]</a>.</p>--<p>Indented <a href="/url">once</a>.</p>--<p>Indented <a href="/url">twice</a>.</p>--<p>Indented <a href="/url">thrice</a>.</p>--<p>Indented [four][] times.</p>--<pre><code>[four]: /url-</code></pre>--<hr />--<p><a href="foo">this</a> should work</p>--<p>So should <a href="foo">this</a>.</p>--<p>And <a href="foo">this</a>.</p>--<p>And <a href="foo">this</a>.</p>--<p>And <a href="foo">this</a>.</p>--<p>But not [that] [].</p>--<p>Nor [that][].</p>--<p>Nor [that].</p>--<p>[Something in brackets like <a href="foo">this</a> should work]</p>--<p>[Same with <a href="foo">this</a>.]</p>--<p>In this case, <a href="/somethingelse/">this</a> points to something else.</p>--<p>Backslashing should suppress [this] and [this].</p>--<hr />--<p>Here's one where the <a href="/url/">link-breaks</a> across lines.</p>--<p>Here's another where the <a href="/url/">link -breaks</a> across lines, but with a line-ending space.</p>
− tests/MarkdownTest_1.0.3/Tests/Links, reference style.text
@@ -1,71 +0,0 @@-Foo [bar] [1].--Foo [bar][1].--Foo [bar]-[1].--[1]: /url/ "Title"---With [embedded [brackets]] [b].---Indented [once][].--Indented [twice][].--Indented [thrice][].--Indented [four][] times.-- [once]: /url-- [twice]: /url-- [thrice]: /url-- [four]: /url---[b]: /url/--* * *--[this] [this] should work--So should [this][this].--And [this] [].--And [this][].--And [this].--But not [that] [].--Nor [that][].--Nor [that].--[Something in brackets like [this][] should work]--[Same with [this].]--In this case, [this](/somethingelse/) points to something else.--Backslashing should suppress \[this] and [this\].--[this]: foo---* * *--Here's one where the [link-breaks] across lines.--Here's another where the [link -breaks] across lines, but with a line-ending space.---[link breaks]: /url/
− tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html
@@ -1,9 +0,0 @@-<p>This is the <a href="/simple">simple case</a>.</p>--<p>This one has a <a href="/foo">line-break</a>.</p>--<p>This one has a <a href="/foo">line -break</a> with a line-ending space.</p>--<p><a href="/that">this</a> and the <a href="/other">other</a></p>
− tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text
@@ -1,20 +0,0 @@-This is the [simple case].--[simple case]: /simple----This one has a [line-break].--This one has a [line -break] with a line-ending space.--[line break]: /foo---[this] [that] and the [other]--[this]: /this-[that]: /that-[other]: /other
− tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html
@@ -1,3 +0,0 @@-<p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p>--<p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p>
− tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text
@@ -1,7 +0,0 @@-Foo [bar][].--Foo [bar](/url/ "Title with "quotes" inside").--- [bar]: /url/ "Title with "quotes" inside"-
− tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html
@@ -1,314 +0,0 @@-<h1>Markdown: Basics</h1>--<ul id="ProjectSubmenu">- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>- <li><a class="selected" title="Markdown Basics">Basics</a></li>- <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>-</ul>--<h2>Getting the Gist of Markdown's Formatting Syntax</h2>--<p>This page offers a brief overview of what it's like to use Markdown.-The <a href="/projects/markdown/syntax" title="Markdown Syntax">syntax page</a> provides complete, detailed documentation for-every feature, but Markdown should be very easy to pick up simply by-looking at a few examples of it in action. The examples on this page-are written in a before/after style, showing example syntax and the-HTML output produced by Markdown.</p>--<p>It's also helpful to simply try Markdown out; the <a href="/projects/markdown/dingus" title="Markdown Dingus">Dingus</a> is a-web application that allows you type your own Markdown-formatted text-and translate it to XHTML.</p>--<p><strong>Note:</strong> This document is itself written using Markdown; you-can <a href="/projects/markdown/basics.text">see the source for it by adding '.text' to the URL</a>.</p>--<h2>Paragraphs, Headers, Blockquotes</h2>--<p>A paragraph is simply one or more consecutive lines of text, separated-by one or more blank lines. (A blank line is any line that looks like a-blank line -- a line containing nothing spaces or tabs is considered-blank.) Normal paragraphs should not be intended with spaces or tabs.</p>--<p>Markdown offers two styles of headers: <em>Setext</em> and <em>atx</em>.-Setext-style headers for <code><h1></code> and <code><h2></code> are created by-"underlining" with equal signs (<code>=</code>) and hyphens (<code>-</code>), respectively.-To create an atx-style header, you put 1-6 hash marks (<code>#</code>) at the-beginning of the line -- the number of hashes equals the resulting-HTML header level.</p>--<p>Blockquotes are indicated using email-style '<code>></code>' angle brackets.</p>--<p>Markdown:</p>--<pre><code>A First Level Header-====================--A Second Level Header------------------------Now is the time for all good men to come to-the aid of their country. This is just a-regular paragraph.--The quick brown fox jumped over the lazy-dog's back.--### Header 3--> This is a blockquote.-> -> This is the second paragraph in the blockquote.->-> ## This is an H2 in a blockquote-</code></pre>--<p>Output:</p>--<pre><code><h1>A First Level Header</h1>--<h2>A Second Level Header</h2>--<p>Now is the time for all good men to come to-the aid of their country. This is just a-regular paragraph.</p>--<p>The quick brown fox jumped over the lazy-dog's back.</p>--<h3>Header 3</h3>--<blockquote>- <p>This is a blockquote.</p>-- <p>This is the second paragraph in the blockquote.</p>-- <h2>This is an H2 in a blockquote</h2>-</blockquote>-</code></pre>--<h3>Phrase Emphasis</h3>--<p>Markdown uses asterisks and underscores to indicate spans of emphasis.</p>--<p>Markdown:</p>--<pre><code>Some of these words *are emphasized*.-Some of these words _are emphasized also_.--Use two asterisks for **strong emphasis**.-Or, if you prefer, __use two underscores instead__.-</code></pre>--<p>Output:</p>--<pre><code><p>Some of these words <em>are emphasized</em>.-Some of these words <em>are emphasized also</em>.</p>--<p>Use two asterisks for <strong>strong emphasis</strong>.-Or, if you prefer, <strong>use two underscores instead</strong>.</p>-</code></pre>--<h2>Lists</h2>--<p>Unordered (bulleted) lists use asterisks, pluses, and hyphens (<code>*</code>,-<code>+</code>, and <code>-</code>) as list markers. These three markers are-interchangable; this:</p>--<pre><code>* Candy.-* Gum.-* Booze.-</code></pre>--<p>this:</p>--<pre><code>+ Candy.-+ Gum.-+ Booze.-</code></pre>--<p>and this:</p>--<pre><code>- Candy.-- Gum.-- Booze.-</code></pre>--<p>all produce the same output:</p>--<pre><code><ul>-<li>Candy.</li>-<li>Gum.</li>-<li>Booze.</li>-</ul>-</code></pre>--<p>Ordered (numbered) lists use regular numbers, followed by periods, as-list markers:</p>--<pre><code>1. Red-2. Green-3. Blue-</code></pre>--<p>Output:</p>--<pre><code><ol>-<li>Red</li>-<li>Green</li>-<li>Blue</li>-</ol>-</code></pre>--<p>If you put blank lines between items, you'll get <code><p></code> tags for the-list item text. You can create multi-paragraph list items by indenting-the paragraphs by 4 spaces or 1 tab:</p>--<pre><code>* A list item.-- With multiple paragraphs.--* Another item in the list.-</code></pre>--<p>Output:</p>--<pre><code><ul>-<li><p>A list item.</p>-<p>With multiple paragraphs.</p></li>-<li><p>Another item in the list.</p></li>-</ul>-</code></pre>--<h3>Links</h3>--<p>Markdown supports two styles for creating links: <em>inline</em> and-<em>reference</em>. With both styles, you use square brackets to delimit the-text you want to turn into a link.</p>--<p>Inline-style links use parentheses immediately after the link text.-For example:</p>--<pre><code>This is an [example link](http://example.com/).-</code></pre>--<p>Output:</p>--<pre><code><p>This is an <a href="http://example.com/">-example link</a>.</p>-</code></pre>--<p>Optionally, you may include a title attribute in the parentheses:</p>--<pre><code>This is an [example link](http://example.com/ "With a Title").-</code></pre>--<p>Output:</p>--<pre><code><p>This is an <a href="http://example.com/" title="With a Title">-example link</a>.</p>-</code></pre>--<p>Reference-style links allow you to refer to your links by names, which-you define elsewhere in your document:</p>--<pre><code>I get 10 times more traffic from [Google][1] than from-[Yahoo][2] or [MSN][3].--[1]: http://google.com/ "Google"-[2]: http://search.yahoo.com/ "Yahoo Search"-[3]: http://search.msn.com/ "MSN Search"-</code></pre>--<p>Output:</p>--<pre><code><p>I get 10 times more traffic from <a href="http://google.com/"-title="Google">Google</a> than from <a href="http://search.yahoo.com/"-title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"-title="MSN Search">MSN</a>.</p>-</code></pre>--<p>The title attribute is optional. Link names may contain letters,-numbers and spaces, but are <em>not</em> case sensitive:</p>--<pre><code>I start my morning with a cup of coffee and-[The New York Times][NY Times].--[ny times]: http://www.nytimes.com/-</code></pre>--<p>Output:</p>--<pre><code><p>I start my morning with a cup of coffee and-<a href="http://www.nytimes.com/">The New York Times</a>.</p>-</code></pre>--<h3>Images</h3>--<p>Image syntax is very much like link syntax.</p>--<p>Inline (titles are optional):</p>--<pre><code>-</code></pre>--<p>Reference-style:</p>--<pre><code>![alt text][id]--[id]: /path/to/img.jpg "Title"-</code></pre>--<p>Both of the above examples produce the same output:</p>--<pre><code><img src="/path/to/img.jpg" alt="alt text" title="Title" />-</code></pre>--<h3>Code</h3>--<p>In a regular paragraph, you can create code span by wrapping text in-backtick quotes. Any ampersands (<code>&</code>) and angle brackets (<code><</code> or-<code>></code>) will automatically be translated into HTML entities. This makes-it easy to use Markdown to write about HTML example code:</p>--<pre><code>I strongly recommend against using any `<blink>` tags.--I wish SmartyPants used named entities like `&mdash;`-instead of decimal-encoded entites like `&#8212;`.-</code></pre>--<p>Output:</p>--<pre><code><p>I strongly recommend against using any-<code>&lt;blink&gt;</code> tags.</p>--<p>I wish SmartyPants used named entities like-<code>&amp;mdash;</code> instead of decimal-encoded-entites like <code>&amp;#8212;</code>.</p>-</code></pre>--<p>To specify an entire block of pre-formatted code, indent every line of-the block by 4 spaces or 1 tab. Just like with code spans, <code>&</code>, <code><</code>,-and <code>></code> characters will be escaped automatically.</p>--<p>Markdown:</p>--<pre><code>If you want your page to validate under XHTML 1.0 Strict,-you've got to put paragraph tags in your blockquotes:-- <blockquote>- <p>For example.</p>- </blockquote>-</code></pre>--<p>Output:</p>--<pre><code><p>If you want your page to validate under XHTML 1.0 Strict,-you've got to put paragraph tags in your blockquotes:</p>--<pre><code>&lt;blockquote&gt;- &lt;p&gt;For example.&lt;/p&gt;-&lt;/blockquote&gt;-</code></pre>-</code></pre>
− tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text
@@ -1,306 +0,0 @@-Markdown: Basics-================--<ul id="ProjectSubmenu">- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>- <li><a class="selected" title="Markdown Basics">Basics</a></li>- <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>-</ul>---Getting the Gist of Markdown's Formatting Syntax---------------------------------------------------This page offers a brief overview of what it's like to use Markdown.-The [syntax page] [s] provides complete, detailed documentation for-every feature, but Markdown should be very easy to pick up simply by-looking at a few examples of it in action. The examples on this page-are written in a before/after style, showing example syntax and the-HTML output produced by Markdown.--It's also helpful to simply try Markdown out; the [Dingus] [d] is a-web application that allows you type your own Markdown-formatted text-and translate it to XHTML.--**Note:** This document is itself written using Markdown; you-can [see the source for it by adding '.text' to the URL] [src].-- [s]: /projects/markdown/syntax "Markdown Syntax"- [d]: /projects/markdown/dingus "Markdown Dingus"- [src]: /projects/markdown/basics.text---## Paragraphs, Headers, Blockquotes ##--A paragraph is simply one or more consecutive lines of text, separated-by one or more blank lines. (A blank line is any line that looks like a-blank line -- a line containing nothing spaces or tabs is considered-blank.) Normal paragraphs should not be intended with spaces or tabs.--Markdown offers two styles of headers: *Setext* and *atx*.-Setext-style headers for `<h1>` and `<h2>` are created by-"underlining" with equal signs (`=`) and hyphens (`-`), respectively.-To create an atx-style header, you put 1-6 hash marks (`#`) at the-beginning of the line -- the number of hashes equals the resulting-HTML header level.--Blockquotes are indicated using email-style '`>`' angle brackets.--Markdown:-- A First Level Header- ====================- - A Second Level Header- ----------------------- Now is the time for all good men to come to- the aid of their country. This is just a- regular paragraph.-- The quick brown fox jumped over the lazy- dog's back.- - ### Header 3-- > This is a blockquote.- > - > This is the second paragraph in the blockquote.- >- > ## This is an H2 in a blockquote---Output:-- <h1>A First Level Header</h1>- - <h2>A Second Level Header</h2>- - <p>Now is the time for all good men to come to- the aid of their country. This is just a- regular paragraph.</p>- - <p>The quick brown fox jumped over the lazy- dog's back.</p>- - <h3>Header 3</h3>- - <blockquote>- <p>This is a blockquote.</p>- - <p>This is the second paragraph in the blockquote.</p>- - <h2>This is an H2 in a blockquote</h2>- </blockquote>----### Phrase Emphasis ###--Markdown uses asterisks and underscores to indicate spans of emphasis.--Markdown:-- Some of these words *are emphasized*.- Some of these words _are emphasized also_.- - Use two asterisks for **strong emphasis**.- Or, if you prefer, __use two underscores instead__.--Output:-- <p>Some of these words <em>are emphasized</em>.- Some of these words <em>are emphasized also</em>.</p>- - <p>Use two asterisks for <strong>strong emphasis</strong>.- Or, if you prefer, <strong>use two underscores instead</strong>.</p>- ---## Lists ##--Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,-`+`, and `-`) as list markers. These three markers are-interchangable; this:-- * Candy.- * Gum.- * Booze.--this:-- + Candy.- + Gum.- + Booze.--and this:-- - Candy.- - Gum.- - Booze.--all produce the same output:-- <ul>- <li>Candy.</li>- <li>Gum.</li>- <li>Booze.</li>- </ul>--Ordered (numbered) lists use regular numbers, followed by periods, as-list markers:-- 1. Red- 2. Green- 3. Blue--Output:-- <ol>- <li>Red</li>- <li>Green</li>- <li>Blue</li>- </ol>--If you put blank lines between items, you'll get `<p>` tags for the-list item text. You can create multi-paragraph list items by indenting-the paragraphs by 4 spaces or 1 tab:-- * A list item.- - With multiple paragraphs.-- * Another item in the list.--Output:-- <ul>- <li><p>A list item.</p>- <p>With multiple paragraphs.</p></li>- <li><p>Another item in the list.</p></li>- </ul>- ---### Links ###--Markdown supports two styles for creating links: *inline* and-*reference*. With both styles, you use square brackets to delimit the-text you want to turn into a link.--Inline-style links use parentheses immediately after the link text.-For example:-- This is an [example link](http://example.com/).--Output:-- <p>This is an <a href="http://example.com/">- example link</a>.</p>--Optionally, you may include a title attribute in the parentheses:-- This is an [example link](http://example.com/ "With a Title").--Output:-- <p>This is an <a href="http://example.com/" title="With a Title">- example link</a>.</p>--Reference-style links allow you to refer to your links by names, which-you define elsewhere in your document:-- I get 10 times more traffic from [Google][1] than from- [Yahoo][2] or [MSN][3].-- [1]: http://google.com/ "Google"- [2]: http://search.yahoo.com/ "Yahoo Search"- [3]: http://search.msn.com/ "MSN Search"--Output:-- <p>I get 10 times more traffic from <a href="http://google.com/"- title="Google">Google</a> than from <a href="http://search.yahoo.com/"- title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"- title="MSN Search">MSN</a>.</p>--The title attribute is optional. Link names may contain letters,-numbers and spaces, but are *not* case sensitive:-- I start my morning with a cup of coffee and- [The New York Times][NY Times].-- [ny times]: http://www.nytimes.com/--Output:-- <p>I start my morning with a cup of coffee and- <a href="http://www.nytimes.com/">The New York Times</a>.</p>---### Images ###--Image syntax is very much like link syntax.--Inline (titles are optional):-- --Reference-style:-- ![alt text][id]-- [id]: /path/to/img.jpg "Title"--Both of the above examples produce the same output:-- <img src="/path/to/img.jpg" alt="alt text" title="Title" />----### Code ###--In a regular paragraph, you can create code span by wrapping text in-backtick quotes. Any ampersands (`&`) and angle brackets (`<` or-`>`) will automatically be translated into HTML entities. This makes-it easy to use Markdown to write about HTML example code:-- I strongly recommend against using any `<blink>` tags.-- I wish SmartyPants used named entities like `—`- instead of decimal-encoded entites like `—`.--Output:-- <p>I strongly recommend against using any- <code><blink></code> tags.</p>- - <p>I wish SmartyPants used named entities like- <code>&mdash;</code> instead of decimal-encoded- entites like <code>&#8212;</code>.</p>---To specify an entire block of pre-formatted code, indent every line of-the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,-and `>` characters will be escaped automatically.--Markdown:-- If you want your page to validate under XHTML 1.0 Strict,- you've got to put paragraph tags in your blockquotes:-- <blockquote>- <p>For example.</p>- </blockquote>--Output:-- <p>If you want your page to validate under XHTML 1.0 Strict,- you've got to put paragraph tags in your blockquotes:</p>- - <pre><code><blockquote>- <p>For example.</p>- </blockquote>- </code></pre>
− tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html
@@ -1,942 +0,0 @@-<h1>Markdown: Syntax</h1>--<ul id="ProjectSubmenu">- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>- <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>- <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>-</ul>--<ul>-<li><a href="#overview">Overview</a>-<ul>-<li><a href="#philosophy">Philosophy</a></li>-<li><a href="#html">Inline HTML</a></li>-<li><a href="#autoescape">Automatic Escaping for Special Characters</a></li>-</ul></li>-<li><a href="#block">Block Elements</a>-<ul>-<li><a href="#p">Paragraphs and Line Breaks</a></li>-<li><a href="#header">Headers</a></li>-<li><a href="#blockquote">Blockquotes</a></li>-<li><a href="#list">Lists</a></li>-<li><a href="#precode">Code Blocks</a></li>-<li><a href="#hr">Horizontal Rules</a></li>-</ul></li>-<li><a href="#span">Span Elements</a>-<ul>-<li><a href="#link">Links</a></li>-<li><a href="#em">Emphasis</a></li>-<li><a href="#code">Code</a></li>-<li><a href="#img">Images</a></li>-</ul></li>-<li><a href="#misc">Miscellaneous</a>-<ul>-<li><a href="#backslash">Backslash Escapes</a></li>-<li><a href="#autolink">Automatic Links</a></li>-</ul></li>-</ul>--<p><strong>Note:</strong> This document is itself written using Markdown; you-can <a href="/projects/markdown/syntax.text">see the source for it by adding '.text' to the URL</a>.</p>--<hr />--<h2 id="overview">Overview</h2>--<h3 id="philosophy">Philosophy</h3>--<p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p>--<p>Readability, however, is emphasized above all else. A Markdown-formatted-document should be publishable as-is, as plain text, without looking-like it's been marked up with tags or formatting instructions. While-Markdown's syntax has been influenced by several existing text-to-HTML-filters -- including <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a>, <a href="http://www.aaronsw.com/2002/atx/">atx</a>, <a href="http://textism.com/tools/textile/">Textile</a>, <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>,-<a href="http://www.triptico.com/software/grutatxt.html">Grutatext</a>, and <a href="http://ettext.taint.org/doc/">EtText</a> -- the single biggest source of-inspiration for Markdown's syntax is the format of plain text email.</p>--<p>To this end, Markdown's syntax is comprised entirely of punctuation-characters, which punctuation characters have been carefully chosen so-as to look like what they mean. E.g., asterisks around a word actually-look like *emphasis*. Markdown lists look like, well, lists. Even-blockquotes look like quoted passages of text, assuming you've ever-used email.</p>--<h3 id="html">Inline HTML</h3>--<p>Markdown's syntax is intended for one purpose: to be used as a-format for <em>writing</em> for the web.</p>--<p>Markdown is not a replacement for HTML, or even close to it. Its-syntax is very small, corresponding only to a very small subset of-HTML tags. The idea is <em>not</em> to create a syntax that makes it easier-to insert HTML tags. In my opinion, HTML tags are already easy to-insert. The idea for Markdown is to make it easy to read, write, and-edit prose. HTML is a <em>publishing</em> format; Markdown is a <em>writing</em>-format. Thus, Markdown's formatting syntax only addresses issues that-can be conveyed in plain text.</p>--<p>For any markup that is not covered by Markdown's syntax, you simply-use HTML itself. There's no need to preface it or delimit it to-indicate that you're switching from Markdown to HTML; you just use-the tags.</p>--<p>The only restrictions are that block-level HTML elements -- e.g. <code><div></code>,-<code><table></code>, <code><pre></code>, <code><p></code>, etc. -- must be separated from surrounding-content by blank lines, and the start and end tags of the block should-not be indented with tabs or spaces. Markdown is smart enough not-to add extra (unwanted) <code><p></code> tags around HTML block-level tags.</p>--<p>For example, to add an HTML table to a Markdown article:</p>--<pre><code>This is a regular paragraph.--<table>- <tr>- <td>Foo</td>- </tr>-</table>--This is another regular paragraph.-</code></pre>--<p>Note that Markdown formatting syntax is not processed within block-level-HTML tags. E.g., you can't use Markdown-style <code>*emphasis*</code> inside an-HTML block.</p>--<p>Span-level HTML tags -- e.g. <code><span></code>, <code><cite></code>, or <code><del></code> -- can be-used anywhere in a Markdown paragraph, list item, or header. If you-want, you can even use HTML tags instead of Markdown formatting; e.g. if-you'd prefer to use HTML <code><a></code> or <code><img></code> tags instead of Markdown's-link or image syntax, go right ahead.</p>--<p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within-span-level tags.</p>--<h3 id="autoescape">Automatic Escaping for Special Characters</h3>--<p>In HTML, there are two characters that demand special treatment: <code><</code>-and <code>&</code>. Left angle brackets are used to start tags; ampersands are-used to denote HTML entities. If you want to use them as literal-characters, you must escape them as entities, e.g. <code>&lt;</code>, and-<code>&amp;</code>.</p>--<p>Ampersands in particular are bedeviling for web writers. If you want to-write about 'AT&T', you need to write '<code>AT&amp;T</code>'. You even need to-escape ampersands within URLs. Thus, if you want to link to:</p>--<pre><code>http://images.google.com/images?num=30&q=larry+bird-</code></pre>--<p>you need to encode the URL as:</p>--<pre><code>http://images.google.com/images?num=30&amp;q=larry+bird-</code></pre>--<p>in your anchor tag <code>href</code> attribute. Needless to say, this is easy to-forget, and is probably the single most common source of HTML validation-errors in otherwise well-marked-up web sites.</p>--<p>Markdown allows you to use these characters naturally, taking care of-all the necessary escaping for you. If you use an ampersand as part of-an HTML entity, it remains unchanged; otherwise it will be translated-into <code>&amp;</code>.</p>--<p>So, if you want to include a copyright symbol in your article, you can write:</p>--<pre><code>&copy;-</code></pre>--<p>and Markdown will leave it alone. But if you write:</p>--<pre><code>AT&T-</code></pre>--<p>Markdown will translate it to:</p>--<pre><code>AT&amp;T-</code></pre>--<p>Similarly, because Markdown supports <a href="#html">inline HTML</a>, if you use-angle brackets as delimiters for HTML tags, Markdown will treat them as-such. But if you write:</p>--<pre><code>4 < 5-</code></pre>--<p>Markdown will translate it to:</p>--<pre><code>4 &lt; 5-</code></pre>--<p>However, inside Markdown code spans and blocks, angle brackets and-ampersands are <em>always</em> encoded automatically. This makes it easy to use-Markdown to write about HTML code. (As opposed to raw HTML, which is a-terrible format for writing about HTML syntax, because every single <code><</code>-and <code>&</code> in your example code needs to be escaped.)</p>--<hr />--<h2 id="block">Block Elements</h2>--<h3 id="p">Paragraphs and Line Breaks</h3>--<p>A paragraph is simply one or more consecutive lines of text, separated-by one or more blank lines. (A blank line is any line that looks like a-blank line -- a line containing nothing but spaces or tabs is considered-blank.) Normal paragraphs should not be intended with spaces or tabs.</p>--<p>The implication of the "one or more consecutive lines of text" rule is-that Markdown supports "hard-wrapped" text paragraphs. This differs-significantly from most other text-to-HTML formatters (including Movable-Type's "Convert Line Breaks" option) which translate every line break-character in a paragraph into a <code><br /></code> tag.</p>--<p>When you <em>do</em> want to insert a <code><br /></code> break tag using Markdown, you-end a line with two or more spaces, then type return.</p>--<p>Yes, this takes a tad more effort to create a <code><br /></code>, but a simplistic-"every line break is a <code><br /></code>" rule wouldn't work for Markdown.-Markdown's email-style <a href="#blockquote">blockquoting</a> and multi-paragraph <a href="#list">list items</a>-work best -- and look better -- when you format them with hard breaks.</p>--<h3 id="header">Headers</h3>--<p>Markdown supports two styles of headers, <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a> and <a href="http://www.aaronsw.com/2002/atx/">atx</a>.</p>--<p>Setext-style headers are "underlined" using equal signs (for first-level-headers) and dashes (for second-level headers). For example:</p>--<pre><code>This is an H1-=============--This is an H2---------------</code></pre>--<p>Any number of underlining <code>=</code>'s or <code>-</code>'s will work.</p>--<p>Atx-style headers use 1-6 hash characters at the start of the line,-corresponding to header levels 1-6. For example:</p>--<pre><code># This is an H1--## This is an H2--###### This is an H6-</code></pre>--<p>Optionally, you may "close" atx-style headers. This is purely-cosmetic -- you can use this if you think it looks better. The-closing hashes don't even need to match the number of hashes-used to open the header. (The number of opening hashes-determines the header level.) :</p>--<pre><code># This is an H1 #--## This is an H2 ##--### This is an H3 ######-</code></pre>--<h3 id="blockquote">Blockquotes</h3>--<p>Markdown uses email-style <code>></code> characters for blockquoting. If you're-familiar with quoting passages of text in an email message, then you-know how to create a blockquote in Markdown. It looks best if you hard-wrap the text and put a <code>></code> before every line:</p>--<pre><code>> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,-> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.-> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.-> -> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse-> id sem consectetuer libero luctus adipiscing.-</code></pre>--<p>Markdown allows you to be lazy and only put the <code>></code> before the first-line of a hard-wrapped paragraph:</p>--<pre><code>> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,-consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.-Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.--> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse-id sem consectetuer libero luctus adipiscing.-</code></pre>--<p>Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by-adding additional levels of <code>></code>:</p>--<pre><code>> This is the first level of quoting.->-> > This is nested blockquote.->-> Back to the first level.-</code></pre>--<p>Blockquotes can contain other Markdown elements, including headers, lists,-and code blocks:</p>--<pre><code>> ## This is a header.-> -> 1. This is the first list item.-> 2. This is the second list item.-> -> Here's some example code:-> -> return shell_exec("echo $input | $markdown_script");-</code></pre>--<p>Any decent text editor should make email-style quoting easy. For-example, with BBEdit, you can make a selection and choose Increase-Quote Level from the Text menu.</p>--<h3 id="list">Lists</h3>--<p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p>--<p>Unordered lists use asterisks, pluses, and hyphens -- interchangably--- as list markers:</p>--<pre><code>* Red-* Green-* Blue-</code></pre>--<p>is equivalent to:</p>--<pre><code>+ Red-+ Green-+ Blue-</code></pre>--<p>and:</p>--<pre><code>- Red-- Green-- Blue-</code></pre>--<p>Ordered lists use numbers followed by periods:</p>--<pre><code>1. Bird-2. McHale-3. Parish-</code></pre>--<p>It's important to note that the actual numbers you use to mark the-list have no effect on the HTML output Markdown produces. The HTML-Markdown produces from the above list is:</p>--<pre><code><ol>-<li>Bird</li>-<li>McHale</li>-<li>Parish</li>-</ol>-</code></pre>--<p>If you instead wrote the list in Markdown like this:</p>--<pre><code>1. Bird-1. McHale-1. Parish-</code></pre>--<p>or even:</p>--<pre><code>3. Bird-1. McHale-8. Parish-</code></pre>--<p>you'd get the exact same HTML output. The point is, if you want to,-you can use ordinal numbers in your ordered Markdown lists, so that-the numbers in your source match the numbers in your published HTML.-But if you want to be lazy, you don't have to.</p>--<p>If you do use lazy list numbering, however, you should still start the-list with the number 1. At some point in the future, Markdown may support-starting ordered lists at an arbitrary number.</p>--<p>List markers typically start at the left margin, but may be indented by-up to three spaces. List markers must be followed by one or more spaces-or a tab.</p>--<p>To make lists look nice, you can wrap items with hanging indents:</p>--<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,- viverra nec, fringilla in, laoreet vitae, risus.-* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.- Suspendisse id sem consectetuer libero luctus adipiscing.-</code></pre>--<p>But if you want to be lazy, you don't have to:</p>--<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.-Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,-viverra nec, fringilla in, laoreet vitae, risus.-* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.-Suspendisse id sem consectetuer libero luctus adipiscing.-</code></pre>--<p>If list items are separated by blank lines, Markdown will wrap the-items in <code><p></code> tags in the HTML output. For example, this input:</p>--<pre><code>* Bird-* Magic-</code></pre>--<p>will turn into:</p>--<pre><code><ul>-<li>Bird</li>-<li>Magic</li>-</ul>-</code></pre>--<p>But this:</p>--<pre><code>* Bird--* Magic-</code></pre>--<p>will turn into:</p>--<pre><code><ul>-<li><p>Bird</p></li>-<li><p>Magic</p></li>-</ul>-</code></pre>--<p>List items may consist of multiple paragraphs. Each subsequent-paragraph in a list item must be intended by either 4 spaces-or one tab:</p>--<pre><code>1. This is a list item with two paragraphs. Lorem ipsum dolor- sit amet, consectetuer adipiscing elit. Aliquam hendrerit- mi posuere lectus.-- Vestibulum enim wisi, viverra nec, fringilla in, laoreet- vitae, risus. Donec sit amet nisl. Aliquam semper ipsum- sit amet velit.--2. Suspendisse id sem consectetuer libero luctus adipiscing.-</code></pre>--<p>It looks nice if you indent every line of the subsequent-paragraphs, but here again, Markdown will allow you to be-lazy:</p>--<pre><code>* This is a list item with two paragraphs.-- This is the second paragraph in the list item. You're-only required to indent the first line. Lorem ipsum dolor-sit amet, consectetuer adipiscing elit.--* Another item in the same list.-</code></pre>--<p>To put a blockquote within a list item, the blockquote's <code>></code>-delimiters need to be indented:</p>--<pre><code>* A list item with a blockquote:-- > This is a blockquote- > inside a list item.-</code></pre>--<p>To put a code block within a list item, the code block needs-to be indented <em>twice</em> -- 8 spaces or two tabs:</p>--<pre><code>* A list item with a code block:-- <code goes here>-</code></pre>--<p>It's worth noting that it's possible to trigger an ordered list by-accident, by writing something like this:</p>--<pre><code>1986. What a great season.-</code></pre>--<p>In other words, a <em>number-period-space</em> sequence at the beginning of a-line. To avoid this, you can backslash-escape the period:</p>--<pre><code>1986\. What a great season.-</code></pre>--<h3 id="precode">Code Blocks</h3>--<p>Pre-formatted code blocks are used for writing about programming or-markup source code. Rather than forming normal paragraphs, the lines-of a code block are interpreted literally. Markdown wraps a code block-in both <code><pre></code> and <code><code></code> tags.</p>--<p>To produce a code block in Markdown, simply indent every line of the-block by at least 4 spaces or 1 tab. For example, given this input:</p>--<pre><code>This is a normal paragraph:-- This is a code block.-</code></pre>--<p>Markdown will generate:</p>--<pre><code><p>This is a normal paragraph:</p>--<pre><code>This is a code block.-</code></pre>-</code></pre>--<p>One level of indentation -- 4 spaces or 1 tab -- is removed from each-line of the code block. For example, this:</p>--<pre><code>Here is an example of AppleScript:-- tell application "Foo"- beep- end tell-</code></pre>--<p>will turn into:</p>--<pre><code><p>Here is an example of AppleScript:</p>--<pre><code>tell application "Foo"- beep-end tell-</code></pre>-</code></pre>--<p>A code block continues until it reaches a line that is not indented-(or the end of the article).</p>--<p>Within a code block, ampersands (<code>&</code>) and angle brackets (<code><</code> and <code>></code>)-are automatically converted into HTML entities. This makes it very-easy to include example HTML source code using Markdown -- just paste-it and indent it, and Markdown will handle the hassle of encoding the-ampersands and angle brackets. For example, this:</p>--<pre><code> <div class="footer">- &copy; 2004 Foo Corporation- </div>-</code></pre>--<p>will turn into:</p>--<pre><code><pre><code>&lt;div class="footer"&gt;- &amp;copy; 2004 Foo Corporation-&lt;/div&gt;-</code></pre>-</code></pre>--<p>Regular Markdown syntax is not processed within code blocks. E.g.,-asterisks are just literal asterisks within a code block. This means-it's also easy to use Markdown to write about Markdown's own syntax.</p>--<h3 id="hr">Horizontal Rules</h3>--<p>You can produce a horizontal rule tag (<code><hr /></code>) by placing three or-more hyphens, asterisks, or underscores on a line by themselves. If you-wish, you may use spaces between the hyphens or asterisks. Each of the-following lines will produce a horizontal rule:</p>--<pre><code>* * *--***--*****--- - --------------------------------------------_ _ _-</code></pre>--<hr />--<h2 id="span">Span Elements</h2>--<h3 id="link">Links</h3>--<p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p>--<p>In both styles, the link text is delimited by [square brackets].</p>--<p>To create an inline link, use a set of regular parentheses immediately-after the link text's closing square bracket. Inside the parentheses,-put the URL where you want the link to point, along with an <em>optional</em>-title for the link, surrounded in quotes. For example:</p>--<pre><code>This is [an example](http://example.com/ "Title") inline link.--[This link](http://example.net/) has no title attribute.-</code></pre>--<p>Will produce:</p>--<pre><code><p>This is <a href="http://example.com/" title="Title">-an example</a> inline link.</p>--<p><a href="http://example.net/">This link</a> has no-title attribute.</p>-</code></pre>--<p>If you're referring to a local resource on the same server, you can-use relative paths:</p>--<pre><code>See my [About](/about/) page for details.-</code></pre>--<p>Reference-style links use a second set of square brackets, inside-which you place a label of your choosing to identify the link:</p>--<pre><code>This is [an example][id] reference-style link.-</code></pre>--<p>You can optionally use a space to separate the sets of brackets:</p>--<pre><code>This is [an example] [id] reference-style link.-</code></pre>--<p>Then, anywhere in the document, you define your link label like this,-on a line by itself:</p>--<pre><code>[id]: http://example.com/ "Optional Title Here"-</code></pre>--<p>That is:</p>--<ul>-<li>Square brackets containing the link identifier (optionally-indented from the left margin using up to three spaces);</li>-<li>followed by a colon;</li>-<li>followed by one or more spaces (or tabs);</li>-<li>followed by the URL for the link;</li>-<li>optionally followed by a title attribute for the link, enclosed-in double or single quotes.</li>-</ul>--<p>The link URL may, optionally, be surrounded by angle brackets:</p>--<pre><code>[id]: <http://example.com/> "Optional Title Here"-</code></pre>--<p>You can put the title attribute on the next line and use extra spaces-or tabs for padding, which tends to look better with longer URLs:</p>--<pre><code>[id]: http://example.com/longish/path/to/resource/here- "Optional Title Here"-</code></pre>--<p>Link definitions are only used for creating links during Markdown-processing, and are stripped from your document in the HTML output.</p>--<p>Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are <em>not</em> case sensitive. E.g. these two links:</p>--<pre><code>[link text][a]-[link text][A]-</code></pre>--<p>are equivalent.</p>--<p>The <em>implicit link name</em> shortcut allows you to omit the name of the-link, in which case the link text itself is used as the name.-Just use an empty set of square brackets -- e.g., to link the word-"Google" to the google.com web site, you could simply write:</p>--<pre><code>[Google][]-</code></pre>--<p>And then define the link:</p>--<pre><code>[Google]: http://google.com/-</code></pre>--<p>Because link names may contain spaces, this shortcut even works for-multiple words in the link text:</p>--<pre><code>Visit [Daring Fireball][] for more information.-</code></pre>--<p>And then define the link:</p>--<pre><code>[Daring Fireball]: http://daringfireball.net/-</code></pre>--<p>Link definitions can be placed anywhere in your Markdown document. I-tend to put them immediately after each paragraph in which they're-used, but if you want, you can put them all at the end of your-document, sort of like footnotes.</p>--<p>Here's an example of reference links in action:</p>--<pre><code>I get 10 times more traffic from [Google] [1] than from-[Yahoo] [2] or [MSN] [3].-- [1]: http://google.com/ "Google"- [2]: http://search.yahoo.com/ "Yahoo Search"- [3]: http://search.msn.com/ "MSN Search"-</code></pre>--<p>Using the implicit link name shortcut, you could instead write:</p>--<pre><code>I get 10 times more traffic from [Google][] than from-[Yahoo][] or [MSN][].-- [google]: http://google.com/ "Google"- [yahoo]: http://search.yahoo.com/ "Yahoo Search"- [msn]: http://search.msn.com/ "MSN Search"-</code></pre>--<p>Both of the above examples will produce the following HTML output:</p>--<pre><code><p>I get 10 times more traffic from <a href="http://google.com/"-title="Google">Google</a> than from-<a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>-or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>-</code></pre>--<p>For comparison, here is the same paragraph written using-Markdown's inline link style:</p>--<pre><code>I get 10 times more traffic from [Google](http://google.com/ "Google")-than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or-[MSN](http://search.msn.com/ "MSN Search").-</code></pre>--<p>The point of reference-style links is not that they're easier to-write. The point is that with reference-style links, your document-source is vastly more readable. Compare the above examples: using-reference-style links, the paragraph itself is only 81 characters-long; with inline-style links, it's 176 characters; and as raw HTML,-it's 234 characters. In the raw HTML, there's more markup than there-is text.</p>--<p>With Markdown's reference-style links, a source document much more-closely resembles the final output, as rendered in a browser. By-allowing you to move the markup-related metadata out of the paragraph,-you can add links without interrupting the narrative flow of your-prose.</p>--<h3 id="em">Emphasis</h3>--<p>Markdown treats asterisks (<code>*</code>) and underscores (<code>_</code>) as indicators of-emphasis. Text wrapped with one <code>*</code> or <code>_</code> will be wrapped with an-HTML <code><em></code> tag; double <code>*</code>'s or <code>_</code>'s will be wrapped with an HTML-<code><strong></code> tag. E.g., this input:</p>--<pre><code>*single asterisks*--_single underscores_--**double asterisks**--__double underscores__-</code></pre>--<p>will produce:</p>--<pre><code><em>single asterisks</em>--<em>single underscores</em>--<strong>double asterisks</strong>--<strong>double underscores</strong>-</code></pre>--<p>You can use whichever style you prefer; the lone restriction is that-the same character must be used to open and close an emphasis span.</p>--<p>Emphasis can be used in the middle of a word:</p>--<pre><code>un*fucking*believable-</code></pre>--<p>But if you surround an <code>*</code> or <code>_</code> with spaces, it'll be treated as a-literal asterisk or underscore.</p>--<p>To produce a literal asterisk or underscore at a position where it-would otherwise be used as an emphasis delimiter, you can backslash-escape it:</p>--<pre><code>\*this text is surrounded by literal asterisks\*-</code></pre>--<h3 id="code">Code</h3>--<p>To indicate a span of code, wrap it with backtick quotes (<code>`</code>).-Unlike a pre-formatted code block, a code span indicates code within a-normal paragraph. For example:</p>--<pre><code>Use the `printf()` function.-</code></pre>--<p>will produce:</p>--<pre><code><p>Use the <code>printf()</code> function.</p>-</code></pre>--<p>To include a literal backtick character within a code span, you can use-multiple backticks as the opening and closing delimiters:</p>--<pre><code>``There is a literal backtick (`) here.``-</code></pre>--<p>which will produce this:</p>--<pre><code><p><code>There is a literal backtick (`) here.</code></p>-</code></pre>--<p>The backtick delimiters surrounding a code span may include spaces ---one after the opening, one before the closing. This allows you to place-literal backtick characters at the beginning or end of a code span:</p>--<pre><code>A single backtick in a code span: `` ` ``--A backtick-delimited string in a code span: `` `foo` ``-</code></pre>--<p>will produce:</p>--<pre><code><p>A single backtick in a code span: <code>`</code></p>--<p>A backtick-delimited string in a code span: <code>`foo`</code></p>-</code></pre>--<p>With a code span, ampersands and angle brackets are encoded as HTML-entities automatically, which makes it easy to include example HTML-tags. Markdown will turn this:</p>--<pre><code>Please don't use any `<blink>` tags.-</code></pre>--<p>into:</p>--<pre><code><p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>-</code></pre>--<p>You can write this:</p>--<pre><code>`&#8212;` is the decimal-encoded equivalent of `&mdash;`.-</code></pre>--<p>to produce:</p>--<pre><code><p><code>&amp;#8212;</code> is the decimal-encoded-equivalent of <code>&amp;mdash;</code>.</p>-</code></pre>--<h3 id="img">Images</h3>--<p>Admittedly, it's fairly difficult to devise a "natural" syntax for-placing images into a plain text document format.</p>--<p>Markdown uses an image syntax that is intended to resemble the syntax-for links, allowing for two styles: <em>inline</em> and <em>reference</em>.</p>--<p>Inline image syntax looks like this:</p>--<pre><code>---</code></pre>--<p>That is:</p>--<ul>-<li>An exclamation mark: <code>!</code>;</li>-<li>followed by a set of square brackets, containing the <code>alt</code>-attribute text for the image;</li>-<li>followed by a set of parentheses, containing the URL or path to-the image, and an optional <code>title</code> attribute enclosed in double-or single quotes.</li>-</ul>--<p>Reference-style image syntax looks like this:</p>--<pre><code>![Alt text][id]-</code></pre>--<p>Where "id" is the name of a defined image reference. Image references-are defined using syntax identical to link references:</p>--<pre><code>[id]: url/to/image "Optional title attribute"-</code></pre>--<p>As of this writing, Markdown has no syntax for specifying the-dimensions of an image; if this is important to you, you can simply-use regular HTML <code><img></code> tags.</p>--<hr />--<h2 id="misc">Miscellaneous</h2>--<h3 id="autolink">Automatic Links</h3>--<p>Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:</p>--<pre><code><http://example.com/>-</code></pre>--<p>Markdown will turn this into:</p>--<pre><code><a href="http://example.com/">http://example.com/</a>-</code></pre>--<p>Automatic links for email addresses work similarly, except that-Markdown will also perform a bit of randomized decimal and hex-entity-encoding to help obscure your address from address-harvesting-spambots. For example, Markdown will turn this:</p>--<pre><code><address@example.com>-</code></pre>--<p>into something like this:</p>--<pre><code><a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;-&#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;-&#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;-&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>-</code></pre>--<p>which will render in a browser as a clickable link to "address@example.com".</p>--<p>(This sort of entity-encoding trick will indeed fool many, if not-most, address-harvesting bots, but it definitely won't fool all of-them. It's better than nothing, but an address published in this way-will probably eventually start receiving spam.)</p>--<h3 id="backslash">Backslash Escapes</h3>--<p>Markdown allows you to use backslash escapes to generate literal-characters which would otherwise have special meaning in Markdown's-formatting syntax. For example, if you wanted to surround a word with-literal asterisks (instead of an HTML <code><em></code> tag), you can backslashes-before the asterisks, like this:</p>--<pre><code>\*literal asterisks\*-</code></pre>--<p>Markdown provides backslash escapes for the following characters:</p>--<pre><code>\ backslash-` backtick-* asterisk-_ underscore-{} curly braces-[] square brackets-() parentheses-# hash mark-+ plus sign-- minus sign (hyphen)-. dot-! exclamation mark-</code></pre>
− tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text
@@ -1,888 +0,0 @@-Markdown: Syntax-================--<ul id="ProjectSubmenu">- <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>- <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>- <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>- <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>- <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>-</ul>---* [Overview](#overview)- * [Philosophy](#philosophy)- * [Inline HTML](#html)- * [Automatic Escaping for Special Characters](#autoescape)-* [Block Elements](#block)- * [Paragraphs and Line Breaks](#p)- * [Headers](#header)- * [Blockquotes](#blockquote)- * [Lists](#list)- * [Code Blocks](#precode)- * [Horizontal Rules](#hr)-* [Span Elements](#span)- * [Links](#link)- * [Emphasis](#em)- * [Code](#code)- * [Images](#img)-* [Miscellaneous](#misc)- * [Backslash Escapes](#backslash)- * [Automatic Links](#autolink)---**Note:** This document is itself written using Markdown; you-can [see the source for it by adding '.text' to the URL][src].-- [src]: /projects/markdown/syntax.text--* * *--<h2 id="overview">Overview</h2>--<h3 id="philosophy">Philosophy</h3>--Markdown is intended to be as easy-to-read and easy-to-write as is feasible.--Readability, however, is emphasized above all else. A Markdown-formatted-document should be publishable as-is, as plain text, without looking-like it's been marked up with tags or formatting instructions. While-Markdown's syntax has been influenced by several existing text-to-HTML-filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],-[Grutatext] [5], and [EtText] [6] -- the single biggest source of-inspiration for Markdown's syntax is the format of plain text email.-- [1]: http://docutils.sourceforge.net/mirror/setext.html- [2]: http://www.aaronsw.com/2002/atx/- [3]: http://textism.com/tools/textile/- [4]: http://docutils.sourceforge.net/rst.html- [5]: http://www.triptico.com/software/grutatxt.html- [6]: http://ettext.taint.org/doc/--To this end, Markdown's syntax is comprised entirely of punctuation-characters, which punctuation characters have been carefully chosen so-as to look like what they mean. E.g., asterisks around a word actually-look like \*emphasis\*. Markdown lists look like, well, lists. Even-blockquotes look like quoted passages of text, assuming you've ever-used email.----<h3 id="html">Inline HTML</h3>--Markdown's syntax is intended for one purpose: to be used as a-format for *writing* for the web.--Markdown is not a replacement for HTML, or even close to it. Its-syntax is very small, corresponding only to a very small subset of-HTML tags. The idea is *not* to create a syntax that makes it easier-to insert HTML tags. In my opinion, HTML tags are already easy to-insert. The idea for Markdown is to make it easy to read, write, and-edit prose. HTML is a *publishing* format; Markdown is a *writing*-format. Thus, Markdown's formatting syntax only addresses issues that-can be conveyed in plain text.--For any markup that is not covered by Markdown's syntax, you simply-use HTML itself. There's no need to preface it or delimit it to-indicate that you're switching from Markdown to HTML; you just use-the tags.--The only restrictions are that block-level HTML elements -- e.g. `<div>`,-`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding-content by blank lines, and the start and end tags of the block should-not be indented with tabs or spaces. Markdown is smart enough not-to add extra (unwanted) `<p>` tags around HTML block-level tags.--For example, to add an HTML table to a Markdown article:-- This is a regular paragraph.-- <table>- <tr>- <td>Foo</td>- </tr>- </table>-- This is another regular paragraph.--Note that Markdown formatting syntax is not processed within block-level-HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an-HTML block.--Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be-used anywhere in a Markdown paragraph, list item, or header. If you-want, you can even use HTML tags instead of Markdown formatting; e.g. if-you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's-link or image syntax, go right ahead.--Unlike block-level HTML tags, Markdown syntax *is* processed within-span-level tags.---<h3 id="autoescape">Automatic Escaping for Special Characters</h3>--In HTML, there are two characters that demand special treatment: `<`-and `&`. Left angle brackets are used to start tags; ampersands are-used to denote HTML entities. If you want to use them as literal-characters, you must escape them as entities, e.g. `<`, and-`&`.--Ampersands in particular are bedeviling for web writers. If you want to-write about 'AT&T', you need to write '`AT&T`'. You even need to-escape ampersands within URLs. Thus, if you want to link to:-- http://images.google.com/images?num=30&q=larry+bird--you need to encode the URL as:-- http://images.google.com/images?num=30&q=larry+bird--in your anchor tag `href` attribute. Needless to say, this is easy to-forget, and is probably the single most common source of HTML validation-errors in otherwise well-marked-up web sites.--Markdown allows you to use these characters naturally, taking care of-all the necessary escaping for you. If you use an ampersand as part of-an HTML entity, it remains unchanged; otherwise it will be translated-into `&`.--So, if you want to include a copyright symbol in your article, you can write:-- ©--and Markdown will leave it alone. But if you write:-- AT&T--Markdown will translate it to:-- AT&T--Similarly, because Markdown supports [inline HTML](#html), if you use-angle brackets as delimiters for HTML tags, Markdown will treat them as-such. But if you write:-- 4 < 5--Markdown will translate it to:-- 4 < 5--However, inside Markdown code spans and blocks, angle brackets and-ampersands are *always* encoded automatically. This makes it easy to use-Markdown to write about HTML code. (As opposed to raw HTML, which is a-terrible format for writing about HTML syntax, because every single `<`-and `&` in your example code needs to be escaped.)---* * *---<h2 id="block">Block Elements</h2>---<h3 id="p">Paragraphs and Line Breaks</h3>--A paragraph is simply one or more consecutive lines of text, separated-by one or more blank lines. (A blank line is any line that looks like a-blank line -- a line containing nothing but spaces or tabs is considered-blank.) Normal paragraphs should not be intended with spaces or tabs.--The implication of the "one or more consecutive lines of text" rule is-that Markdown supports "hard-wrapped" text paragraphs. This differs-significantly from most other text-to-HTML formatters (including Movable-Type's "Convert Line Breaks" option) which translate every line break-character in a paragraph into a `<br />` tag.--When you *do* want to insert a `<br />` break tag using Markdown, you-end a line with two or more spaces, then type return.--Yes, this takes a tad more effort to create a `<br />`, but a simplistic-"every line break is a `<br />`" rule wouldn't work for Markdown.-Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]-work best -- and look better -- when you format them with hard breaks.-- [bq]: #blockquote- [l]: #list----<h3 id="header">Headers</h3>--Markdown supports two styles of headers, [Setext] [1] and [atx] [2].--Setext-style headers are "underlined" using equal signs (for first-level-headers) and dashes (for second-level headers). For example:-- This is an H1- =============-- This is an H2- ---------------Any number of underlining `=`'s or `-`'s will work.--Atx-style headers use 1-6 hash characters at the start of the line,-corresponding to header levels 1-6. For example:-- # This is an H1-- ## This is an H2-- ###### This is an H6--Optionally, you may "close" atx-style headers. This is purely-cosmetic -- you can use this if you think it looks better. The-closing hashes don't even need to match the number of hashes-used to open the header. (The number of opening hashes-determines the header level.) :-- # This is an H1 #-- ## This is an H2 ##-- ### This is an H3 ######---<h3 id="blockquote">Blockquotes</h3>--Markdown uses email-style `>` characters for blockquoting. If you're-familiar with quoting passages of text in an email message, then you-know how to create a blockquote in Markdown. It looks best if you hard-wrap the text and put a `>` before every line:-- > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,- > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.- > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.- > - > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse- > id sem consectetuer libero luctus adipiscing.--Markdown allows you to be lazy and only put the `>` before the first-line of a hard-wrapped paragraph:-- > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,- consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.- Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.-- > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse- id sem consectetuer libero luctus adipiscing.--Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by-adding additional levels of `>`:-- > This is the first level of quoting.- >- > > This is nested blockquote.- >- > Back to the first level.--Blockquotes can contain other Markdown elements, including headers, lists,-and code blocks:-- > ## This is a header.- > - > 1. This is the first list item.- > 2. This is the second list item.- > - > Here's some example code:- > - > return shell_exec("echo $input | $markdown_script");--Any decent text editor should make email-style quoting easy. For-example, with BBEdit, you can make a selection and choose Increase-Quote Level from the Text menu.---<h3 id="list">Lists</h3>--Markdown supports ordered (numbered) and unordered (bulleted) lists.--Unordered lists use asterisks, pluses, and hyphens -- interchangably--- as list markers:-- * Red- * Green- * Blue--is equivalent to:-- + Red- + Green- + Blue--and:-- - Red- - Green- - Blue--Ordered lists use numbers followed by periods:-- 1. Bird- 2. McHale- 3. Parish--It's important to note that the actual numbers you use to mark the-list have no effect on the HTML output Markdown produces. The HTML-Markdown produces from the above list is:-- <ol>- <li>Bird</li>- <li>McHale</li>- <li>Parish</li>- </ol>--If you instead wrote the list in Markdown like this:-- 1. Bird- 1. McHale- 1. Parish--or even:-- 3. Bird- 1. McHale- 8. Parish--you'd get the exact same HTML output. The point is, if you want to,-you can use ordinal numbers in your ordered Markdown lists, so that-the numbers in your source match the numbers in your published HTML.-But if you want to be lazy, you don't have to.--If you do use lazy list numbering, however, you should still start the-list with the number 1. At some point in the future, Markdown may support-starting ordered lists at an arbitrary number.--List markers typically start at the left margin, but may be indented by-up to three spaces. List markers must be followed by one or more spaces-or a tab.--To make lists look nice, you can wrap items with hanging indents:-- * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,- viverra nec, fringilla in, laoreet vitae, risus.- * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.- Suspendisse id sem consectetuer libero luctus adipiscing.--But if you want to be lazy, you don't have to:-- * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.- Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,- viverra nec, fringilla in, laoreet vitae, risus.- * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.- Suspendisse id sem consectetuer libero luctus adipiscing.--If list items are separated by blank lines, Markdown will wrap the-items in `<p>` tags in the HTML output. For example, this input:-- * Bird- * Magic--will turn into:-- <ul>- <li>Bird</li>- <li>Magic</li>- </ul>--But this:-- * Bird-- * Magic--will turn into:-- <ul>- <li><p>Bird</p></li>- <li><p>Magic</p></li>- </ul>--List items may consist of multiple paragraphs. Each subsequent-paragraph in a list item must be intended by either 4 spaces-or one tab:-- 1. This is a list item with two paragraphs. Lorem ipsum dolor- sit amet, consectetuer adipiscing elit. Aliquam hendrerit- mi posuere lectus.-- Vestibulum enim wisi, viverra nec, fringilla in, laoreet- vitae, risus. Donec sit amet nisl. Aliquam semper ipsum- sit amet velit.-- 2. Suspendisse id sem consectetuer libero luctus adipiscing.--It looks nice if you indent every line of the subsequent-paragraphs, but here again, Markdown will allow you to be-lazy:-- * This is a list item with two paragraphs.-- This is the second paragraph in the list item. You're- only required to indent the first line. Lorem ipsum dolor- sit amet, consectetuer adipiscing elit.-- * Another item in the same list.--To put a blockquote within a list item, the blockquote's `>`-delimiters need to be indented:-- * A list item with a blockquote:-- > This is a blockquote- > inside a list item.--To put a code block within a list item, the code block needs-to be indented *twice* -- 8 spaces or two tabs:-- * A list item with a code block:-- <code goes here>---It's worth noting that it's possible to trigger an ordered list by-accident, by writing something like this:-- 1986. What a great season.--In other words, a *number-period-space* sequence at the beginning of a-line. To avoid this, you can backslash-escape the period:-- 1986\. What a great season.----<h3 id="precode">Code Blocks</h3>--Pre-formatted code blocks are used for writing about programming or-markup source code. Rather than forming normal paragraphs, the lines-of a code block are interpreted literally. Markdown wraps a code block-in both `<pre>` and `<code>` tags.--To produce a code block in Markdown, simply indent every line of the-block by at least 4 spaces or 1 tab. For example, given this input:-- This is a normal paragraph:-- This is a code block.--Markdown will generate:-- <p>This is a normal paragraph:</p>-- <pre><code>This is a code block.- </code></pre>--One level of indentation -- 4 spaces or 1 tab -- is removed from each-line of the code block. For example, this:-- Here is an example of AppleScript:-- tell application "Foo"- beep- end tell--will turn into:-- <p>Here is an example of AppleScript:</p>-- <pre><code>tell application "Foo"- beep- end tell- </code></pre>--A code block continues until it reaches a line that is not indented-(or the end of the article).--Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)-are automatically converted into HTML entities. This makes it very-easy to include example HTML source code using Markdown -- just paste-it and indent it, and Markdown will handle the hassle of encoding the-ampersands and angle brackets. For example, this:-- <div class="footer">- © 2004 Foo Corporation- </div>--will turn into:-- <pre><code><div class="footer">- &copy; 2004 Foo Corporation- </div>- </code></pre>--Regular Markdown syntax is not processed within code blocks. E.g.,-asterisks are just literal asterisks within a code block. This means-it's also easy to use Markdown to write about Markdown's own syntax.----<h3 id="hr">Horizontal Rules</h3>--You can produce a horizontal rule tag (`<hr />`) by placing three or-more hyphens, asterisks, or underscores on a line by themselves. If you-wish, you may use spaces between the hyphens or asterisks. Each of the-following lines will produce a horizontal rule:-- * * *-- ***-- *****- - - - --- ----------------------------------------- _ _ _---* * *--<h2 id="span">Span Elements</h2>--<h3 id="link">Links</h3>--Markdown supports two style of links: *inline* and *reference*.--In both styles, the link text is delimited by [square brackets].--To create an inline link, use a set of regular parentheses immediately-after the link text's closing square bracket. Inside the parentheses,-put the URL where you want the link to point, along with an *optional*-title for the link, surrounded in quotes. For example:-- This is [an example](http://example.com/ "Title") inline link.-- [This link](http://example.net/) has no title attribute.--Will produce:-- <p>This is <a href="http://example.com/" title="Title">- an example</a> inline link.</p>-- <p><a href="http://example.net/">This link</a> has no- title attribute.</p>--If you're referring to a local resource on the same server, you can-use relative paths:-- See my [About](/about/) page for details.--Reference-style links use a second set of square brackets, inside-which you place a label of your choosing to identify the link:-- This is [an example][id] reference-style link.--You can optionally use a space to separate the sets of brackets:-- This is [an example] [id] reference-style link.--Then, anywhere in the document, you define your link label like this,-on a line by itself:-- [id]: http://example.com/ "Optional Title Here"--That is:--* Square brackets containing the link identifier (optionally- indented from the left margin using up to three spaces);-* followed by a colon;-* followed by one or more spaces (or tabs);-* followed by the URL for the link;-* optionally followed by a title attribute for the link, enclosed- in double or single quotes.--The link URL may, optionally, be surrounded by angle brackets:-- [id]: <http://example.com/> "Optional Title Here"--You can put the title attribute on the next line and use extra spaces-or tabs for padding, which tends to look better with longer URLs:-- [id]: http://example.com/longish/path/to/resource/here- "Optional Title Here"--Link definitions are only used for creating links during Markdown-processing, and are stripped from your document in the HTML output.--Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links:-- [link text][a]- [link text][A]--are equivalent.--The *implicit link name* shortcut allows you to omit the name of the-link, in which case the link text itself is used as the name.-Just use an empty set of square brackets -- e.g., to link the word-"Google" to the google.com web site, you could simply write:-- [Google][]--And then define the link:-- [Google]: http://google.com/--Because link names may contain spaces, this shortcut even works for-multiple words in the link text:-- Visit [Daring Fireball][] for more information.--And then define the link:- - [Daring Fireball]: http://daringfireball.net/--Link definitions can be placed anywhere in your Markdown document. I-tend to put them immediately after each paragraph in which they're-used, but if you want, you can put them all at the end of your-document, sort of like footnotes.--Here's an example of reference links in action:-- I get 10 times more traffic from [Google] [1] than from- [Yahoo] [2] or [MSN] [3].-- [1]: http://google.com/ "Google"- [2]: http://search.yahoo.com/ "Yahoo Search"- [3]: http://search.msn.com/ "MSN Search"--Using the implicit link name shortcut, you could instead write:-- I get 10 times more traffic from [Google][] than from- [Yahoo][] or [MSN][].-- [google]: http://google.com/ "Google"- [yahoo]: http://search.yahoo.com/ "Yahoo Search"- [msn]: http://search.msn.com/ "MSN Search"--Both of the above examples will produce the following HTML output:-- <p>I get 10 times more traffic from <a href="http://google.com/"- title="Google">Google</a> than from- <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>- or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>--For comparison, here is the same paragraph written using-Markdown's inline link style:-- I get 10 times more traffic from [Google](http://google.com/ "Google")- than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or- [MSN](http://search.msn.com/ "MSN Search").--The point of reference-style links is not that they're easier to-write. The point is that with reference-style links, your document-source is vastly more readable. Compare the above examples: using-reference-style links, the paragraph itself is only 81 characters-long; with inline-style links, it's 176 characters; and as raw HTML,-it's 234 characters. In the raw HTML, there's more markup than there-is text.--With Markdown's reference-style links, a source document much more-closely resembles the final output, as rendered in a browser. By-allowing you to move the markup-related metadata out of the paragraph,-you can add links without interrupting the narrative flow of your-prose.---<h3 id="em">Emphasis</h3>--Markdown treats asterisks (`*`) and underscores (`_`) as indicators of-emphasis. Text wrapped with one `*` or `_` will be wrapped with an-HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML-`<strong>` tag. E.g., this input:-- *single asterisks*-- _single underscores_-- **double asterisks**-- __double underscores__--will produce:-- <em>single asterisks</em>-- <em>single underscores</em>-- <strong>double asterisks</strong>-- <strong>double underscores</strong>--You can use whichever style you prefer; the lone restriction is that-the same character must be used to open and close an emphasis span.--Emphasis can be used in the middle of a word:-- un*fucking*believable--But if you surround an `*` or `_` with spaces, it'll be treated as a-literal asterisk or underscore.--To produce a literal asterisk or underscore at a position where it-would otherwise be used as an emphasis delimiter, you can backslash-escape it:-- \*this text is surrounded by literal asterisks\*----<h3 id="code">Code</h3>--To indicate a span of code, wrap it with backtick quotes (`` ` ``).-Unlike a pre-formatted code block, a code span indicates code within a-normal paragraph. For example:-- Use the `printf()` function.--will produce:-- <p>Use the <code>printf()</code> function.</p>--To include a literal backtick character within a code span, you can use-multiple backticks as the opening and closing delimiters:-- ``There is a literal backtick (`) here.``--which will produce this:-- <p><code>There is a literal backtick (`) here.</code></p>--The backtick delimiters surrounding a code span may include spaces ---one after the opening, one before the closing. This allows you to place-literal backtick characters at the beginning or end of a code span:-- A single backtick in a code span: `` ` ``- - A backtick-delimited string in a code span: `` `foo` ``--will produce:-- <p>A single backtick in a code span: <code>`</code></p>- - <p>A backtick-delimited string in a code span: <code>`foo`</code></p>--With a code span, ampersands and angle brackets are encoded as HTML-entities automatically, which makes it easy to include example HTML-tags. Markdown will turn this:-- Please don't use any `<blink>` tags.--into:-- <p>Please don't use any <code><blink></code> tags.</p>--You can write this:-- `—` is the decimal-encoded equivalent of `—`.--to produce:-- <p><code>&#8212;</code> is the decimal-encoded- equivalent of <code>&mdash;</code>.</p>----<h3 id="img">Images</h3>--Admittedly, it's fairly difficult to devise a "natural" syntax for-placing images into a plain text document format.--Markdown uses an image syntax that is intended to resemble the syntax-for links, allowing for two styles: *inline* and *reference*.--Inline image syntax looks like this:-- -- --That is:--* An exclamation mark: `!`;-* followed by a set of square brackets, containing the `alt`- attribute text for the image;-* followed by a set of parentheses, containing the URL or path to- the image, and an optional `title` attribute enclosed in double- or single quotes.--Reference-style image syntax looks like this:-- ![Alt text][id]--Where "id" is the name of a defined image reference. Image references-are defined using syntax identical to link references:-- [id]: url/to/image "Optional title attribute"--As of this writing, Markdown has no syntax for specifying the-dimensions of an image; if this is important to you, you can simply-use regular HTML `<img>` tags.---* * *---<h2 id="misc">Miscellaneous</h2>--<h3 id="autolink">Automatic Links</h3>--Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:-- <http://example.com/>- -Markdown will turn this into:-- <a href="http://example.com/">http://example.com/</a>--Automatic links for email addresses work similarly, except that-Markdown will also perform a bit of randomized decimal and hex-entity-encoding to help obscure your address from address-harvesting-spambots. For example, Markdown will turn this:-- <address@example.com>--into something like this:-- <a href="mailto:addre- ss@example.co- m">address@exa- mple.com</a>--which will render in a browser as a clickable link to "address@example.com".--(This sort of entity-encoding trick will indeed fool many, if not-most, address-harvesting bots, but it definitely won't fool all of-them. It's better than nothing, but an address published in this way-will probably eventually start receiving spam.)----<h3 id="backslash">Backslash Escapes</h3>--Markdown allows you to use backslash escapes to generate literal-characters which would otherwise have special meaning in Markdown's-formatting syntax. For example, if you wanted to surround a word with-literal asterisks (instead of an HTML `<em>` tag), you can backslashes-before the asterisks, like this:-- \*literal asterisks\*--Markdown provides backslash escapes for the following characters:-- \ backslash- ` backtick- * asterisk- _ underscore- {} curly braces- [] square brackets- () parentheses- # hash mark- + plus sign- - minus sign (hyphen)- . dot- ! exclamation mark-
− tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html
@@ -1,9 +0,0 @@-<blockquote>- <p>foo</p>- - <blockquote>- <p>bar</p>- </blockquote>- - <p>foo</p>-</blockquote>
− tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text
@@ -1,5 +0,0 @@-> foo->-> > bar->-> foo
− tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html
@@ -1,148 +0,0 @@-<h2>Unordered</h2>--<p>Asterisks tight:</p>--<ul>-<li>asterisk 1</li>-<li>asterisk 2</li>-<li>asterisk 3</li>-</ul>--<p>Asterisks loose:</p>--<ul>-<li><p>asterisk 1</p></li>-<li><p>asterisk 2</p></li>-<li><p>asterisk 3</p></li>-</ul>--<hr />--<p>Pluses tight:</p>--<ul>-<li>Plus 1</li>-<li>Plus 2</li>-<li>Plus 3</li>-</ul>--<p>Pluses loose:</p>--<ul>-<li><p>Plus 1</p></li>-<li><p>Plus 2</p></li>-<li><p>Plus 3</p></li>-</ul>--<hr />--<p>Minuses tight:</p>--<ul>-<li>Minus 1</li>-<li>Minus 2</li>-<li>Minus 3</li>-</ul>--<p>Minuses loose:</p>--<ul>-<li><p>Minus 1</p></li>-<li><p>Minus 2</p></li>-<li><p>Minus 3</p></li>-</ul>--<h2>Ordered</h2>--<p>Tight:</p>--<ol>-<li>First</li>-<li>Second</li>-<li>Third</li>-</ol>--<p>and:</p>--<ol>-<li>One</li>-<li>Two</li>-<li>Three</li>-</ol>--<p>Loose using tabs:</p>--<ol>-<li><p>First</p></li>-<li><p>Second</p></li>-<li><p>Third</p></li>-</ol>--<p>and using spaces:</p>--<ol>-<li><p>One</p></li>-<li><p>Two</p></li>-<li><p>Three</p></li>-</ol>--<p>Multiple paragraphs:</p>--<ol>-<li><p>Item 1, graf one.</p>--<p>Item 2. graf two. The quick brown fox jumped over the lazy dog's-back.</p></li>-<li><p>Item 2.</p></li>-<li><p>Item 3.</p></li>-</ol>--<h2>Nested</h2>--<ul>-<li>Tab-<ul>-<li>Tab-<ul>-<li>Tab</li>-</ul></li>-</ul></li>-</ul>--<p>Here's another:</p>--<ol>-<li>First</li>-<li>Second:-<ul>-<li>Fee</li>-<li>Fie</li>-<li>Foe</li>-</ul></li>-<li>Third</li>-</ol>--<p>Same thing but with paragraphs:</p>--<ol>-<li><p>First</p></li>-<li><p>Second:</p>--<ul>-<li>Fee</li>-<li>Fie</li>-<li>Foe</li>-</ul></li>-<li><p>Third</p></li>-</ol>---<p>This was an error in Markdown 1.0.1:</p>--<ul>-<li><p>this</p>--<ul><li>sub</li></ul>--<p>that</p></li>-</ul>
− tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text
@@ -1,131 +0,0 @@-## Unordered--Asterisks tight:--* asterisk 1-* asterisk 2-* asterisk 3---Asterisks loose:--* asterisk 1--* asterisk 2--* asterisk 3--* * *--Pluses tight:--+ Plus 1-+ Plus 2-+ Plus 3---Pluses loose:--+ Plus 1--+ Plus 2--+ Plus 3--* * *---Minuses tight:--- Minus 1-- Minus 2-- Minus 3---Minuses loose:--- Minus 1--- Minus 2--- Minus 3---## Ordered--Tight:--1. First-2. Second-3. Third--and:--1. One-2. Two-3. Three---Loose using tabs:--1. First--2. Second--3. Third--and using spaces:--1. One--2. Two--3. Three--Multiple paragraphs:--1. Item 1, graf one.-- Item 2. graf two. The quick brown fox jumped over the lazy dog's- back.- -2. Item 2.--3. Item 3.----## Nested--* Tab- * Tab- * Tab--Here's another:--1. First-2. Second:- * Fee- * Fie- * Foe-3. Third--Same thing but with paragraphs:--1. First--2. Second:- * Fee- * Fie- * Foe--3. Third---This was an error in Markdown 1.0.1:--* this-- * sub-- that
− tests/MarkdownTest_1.0.3/Tests/Strong and em together.html
@@ -1,7 +0,0 @@-<p><strong><em>This is strong and em.</em></strong></p>--<p>So is <strong><em>this</em></strong> word.</p>--<p><strong><em>This is strong and em.</em></strong></p>--<p>So is <strong><em>this</em></strong> word.</p>
− tests/MarkdownTest_1.0.3/Tests/Strong and em together.text
@@ -1,7 +0,0 @@-***This is strong and em.***--So is ***this*** word.--___This is strong and em.___--So is ___this___ word.
− tests/MarkdownTest_1.0.3/Tests/Tabs.html
@@ -1,25 +0,0 @@-<ul>-<li><p>this is a list item-indented with tabs</p></li>-<li><p>this is a list item-indented with spaces</p></li>-</ul>--<p>Code:</p>--<pre><code>this code block is indented by one tab-</code></pre>--<p>And:</p>--<pre><code> this code block is indented by two tabs-</code></pre>--<p>And:</p>--<pre><code>+ this is an example list item- indented with tabs--+ this is an example list item- indented with spaces-</code></pre>
− tests/MarkdownTest_1.0.3/Tests/Tabs.text
@@ -1,21 +0,0 @@-+ this is a list item- indented with tabs--+ this is a list item- indented with spaces--Code:-- this code block is indented by one tab--And:-- this code block is indented by two tabs--And:-- + this is an example list item- indented with tabs- - + this is an example list item- indented with spaces
− tests/MarkdownTest_1.0.3/Tests/Tidyness.html
@@ -1,8 +0,0 @@-<blockquote>-<p>A list within a blockquote:</p>-<ul>-<li>asterisk 1</li>-<li>asterisk 2</li>-<li>asterisk 3</li>-</ul>-</blockquote>
− tests/MarkdownTest_1.0.3/Tests/Tidyness.text
@@ -1,5 +0,0 @@-> A list within a blockquote:-> -> * asterisk 1-> * asterisk 2-> * asterisk 3
+ tests/RunTests.hs view
@@ -0,0 +1,123 @@+{-# OPTIONS_GHC -Wall #-}+-- RunTests.hs - run test suite for pandoc+-- This script is designed to be run from the tests directory.+-- It assumes the pandoc executable is in dist/build/pandoc.++module Main where+import System.Exit+import System.IO.UTF8+import System.IO ( openTempFile, stderr )+import Prelude hiding ( putStrLn, putStr, readFile )+import System.Process ( runProcess, waitForProcess )+import System.FilePath ( (</>), (<.>) )+import System.Directory+import System.Exit+import Text.Printf+import Diff++pandocPath :: FilePath+pandocPath = ".." </> "dist" </> "build" </> "pandoc" </> "pandoc"++data TestResult = TestPassed+ | TestError ExitCode+ | TestFailed [(DI, String)]+ deriving (Eq)++instance Show TestResult where+ show TestPassed = "PASSED"+ show (TestError ec) = "ERROR " ++ show ec+ show (TestFailed d) = "FAILED\n" ++ showDiff d++showDiff :: [(DI, String)] -> String+showDiff [] = ""+showDiff ((F, ln) : ds) = "|TEST| " ++ ln ++ "\n" ++ showDiff ds+showDiff ((S, ln) : ds) = "|NORM| " ++ ln ++ "\n" ++ showDiff ds+showDiff ((B, _ ) : ds) = showDiff ds++writerFormats :: [String]+writerFormats = [ "native"+ , "html"+ , "docbook"+ , "opendocument"+ , "latex"+ , "context"+ , "texinfo"+ , "man"+ , "markdown"+ , "rst"+ , "mediawiki"+ , "rtf"+ ]++main :: IO ()+main = do+ r1s <- mapM runWriterTest writerFormats+ r2 <- runS5WriterTest "basic" ["-s"] "s5"+ r3 <- runS5WriterTest "fancy" ["-s","-m","-i"] "s5"+ r4 <- runS5WriterTest "fragment" [] "html"+ r5 <- runS5WriterTest "inserts" ["-s", "-H", "insert",+ "-B", "insert", "-A", "insert", "-c", "main.css"] "html"+ r6 <- runTest "markdown reader" ["-r", "markdown", "-w", "native", "-s", "-S"]+ "testsuite.txt" "testsuite.native"+ r7 <- runTest "markdown reader (tables)" ["-r", "markdown", "-w", "native"]+ "tables.txt" "tables.native"+ r7a <- runTest "markdown reader (more)" ["-r", "markdown", "-w", "native"]+ "markdown-reader-more.txt" "markdown-reader-more.native"+ r8 <- runTest "rst reader" ["-r", "rst", "-w", "native", "-s", "-S"]+ "rst-reader.rst" "rst-reader.native"+ r9 <- runTest "html reader" ["-r", "html", "-w", "native", "-s"]+ "html-reader.html" "html-reader.native"+ r10 <- runTest "latex reader" ["-r", "latex", "-w", "native", "-s", "-R"]+ "latex-reader.latex" "latex-reader.native"+ r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"]+ "testsuite.native" "testsuite.native"+ let results = r1s ++ [r2, r3, r4, r5, r6, r7, r7a, r8, r9, r10, r11]+ if all id results+ then do+ putStrLn "\nAll tests passed."+ exitWith ExitSuccess+ else do+ let failures = length $ filter not results+ putStrLn $ "\n" ++ show failures ++ " tests failed."+ exitWith (ExitFailure failures)++-- makes sure file is fully closed after reading+readFile' :: FilePath -> IO String+readFile' f = do s <- readFile f+ return $! (length s `seq` s)++runWriterTest :: String -> IO Bool+runWriterTest format = do+ r1 <- runTest (format ++ " writer") ["-r", "native", "-s", "-w", format] "testsuite.native" ("writer" <.> format)+ r2 <- runTest (format ++ " writer (tables)") ["-r", "native", "-w", format] "tables.native" ("tables" <.> format)+ return (r1 && r2)++runS5WriterTest :: String -> [String] -> String -> IO Bool+runS5WriterTest modifier opts format = runTest (format ++ " writer (" ++ modifier ++ ")")+ (["-r", "native", "-w", format] ++ opts) "s5.native" ("s5." ++ modifier <.> "html")++-- | Run a test, return True if test passed.+runTest :: String -- ^ Title of test+ -> [String] -- ^ Options to pass to pandoc+ -> String -- ^ Input filepath+ -> FilePath -- ^ Norm (for test results) filepath+ -> IO Bool+runTest testname opts inp norm = do+ (outputPath, hOut) <- openTempFile "" "pandoc-test"+ let inpPath = inp+ let normPath = norm+ -- Note: COLUMNS must be set for markdown table reader+ ph <- runProcess pandocPath (opts ++ [inpPath]) Nothing (Just [("COLUMNS", "80")]) Nothing (Just hOut) (Just stderr)+ ec <- waitForProcess ph+ result <- if ec == ExitSuccess+ then do+ -- filter \r so the tests will work on Windows machines+ outputContents <- readFile' outputPath >>= return . filter (/='\r')+ normContents <- readFile' normPath >>= return . filter (/='\r')+ if outputContents == normContents+ then return TestPassed+ else return $ TestFailed $ getDiff (lines outputContents) (lines normContents)+ else return $ TestError ec+ removeFile outputPath+ putStrLn $ printf "%-28s ---> %s" testname (show result)+ return (result == TestPassed)
− tests/generate.sh
@@ -1,12 +0,0 @@-#!/bin/sh--../pandoc -r native -s -w native testsuite.native > writer.native-../pandoc -r native -s -w markdown testsuite.native > writer.markdown-../pandoc -r native -s -w rst testsuite.native > writer.rst -../pandoc -r native -s -w html testsuite.native > writer.html-../pandoc -r native -s -w latex testsuite.native > writer.latex-../pandoc -r native -s -w rtf testsuite.native > writer.rtf-../pandoc -r native -s -w man testsuite.native > writer.man-sed -e '/^, Header 1 \[Str "HTML",Space,Str "Blocks"\]/,/^, HorizontalRule/d' testsuite.native | ../pandoc -r native -w docbook -s > writer.docbook-sed -e '/^, Header 1 \[Str "LaTeX"\]/,/^, HorizontalRule/d' testsuite.native | ../pandoc -r native -w context -s > writer.context-
tests/html-reader.native view
@@ -26,7 +26,7 @@ , BlockQuote [ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]- , CodeBlock "sub status {\n print \"working\";\n}"+ , CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" , Para [Str "A",Space,Str "list:"] , OrderedList (1,DefaultStyle,DefaultDelim) [ [ Plain [Str "item",Space,Str "one"] ]@@ -42,7 +42,7 @@ , Para [Str "Box-style:"] , BlockQuote [ Para [Str "Example:"]- , CodeBlock "sub status {\n print \"working\";\n}" ]+ , CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" ] , BlockQuote [ OrderedList (1,DefaultStyle,DefaultDelim) [ [ Plain [Str "do",Space,Str "laundry"] ]@@ -57,9 +57,9 @@ , HorizontalRule , Header 1 [Str "Code",Space,Str "Blocks"] , Para [Str "Code:"]-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"+, CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab" , Para [Str "And:"]-, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"+, CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" , HorizontalRule , Header 1 [Str "Lists"] , Header 2 [Str "Unordered"]@@ -198,18 +198,18 @@ , Para [Str "Here's",Space,Str "a",Space,Str "simple",Space,Str "block:"] , Plain [Str "foo"] , Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]-, CodeBlock "<div>\n foo\n</div>"+, CodeBlock ("",[],[]) "<div>\n foo\n</div>" , Para [Str "As",Space,Str "should",Space,Str "this:"]-, CodeBlock "<div>foo</div>"+, CodeBlock ("",[],[]) "<div>foo</div>" , Para [Str "Now,",Space,Str "nested:"] , Plain [Str "foo"] , Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"] , Para [Str "Multiline:"] , Para [Str "Code",Space,Str "block:"]-, CodeBlock "<!-- Comment -->"+, CodeBlock ("",[],[]) "<!-- Comment -->" , Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"] , Para [Str "Code:"]-, CodeBlock "<hr />"+, CodeBlock ("",[],[]) "<hr />" , Para [Str "Hr's:"] , HorizontalRule , HorizontalRule@@ -310,7 +310,7 @@ , Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."] , Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."] , Para [Str "This",Space,Str "should",Space,Str "[not]",Space,Str "be",Space,Str "a",Space,Str "link."]-, CodeBlock "[not]: /url"+, CodeBlock ("",[],[]) "[not]: /url" , Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."] , Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."] , Header 2 [Str "With",Space,Str "ampersands"]@@ -329,7 +329,7 @@ [ Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] ("http://example.com/","")] ] , Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code "<http://example.com/>"]-, CodeBlock "or here: <http://example.com/>"+, CodeBlock ("",[],[]) "or here: <http://example.com/>" , HorizontalRule , Header 1 [Str "Images"] , Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]@@ -341,6 +341,6 @@ , Para [Link [Str "(1)"] ("#ref_1",""),Space,Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."] , Para [Link [Str "(longnote)"] ("#ref_longnote",""),Space,Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."] , Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]-, CodeBlock " { <code> }"+, CodeBlock ("",[],[]) " { <code> }" , Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."] ]
tests/latex-reader.native view
@@ -26,7 +26,7 @@ , BlockQuote [ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]- , CodeBlock "sub status {\n print \"working\";\n}"+ , CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" , Para [Str "A",Space,Str "list:"] , OrderedList (1,Decimal,Period) [ [ Para [Str "item",Space,Str "one"] ]@@ -42,7 +42,7 @@ , Para [Str "Box",Str "-",Str "style:"] , BlockQuote [ Para [Str "Example:"]- , CodeBlock "sub status {\n print \"working\";\n}" ]+ , CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" ] , BlockQuote [ OrderedList (1,Decimal,Period) [ [ Para [Str "do",Space,Str "laundry"] ]@@ -57,9 +57,9 @@ , HorizontalRule , Header 1 [Str "Code",Space,Str "Blocks"] , Para [Str "Code:"]-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"+, CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab" , Para [Str "And:"]-, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"+, CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" , HorizontalRule , Header 1 [Str "Lists"] , Header 2 [Str "Unordered"]@@ -223,7 +223,7 @@ , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ] ), ([Emph [Str "orange"]], [ Para [Str "orange",Space,Str "fruit"]- , CodeBlock "{ orange code block }"+ , CodeBlock ("",[],[]) "{ orange code block }" , BlockQuote [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ] ] ) ]@@ -233,17 +233,17 @@ , Para [Str "foo",Space,Str "bar",Space,Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"] , Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Space,Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"],Space,Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "simple",Space,Str "block:"] , Para [Str "foo",Space,Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]-, CodeBlock "<div>\n foo\n</div>"+, CodeBlock ("",[],[]) "<div>\n foo\n</div>" , Para [Str "As",Space,Str "should",Space,Str "this:"]-, CodeBlock "<div>foo</div>"+, CodeBlock ("",[],[]) "<div>foo</div>" , Para [Str "Now,",Space,Str "nested:"] , Para [Str "foo",Space,Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"] , Para [Str "Multiline:"] , Para [Str "Code",Space,Str "block:"]-, CodeBlock "<!-- Comment -->"+, CodeBlock ("",[],[]) "<!-- Comment -->" , Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"] , Para [Str "Code:"]-, CodeBlock "<hr />"+, CodeBlock ("",[],[]) "<hr />" , Para [Str "Hr",Apostrophe,Str "s:"] , HorizontalRule , Header 1 [Str "Inline",Space,Str "Markup"]@@ -274,13 +274,13 @@ , BulletList [ [ Para [TeX "\\cite[22-23]{smith.1899}"] ] , [ Para [TeX "\\doublespacing"] ]- , [ Para [Math "2+2=4"] ]- , [ Para [Math "x \\in y"] ]- , [ Para [Math "\\alpha \\wedge \\omega"] ]- , [ Para [Math "223"] ]- , [ Para [Math "p",Str "-",Str "Tree"] ]- , [ Para [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]- , [ Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ]+ , [ Para [Math InlineMath "2+2=4"] ]+ , [ Para [Math InlineMath "x \\in y"] ]+ , [ Para [Math InlineMath "\\alpha \\wedge \\omega"] ]+ , [ Para [Math InlineMath "223"] ]+ , [ Para [Math InlineMath "p",Str "-",Str "Tree"] ]+ , [ Para [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]+ , [ Para [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ] , Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"] , BulletList [ [ Para [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]@@ -303,7 +303,7 @@ , Para [Str "4",Space,Str "<",Space,Str "5."] , Para [Str "6",Space,Str ">",Space,Str "5."] , Para [Str "Backslash:",Space,Str "\\"]-, Para [Str "Backtick:"]+, Para [Str "Backtick:",Space,Str "`"] , Para [Str "Asterisk:",Space,Str "*"] , Para [Str "Underscore:",Space,Str "_"] , Para [Str "Left",Space,Str "brace:",Space,Str "{"]@@ -340,7 +340,7 @@ , Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."] , Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."] , Para [Str "This",Space,Str "should",Space,Str "[not][]",Space,Str "be",Space,Str "a",Space,Str "link."]-, CodeBlock "[not]: /url"+, CodeBlock ("",[],[]) "[not]: /url" , Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."] , Para [Str "Foo",Space,Link [Str "biz"] ("/url/",""),Str "."] , Header 2 [Str "With",Space,Str "ampersands"]@@ -359,7 +359,7 @@ [ Para [Str "Blockquoted:",Space,Link [Code "http://example.com/"] ("http://example.com/","")] ] , Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code "<http://example.com/>"]-, CodeBlock "or here: <http://example.com/>"+, CodeBlock ("",[],[]) "or here: <http://example.com/>" , HorizontalRule , Header 1 [Str "Images"] , Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]@@ -367,7 +367,7 @@ , Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "image"] ("movie.jpg",""),Space,Str "icon."] , HorizontalRule , Header 1 [Str "Footnotes"]-, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.[",Str "^",Str "my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.[",Str "^",Str "my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]] , BlockQuote [ Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]] ]
+ tests/markdown-reader-more.native view
@@ -0,0 +1,8 @@+Pandoc (Meta [] [] "")+[ Header 1 [Str "Additional",Space,Str "markdown",Space,Str "reader",Space,Str "tests"]+, Header 2 [Str "Blank",Space,Str "line",Space,Str "before",Space,Str "URL",Space,Str "in",Space,Str "link",Space,Str "reference"]+, Para [Link [Str "foo"] ("/url",""),Space,Str "and",Space,Link [Str "bar"] ("/url","title")]+, Header 2 [Str "Raw",Space,Str "ConTeXt",Space,Str "environments"]+, Para [TeX "\\placeformula",Space,TeX "\\startformula\n L_{1} = L_{2}\n \\stopformula"]+, Para [TeX "\\start[a2]\n\\start[a2]\n\\stop[a2]\n\\stop[a2]"] ]+
+ tests/markdown-reader-more.txt view
@@ -0,0 +1,24 @@+# Additional markdown reader tests++## Blank line before URL in link reference++[foo] and [bar]++[foo]: + /url++[bar]:+/url+"title"++## Raw ConTeXt environments++\placeformula \startformula+ L_{1} = L_{2}+ \stopformula++\start[a2]+\start[a2]+\stop[a2]+\stop[a2]+
tests/rst-reader.native view
@@ -26,7 +26,7 @@ , BlockQuote [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It's",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab."] , Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]- , CodeBlock "sub status {\n print \"working\";\n}"+ , CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" , Para [Str "List",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"] , OrderedList (1,Decimal,Period) [ [ Plain [Str "item",Space,Str "one"] ]@@ -39,10 +39,10 @@ ] ] , Header 1 [Str "Code",Space,Str "Blocks"] , Para [Str "Code",Str ":"]-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}"-, CodeBlock "this code block is indented by one tab"+, CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}"+, CodeBlock ("",[],[]) "this code block is indented by one tab" , Para [Str "And",Str ":"]-, CodeBlock "this block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"+, CodeBlock ("",[],[]) "this block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" , Header 1 [Str "Lists"] , Header 2 [Str "Unordered"] , Para [Str "Asterisks",Space,Str "tight",Str ":"]@@ -225,7 +225,7 @@ , Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT&T"] ("/url/",""),Str "."] , Para [Str "Autolinks",Str ":",Space,Link [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2",""),Space,Str "and",Space,Link [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net",""),Str "."] , Para [Str "But",Space,Str "not",Space,Str "here",Str ":"]-, CodeBlock "http://example.com/"+, CodeBlock ("",[],[]) "http://example.com/" , Header 1 [Str "Images"] , Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902)",Str ":"] , Plain [Image [Str "image"] ("lalune.jpg","")]
− tests/runtests.pl
@@ -1,110 +0,0 @@-#!/bin/perl -w--$verbose = 1;-my $diffexists = `which diff`;-if ($diffexists eq "") { die "diff not found in path.\n"; }--my $script = "COLUMNS=78 ./pandoc";--use Getopt::Long;-GetOptions("script=s" => \$script);--unless (-f $script) { die "$script does not exist.\n"; }-unless (-x $script) { die "$script is not executable.\n"; }--print "Writer tests:\n";--my @writeformats = ("html", "latex", "rst", "rtf", "markdown", "man", "native"); # docbook, context, and s5 handled separately-my $source = "testsuite.native";--sub test_results -{- my $testname = $_[0];- my $output = $_[1];- my $norm = $_[2];- my $diffoutput = `diff --strip-trailing-cr $output $norm`;- if ($diffoutput eq "") - {- print "passed\n";- }- else- {- print "FAILED\n";- if ($verbose) { print $diffoutput; } - } -}--foreach my $format (@writeformats)-{- $options = "";-- my $extension = $format;- print "Testing $format writer...";-- `$script -r native -w $extension $options -s $source > tmp.$extension`;-- test_results("$format writer", "tmp.$extension", "writer.$format");-- print " $format tables...";-- `$script -r native -w $extension tables.native > tmp.$extension`;-- test_results("$format writer", "tmp.$extension", "tables.$format");-}--print "Testing docbook writer...";-# remove HTML block tests, as this produces invalid docbook...-`sed -e '/^, Header 1 \\[Str "HTML",Space,Str "Blocks"\\]/,/^, HorizontalRule/d' testsuite.native | $script -r native -w docbook -s > tmp.docbook`;-test_results("docbook writer", "tmp.docbook", "writer.docbook");-`$script -r native -w docbook tables.native > tmp.docbook`;-print " docbook tables...";-test_results("docbook tables", "tmp.docbook", "tables.docbook");--print "Testing context writer...";-# remove LaTeX tests, as this produces invalid docbook...-`sed -e '/^, Header 1 \\[Str "LaTeX"\\]/,/^, HorizontalRule/d' testsuite.native | $script -r native -w context -s > tmp.context`;-test_results("context writer", "tmp.context", "writer.context");-`$script -r native -w context tables.native > tmp.context`;-print " context tables...";-test_results("context tables", "tmp.context", "tables.context");--print "Testing s5 writer (basic)...";-`$script -r native -w s5 -s s5.native > tmp.html`;-test_results("s5 writer (basic)", "tmp.html", "s5.basic.html");--print "Testing s5 writer (fancy)...";-`$script -r native -w s5 -s -m -i s5.native > tmp.html`;-test_results("s5 writer (fancy)", "tmp.html", "s5.fancy.html");--print "Testing html fragment...";-`$script -r native -w html s5.native > tmp.html`;-test_results("html fragment", "tmp.html", "s5.fragment.html");--print "Testing -H -B -A -c options...";-`$script -r native -s -w html -H insert -B insert -A insert -c main.css s5.native > tmp.html`;-test_results("-B, -A, -H, -c options", "tmp.html", "s5.inserts.html");--print "\nReader tests:\n";--print "Testing markdown reader...";-`$script -r markdown -w native -s -S testsuite.txt > tmp.native`;-test_results("markdown reader", "tmp.native", "testsuite.native");--print "Testing rst reader...";-`$script -r rst -w native -s rst-reader.rst > tmp.native`;-test_results("rst reader", "tmp.native", "rst-reader.native");--print "Testing html reader...";-`$script -r html -w native -s html-reader.html > tmp.native`;-test_results("html reader", "tmp.native", "html-reader.native");--print "Testing latex reader...";-`$script -r latex -w native -R -s latex-reader.latex > tmp.native`;-test_results("latex reader", "tmp.native", "latex-reader.native");--print "Testing native reader...";-`$script -r native -w native -s testsuite.native > tmp.native`;-test_results("native reader", "tmp.native", "testsuite.native");--`rm tmp.*`;-
tests/s5.basic.html view
@@ -131,7 +131,8 @@ /* diagnostics li:after {content: " [" attr(class) "]"; color: #F88;}- */+*/+ </style> <style type="text/css" media="projection" id="operaFix"> /* DO NOT CHANGE THESE unless you really want to break Opera Show */@@ -193,555 +194,81 @@ // // Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information // about all the wonderful and talented contributors to this code!--var undef;-var slideCSS = '';-var snum = 0;-var smax = 1;-var incpos = 0;-var number = undef;-var s5mode = true;-var defaultView = 'slideshow';-var controlVis = 'visible';--var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;-var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;-var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;--function hasClass(object, className) {- if (!object.className) return false;- return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);-}--function hasValue(object, value) {- if (!object) return false;- return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);-}--function removeClass(object,className) {- if (!object) return;- object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);-}--function addClass(object,className) {- if (!object || hasClass(object, className)) return;- if (object.className) {- object.className += ' '+className;- } else {- object.className = className;- }-}--function GetElementsWithClassName(elementName,className) {- var allElements = document.getElementsByTagName(elementName);- var elemColl = new Array();- for (var i = 0; i< allElements.length; i++) {- if (hasClass(allElements[i], className)) {- elemColl[elemColl.length] = allElements[i];- }- }- return elemColl;-}--function isParentOrSelf(element, id) {- if (element == null || element.nodeName=='BODY') return false;- else if (element.id == id) return true;- else return isParentOrSelf(element.parentNode, id);-}--function nodeValue(node) {- var result = "";- if (node.nodeType == 1) {- var children = node.childNodes;- for (var i = 0; i < children.length; ++i) {- result += nodeValue(children[i]);- } - }- else if (node.nodeType == 3) {- result = node.nodeValue;- }- return(result);-}--function slideLabel() {- var slideColl = GetElementsWithClassName('*','slide');- var list = document.getElementById('jumplist');- smax = slideColl.length;- for (var n = 0; n < smax; n++) {- var obj = slideColl[n];-- var did = 'slide' + n.toString();- obj.setAttribute('id',did);- if (isOp) continue;-- var otext = '';- var menu = obj.firstChild;- if (!menu) continue; // to cope with empty slides- while (menu && menu.nodeType == 3) {- menu = menu.nextSibling;- }- if (!menu) continue; // to cope with slides with only text nodes-- var menunodes = menu.childNodes;- for (var o = 0; o < menunodes.length; o++) {- otext += nodeValue(menunodes[o]);- }- list.options[list.length] = new Option(n + ' : ' + otext, n);- }-}--function currentSlide() {- var cs;- if (document.getElementById) {- cs = document.getElementById('currentSlide');- } else {- cs = document.currentSlide;- }- cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' + - '<span id="csSep">\/<\/span> ' + - '<span id="csTotal">' + (smax-1) + '<\/span>';- if (snum == 0) {- cs.style.visibility = 'hidden';- } else {- cs.style.visibility = 'visible';- }-}--function go(step) {- if (document.getElementById('slideProj').disabled || step == 0) return;- var jl = document.getElementById('jumplist');- var cid = 'slide' + snum;- var ce = document.getElementById(cid);- if (incrementals[snum].length > 0) {- for (var i = 0; i < incrementals[snum].length; i++) {- removeClass(incrementals[snum][i], 'current');- removeClass(incrementals[snum][i], 'incremental');- }- }- if (step != 'j') {- snum += step;- lmax = smax - 1;- if (snum > lmax) snum = lmax;- if (snum < 0) snum = 0;- } else- snum = parseInt(jl.value);- var nid = 'slide' + snum;- var ne = document.getElementById(nid);- if (!ne) {- ne = document.getElementById('slide0');- snum = 0;- }- if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}- if (incrementals[snum].length > 0 && incpos == 0) {- for (var i = 0; i < incrementals[snum].length; i++) {- if (hasClass(incrementals[snum][i], 'current'))- incpos = i + 1;- else- addClass(incrementals[snum][i], 'incremental');- }- }- if (incrementals[snum].length > 0 && incpos > 0)- addClass(incrementals[snum][incpos - 1], 'current');- ce.style.visibility = 'hidden';- ne.style.visibility = 'visible';- jl.selectedIndex = snum;- currentSlide();- number = 0;-}--function goTo(target) {- if (target >= smax || target == snum) return;- go(target - snum);-}--function subgo(step) {- if (step > 0) {- removeClass(incrementals[snum][incpos - 1],'current');- removeClass(incrementals[snum][incpos], 'incremental');- addClass(incrementals[snum][incpos],'current');- incpos++;- } else {- incpos--;- removeClass(incrementals[snum][incpos],'current');- addClass(incrementals[snum][incpos], 'incremental');- addClass(incrementals[snum][incpos - 1],'current');- }-}--function toggle() {- var slideColl = GetElementsWithClassName('*','slide');- var slides = document.getElementById('slideProj');- var outline = document.getElementById('outlineStyle');- if (!slides.disabled) {- slides.disabled = true;- outline.disabled = false;- s5mode = false;- fontSize('1em');- for (var n = 0; n < smax; n++) {- var slide = slideColl[n];- slide.style.visibility = 'visible';- }- } else {- slides.disabled = false;- outline.disabled = true;- s5mode = true;- fontScale();- for (var n = 0; n < smax; n++) {- var slide = slideColl[n];- slide.style.visibility = 'hidden';- }- slideColl[snum].style.visibility = 'visible';- }-}--function showHide(action) {- var obj = GetElementsWithClassName('*','hideme')[0];- switch (action) {- case 's': obj.style.visibility = 'visible'; break;- case 'h': obj.style.visibility = 'hidden'; break;- case 'k':- if (obj.style.visibility != 'visible') {- obj.style.visibility = 'visible';- } else {- obj.style.visibility = 'hidden';- }- break;- }-}--// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)-function keys(key) {- if (!key) {- key = event;- key.which = key.keyCode;- }- if (key.which == 84) {- toggle();- return;- }- if (s5mode) {- switch (key.which) {- case 10: // return- case 13: // enter- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;- if (key.target && isParentOrSelf(key.target, 'controls')) return;- if(number != undef) {- goTo(number);- break;- }- case 32: // spacebar- case 34: // page down- case 39: // rightkey- case 40: // downkey- if(number != undef) {- go(number);- } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {- go(1);- } else {- subgo(1);- }- break;- case 33: // page up- case 37: // leftkey- case 38: // upkey- if(number != undef) {- go(-1 * number);- } else if (!incrementals[snum] || incpos <= 0) {- go(-1);- } else {- subgo(-1);- }- break;- case 36: // home- goTo(0);- break;- case 35: // end- goTo(smax-1);- break;- case 67: // c- showHide('k');- break;- }- if (key.which < 48 || key.which > 57) {- number = undef;- } else {- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;- if (key.target && isParentOrSelf(key.target, 'controls')) return;- number = (((number != undef) ? number : 0) * 10) + (key.which - 48);- }- }- return false;-}--function clicker(e) {- number = undef;- var target;- if (window.event) {- target = window.event.srcElement;- e = window.event;- } else target = e.target;- if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;- if (!e.which || e.which == 1) {- if (!incrementals[snum] || incpos >= incrementals[snum].length) {- go(1);- } else {- subgo(1);- }- }-}--function findSlide(hash) {- var target = null;- var slides = GetElementsWithClassName('*','slide');- for (var i = 0; i < slides.length; i++) {- var targetSlide = slides[i];- if ( (targetSlide.name && targetSlide.name == hash)- || (targetSlide.id && targetSlide.id == hash) ) {- target = targetSlide;- break;- }- }- while(target != null && target.nodeName != 'BODY') {- if (hasClass(target, 'slide')) {- return parseInt(target.id.slice(5));- }- target = target.parentNode;- }- return null;-}--function slideJump() {- if (window.location.hash == null) return;- var sregex = /^#slide(\d+)$/;- var matches = sregex.exec(window.location.hash);- var dest = null;- if (matches != null) {- dest = parseInt(matches[1]);- } else {- dest = findSlide(window.location.hash.slice(1));- }- if (dest != null)- go(dest - snum);-}--function fixLinks() {- var thisUri = window.location.href;- thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);- var aelements = document.getElementsByTagName('A');- for (var i = 0; i < aelements.length; i++) {- var a = aelements[i].href;- var slideID = a.match('\#slide[0-9]{1,2}');- if ((slideID) && (slideID[0].slice(0,1) == '#')) {- var dest = findSlide(slideID[0].slice(1));- if (dest != null) {- if (aelements[i].addEventListener) {- aelements[i].addEventListener("click", new Function("e",- "if (document.getElementById('slideProj').disabled) return;" +- "go("+dest+" - snum); " +- "if (e.preventDefault) e.preventDefault();"), true);- } else if (aelements[i].attachEvent) {- aelements[i].attachEvent("onclick", new Function("",- "if (document.getElementById('slideProj').disabled) return;" +- "go("+dest+" - snum); " +- "event.returnValue = false;"));- }- }- }- }-}--function externalLinks() {- if (!document.getElementsByTagName) return;- var anchors = document.getElementsByTagName('a');- for (var i=0; i<anchors.length; i++) {- var anchor = anchors[i];- if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {- anchor.target = '_blank';- addClass(anchor,'external');- }- }-}--function createControls() {- var controlsDiv = document.getElementById("controls");- if (!controlsDiv) return;- var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';- var hideDiv, hideList = '';- if (controlVis == 'hidden') {- hideDiv = hider;- } else {- hideList = hider;- }- controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +- '<div id="navLinks">' +- '<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>' +- '<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>' +- '<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>' +- '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +- '<\/div><\/form>';- if (controlVis == 'hidden') {- var hidden = document.getElementById('navLinks');- } else {- var hidden = document.getElementById('jumplist');- }- addClass(hidden,'hideme');-}--function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers- if (!s5mode) return false;- var vScale = 22; // both yield 32 (after rounding) at 1024x768- var hScale = 32; // perhaps should auto-calculate based on theme's declared value?- if (window.innerHeight) {- var vSize = window.innerHeight;- var hSize = window.innerWidth;- } else if (document.documentElement.clientHeight) {- var vSize = document.documentElement.clientHeight;- var hSize = document.documentElement.clientWidth;- } else if (document.body.clientHeight) {- var vSize = document.body.clientHeight;- var hSize = document.body.clientWidth;- } else {- var vSize = 700; // assuming 1024x768, minus chrome and such- var hSize = 1024; // these do not account for kiosk mode or Opera Show- }- var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));- fontSize(newSize + 'px');- if (isGe) { // hack to counter incremental reflow bugs- var obj = document.getElementsByTagName('body')[0];- obj.style.display = 'none';- obj.style.display = 'block';- }-}--function fontSize(value) {- if (!(s5ss = document.getElementById('s5ss'))) {- if (!isIE) {- document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));- s5ss.setAttribute('media','screen, projection');- s5ss.setAttribute('id','s5ss');- } else {- document.createStyleSheet();- document.s5ss = document.styleSheets[document.styleSheets.length - 1];- }- }- if (!isIE) {- while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);- s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));- } else {- document.s5ss.addRule('body','font-size: ' + value + ' !important;');- }-}--function notOperaFix() {- slideCSS = document.getElementById('slideProj').href;- var slides = document.getElementById('slideProj');- var outline = document.getElementById('outlineStyle');- slides.setAttribute('media','screen');- outline.disabled = true;- if (isGe) {- slides.setAttribute('href','null'); // Gecko fix- slides.setAttribute('href',slideCSS); // Gecko fix- }- if (isIE && document.styleSheets && document.styleSheets[0]) {- document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');- document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');- document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');- }-}--function getIncrementals(obj) {- var incrementals = new Array();- if (!obj) - return incrementals;- var children = obj.childNodes;- for (var i = 0; i < children.length; i++) {- var child = children[i];- if (hasClass(child, 'incremental')) {- if (child.nodeName == 'OL' || child.nodeName == 'UL') {- removeClass(child, 'incremental');- for (var j = 0; j < child.childNodes.length; j++) {- if (child.childNodes[j].nodeType == 1) {- addClass(child.childNodes[j], 'incremental');- }- }- } else {- incrementals[incrementals.length] = child;- removeClass(child,'incremental');- }- }- if (hasClass(child, 'show-first')) {- if (child.nodeName == 'OL' || child.nodeName == 'UL') {- removeClass(child, 'show-first');- if (child.childNodes[isGe].nodeType == 1) {- removeClass(child.childNodes[isGe], 'incremental');- }- } else {- incrementals[incrementals.length] = child;- }- }- incrementals = incrementals.concat(getIncrementals(child));- }- return incrementals;-}--function createIncrementals() {- var incrementals = new Array();- for (var i = 0; i < smax; i++) {- incrementals[i] = getIncrementals(document.getElementById('slide'+i));- }- return incrementals;-}--function defaultCheck() {- var allMetas = document.getElementsByTagName('meta');- for (var i = 0; i< allMetas.length; i++) {- if (allMetas[i].name == 'defaultView') {- defaultView = allMetas[i].content;- }- if (allMetas[i].name == 'controlVis') {- controlVis = allMetas[i].content;- }- }-}--// Key trap fix, new function body for trap()-function trap(e) {- if (!e) {- e = event;- e.which = e.keyCode;- }- try {- modifierKey = e.ctrlKey || e.altKey || e.metaKey;- }- catch(e) {- modifierKey = false;- }- return modifierKey || e.which == 0;-}--function startup() {- defaultCheck();- if (!isOp) - createControls();- slideLabel();- fixLinks();- externalLinks();- fontScale();- if (!isOp) {- notOperaFix();- incrementals = createIncrementals();- slideJump();- if (defaultView == 'outline') {- toggle();- }- document.onkeyup = keys;- document.onkeypress = trap;- document.onclick = clicker;- }-}--window.onload = startup;-window.onresize = function(){setTimeout('fontScale()', 50);}</script>+var undef;var slideCSS='';var snum=0;var smax=1;var incpos=0;var number=undef;var s5mode=true;var defaultView='slideshow';var controlVis='visible';var isIE=navigator.appName=='Microsoft Internet Explorer'&&navigator.userAgent.indexOf('Opera')<1?1:0;var isOp=navigator.userAgent.indexOf('Opera')>-1?1:0;var isGe=navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('Safari')<1?1:0;function hasClass(object,className){if(!object.className)return false;return(object.className.search('(^|\\s)'+className+'(\\s|$)')!=-1);}+function hasValue(object,value){if(!object)return false;return(object.search('(^|\\s)'+value+'(\\s|$)')!=-1);}+function removeClass(object,className){if(!object)return;object.className=object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'),RegExp.$1+RegExp.$2);}+function addClass(object,className){if(!object||hasClass(object,className))return;if(object.className){object.className+=' '+className;}else{object.className=className;}}+function GetElementsWithClassName(elementName,className){var allElements=document.getElementsByTagName(elementName);var elemColl=new Array();for(var i=0;i<allElements.length;i++){if(hasClass(allElements[i],className)){elemColl[elemColl.length]=allElements[i];}}+return elemColl;}+function isParentOrSelf(element,id){if(element==null||element.nodeName=='BODY')return false;else if(element.id==id)return true;else return isParentOrSelf(element.parentNode,id);}+function nodeValue(node){var result="";if(node.nodeType==1){var children=node.childNodes;for(var i=0;i<children.length;++i){result+=nodeValue(children[i]);}}+else if(node.nodeType==3){result=node.nodeValue;}+return(result);}+function slideLabel(){var slideColl=GetElementsWithClassName('*','slide');var list=document.getElementById('jumplist');smax=slideColl.length;for(var n=0;n<smax;n++){var obj=slideColl[n];var did='slide'+n.toString();obj.setAttribute('id',did);if(isOp)continue;var otext='';var menu=obj.firstChild;if(!menu)continue;while(menu&&menu.nodeType==3){menu=menu.nextSibling;}+if(!menu)continue;var menunodes=menu.childNodes;for(var o=0;o<menunodes.length;o++){otext+=nodeValue(menunodes[o]);}+list.options[list.length]=new Option(n+' : '+otext,n);}}+function currentSlide(){var cs;if(document.getElementById){cs=document.getElementById('currentSlide');}else{cs=document.currentSlide;}+cs.innerHTML='<span id="csHere">'+snum+'<\/span> '+'<span id="csSep">\/<\/span> '+'<span id="csTotal">'+(smax-1)+'<\/span>';if(snum==0){cs.style.visibility='hidden';}else{cs.style.visibility='visible';}}+function go(step){if(document.getElementById('slideProj').disabled||step==0)return;var jl=document.getElementById('jumplist');var cid='slide'+snum;var ce=document.getElementById(cid);if(incrementals[snum].length>0){for(var i=0;i<incrementals[snum].length;i++){removeClass(incrementals[snum][i],'current');removeClass(incrementals[snum][i],'incremental');}}+if(step!='j'){snum+=step;lmax=smax-1;if(snum>lmax)snum=lmax;if(snum<0)snum=0;}else+snum=parseInt(jl.value);var nid='slide'+snum;var ne=document.getElementById(nid);if(!ne){ne=document.getElementById('slide0');snum=0;}+if(step<0){incpos=incrementals[snum].length}else{incpos=0;}+if(incrementals[snum].length>0&&incpos==0){for(var i=0;i<incrementals[snum].length;i++){if(hasClass(incrementals[snum][i],'current'))+incpos=i+1;else+addClass(incrementals[snum][i],'incremental');}}+if(incrementals[snum].length>0&&incpos>0)+addClass(incrementals[snum][incpos-1],'current');ce.style.visibility='hidden';ne.style.visibility='visible';jl.selectedIndex=snum;currentSlide();number=0;}+function goTo(target){if(target>=smax||target==snum)return;go(target-snum);}+function subgo(step){if(step>0){removeClass(incrementals[snum][incpos-1],'current');removeClass(incrementals[snum][incpos],'incremental');addClass(incrementals[snum][incpos],'current');incpos++;}else{incpos--;removeClass(incrementals[snum][incpos],'current');addClass(incrementals[snum][incpos],'incremental');addClass(incrementals[snum][incpos-1],'current');}}+function toggle(){var slideColl=GetElementsWithClassName('*','slide');var slides=document.getElementById('slideProj');var outline=document.getElementById('outlineStyle');if(!slides.disabled){slides.disabled=true;outline.disabled=false;s5mode=false;fontSize('1em');for(var n=0;n<smax;n++){var slide=slideColl[n];slide.style.visibility='visible';}}else{slides.disabled=false;outline.disabled=true;s5mode=true;fontScale();for(var n=0;n<smax;n++){var slide=slideColl[n];slide.style.visibility='hidden';}+slideColl[snum].style.visibility='visible';}}+function showHide(action){var obj=GetElementsWithClassName('*','hideme')[0];switch(action){case's':obj.style.visibility='visible';break;case'h':obj.style.visibility='hidden';break;case'k':if(obj.style.visibility!='visible'){obj.style.visibility='visible';}else{obj.style.visibility='hidden';}+break;}}+function keys(key){if(!key){key=event;key.which=key.keyCode;}+if(key.which==84){toggle();return;}+if(s5mode){switch(key.which){case 10:case 13:if(window.event&&isParentOrSelf(window.event.srcElement,'controls'))return;if(key.target&&isParentOrSelf(key.target,'controls'))return;if(number!=undef){goTo(number);break;}+case 32:case 34:case 39:case 40:if(number!=undef){go(number);}else if(!incrementals[snum]||incpos>=incrementals[snum].length){go(1);}else{subgo(1);}+break;case 33:case 37:case 38:if(number!=undef){go(-1*number);}else if(!incrementals[snum]||incpos<=0){go(-1);}else{subgo(-1);}+break;case 36:goTo(0);break;case 35:goTo(smax-1);break;case 67:showHide('k');break;}+if(key.which<48||key.which>57){number=undef;}else{if(window.event&&isParentOrSelf(window.event.srcElement,'controls'))return;if(key.target&&isParentOrSelf(key.target,'controls'))return;number=(((number!=undef)?number:0)*10)+(key.which-48);}}+return false;}+function clicker(e){number=undef;var target;if(window.event){target=window.event.srcElement;e=window.event;}else target=e.target;if(target.getAttribute('href')!=null||hasValue(target.rel,'external')||isParentOrSelf(target,'controls')||isParentOrSelf(target,'embed')||isParentOrSelf(target,'object'))return true;if(!e.which||e.which==1){if(!incrementals[snum]||incpos>=incrementals[snum].length){go(1);}else{subgo(1);}}}+function findSlide(hash){var target=null;var slides=GetElementsWithClassName('*','slide');for(var i=0;i<slides.length;i++){var targetSlide=slides[i];if((targetSlide.name&&targetSlide.name==hash)||(targetSlide.id&&targetSlide.id==hash)){target=targetSlide;break;}}+while(target!=null&&target.nodeName!='BODY'){if(hasClass(target,'slide')){return parseInt(target.id.slice(5));}+target=target.parentNode;}+return null;}+function slideJump(){if(window.location.hash==null)return;var sregex=/^#slide(\d+)$/;var matches=sregex.exec(window.location.hash);var dest=null;if(matches!=null){dest=parseInt(matches[1]);}else{dest=findSlide(window.location.hash.slice(1));}+if(dest!=null)+go(dest-snum);}+function fixLinks(){var thisUri=window.location.href;thisUri=thisUri.slice(0,thisUri.length-window.location.hash.length);var aelements=document.getElementsByTagName('A');for(var i=0;i<aelements.length;i++){var a=aelements[i].href;var slideID=a.match('\#slide[0-9]{1,2}');if((slideID)&&(slideID[0].slice(0,1)=='#')){var dest=findSlide(slideID[0].slice(1));if(dest!=null){if(aelements[i].addEventListener){aelements[i].addEventListener("click",new Function("e","if (document.getElementById('slideProj').disabled) return;"+"go("+dest+" - snum); "+"if (e.preventDefault) e.preventDefault();"),true);}else if(aelements[i].attachEvent){aelements[i].attachEvent("onclick",new Function("","if (document.getElementById('slideProj').disabled) return;"+"go("+dest+" - snum); "+"event.returnValue = false;"));}}}}}+function externalLinks(){if(!document.getElementsByTagName)return;var anchors=document.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&hasValue(anchor.rel,'external')){anchor.target='_blank';addClass(anchor,'external');}}}+function createControls(){var controlsDiv=document.getElementById("controls");if(!controlsDiv)return;var hider=' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';var hideDiv,hideList='';if(controlVis=='hidden'){hideDiv=hider;}else{hideList=hider;}+controlsDiv.innerHTML='<form action="#" id="controlForm"'+hideDiv+'>'+'<div id="navLinks">'+'<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>'+'<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>'+'<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>'+'<div id="navList"'+hideList+'><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>'+'<\/div><\/form>';if(controlVis=='hidden'){var hidden=document.getElementById('navLinks');}else{var hidden=document.getElementById('jumplist');}+addClass(hidden,'hideme');}+function fontScale(){if(!s5mode)return false;var vScale=22;var hScale=32;if(window.innerHeight){var vSize=window.innerHeight;var hSize=window.innerWidth;}else if(document.documentElement.clientHeight){var vSize=document.documentElement.clientHeight;var hSize=document.documentElement.clientWidth;}else if(document.body.clientHeight){var vSize=document.body.clientHeight;var hSize=document.body.clientWidth;}else{var vSize=700;var hSize=1024;}+var newSize=Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));fontSize(newSize+'px');if(isGe){var obj=document.getElementsByTagName('body')[0];obj.style.display='none';obj.style.display='block';}}+function fontSize(value){if(!(s5ss=document.getElementById('s5ss'))){if(!isIE){document.getElementsByTagName('head')[0].appendChild(s5ss=document.createElement('style'));s5ss.setAttribute('media','screen, projection');s5ss.setAttribute('id','s5ss');}else{document.createStyleSheet();document.s5ss=document.styleSheets[document.styleSheets.length-1];}}+if(!isIE){while(s5ss.lastChild)s5ss.removeChild(s5ss.lastChild);s5ss.appendChild(document.createTextNode('body {font-size: '+value+' !important;}'));}else{document.s5ss.addRule('body','font-size: '+value+' !important;');}}+function notOperaFix(){slideCSS=document.getElementById('slideProj').href;var slides=document.getElementById('slideProj');var outline=document.getElementById('outlineStyle');slides.setAttribute('media','screen');outline.disabled=true;if(isGe){slides.setAttribute('href','null');slides.setAttribute('href',slideCSS);}+if(isIE&&document.styleSheets&&document.styleSheets[0]){document.styleSheets[0].addRule('img','behavior: url(ui/default/iepngfix.htc)');document.styleSheets[0].addRule('div','behavior: url(ui/default/iepngfix.htc)');document.styleSheets[0].addRule('.slide','behavior: url(ui/default/iepngfix.htc)');}}+function getIncrementals(obj){var incrementals=new Array();if(!obj)+return incrementals;var children=obj.childNodes;for(var i=0;i<children.length;i++){var child=children[i];if(hasClass(child,'incremental')){if(child.nodeName=='OL'||child.nodeName=='UL'){removeClass(child,'incremental');for(var j=0;j<child.childNodes.length;j++){if(child.childNodes[j].nodeType==1){addClass(child.childNodes[j],'incremental');}}}else{incrementals[incrementals.length]=child;removeClass(child,'incremental');}}+if(hasClass(child,'show-first')){if(child.nodeName=='OL'||child.nodeName=='UL'){removeClass(child,'show-first');if(child.childNodes[isGe].nodeType==1){removeClass(child.childNodes[isGe],'incremental');}}else{incrementals[incrementals.length]=child;}}+incrementals=incrementals.concat(getIncrementals(child));}+return incrementals;}+function createIncrementals(){var incrementals=new Array();for(var i=0;i<smax;i++){incrementals[i]=getIncrementals(document.getElementById('slide'+i));}+return incrementals;}+function defaultCheck(){var allMetas=document.getElementsByTagName('meta');for(var i=0;i<allMetas.length;i++){if(allMetas[i].name=='defaultView'){defaultView=allMetas[i].content;}+if(allMetas[i].name=='controlVis'){controlVis=allMetas[i].content;}}}+function trap(e){if(!e){e=event;e.which=e.keyCode;}+try{modifierKey=e.ctrlKey||e.altKey||e.metaKey;}+catch(e){modifierKey=false;}+return modifierKey||e.which==0;}+function startup(){defaultCheck();if(!isOp)+createControls();slideLabel();fixLinks();externalLinks();fontScale();if(!isOp){notOperaFix();incrementals=createIncrementals();slideJump();if(defaultView=='outline'){toggle();}+document.onkeyup=keys;document.onkeypress=trap;document.onclick=clicker;}}+window.onload=startup;window.onresize=function(){setTimeout('fontScale()',50);}+</script> </head ><body ><div class="layout">
tests/s5.fancy.html view
@@ -9,3970 +9,474 @@ /><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/ */--var mathcolor = ""; // change it to "" (to inherit) or another color-var mathfontsize = "1em"; // change to e.g. 1.2em for larger math-var mathfontfamily = "serif"; // change to "" to inherit (works in IE) - // or another family (e.g. "arial")-var automathrecognize = false; // writing "amath" on page makes this true-var checkForMathML = true; // check if browser can display MathML-var notifyIfNoMathML = true; // display note at top if no MathML capability-var alertIfNoMathML = false; // show alert box if no MathML capability-var translateOnLoad = true; // set to false to do call translators from js -var translateLaTeX = true; // false to preserve $..$, $$..$$-var translateLaTeXformatting = true; // false to preserve \emph,\begin{},\end{}-var translateASCIIMath = true; // false to preserve `..`-var translateASCIIsvg = true; // false to preserve agraph.., \begin{graph}..-var avoidinnerHTML = false; // set true if assigning to innerHTML gives error-var displaystyle = true; // puts limits above and below large operators-var showasciiformulaonhover = true; // helps students learn ASCIIMath-var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!-var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters-var AMdocumentId = "wikitext" // PmWiki element containing math (default=body)-var checkforprocessasciimathinmoodle = false; // true for systems like Moodle-var dsvglocation = ""; // path to d.svg (blank if same as ASCIIMathML.js loc)--/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */--var isIE = document.createElementNS==null;-var noMathML = false, translated = false;--if (isIE) { // avoid adding MathPlayer info explicitly to each webpage- document.write("<object id=\"mathplayer\"\- classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");- document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");-}--// Add a stylesheet, replacing any previous custom stylesheet (adapted from TW)-function setStylesheet(s) {- var id = "AMMLcustomStyleSheet";- var n = document.getElementById(id);- if(document.createStyleSheet) {- // Test for IE's non-standard createStyleSheet method- if(n)- n.parentNode.removeChild(n);- // This failed without the - document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd"," <style id='" + id + "'>" + s + "</style>");- } else {- if(n) {- n.replaceChild(document.createTextNode(s),n.firstChild);- } else {- n = document.createElement("style");- n.type = "text/css";- n.id = id;- n.appendChild(document.createTextNode(s));- document.getElementsByTagName("head")[0].appendChild(n);- }- }-}--setStylesheet("#AMMLcloseDiv \{font-size:0.8em; padding-top:1em; color:#014\}\n#AMMLwarningBox \{position:absolute; width:100%; top:0; left:0; z-index:200; text-align:center; font-size:1em; font-weight:bold; padding:0.5em 0 0.5em 0; color:#ffc; background:#c30\}");--function init(){- var msg, warnings = new Array();- if (document.getElementById==null){- alert("This webpage requires a recent browser such as Mozilla Firefox/Netscape 7+ or Internet Explorer 6+ with MathPlayer and Adobe SVGviewer");- return null;- }- if (checkForMathML && (msg = checkMathML())) warnings.push(msg);- if (checkIfSVGavailable && (msg = checkSVG())) warnings.push(msg);- if (warnings.length>0) displayWarnings(warnings);- if (!noMathML) initSymbols();- return true;-}--function checkMathML(){- if (navigator.appName.slice(0,8)=="Netscape") - if (navigator.appVersion.slice(0,1)>="5") noMathML = null;- else noMathML = true;- else if (navigator.appName.slice(0,9)=="Microsoft")- try {- var ActiveX = new ActiveXObject("MathPlayer.Factory.1");- noMathML = null;- } catch (e) {- noMathML = true;- }- else noMathML = true;-//noMathML = true; //uncomment to check- if (noMathML && notifyIfNoMathML) {- var msg = "To view the ASCIIMathML notation use Internet Explorer + MathPlayer or Mozilla Firefox 2.0 or later.";- if (alertIfNoMathML)- alert(msg);- else return msg;- }-}--function hideWarning(){- var body = document.getElementsByTagName("body")[0];- body.removeChild(document.getElementById('AMMLwarningBox'));- body.onclick = null;-}--function displayWarnings(warnings) {- var i, frag, nd = createElementXHTML("div");- var body = document.getElementsByTagName("body")[0];- body.onclick=hideWarning;- nd.id = 'AMMLwarningBox';- for (i=0; i<warnings.length; i++) {- frag = createElementXHTML("div");- frag.appendChild(document.createTextNode(warnings[i]));- frag.style.paddingBottom = "1.0em";- nd.appendChild(frag);- }- nd.appendChild(createElementXHTML("p"));- nd.appendChild(document.createTextNode("For instructions see the "));- var an = createElementXHTML("a");- an.appendChild(document.createTextNode("ASCIIMathML"));- an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");- nd.appendChild(an);- nd.appendChild(document.createTextNode(" homepage"));- an = createElementXHTML("div");- an.id = 'AMMLcloseDiv';- an.appendChild(document.createTextNode('(click anywhere to close this warning)'));- nd.appendChild(an);- var body = document.getElementsByTagName("body")[0];- body.insertBefore(nd,body.childNodes[0]);-}--function translate(spanclassAM) {- if (!translated) { // run this only once- translated = true;- var body = document.getElementsByTagName("body")[0];- var processN = document.getElementById(AMdocumentId);- if (translateLaTeX) LMprocessNode((processN!=null?processN:body));- if (translateASCIIMath) AMprocessNode((processN!=null?processN:body), false, spanclassAM);- }-}--function createElementXHTML(t) {- if (isIE) return document.createElement(t);- else return document.createElementNS("http://www.w3.org/1999/xhtml",t);-}--function createMmlNode(t,frag) {- if (isIE) var node = document.createElement("m:"+t);- else var node = document.createElementNS("http://www.w3.org/1998/Math/MathML",t);- if (frag) node.appendChild(frag);- return node;-}--// character lists for Mozilla/Netscape fonts-var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];-var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];-var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];--var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,- RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,- LEFTRIGHT = 9, TEXT = 10, BIG = 11, LONG = 12, STRETCHY = 13,- MATRIX = 14;; // token types--var AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT};--var AMsymbols = [-//some greek symbols-{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST},-{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},-{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},-{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},-{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},-{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST},-{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},-{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST},-{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST},-{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST},-{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST},-{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST},-{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST},-{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST},-{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST},-{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST},-{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST},-{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST},-{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST},-{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST},-{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST},-{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST},-{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST},-{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST},-{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST},-{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST},-{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST},-{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST},-{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST},-{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST},-{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST},-{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST},-{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST},-{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST},-{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST},-{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST},--//binary operation symbols-//{input:"-", tag:"mo", output:"\u0096", tex:null, ttype:CONST},-{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST},-{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST},-{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST},-{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST},-{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},-{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST},-{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST},-{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST},-{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST},-{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST},-{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST},-{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER},-{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER},-{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST},-{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER},-{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST},-{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER},-{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST},-{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER},-{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST},-{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER},--//binary relation symbols-{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST},-{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST},-{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST},-{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST},-{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST},-{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST},-{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST},-{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST},-{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST},-{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST},-{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST},-{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST},-{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST},-{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST},-{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST},-{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST},-{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST},-{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST},-{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST},-{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST},-{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST},-{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST},--//logical symbols-{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},-{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE},-{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST},-{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST},-{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE},-{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST},-{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST},-{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST},-{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST},-{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST},-{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST},-{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST},--//grouping brackets-{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET},-{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET},-{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET},-{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET},-{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET},-{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET},-{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT},-//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT},-{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},-{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},-{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET},-{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET},-{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true},-{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true},--//miscellaneous symbols-{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST},-{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION},-{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION},-{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION},-{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION},-{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST},-{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST},-{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST},-{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST},-{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST},-{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST},-{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST},-{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST},-{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST},-{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST},-{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST},-{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST},-{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST},-{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST},-{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST},-{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST},-{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST},-{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},-{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST},-{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST},-{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST},-{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST},-{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST},-{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST},-{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST},-{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST},-{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST},-{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true},-{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true},--//standard functions-{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},-{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER},-{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},-{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},-{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true},-{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true},-{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true},-{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true},-{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true},-{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true},-{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true},-{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true},-{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true},-{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true},-{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST},-{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST},-{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true},-{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true},-{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST},-{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST},-{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER},-{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER},--//arrows-{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST},-{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST},-{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST},-{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST},-{input:">->", tag:"mo", output:"\u21A3", tex:"rightarrowtail", ttype:CONST},-{input:"->>", tag:"mo", output:"\u21A0", tex:"twoheadrightarrow", ttype:CONST},-{input:">->>", tag:"mo", output:"\u2916", tex:"twoheadrightarrowtail", ttype:CONST},-{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST},-{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST},-{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST},-{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},-{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST},-{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},-//commands with argument-{input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY},-{input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY},-{input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},-{input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX},-{input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},-{input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},-{input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},-{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true},-{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true},-{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true},-{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true},-{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true},-{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true},-{input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT},-{input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT},-AMquote,-{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY},-{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY},-{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY},-{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY},-{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb},-{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb},-{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal},-{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal},-{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY},-{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY},-{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk},-{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk}-];--function compareNames(s1,s2) {- if (s1.input > s2.input) return 1- else return -1;-}--var AMnames = []; //list of input symbols--function initSymbols() {- var texsymbols = [], i;- for (i=0; i<AMsymbols.length; i++)- if (AMsymbols[i].tex) - texsymbols[texsymbols.length] = {input:AMsymbols[i].tex, - tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};- AMsymbols = AMsymbols.concat(texsymbols);- refreshSymbols();-}--function refreshSymbols(){- var i;- AMsymbols.sort(compareNames);- for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;- LMsymbols.sort(compareNames);- for (i=0; i<LMsymbols.length; i++) LMnames[i] = LMsymbols[i].input;-}--function define(oldstr,newstr) {- if(oldstr.substr(0,1)=="\\")- LMsymbols = LMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,- ttype:DEFINITION}]);- else- AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr, - tex:null, ttype:DEFINITION}]);- refreshSymbols(); // this may be a problem if many symbols are defined!-}--function AMremoveCharsAndBlanks(str,n) {-//remove n characters and any following blanks- var st;- if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ") - st = str.slice(n+1);- else st = str.slice(n);- for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);- return st.slice(i);-}--function position(arr, str, n) { -// return position >=n where str appears or would be inserted-// assumes arr is sorted- if (n==0) {- var h,m;- n = -1;- h = arr.length;- while (n+1<h) {- m = (n+h) >> 1;- if (arr[m]<str) n = m; else h = m;- }- return h;- } else- for (var i=n; i<arr.length && arr[i]<str; i++);- return i; // i=arr.length || arr[i]>=str-}--function AMgetSymbol(str) {-//return maximal initial substring of str that appears in names-//return null if there is none- var k = 0; //new pos- var j = 0; //old pos- var mk; //match pos- var st;- var tagst;- var match = "";- var more = true;- for (var i=1; i<=str.length && more; i++) {- st = str.slice(0,i); //initial substring of length i- j = k;- k = position(AMnames, st, j);- if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){- match = AMnames[k];- mk = k;- i = match.length;- }- more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];- }- AMpreviousSymbol=AMcurrentSymbol;- if (match!=""){- AMcurrentSymbol=AMsymbols[mk].ttype;- return AMsymbols[mk]; - }-// if str[0] is a digit or - return maxsubstring of digits.digits- AMcurrentSymbol=CONST;- k = 1;- st = str.slice(0,1);- var integ = true;- while ("0"<=st && st<="9" && k<=str.length) {- st = str.slice(k,k+1);- k++;- }- if (st == decimalsign) {- st = str.slice(k,k+1);- if ("0"<=st && st<="9") {- integ = false;- k++;- while ("0"<=st && st<="9" && k<=str.length) {- st = str.slice(k,k+1);- k++;- }- }- }- if ((integ && k>1) || k>2) {- st = str.slice(0,k-1);- tagst = "mn";- } else {- k = 2;- st = str.slice(0,1); //take 1 character- tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");- }- if (st=="-" && AMpreviousSymbol==INFIX) {- AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse- return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};- }- return {input:st, tag:tagst, output:st, ttype:CONST};-}--function AMremoveBrackets(node) {- var st;- if (node.nodeName=="mrow") {- st = node.firstChild.firstChild.nodeValue;- if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);- }- if (node.nodeName=="mrow") {- st = node.lastChild.firstChild.nodeValue;- if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);- }-}--/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */--var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;--function AMparseSexpr(str) { //parses str and returns [node,tailstr]- var symbol, node, result, i, st,// rightvert = false,- newFrag = document.createDocumentFragment();- str = AMremoveCharsAndBlanks(str,0);- symbol = AMgetSymbol(str); //either a token or a bracket or empty- if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {- return [null,str];- }- if (symbol.ttype == DEFINITION) {- str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length); - symbol = AMgetSymbol(str);- }- switch (symbol.ttype) { case UNDEROVER:- case CONST:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode(symbol.tag, //its a constant- document.createTextNode(symbol.output)),str];- case LEFTBRACKET: //read (expr+)- AMnestingDepth++;- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseExpr(str,true);- AMnestingDepth--;- if (typeof symbol.invisible == "boolean" && symbol.invisible) - node = createMmlNode("mrow",result[0]);- else {- node = createMmlNode("mo",document.createTextNode(symbol.output));- node = createMmlNode("mrow",node);- node.appendChild(result[0]);- }- return [node,result[1]];- case TEXT:- if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);- if (str.charAt(0)=="{") i=str.indexOf("}");- else if (str.charAt(0)=="(") i=str.indexOf(")");- else if (str.charAt(0)=="[") i=str.indexOf("]");- else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;- else i = 0;- if (i==-1) i = str.length;- st = str.slice(1,i);- if (st.charAt(0) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- }- newFrag.appendChild(- createMmlNode(symbol.tag,document.createTextNode(st)));- if (st.charAt(st.length-1) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- }- str = AMremoveCharsAndBlanks(str,i+1);- return [createMmlNode("mrow",newFrag),str];- case UNARY:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseSexpr(str);- if (result[0]==null) return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str];- if (typeof symbol.func == "boolean" && symbol.func) { // functions hack- st = str.charAt(0);- if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {- return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str];- } else {- node = createMmlNode("mrow",- createMmlNode(symbol.tag,document.createTextNode(symbol.output)));- node.appendChild(result[0]);- return [node,result[1]];- }- }- AMremoveBrackets(result[0]);- if (symbol.input == "sqrt") { // sqrt- return [createMmlNode(symbol.tag,result[0]),result[1]];- } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent- node = createMmlNode(symbol.tag,result[0]);- node.appendChild(createMmlNode("mo",document.createTextNode(symbol.output)));- return [node,result[1]];- } else { // font change command- if (!isIE && typeof symbol.codes != "undefined") {- for (i=0; i<result[0].childNodes.length; i++)- if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {- st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:- result[0].childNodes[i].firstChild.nodeValue);- var newst = [];- for (var j=0; j<st.length; j++)- if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +- String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);- else newst = newst + st.charAt(j);- if (result[0].nodeName=="mi")- result[0]=createMmlNode("mo").- appendChild(document.createTextNode(newst));- else result[0].replaceChild(createMmlNode("mo").- appendChild(document.createTextNode(newst)),- result[0].childNodes[i]);- }- }- node = createMmlNode(symbol.tag,result[0]);- node.setAttribute(symbol.atname,symbol.atval);- return [node,result[1]];- }- case BINARY:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseSexpr(str);- if (result[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str];- AMremoveBrackets(result[0]);- var result2 = AMparseSexpr(result[1]);- if (result2[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str];- AMremoveBrackets(result2[0]);- if (symbol.input=="root" || symbol.input=="stackrel") - newFrag.appendChild(result2[0]);- newFrag.appendChild(result[0]);- if (symbol.input=="frac") newFrag.appendChild(result2[0]);- return [createMmlNode(symbol.tag,newFrag),result2[1]];- case INFIX:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode("mo",document.createTextNode(symbol.output)),str];- case SPACE:- str = AMremoveCharsAndBlanks(str,symbol.input.length); - node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- newFrag.appendChild(- createMmlNode(symbol.tag,document.createTextNode(symbol.output)));- node = createMmlNode("mspace");- node.setAttribute("width","1ex");- newFrag.appendChild(node);- return [createMmlNode("mrow",newFrag),str];- case LEFTRIGHT:-// if (rightvert) return [null,str]; else rightvert = true;- AMnestingDepth++;- str = AMremoveCharsAndBlanks(str,symbol.input.length); - result = AMparseExpr(str,false);- AMnestingDepth--;- var st = "";- if (result[0].lastChild!=null)- st = result[0].lastChild.firstChild.nodeValue;- if (st == "|") { // its an absolute value subterm- node = createMmlNode("mo",document.createTextNode(symbol.output));- node = createMmlNode("mrow",node);- node.appendChild(result[0]);- return [node,result[1]];- } else { // the "|" is a \mid so use unicode 2223 (divides) for spacing- node = createMmlNode("mo",document.createTextNode("\u2223"));- node = createMmlNode("mrow",node);- return [node,str];- }- default:-//alert("default");- str = AMremoveCharsAndBlanks(str,symbol.input.length); - return [createMmlNode(symbol.tag, //its a constant- document.createTextNode(symbol.output)),str];- }-}--function AMparseIexpr(str) {- var symbol, sym1, sym2, node, result, underover;- str = AMremoveCharsAndBlanks(str,0);- sym1 = AMgetSymbol(str);- result = AMparseSexpr(str);- node = result[0];- str = result[1];- symbol = AMgetSymbol(str);- if (symbol.ttype == INFIX && symbol.input != "/") {- str = AMremoveCharsAndBlanks(str,symbol.input.length);-// if (symbol.input == "/") result = AMparseIexpr(str); else ...- result = AMparseSexpr(str);- if (result[0] == null) // show box in place of missing argument- result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));- else AMremoveBrackets(result[0]);- str = result[1];-// if (symbol.input == "/") AMremoveBrackets(node);- if (symbol.input == "_") {- sym2 = AMgetSymbol(str);- underover = (sym1.ttype == UNDEROVER);- if (sym2.input == "^") {- str = AMremoveCharsAndBlanks(str,sym2.input.length);- var res2 = AMparseSexpr(str);- AMremoveBrackets(res2[0]);- str = res2[1];- node = createMmlNode((underover?"munderover":"msubsup"),node);- node.appendChild(result[0]);- node.appendChild(res2[0]);- node = createMmlNode("mrow",node); // so sum does not stretch- } else {- node = createMmlNode((underover?"munder":"msub"),node);- node.appendChild(result[0]);- }- } else {- node = createMmlNode(symbol.tag,node);- node.appendChild(result[0]);- }- }- return [node,str];-}--function AMparseExpr(str,rightbracket) {- var symbol, node, result, i, nodeList = [],- newFrag = document.createDocumentFragment();- do {- str = AMremoveCharsAndBlanks(str,0);- result = AMparseIexpr(str);- node = result[0];- str = result[1];- symbol = AMgetSymbol(str);- if (symbol.ttype == INFIX && symbol.input == "/") {- str = AMremoveCharsAndBlanks(str,symbol.input.length);- result = AMparseIexpr(str);- if (result[0] == null) // show box in place of missing argument- result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));- else AMremoveBrackets(result[0]);- str = result[1];- AMremoveBrackets(node);- node = createMmlNode(symbol.tag,node);- node.appendChild(result[0]);- newFrag.appendChild(node);- symbol = AMgetSymbol(str);- } - else if (node!=undefined) newFrag.appendChild(node);- } while ((symbol.ttype != RIGHTBRACKET && - (symbol.ttype != LEFTRIGHT || rightbracket)- || AMnestingDepth == 0) && symbol!=null && symbol.output!="");- if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {-// if (AMnestingDepth > 0) AMnestingDepth--;- var len = newFrag.childNodes.length;- if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&- newFrag.childNodes[len-2].nodeName == "mo" &&- newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix- var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;- if (right==")" || right=="]") {- var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;- if (left=="(" && right==")" && symbol.output != "}" || - left=="[" && right=="]") {- var pos = []; // positions of commas- var matrix = true;- var m = newFrag.childNodes.length;- for (i=0; matrix && i<m; i=i+2) {- pos[i] = [];- node = newFrag.childNodes[i];- if (matrix) matrix = node.nodeName=="mrow" && - (i==m-1 || node.nextSibling.nodeName=="mo" && - node.nextSibling.firstChild.nodeValue==",")&&- node.firstChild.firstChild.nodeValue==left &&- node.lastChild.firstChild.nodeValue==right;- if (matrix) - for (var j=0; j<node.childNodes.length; j++)- if (node.childNodes[j].firstChild.nodeValue==",")- pos[i][pos[i].length]=j;- if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;- }- if (matrix) {- var row, frag, n, k, table = document.createDocumentFragment();- for (i=0; i<m; i=i+2) {- row = document.createDocumentFragment();- frag = document.createDocumentFragment();- node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>- n = node.childNodes.length;- k = 0;- node.removeChild(node.firstChild); //remove (- for (j=1; j<n-1; j++) {- if (typeof pos[i][k] != "undefined" && j==pos[i][k]){- node.removeChild(node.firstChild); //remove ,- row.appendChild(createMmlNode("mtd",frag));- k++;- } else frag.appendChild(node.firstChild);- }- row.appendChild(createMmlNode("mtd",frag));- if (newFrag.childNodes.length>2) {- newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>- newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>- }- table.appendChild(createMmlNode("mtr",row));- }- node = createMmlNode("mtable",table);- if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");- newFrag.replaceChild(node,newFrag.firstChild);- }- }- }- }- str = AMremoveCharsAndBlanks(str,symbol.input.length);- if (typeof symbol.invisible != "boolean" || !symbol.invisible) {- node = createMmlNode("mo",document.createTextNode(symbol.output));- newFrag.appendChild(node);- }- }- return [newFrag,str];-}--function parseMath(str,latex) {- var frag, node;- AMnestingDepth = 0;- frag = latex ? LMparseExpr(str.replace(/^\s+/g,""),false,false)[0] : AMparseExpr(str.replace(/^\s+/g,""),false)[0];- node = createMmlNode("mstyle",frag);- node.setAttribute("mathcolor",mathcolor);- node.setAttribute("fontfamily",mathfontfamily);- node.setAttribute("mathsize",mathfontsize);- if (displaystyle) node.setAttribute("displaystyle","true");- node = createMmlNode("math",node);- if (showasciiformulaonhover) //fixed by djhsu so newline- node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko- return node;-}--function strarr2docFrag(arr, linebreaks, latex) {- var newFrag=document.createDocumentFragment();- var expr = false;- for (var i=0; i<arr.length; i++) {- if (expr) newFrag.appendChild(parseMath(arr[i],latex));- else {- var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);- newFrag.appendChild(createElementXHTML("span").- appendChild(document.createTextNode(arri[0])));- for (var j=1; j<arri.length; j++) {- newFrag.appendChild(createElementXHTML("p"));- newFrag.appendChild(createElementXHTML("span").- appendChild(document.createTextNode(arri[j])));- }- }- expr = !expr;- }- return newFrag;-}--function AMautomathrec(str) {-//formula is a space (or start of str) followed by a maximal sequence of *two* or more tokens, possibly separated by runs of digits and/or space.-//tokens are single letters (except a, A, I) and ASCIIMathML tokens- var texcommand = "\\\\[a-zA-Z]+|\\\\\\s|";- var ambigAMtoken = "\\b(?:oo|lim|ln|int|oint|del|grad|aleph|prod|prop|sinh|cosh|tanh|cos|sec|pi|tt|fr|sf|sube|supe|sub|sup|det|mod|gcd|lcm|min|max|vec|ddot|ul|chi|eta|nu|mu)(?![a-z])|";- var englishAMtoken = "\\b(?:sum|ox|log|sin|tan|dim|hat|bar|dot)(?![a-z])|";- var secondenglishAMtoken = "|\\bI\\b|\\bin\\b|\\btext\\b"; // took if and or not out- var simpleAMtoken = "NN|ZZ|QQ|RR|CC|TT|AA|EE|sqrt|dx|dy|dz|dt|xx|vv|uu|nn|bb|cc|csc|cot|alpha|beta|delta|Delta|epsilon|gamma|Gamma|kappa|lambda|Lambda|omega|phi|Phi|Pi|psi|Psi|rho|sigma|Sigma|tau|theta|Theta|xi|Xi|zeta"; // uuu nnn?- var letter = "[a-zA-HJ-Z](?=(?:[^a-zA-Z]|$|"+ambigAMtoken+englishAMtoken+simpleAMtoken+"))|";- var token = letter+texcommand+"\\d+|[-()[\\]{}+=*&^_%\\\@/<>,\\|!:;'~]|\\.(?!(?:\x20|$))|"+ambigAMtoken+englishAMtoken+simpleAMtoken;- var re = new RegExp("(^|\\s)((("+token+")\\s?)(("+token+secondenglishAMtoken+")\\s?)+)([,.?]?(?=\\s|$))","g");- str = str.replace(re," `$2`$7");- var arr = str.split(AMdelimiter1);- var re1 = new RegExp("(^|\\s)([b-zB-HJ-Z+*<>]|"+texcommand+ambigAMtoken+simpleAMtoken+")(\\s|\\n|$)","g");- var re2 = new RegExp("(^|\\s)([a-z]|"+texcommand+ambigAMtoken+simpleAMtoken+")([,.])","g"); // removed |\d+ for now- for (i=0; i<arr.length; i++) //single nonenglish tokens- if (i%2==0) {- arr[i] = arr[i].replace(re1," `$2`$3");- arr[i] = arr[i].replace(re2," `$2`$3");- arr[i] = arr[i].replace(/([{}[\]])/,"`$1`");- }- str = arr.join(AMdelimiter1);- str = str.replace(/((^|\s)\([a-zA-Z]{2,}.*?)\)`/g,"$1`)"); //fix parentheses- str = str.replace(/`(\((a\s|in\s))(.*?[a-zA-Z]{2,}\))/g,"$1`$3"); //fix parentheses- str = str.replace(/\sin`/g,"` in");- str = str.replace(/`(\(\w\)[,.]?(\s|\n|$))/g,"$1`");- str = str.replace(/`([0-9.]+|e.g|i.e)`(\.?)/gi,"$1$2");- str = str.replace(/`([0-9.]+:)`/g,"$1");- return str;-}--function processNodeR(n, linebreaks,latex) {- var mtch, str, arr, frg, i;- if (n.childNodes.length == 0) {- if ((n.nodeType!=8 || linebreaks) &&- n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&- n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */) {- str = n.nodeValue;- if (!(str == null)) {- str = str.replace(/\r\n\r\n/g,"\n\n");- str = str.replace(/\x20+/g," ");- str = str.replace(/\s*\r\n/g," ");- if(latex) {-// DELIMITERS:- mtch = (str.indexOf("\$")==-1 ? false : true);- str = str.replace(/([^\\])\$/g,"$1 \$");- str = str.replace(/^\$/," \$"); // in case \$ at start of string- arr = str.split(" \$");- for (i=0; i<arr.length; i++)- arr[i]=arr[i].replace(/\\\$/g,"\$");- } else {- mtch = false;- str = str.replace(new RegExp(AMescape1, "g"),- function(){mtch = true; return "AMescape1"});- str = str.replace(/\\?end{?a?math}?/i,- function(){automathrecognize = false; mtch = true; return ""});- str = str.replace(/amath\b|\\begin{a?math}/i,- function(){automathrecognize = true; mtch = true; return ""});- arr = str.split(AMdelimiter1);- if (automathrecognize)- for (i=0; i<arr.length; i++)- if (i%2==0) arr[i] = AMautomathrec(arr[i]);- str = arr.join(AMdelimiter1);- arr = str.split(AMdelimiter1);- for (i=0; i<arr.length; i++) // this is a problem ************- arr[i]=arr[i].replace(/AMescape1/g,AMdelimiter1);- }- if (arr.length>1 || mtch) {- if (!noMathML) {- frg = strarr2docFrag(arr,n.nodeType==8,latex);- var len = frg.childNodes.length;- n.parentNode.replaceChild(frg,n);- return len-1;- } else return 0;- }- }- } else return 0;- } else if (n.nodeName!="math") {- for (i=0; i<n.childNodes.length; i++)- i += processNodeR(n.childNodes[i], linebreaks,latex);- }- return 0;-}--function AMprocessNode(n, linebreaks, spanclassAM) {- var frag,st;- if (spanclassAM!=null) {- frag = document.getElementsByTagName("span")- for (var i=0;i<frag.length;i++)- if (frag[i].className == "AM") - processNodeR(frag[i],linebreaks,false);- } else {- try {- st = n.innerHTML; // look for AMdelimiter on page- } catch(err) {}-//alert(st)- if (st==null || /amath\b|\\begin{a?math}/i.test(st) ||- st.indexOf(AMdelimiter1+" ")!=-1 || st.slice(-1)==AMdelimiter1 ||- st.indexOf(AMdelimiter1+"<")!=-1 || st.indexOf(AMdelimiter1+"\n")!=-1) {- processNodeR(n,linebreaks,false);- }- }-/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */-}--/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */--// all further global variables start with "LM"--// Commented out by DRW to prevent 1/2 turning into a 2-line fraction-// LMdiv = {input:"/", tag:"mfrac", output:"/", ttype:INFIX},-// Commented out by DRW so that " prints literally in equations-// LMquote = {input:"\"", tag:"mtext", output:"mbox", ttype:TEXT};--var LMsymbols = [-//Greek letters-{input:"\\alpha", tag:"mi", output:"\u03B1", ttype:CONST},-{input:"\\beta", tag:"mi", output:"\u03B2", ttype:CONST},-{input:"\\gamma", tag:"mi", output:"\u03B3", ttype:CONST},-{input:"\\delta", tag:"mi", output:"\u03B4", ttype:CONST},-{input:"\\epsilon", tag:"mi", output:"\u03B5", ttype:CONST},-{input:"\\varepsilon", tag:"mi", output:"\u025B", ttype:CONST},-{input:"\\zeta", tag:"mi", output:"\u03B6", ttype:CONST},-{input:"\\eta", tag:"mi", output:"\u03B7", ttype:CONST},-{input:"\\theta", tag:"mi", output:"\u03B8", ttype:CONST},-{input:"\\vartheta", tag:"mi", output:"\u03D1", ttype:CONST},-{input:"\\iota", tag:"mi", output:"\u03B9", ttype:CONST},-{input:"\\kappa", tag:"mi", output:"\u03BA", ttype:CONST},-{input:"\\lambda", tag:"mi", output:"\u03BB", ttype:CONST},-{input:"\\mu", tag:"mi", output:"\u03BC", ttype:CONST},-{input:"\\nu", tag:"mi", output:"\u03BD", ttype:CONST},-{input:"\\xi", tag:"mi", output:"\u03BE", ttype:CONST},-{input:"\\pi", tag:"mi", output:"\u03C0", ttype:CONST},-{input:"\\varpi", tag:"mi", output:"\u03D6", ttype:CONST},-{input:"\\rho", tag:"mi", output:"\u03C1", ttype:CONST},-{input:"\\varrho", tag:"mi", output:"\u03F1", ttype:CONST},-{input:"\\varsigma", tag:"mi", output:"\u03C2", ttype:CONST},-{input:"\\sigma", tag:"mi", output:"\u03C3", ttype:CONST},-{input:"\\tau", tag:"mi", output:"\u03C4", ttype:CONST},-{input:"\\upsilon", tag:"mi", output:"\u03C5", ttype:CONST},-{input:"\\phi", tag:"mi", output:"\u03C6", ttype:CONST},-{input:"\\varphi", tag:"mi", output:"\u03D5", ttype:CONST},-{input:"\\chi", tag:"mi", output:"\u03C7", ttype:CONST},-{input:"\\psi", tag:"mi", output:"\u03C8", ttype:CONST},-{input:"\\omega", tag:"mi", output:"\u03C9", ttype:CONST},-{input:"\\Gamma", tag:"mo", output:"\u0393", ttype:CONST},-{input:"\\Delta", tag:"mo", output:"\u0394", ttype:CONST},-{input:"\\Theta", tag:"mo", output:"\u0398", ttype:CONST},-{input:"\\Lambda", tag:"mo", output:"\u039B", ttype:CONST},-{input:"\\Xi", tag:"mo", output:"\u039E", ttype:CONST},-{input:"\\Pi", tag:"mo", output:"\u03A0", ttype:CONST},-{input:"\\Sigma", tag:"mo", output:"\u03A3", ttype:CONST},-{input:"\\Upsilon", tag:"mo", output:"\u03A5", ttype:CONST},-{input:"\\Phi", tag:"mo", output:"\u03A6", ttype:CONST},-{input:"\\Psi", tag:"mo", output:"\u03A8", ttype:CONST},-{input:"\\Omega", tag:"mo", output:"\u03A9", ttype:CONST},--//fractions-{input:"\\frac12", tag:"mo", output:"\u00BD", ttype:CONST},-{input:"\\frac14", tag:"mo", output:"\u00BC", ttype:CONST},-{input:"\\frac34", tag:"mo", output:"\u00BE", ttype:CONST},-{input:"\\frac13", tag:"mo", output:"\u2153", ttype:CONST},-{input:"\\frac23", tag:"mo", output:"\u2154", ttype:CONST},-{input:"\\frac15", tag:"mo", output:"\u2155", ttype:CONST},-{input:"\\frac25", tag:"mo", output:"\u2156", ttype:CONST},-{input:"\\frac35", tag:"mo", output:"\u2157", ttype:CONST},-{input:"\\frac45", tag:"mo", output:"\u2158", ttype:CONST},-{input:"\\frac16", tag:"mo", output:"\u2159", ttype:CONST},-{input:"\\frac56", tag:"mo", output:"\u215A", ttype:CONST},-{input:"\\frac18", tag:"mo", output:"\u215B", ttype:CONST},-{input:"\\frac38", tag:"mo", output:"\u215C", ttype:CONST},-{input:"\\frac58", tag:"mo", output:"\u215D", ttype:CONST},-{input:"\\frac78", tag:"mo", output:"\u215E", ttype:CONST},--//binary operation symbols-{input:"\\pm", tag:"mo", output:"\u00B1", ttype:CONST},-{input:"\\mp", tag:"mo", output:"\u2213", ttype:CONST},-{input:"\\triangleleft",tag:"mo", output:"\u22B2", ttype:CONST},-{input:"\\triangleright",tag:"mo",output:"\u22B3", ttype:CONST},-{input:"\\cdot", tag:"mo", output:"\u22C5", ttype:CONST},-{input:"\\star", tag:"mo", output:"\u22C6", ttype:CONST},-{input:"\\ast", tag:"mo", output:"\u002A", ttype:CONST},-{input:"\\times", tag:"mo", output:"\u00D7", ttype:CONST},-{input:"\\div", tag:"mo", output:"\u00F7", ttype:CONST},-{input:"\\circ", tag:"mo", output:"\u2218", ttype:CONST},-//{input:"\\bullet", tag:"mo", output:"\u2219", ttype:CONST},-{input:"\\bullet", tag:"mo", output:"\u2022", ttype:CONST},-{input:"\\oplus", tag:"mo", output:"\u2295", ttype:CONST},-{input:"\\ominus", tag:"mo", output:"\u2296", ttype:CONST},-{input:"\\otimes", tag:"mo", output:"\u2297", ttype:CONST},-{input:"\\bigcirc", tag:"mo", output:"\u25CB", ttype:CONST},-{input:"\\oslash", tag:"mo", output:"\u2298", ttype:CONST},-{input:"\\odot", tag:"mo", output:"\u2299", ttype:CONST},-{input:"\\land", tag:"mo", output:"\u2227", ttype:CONST},-{input:"\\wedge", tag:"mo", output:"\u2227", ttype:CONST},-{input:"\\lor", tag:"mo", output:"\u2228", ttype:CONST},-{input:"\\vee", tag:"mo", output:"\u2228", ttype:CONST},-{input:"\\cap", tag:"mo", output:"\u2229", ttype:CONST},-{input:"\\cup", tag:"mo", output:"\u222A", ttype:CONST},-{input:"\\sqcap", tag:"mo", output:"\u2293", ttype:CONST},-{input:"\\sqcup", tag:"mo", output:"\u2294", ttype:CONST},-{input:"\\uplus", tag:"mo", output:"\u228E", ttype:CONST},-{input:"\\amalg", tag:"mo", output:"\u2210", ttype:CONST},-{input:"\\bigtriangleup",tag:"mo",output:"\u25B3", ttype:CONST},-{input:"\\bigtriangledown",tag:"mo",output:"\u25BD", ttype:CONST},-{input:"\\dag", tag:"mo", output:"\u2020", ttype:CONST},-{input:"\\dagger", tag:"mo", output:"\u2020", ttype:CONST},-{input:"\\ddag", tag:"mo", output:"\u2021", ttype:CONST},-{input:"\\ddagger", tag:"mo", output:"\u2021", ttype:CONST},-{input:"\\lhd", tag:"mo", output:"\u22B2", ttype:CONST},-{input:"\\rhd", tag:"mo", output:"\u22B3", ttype:CONST},-{input:"\\unlhd", tag:"mo", output:"\u22B4", ttype:CONST},-{input:"\\unrhd", tag:"mo", output:"\u22B5", ttype:CONST},---//BIG Operators-{input:"\\sum", tag:"mo", output:"\u2211", ttype:UNDEROVER},-{input:"\\prod", tag:"mo", output:"\u220F", ttype:UNDEROVER},-{input:"\\bigcap", tag:"mo", output:"\u22C2", ttype:UNDEROVER},-{input:"\\bigcup", tag:"mo", output:"\u22C3", ttype:UNDEROVER},-{input:"\\bigwedge", tag:"mo", output:"\u22C0", ttype:UNDEROVER},-{input:"\\bigvee", tag:"mo", output:"\u22C1", ttype:UNDEROVER},-{input:"\\bigsqcap", tag:"mo", output:"\u2A05", ttype:UNDEROVER},-{input:"\\bigsqcup", tag:"mo", output:"\u2A06", ttype:UNDEROVER},-{input:"\\coprod", tag:"mo", output:"\u2210", ttype:UNDEROVER},-{input:"\\bigoplus", tag:"mo", output:"\u2A01", ttype:UNDEROVER},-{input:"\\bigotimes", tag:"mo", output:"\u2A02", ttype:UNDEROVER},-{input:"\\bigodot", tag:"mo", output:"\u2A00", ttype:UNDEROVER},-{input:"\\biguplus", tag:"mo", output:"\u2A04", ttype:UNDEROVER},-{input:"\\int", tag:"mo", output:"\u222B", ttype:CONST},-{input:"\\oint", tag:"mo", output:"\u222E", ttype:CONST},--//binary relation symbols-{input:":=", tag:"mo", output:":=", ttype:CONST},-{input:"\\lt", tag:"mo", output:"<", ttype:CONST},-{input:"\\gt", tag:"mo", output:">", ttype:CONST},-{input:"\\ne", tag:"mo", output:"\u2260", ttype:CONST},-{input:"\\neq", tag:"mo", output:"\u2260", ttype:CONST},-{input:"\\le", tag:"mo", output:"\u2264", ttype:CONST},-{input:"\\leq", tag:"mo", output:"\u2264", ttype:CONST},-{input:"\\leqslant", tag:"mo", output:"\u2264", ttype:CONST},-{input:"\\ge", tag:"mo", output:"\u2265", ttype:CONST},-{input:"\\geq", tag:"mo", output:"\u2265", ttype:CONST},-{input:"\\geqslant", tag:"mo", output:"\u2265", ttype:CONST},-{input:"\\equiv", tag:"mo", output:"\u2261", ttype:CONST},-{input:"\\ll", tag:"mo", output:"\u226A", ttype:CONST},-{input:"\\gg", tag:"mo", output:"\u226B", ttype:CONST},-{input:"\\doteq", tag:"mo", output:"\u2250", ttype:CONST},-{input:"\\prec", tag:"mo", output:"\u227A", ttype:CONST},-{input:"\\succ", tag:"mo", output:"\u227B", ttype:CONST},-{input:"\\preceq", tag:"mo", output:"\u227C", ttype:CONST},-{input:"\\succeq", tag:"mo", output:"\u227D", ttype:CONST},-{input:"\\subset", tag:"mo", output:"\u2282", ttype:CONST},-{input:"\\supset", tag:"mo", output:"\u2283", ttype:CONST},-{input:"\\subseteq", tag:"mo", output:"\u2286", ttype:CONST},-{input:"\\supseteq", tag:"mo", output:"\u2287", ttype:CONST},-{input:"\\sqsubset", tag:"mo", output:"\u228F", ttype:CONST},-{input:"\\sqsupset", tag:"mo", output:"\u2290", ttype:CONST},-{input:"\\sqsubseteq", tag:"mo", output:"\u2291", ttype:CONST},-{input:"\\sqsupseteq", tag:"mo", output:"\u2292", ttype:CONST},-{input:"\\sim", tag:"mo", output:"\u223C", ttype:CONST},-{input:"\\simeq", tag:"mo", output:"\u2243", ttype:CONST},-{input:"\\approx", tag:"mo", output:"\u2248", ttype:CONST},-{input:"\\cong", tag:"mo", output:"\u2245", ttype:CONST},-{input:"\\Join", tag:"mo", output:"\u22C8", ttype:CONST},-{input:"\\bowtie", tag:"mo", output:"\u22C8", ttype:CONST},-{input:"\\in", tag:"mo", output:"\u2208", ttype:CONST},-{input:"\\ni", tag:"mo", output:"\u220B", ttype:CONST},-{input:"\\owns", tag:"mo", output:"\u220B", ttype:CONST},-{input:"\\propto", tag:"mo", output:"\u221D", ttype:CONST},-{input:"\\vdash", tag:"mo", output:"\u22A2", ttype:CONST},-{input:"\\dashv", tag:"mo", output:"\u22A3", ttype:CONST},-{input:"\\models", tag:"mo", output:"\u22A8", ttype:CONST},-{input:"\\perp", tag:"mo", output:"\u22A5", ttype:CONST},-{input:"\\smile", tag:"mo", output:"\u2323", ttype:CONST},-{input:"\\frown", tag:"mo", output:"\u2322", ttype:CONST},-{input:"\\asymp", tag:"mo", output:"\u224D", ttype:CONST},-{input:"\\notin", tag:"mo", output:"\u2209", ttype:CONST},--//matrices-{input:"\\begin{eqnarray}", output:"X", ttype:MATRIX, invisible:true},-{input:"\\begin{array}", output:"X", ttype:MATRIX, invisible:true},-{input:"\\\\", output:"}&{", ttype:DEFINITION},-{input:"\\end{eqnarray}", output:"}}", ttype:DEFINITION},-{input:"\\end{array}", output:"}}", ttype:DEFINITION},--//grouping and literal brackets -- ieval is for IE-{input:"\\big", tag:"mo", output:"X", atval:"1.2", ieval:"2.2", ttype:BIG},-{input:"\\Big", tag:"mo", output:"X", atval:"1.6", ieval:"2.6", ttype:BIG},-{input:"\\bigg", tag:"mo", output:"X", atval:"2.2", ieval:"3.2", ttype:BIG},-{input:"\\Bigg", tag:"mo", output:"X", atval:"2.9", ieval:"3.9", ttype:BIG},-{input:"\\left", tag:"mo", output:"X", ttype:LEFTBRACKET},-{input:"\\right", tag:"mo", output:"X", ttype:RIGHTBRACKET},-{input:"{", output:"{", ttype:LEFTBRACKET, invisible:true},-{input:"}", output:"}", ttype:RIGHTBRACKET, invisible:true},--{input:"(", tag:"mo", output:"(", atval:"1", ttype:STRETCHY},-{input:"[", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},-{input:"\\lbrack", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},-{input:"\\{", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},-{input:"\\lbrace", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},-{input:"\\langle", tag:"mo", output:"\u2329", atval:"1", ttype:STRETCHY},-{input:"\\lfloor", tag:"mo", output:"\u230A", atval:"1", ttype:STRETCHY},-{input:"\\lceil", tag:"mo", output:"\u2308", atval:"1", ttype:STRETCHY},--// rtag:"mi" causes space to be inserted before a following sin, cos, etc.-// (see function LMparseExpr() )-{input:")", tag:"mo",output:")", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"]", tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rbrack",tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\}", tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1",ttype:STRETCHY},-{input:"\\rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1",ttype:STRETCHY},--// "|", "\\|", "\\vert" and "\\Vert" modified later: lspace = rspace = 0em-{input:"|", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},-{input:"\\|", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},-{input:"\\vert", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},-{input:"\\Vert", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},-{input:"\\mid", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},-{input:"\\parallel", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},-{input:"/", tag:"mo", output:"/", atval:"1.01", ttype:STRETCHY},-{input:"\\backslash", tag:"mo", output:"\u2216", atval:"1", ttype:STRETCHY},-{input:"\\setminus", tag:"mo", output:"\\", ttype:CONST},--//miscellaneous symbols-{input:"\\!", tag:"mspace", atname:"width", atval:"-0.167em", ttype:SPACE},-{input:"\\,", tag:"mspace", atname:"width", atval:"0.167em", ttype:SPACE},-{input:"\\>", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},-{input:"\\:", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},-{input:"\\;", tag:"mspace", atname:"width", atval:"0.278em", ttype:SPACE},-{input:"~", tag:"mspace", atname:"width", atval:"0.333em", ttype:SPACE},-{input:"\\quad", tag:"mspace", atname:"width", atval:"1em", ttype:SPACE},-{input:"\\qquad", tag:"mspace", atname:"width", atval:"2em", ttype:SPACE},-//{input:"{}", tag:"mo", output:"\u200B", ttype:CONST}, // zero-width-{input:"\\prime", tag:"mo", output:"\u2032", ttype:CONST},-{input:"'", tag:"mo", output:"\u02B9", ttype:CONST},-{input:"''", tag:"mo", output:"\u02BA", ttype:CONST},-{input:"'''", tag:"mo", output:"\u2034", ttype:CONST},-{input:"''''", tag:"mo", output:"\u2057", ttype:CONST},-{input:"\\ldots", tag:"mo", output:"\u2026", ttype:CONST},-{input:"\\cdots", tag:"mo", output:"\u22EF", ttype:CONST},-{input:"\\vdots", tag:"mo", output:"\u22EE", ttype:CONST},-{input:"\\ddots", tag:"mo", output:"\u22F1", ttype:CONST},-{input:"\\forall", tag:"mo", output:"\u2200", ttype:CONST},-{input:"\\exists", tag:"mo", output:"\u2203", ttype:CONST},-{input:"\\Re", tag:"mo", output:"\u211C", ttype:CONST},-{input:"\\Im", tag:"mo", output:"\u2111", ttype:CONST},-{input:"\\aleph", tag:"mo", output:"\u2135", ttype:CONST},-{input:"\\hbar", tag:"mo", output:"\u210F", ttype:CONST},-{input:"\\ell", tag:"mo", output:"\u2113", ttype:CONST},-{input:"\\wp", tag:"mo", output:"\u2118", ttype:CONST},-{input:"\\emptyset", tag:"mo", output:"\u2205", ttype:CONST},-{input:"\\infty", tag:"mo", output:"\u221E", ttype:CONST},-{input:"\\surd", tag:"mo", output:"\\sqrt{}", ttype:DEFINITION},-{input:"\\partial", tag:"mo", output:"\u2202", ttype:CONST},-{input:"\\nabla", tag:"mo", output:"\u2207", ttype:CONST},-{input:"\\triangle", tag:"mo", output:"\u25B3", ttype:CONST},-{input:"\\therefore", tag:"mo", output:"\u2234", ttype:CONST},-{input:"\\angle", tag:"mo", output:"\u2220", ttype:CONST},-//{input:"\\\\ ", tag:"mo", output:"\u00A0", ttype:CONST},-{input:"\\diamond", tag:"mo", output:"\u22C4", ttype:CONST},-//{input:"\\Diamond", tag:"mo", output:"\u25CA", ttype:CONST},-{input:"\\Diamond", tag:"mo", output:"\u25C7", ttype:CONST},-{input:"\\neg", tag:"mo", output:"\u00AC", ttype:CONST},-{input:"\\lnot", tag:"mo", output:"\u00AC", ttype:CONST},-{input:"\\bot", tag:"mo", output:"\u22A5", ttype:CONST},-{input:"\\top", tag:"mo", output:"\u22A4", ttype:CONST},-{input:"\\square", tag:"mo", output:"\u25AB", ttype:CONST},-{input:"\\Box", tag:"mo", output:"\u25A1", ttype:CONST},-{input:"\\wr", tag:"mo", output:"\u2240", ttype:CONST},--//standard functions-//Note UNDEROVER *must* have tag:"mo" to work properly-{input:"\\arccos", tag:"mi", output:"arccos", ttype:UNARY, func:true},-{input:"\\arcsin", tag:"mi", output:"arcsin", ttype:UNARY, func:true},-{input:"\\arctan", tag:"mi", output:"arctan", ttype:UNARY, func:true},-{input:"\\arg", tag:"mi", output:"arg", ttype:UNARY, func:true},-{input:"\\cos", tag:"mi", output:"cos", ttype:UNARY, func:true},-{input:"\\cosh", tag:"mi", output:"cosh", ttype:UNARY, func:true},-{input:"\\cot", tag:"mi", output:"cot", ttype:UNARY, func:true},-{input:"\\coth", tag:"mi", output:"coth", ttype:UNARY, func:true},-{input:"\\csc", tag:"mi", output:"csc", ttype:UNARY, func:true},-{input:"\\deg", tag:"mi", output:"deg", ttype:UNARY, func:true},-{input:"\\det", tag:"mi", output:"det", ttype:UNARY, func:true},-{input:"\\dim", tag:"mi", output:"dim", ttype:UNARY, func:true}, //CONST?-{input:"\\exp", tag:"mi", output:"exp", ttype:UNARY, func:true},-{input:"\\gcd", tag:"mi", output:"gcd", ttype:UNARY, func:true}, //CONST?-{input:"\\hom", tag:"mi", output:"hom", ttype:UNARY, func:true},-{input:"\\inf", tag:"mo", output:"inf", ttype:UNDEROVER},-{input:"\\ker", tag:"mi", output:"ker", ttype:UNARY, func:true},-{input:"\\lg", tag:"mi", output:"lg", ttype:UNARY, func:true},-{input:"\\lim", tag:"mo", output:"lim", ttype:UNDEROVER},-{input:"\\liminf", tag:"mo", output:"liminf", ttype:UNDEROVER},-{input:"\\limsup", tag:"mo", output:"limsup", ttype:UNDEROVER},-{input:"\\ln", tag:"mi", output:"ln", ttype:UNARY, func:true},-{input:"\\log", tag:"mi", output:"log", ttype:UNARY, func:true},-{input:"\\max", tag:"mo", output:"max", ttype:UNDEROVER},-{input:"\\min", tag:"mo", output:"min", ttype:UNDEROVER},-{input:"\\Pr", tag:"mi", output:"Pr", ttype:UNARY, func:true},-{input:"\\sec", tag:"mi", output:"sec", ttype:UNARY, func:true},-{input:"\\sin", tag:"mi", output:"sin", ttype:UNARY, func:true},-{input:"\\sinh", tag:"mi", output:"sinh", ttype:UNARY, func:true},-{input:"\\sup", tag:"mo", output:"sup", ttype:UNDEROVER},-{input:"\\tan", tag:"mi", output:"tan", ttype:UNARY, func:true},-{input:"\\tanh", tag:"mi", output:"tanh", ttype:UNARY, func:true},--//arrows-{input:"\\gets", tag:"mo", output:"\u2190", ttype:CONST},-{input:"\\leftarrow", tag:"mo", output:"\u2190", ttype:CONST},-{input:"\\to", tag:"mo", output:"\u2192", ttype:CONST},-{input:"\\rightarrow", tag:"mo", output:"\u2192", ttype:CONST},-{input:"\\leftrightarrow", tag:"mo", output:"\u2194", ttype:CONST},-{input:"\\uparrow", tag:"mo", output:"\u2191", ttype:CONST},-{input:"\\downarrow", tag:"mo", output:"\u2193", ttype:CONST},-{input:"\\updownarrow", tag:"mo", output:"\u2195", ttype:CONST},-{input:"\\Leftarrow", tag:"mo", output:"\u21D0", ttype:CONST},-{input:"\\Rightarrow", tag:"mo", output:"\u21D2", ttype:CONST},-{input:"\\Leftrightarrow", tag:"mo", output:"\u21D4", ttype:CONST},-{input:"\\iff", tag:"mo", output:"~\\Longleftrightarrow~", ttype:DEFINITION},-{input:"\\Uparrow", tag:"mo", output:"\u21D1", ttype:CONST},-{input:"\\Downarrow", tag:"mo", output:"\u21D3", ttype:CONST},-{input:"\\Updownarrow", tag:"mo", output:"\u21D5", ttype:CONST},-{input:"\\mapsto", tag:"mo", output:"\u21A6", ttype:CONST},-{input:"\\longleftarrow", tag:"mo", output:"\u2190", ttype:LONG},-{input:"\\longrightarrow", tag:"mo", output:"\u2192", ttype:LONG},-{input:"\\longleftrightarrow", tag:"mo", output:"\u2194", ttype:LONG},-{input:"\\Longleftarrow", tag:"mo", output:"\u21D0", ttype:LONG},-{input:"\\Longrightarrow", tag:"mo", output:"\u21D2", ttype:LONG},-{input:"\\implies", tag:"mo", output:"\u21D2", ttype:LONG},-{input:"\\Longleftrightarrow", tag:"mo", output:"\u21D4", ttype:LONG},-{input:"\\longmapsto", tag:"mo", output:"\u21A6", ttype:CONST},- // disaster if LONG--//commands with argument--{input:"\\sqrt", tag:"msqrt", output:"sqrt", ttype:UNARY},-{input:"\\root", tag:"mroot", output:"root", ttype:BINARY},-{input:"\\frac", tag:"mfrac", output:"/", ttype:BINARY},-{input:"\\stackrel", tag:"mover", output:"stackrel", ttype:BINARY},-{input:"\\atop", tag:"mfrac", output:"", ttype:INFIX},-{input:"\\choose", tag:"mfrac", output:"", ttype:INFIX},-{input:"_", tag:"msub", output:"_", ttype:INFIX},-{input:"^", tag:"msup", output:"^", ttype:INFIX},-{input:"\\mathrm", tag:"mtext", output:"text", ttype:TEXT},-{input:"\\mbox", tag:"mtext", output:"mbox", ttype:TEXT},--//diacritical marks-{input:"\\acute", tag:"mover", output:"\u00B4", ttype:UNARY, acc:true},-//{input:"\\acute", tag:"mover", output:"\u0317", ttype:UNARY, acc:true},-//{input:"\\acute", tag:"mover", output:"\u0301", ttype:UNARY, acc:true},-//{input:"\\grave", tag:"mover", output:"\u0300", ttype:UNARY, acc:true},-//{input:"\\grave", tag:"mover", output:"\u0316", ttype:UNARY, acc:true},-{input:"\\grave", tag:"mover", output:"\u0060", ttype:UNARY, acc:true},-{input:"\\breve", tag:"mover", output:"\u02D8", ttype:UNARY, acc:true},-{input:"\\check", tag:"mover", output:"\u02C7", ttype:UNARY, acc:true},-{input:"\\dot", tag:"mover", output:".", ttype:UNARY, acc:true},-{input:"\\ddot", tag:"mover", output:"..", ttype:UNARY, acc:true},-//{input:"\\ddot", tag:"mover", output:"\u00A8", ttype:UNARY, acc:true},-{input:"\\mathring", tag:"mover", output:"\u00B0", ttype:UNARY, acc:true},-{input:"\\vec", tag:"mover", output:"\u20D7", ttype:UNARY, acc:true},-{input:"\\overrightarrow",tag:"mover",output:"\u20D7", ttype:UNARY, acc:true},-{input:"\\overleftarrow",tag:"mover", output:"\u20D6", ttype:UNARY, acc:true},-{input:"\\hat", tag:"mover", output:"\u005E", ttype:UNARY, acc:true},-{input:"\\widehat", tag:"mover", output:"\u0302", ttype:UNARY, acc:true},-{input:"\\tilde", tag:"mover", output:"~", ttype:UNARY, acc:true},-//{input:"\\tilde", tag:"mover", output:"\u0303", ttype:UNARY, acc:true},-{input:"\\widetilde", tag:"mover", output:"\u02DC", ttype:UNARY, acc:true},-{input:"\\bar", tag:"mover", output:"\u203E", ttype:UNARY, acc:true},-{input:"\\overbrace", tag:"mover", output:"\u23B4", ttype:UNARY, acc:true},-{input:"\\overline", tag:"mover", output:"\u00AF", ttype:UNARY, acc:true},-{input:"\\underbrace", tag:"munder", output:"\u23B5", ttype:UNARY, acc:true},-{input:"\\underline", tag:"munder", output:"\u00AF", ttype:UNARY, acc:true},-//{input:"underline", tag:"munder", output:"\u0332", ttype:UNARY, acc:true},--//typestyles and fonts-{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", ttype:UNARY},-{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", ttype:UNARY},-{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", ttype:UNARY},-{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", ttype:UNARY},-{input:"\\textrm", tag:"mstyle", output:"\\mathrm", ttype: DEFINITION},-{input:"\\mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},-{input:"\\textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},-{input:"\\mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},-{input:"\\textit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},-{input:"\\mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},-{input:"\\texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},-{input:"\\mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", ttype:UNARY},-{input:"\\mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", ttype:UNARY, codes:AMbbb},-{input:"\\mathcal",tag:"mstyle", atname:"mathvariant", atval:"script", ttype:UNARY, codes:AMcal},-{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant", atval:"fraktur",ttype:UNARY, codes:AMfrk}-];--var LMnames = []; //list of input symbols--function LMremoveCharsAndBlanks(str,n) {-//remove n characters and any following blanks- var st;- st = str.slice(n);- for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);- return st.slice(i);-}--function LMgetSymbol(str) {-//return maximal initial substring of str that appears in names-//return null if there is none- var k = 0; //new pos- var j = 0; //old pos- var mk; //match pos- var st;- var tagst;- var match = "";- var more = true;- for (var i=1; i<=str.length && more; i++) {- st = str.slice(0,i); //initial substring of length i- j = k;- k = position(LMnames, st, j);- if (k<LMnames.length && str.slice(0,LMnames[k].length)==LMnames[k]){- match = LMnames[k];- mk = k;- i = match.length;- }- more = k<LMnames.length && str.slice(0,LMnames[k].length)>=LMnames[k];- }- LMpreviousSymbol=LMcurrentSymbol;- if (match!=""){- LMcurrentSymbol=LMsymbols[mk].ttype;- return LMsymbols[mk];- }- LMcurrentSymbol=CONST;- k = 1;- st = str.slice(0,1); //take 1 character- if ("0"<=st && st<="9") tagst = "mn";- else tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");-/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */- return {input:st, tag:tagst, output:st, ttype:CONST};-}---/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */--var LMpreviousSymbol,LMcurrentSymbol;--function LMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag]- var symbol, node, result, result2, i, st,// rightvert = false,- newFrag = document.createDocumentFragment();- str = LMremoveCharsAndBlanks(str,0);- symbol = LMgetSymbol(str); //either a token or a bracket or empty- if (symbol == null || symbol.ttype == RIGHTBRACKET)- return [null,str,null];- if (symbol.ttype == DEFINITION) {- str = symbol.output+LMremoveCharsAndBlanks(str,symbol.input.length);- symbol = LMgetSymbol(str);- if (symbol == null || symbol.ttype == RIGHTBRACKET)- return [null,str,null];- }- str = LMremoveCharsAndBlanks(str,symbol.input.length);- switch (symbol.ttype) {- case SPACE:- node = createMmlNode(symbol.tag);- node.setAttribute(symbol.atname,symbol.atval);- return [node,str,symbol.tag];- case UNDEROVER:- if (isIE) {- if (symbol.input.substr(0,4) == "\\big") { // botch for missing symbols- str = "\\"+symbol.input.substr(4)+str; // make \bigcup = \cup etc.- symbol = LMgetSymbol(str);- symbol.ttype = UNDEROVER;- str = LMremoveCharsAndBlanks(str,symbol.input.length);- }- }- return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str,symbol.tag];- case CONST:- var output = symbol.output;- if (isIE) {- if (symbol.input == "'")- output = "\u2032";- else if (symbol.input == "''")- output = "\u2033";- else if (symbol.input == "'''")- output = "\u2033\u2032";- else if (symbol.input == "''''")- output = "\u2033\u2033";- else if (symbol.input == "\\square")- output = "\u25A1"; // same as \Box- else if (symbol.input.substr(0,5) == "\\frac") {- // botch for missing fractions- var denom = symbol.input.substr(6,1);- if (denom == "5" || denom == "6") {- str = symbol.input.replace(/\\frac/,"\\frac ")+str;- return [node,str,symbol.tag];- }- }- }- node = createMmlNode(symbol.tag,document.createTextNode(output));- return [node,str,symbol.tag];- case LONG: // added by DRW- node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));- node.setAttribute("minsize","1.5");- node.setAttribute("maxsize","1.5");- node = createMmlNode("mover",node);- node.appendChild(createMmlNode("mspace"));- return [node,str,symbol.tag];- case STRETCHY: // added by DRW- if (isIE && symbol.input == "\\backslash")- symbol.output = "\\"; // doesn't expand, but then nor does "\u2216"- node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));- if (symbol.input == "|" || symbol.input == "\\vert" ||- symbol.input == "\\|" || symbol.input == "\\Vert") {- node.setAttribute("lspace","0em");- node.setAttribute("rspace","0em");- }- node.setAttribute("maxsize",symbol.atval); // don't allow to stretch here- if (symbol.rtag != null)- return [node,str,symbol.rtag];- else- return [node,str,symbol.tag];- case BIG: // added by DRW- var atval = symbol.atval;- if (isIE)- atval = symbol.ieval;- symbol = LMgetSymbol(str);- if (symbol == null)- return [null,str,null];- str = LMremoveCharsAndBlanks(str,symbol.input.length);- node = createMmlNode(symbol.tag,document.createTextNode(symbol.output));- if (isIE) { // to get brackets to expand- var space = createMmlNode("mspace");- space.setAttribute("height",atval+"ex");- node = createMmlNode("mrow",node);- node.appendChild(space);- } else { // ignored in IE- node.setAttribute("minsize",atval);- node.setAttribute("maxsize",atval);- }- return [node,str,symbol.tag];- case LEFTBRACKET: //read (expr+)- if (symbol.input == "\\left") { // left what?- symbol = LMgetSymbol(str);- if (symbol != null) {- if (symbol.input == ".")- symbol.invisible = true;- str = LMremoveCharsAndBlanks(str,symbol.input.length);- }- }- result = LMparseExpr(str,true,false);- if (symbol==null ||- (typeof symbol.invisible == "boolean" && symbol.invisible))- node = createMmlNode("mrow",result[0]);- else {- node = createMmlNode("mo",document.createTextNode(symbol.output));- node = createMmlNode("mrow",node);- node.appendChild(result[0]);- }- return [node,result[1],result[2]];- case MATRIX: //read (expr+)- if (symbol.input == "\\begin{array}") {- var mask = "";- symbol = LMgetSymbol(str);- str = LMremoveCharsAndBlanks(str,0);- if (symbol == null)- mask = "l";- else {- str = LMremoveCharsAndBlanks(str,symbol.input.length);- if (symbol.input != "{")- mask = "l";- else do {- symbol = LMgetSymbol(str);- if (symbol != null) {- str = LMremoveCharsAndBlanks(str,symbol.input.length);- if (symbol.input != "}")- mask = mask+symbol.input;- }- } while (symbol != null && symbol.input != "" && symbol.input != "}");- }- result = LMparseExpr("{"+str,true,true);-// if (result[0]==null) return [createMmlNode("mo",-// document.createTextNode(symbol.input)),str];- node = createMmlNode("mtable",result[0]);- mask = mask.replace(/l/g,"left ");- mask = mask.replace(/r/g,"right ");- mask = mask.replace(/c/g,"center ");- node.setAttribute("columnalign",mask);- node.setAttribute("displaystyle","false");- if (isIE)- return [node,result[1],null];-// trying to get a *little* bit of space around the array-// (IE already includes it)- var lspace = createMmlNode("mspace");- lspace.setAttribute("width","0.167em");- var rspace = createMmlNode("mspace");- rspace.setAttribute("width","0.167em");- var node1 = createMmlNode("mrow",lspace);- node1.appendChild(node);- node1.appendChild(rspace);- return [node1,result[1],null];- } else { // eqnarray- result = LMparseExpr("{"+str,true,true);- node = createMmlNode("mtable",result[0]);- if (isIE)- node.setAttribute("columnspacing","0.25em"); // best in practice?- else- node.setAttribute("columnspacing","0.167em"); // correct (but ignored?)- node.setAttribute("columnalign","right center left");- node.setAttribute("displaystyle","true");- node = createMmlNode("mrow",node);- return [node,result[1],null];- }- case TEXT:- if (str.charAt(0)=="{") i=str.indexOf("}");- else i = 0;- if (i==-1)- i = str.length;- st = str.slice(1,i);- if (st.charAt(0) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","0.33em"); // was 1ex- newFrag.appendChild(node);- }- newFrag.appendChild(- createMmlNode(symbol.tag,document.createTextNode(st)));- if (st.charAt(st.length-1) == " ") {- node = createMmlNode("mspace");- node.setAttribute("width","0.33em"); // was 1ex- newFrag.appendChild(node);- }- str = LMremoveCharsAndBlanks(str,i+1);- return [createMmlNode("mrow",newFrag),str,null];- case UNARY:- result = LMparseSexpr(str);- if (result[0]==null) return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str];- if (typeof symbol.func == "boolean" && symbol.func) { // functions hack- st = str.charAt(0);-// if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {- if (st=="^" || st=="_" || st==",") {- return [createMmlNode(symbol.tag,- document.createTextNode(symbol.output)),str,symbol.tag];- } else {- node = createMmlNode("mrow",- createMmlNode(symbol.tag,document.createTextNode(symbol.output)));- if (isIE) {- var space = createMmlNode("mspace");- space.setAttribute("width","0.167em");- node.appendChild(space);- }- node.appendChild(result[0]);- return [node,result[1],symbol.tag];- }- }- if (symbol.input == "\\sqrt") { // sqrt- if (isIE) { // set minsize, for \surd- var space = createMmlNode("mspace");- space.setAttribute("height","1.2ex");- space.setAttribute("width","0em"); // probably no effect- node = createMmlNode(symbol.tag,result[0])-// node.setAttribute("minsize","1"); // ignored-// node = createMmlNode("mrow",node); // hopefully unnecessary- node.appendChild(space);- return [node,result[1],symbol.tag];- } else- return [createMmlNode(symbol.tag,result[0]),result[1],symbol.tag];- } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent- node = createMmlNode(symbol.tag,result[0]);- var output = symbol.output;- if (isIE) {- if (symbol.input == "\\hat")- output = "\u0302";- else if (symbol.input == "\\widehat")- output = "\u005E";- else if (symbol.input == "\\bar")- output = "\u00AF";- else if (symbol.input == "\\grave")- output = "\u0300";- else if (symbol.input == "\\tilde")- output = "\u0303";- }- var node1 = createMmlNode("mo",document.createTextNode(output));- if (symbol.input == "\\vec" || symbol.input == "\\check")- // don't allow to stretch- node1.setAttribute("maxsize","1.2");- // why doesn't "1" work? \vec nearly disappears in firefox- if (isIE && symbol.input == "\\bar")- node1.setAttribute("maxsize","0.5");- if (symbol.input == "\\underbrace" || symbol.input == "\\underline")- node1.setAttribute("accentunder","true");- else- node1.setAttribute("accent","true");- node.appendChild(node1);- if (symbol.input == "\\overbrace" || symbol.input == "\\underbrace")- node.ttype = UNDEROVER;- return [node,result[1],symbol.tag];- } else { // font change or displaystyle command- if (!isIE && typeof symbol.codes != "undefined") {- for (i=0; i<result[0].childNodes.length; i++)- if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {- st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:- result[0].childNodes[i].firstChild.nodeValue);- var newst = [];- for (var j=0; j<st.length; j++)- if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +- String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);- else newst = newst + st.charAt(j);- if (result[0].nodeName=="mi")- result[0]=createMmlNode("mo").- appendChild(document.createTextNode(newst));- else result[0].replaceChild(createMmlNode("mo").- appendChild(document.createTextNode(newst)),result[0].childNodes[i]);- }- }- node = createMmlNode(symbol.tag,result[0]);- node.setAttribute(symbol.atname,symbol.atval);- if (symbol.input == "\\scriptstyle" ||- symbol.input == "\\scriptscriptstyle")- node.setAttribute("displaystyle","false");- return [node,result[1],symbol.tag];- }- case BINARY:- result = LMparseSexpr(str);- if (result[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str,null];- result2 = LMparseSexpr(result[1]);- if (result2[0]==null) return [createMmlNode("mo",- document.createTextNode(symbol.input)),str,null];- if (symbol.input=="\\root" || symbol.input=="\\stackrel")- newFrag.appendChild(result2[0]);- newFrag.appendChild(result[0]);- if (symbol.input=="\\frac") newFrag.appendChild(result2[0]);- return [createMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];- case INFIX:- str = LMremoveCharsAndBlanks(str,symbol.input.length);- return [createMmlNode("mo",document.createTextNode(symbol.output)),- str,symbol.tag];- default:- return [createMmlNode(symbol.tag, //its a constant- document.createTextNode(symbol.output)),str,symbol.tag];- }-}--function LMparseIexpr(str) {- var symbol, sym1, sym2, node, result, tag, underover;- str = LMremoveCharsAndBlanks(str,0);- sym1 = LMgetSymbol(str);- result = LMparseSexpr(str);- node = result[0];- str = result[1];- tag = result[2];- symbol = LMgetSymbol(str);- if (symbol.ttype == INFIX) {- str = LMremoveCharsAndBlanks(str,symbol.input.length);- result = LMparseSexpr(str);- if (result[0] == null) // show box in place of missing argument- result[0] = createMmlNode("mo",document.createTextNode("\u25A1"));- str = result[1];- tag = result[2];- if (symbol.input == "_" || symbol.input == "^") {- sym2 = LMgetSymbol(str);- tag = null; // no space between x^2 and a following sin, cos, etc.-// This is for \underbrace and \overbrace- underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER));-// underover = (sym1.ttype == UNDEROVER);- if (symbol.input == "_" && sym2.input == "^") {- str = LMremoveCharsAndBlanks(str,sym2.input.length);- var res2 = LMparseSexpr(str);- str = res2[1];- tag = res2[2]; // leave space between x_1^2 and a following sin etc.- node = createMmlNode((underover?"munderover":"msubsup"),node);- node.appendChild(result[0]);- node.appendChild(res2[0]);- } else if (symbol.input == "_") {- node = createMmlNode((underover?"munder":"msub"),node);- node.appendChild(result[0]);- } else {- node = createMmlNode((underover?"mover":"msup"),node);- node.appendChild(result[0]);- }- node = createMmlNode("mrow",node); // so sum does not stretch- } else {- node = createMmlNode(symbol.tag,node);- if (symbol.input == "\\atop" || symbol.input == "\\choose")- node.setAttribute("linethickness","0ex");- node.appendChild(result[0]);- if (symbol.input == "\\choose")- node = createMmlNode("mfenced",node);- }- }- return [node,str,tag];-}--function LMparseExpr(str,rightbracket,matrix) {- var symbol, node, result, i, tag,- newFrag = document.createDocumentFragment();- do {- str = LMremoveCharsAndBlanks(str,0);- result = LMparseIexpr(str);- node = result[0];- str = result[1];- tag = result[2];- symbol = LMgetSymbol(str);- if (node!=undefined) {- if ((tag == "mn" || tag == "mi") && symbol!=null &&- typeof symbol.func == "boolean" && symbol.func) {- // Add space before \sin in 2\sin x or x\sin x- var space = createMmlNode("mspace");- space.setAttribute("width","0.167em");- node = createMmlNode("mrow",node);- node.appendChild(space);- }- newFrag.appendChild(node);- }- } while ((symbol.ttype != RIGHTBRACKET)- && symbol!=null && symbol.output!="");- tag = null;- if (symbol.ttype == RIGHTBRACKET) {- if (symbol.input == "\\right") { // right what?- str = LMremoveCharsAndBlanks(str,symbol.input.length);- symbol = LMgetSymbol(str);- if (symbol != null && symbol.input == ".")- symbol.invisible = true;- if (symbol != null)- tag = symbol.rtag;- }- if (symbol!=null)- str = LMremoveCharsAndBlanks(str,symbol.input.length); // ready to return- var len = newFrag.childNodes.length;- if (matrix &&- len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&- newFrag.childNodes[len-2].nodeName == "mo" &&- newFrag.childNodes[len-2].firstChild.nodeValue == "&") { //matrix- var pos = []; // positions of ampersands- var m = newFrag.childNodes.length;- for (i=0; matrix && i<m; i=i+2) {- pos[i] = [];- node = newFrag.childNodes[i];- for (var j=0; j<node.childNodes.length; j++)- if (node.childNodes[j].firstChild.nodeValue=="&")- pos[i][pos[i].length]=j;- }- var row, frag, n, k, table = document.createDocumentFragment();- for (i=0; i<m; i=i+2) {- row = document.createDocumentFragment();- frag = document.createDocumentFragment();- node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow>- n = node.childNodes.length;- k = 0;- for (j=0; j<n; j++) {- if (typeof pos[i][k] != "undefined" && j==pos[i][k]){- node.removeChild(node.firstChild); //remove &- row.appendChild(createMmlNode("mtd",frag));- k++;- } else frag.appendChild(node.firstChild);- }- row.appendChild(createMmlNode("mtd",frag));- if (newFrag.childNodes.length>2) {- newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow>- newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo>- }- table.appendChild(createMmlNode("mtr",row));- }- return [table,str];- }- if (typeof symbol.invisible != "boolean" || !symbol.invisible) {- node = createMmlNode("mo",document.createTextNode(symbol.output));- newFrag.appendChild(node);- }- }- return [newFrag,str,tag];-}--var tcnt = 0, dcnt = 0; //theorem and definition counters--function simpleLaTeXformatting(st) {- st = st.replace(/\$\$((.|\n)*?)\$\$/g,"<p align=\"center\">$\\displaystyle{$1}$</p>");- st = st.replace(/\\begin{(theorem|lemma|proposition|corollary)}((.|\n)*?)\\end{\1}/g,function(r,s,t){tcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+tcnt+".</b> <i>"+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+"</i>"});- st = st.replace(/\\begin{(definition|example|remark|problem|exercise|conjecture|solution)}((.|\n)*?)\\end{\1}/g,function(r,s,t){dcnt++; return "<b>"+s.charAt(0).toUpperCase()+s.slice(1)+" "+dcnt+".</b> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")});- st = st.replace(/\\begin{proof}((.|\n)*?)\\end{proof}/g,function(s,t){return "<i>Proof:</i> "+t.replace(/^\s*<\/?\w+\/?>|\s*<\/?\w+\/?>$/g,"")+" □"});- st = st.replace(/\\emph{(.*?)}/g,"<em>$1</em>");- st = st.replace(/\\textbf{(.*?)}/g,"<b>$1</b>");- st = st.replace(/\\cite{(.*?)}/g,"[$1]");- st = st.replace(/\\chapter{(.*?)}/g,"<h2>$1</h2>");- st = st.replace(/\\section{(.*?)}(\s*<\/?(br|p)\s?\/?>)?/g,"<h3>$1</h3>");- st = st.replace(/\\subsection{((.|\n)*?)}/g,"<h4>$1</h4>");- st = st.replace(/\\begin{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"<ul>");- st = st.replace(/\\item\s((.|\n)*?)(?=(\\item|\\end))/g,"<li>$1</li>");- st = st.replace(/\\end{itemize}(\s*<\/?(br|p)\s?\/?>)?/g,"</ul>");- st = st.replace(/\\begin{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"<ol>");- st = st.replace(/\\end{enumerate}(\s*<\/?(br|p)\s?\/?>)?/g,"</ol>");- st = st.replace(/\\item\[(.*?)]{(.*?)}/g,"<dt>$1</dt><dd>$2</dd>");- st = st.replace(/\\begin{description}/g,"<dl>");- st = st.replace(/\\end{description}/g,"</dl>");- st = st.replace(/\\newline\b/g,"<br/>");- st = st.replace(/\\newpage\b/g,"<br style=\"page-break-after:always;\">");- st = st.replace(/\\par\b/g,"<p> </p>");- st = st.replace(/\\bigskip/g,"<p style=\"margin-bottom:0.5in\"> </p>");- st = st.replace(/\\medskip/g,"<p style=\"margin-bottom:0.3in\"> </p>");- st = st.replace(/\\smallskip/g,"<p style=\"margin-bottom:0.15in\"> </p>");- st = st.replace(/\\begin{center}((.|\n)*?)\\end{center}/g,"<center>$1</center>");- return st-}--function ASCIIandgraphformatting(st) {- st = st.replace(/<sup>(.*?)<\/sup>(\s|(\S))/gi,"^{$1} $3");-//st = st.replace(/<\/?font.*?>/gi,""); // do this only in amath...endamath- st = st.replace(/(Proof:)/g,"<i>$1</i>");- st = st.replace(/QED/g," □");- st = st.replace(/(\\?end{?a?math}?)/ig,"<span></span>$1");- st = st.replace(/(\bamath\b|\\begin{a?math})/ig,"<span></span>$1");- st = st.replace(/([>\n])(Theorem|Lemma|Proposition|Corollary|Definition|Example|Remark|Problem|Exercise|Conjecture|Solution)(:|\W\W?(\w|\s|-|\.)*?\W?:)/g,"$1<b>$2$3</b>");- st = st.replace(/<embed\s+class\s?=\s?"?ASCIIsvg"?/gi,"<embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\"");- st = st.replace(/(?:\\begin{a?graph}|\bagraph|\(:graph\s)((.|\n)*?)(?:\\end{a?graph}|enda?graph|:\))/g,function(s,t){return "<table><tr><td><div class=\"ASCIIsvg\"><embed class=\"ASCIIsvg\" src=\""+dsvglocation+"d.svg\" wmode=\"transparent\" script=\'"+t.replace(/<\/?(br|p|pre)\s?\/?>/gi,"\n")+"\'/></div></td></tr></table>"});- st = st.replace(/insertASCIIMathCalculator/g,"<div class=\"ASCIIMathCalculator\"></div>");-//alert(dsvglocation)- return st-}--function LMprocessNode(n) {- var frag,st;- try {- st = n.innerHTML;- } catch(err) {}- var am = /amath\b|graph/i.test(st);- if ((st==null || st.indexOf("\$ ")!=-1 || st.indexOf("\$<")!=-1 || - st.indexOf("\\begin")!=-1 || am || st.slice(-1)=="$" ||- st.indexOf("\$\n")!=-1)&& !/edit-content|HTMLArea|wikiedit|wpTextbox1/.test(st)){- if (!avoidinnerHTML && translateLaTeXformatting) - st = simpleLaTeXformatting(st);- if (st!=null && am && !avoidinnerHTML) {- st = ASCIIandgraphformatting(st);- }- st = st.replace(/%7E/g,"~"); // else PmWiki has url issues-//alert(st)- if (!avoidinnerHTML) n.innerHTML = st;- processNodeR(n,false,true);- }-/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */-}--/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */--// you can change these-var checkIfSVGavailable = true;-var notifyIfNoSVG = true;-var alertIfNoSVG = false;-var noSVG = false;--// global defaults used if not specified by graph (you can change these)-var defaultwidth = 300; defaultheight = 200; // in pixels-var defaultxmin = -5.5; defaultxmax = 5.5; // in usercoords-var defaultborder = 0; border = defaultborder; // in pixel-var defaultstrokewidth = "1"; // default line width in pixel-var defaultstroke = "blue"; // default line color-var defaultstrokeopacity = 1; // transparent = 0, solid =1-var defaultstrokedasharray = null; // "10,10" gives 10px long dashes-var defaultfill = "none"; // default fill color-var defaultfillopacity = 1; // transparent = 0, solid =1-var defaultfontstyle = "normal"; // default text shape normal|italic|inherit-var defaultfontfamily = "times"; // default font times|ariel|helvetica|...-var defaultfontsize = "16"; // default size (scaled automatically)-var defaultfontweight = "normal";// normal|bold|bolder|lighter|100|...|900-var defaultfontstroke = "none"; // default font outline color-var defaultfontfill = "none"; // default font color-var defaultmarker = "none"; // "dot" | "arrow" | "+" | "-" | "|"-var defaultendpoints = ""; // "c-d" where c is <|o|* and d is >|o|*--// global values used for all pictures (you can change these)-var showcoordinates = true;-var markerstrokewidth = "1";-var markerstroke = "black";-var markerfill = "yellow";-var markersize = 4;-var arrowfill = stroke;-var dotradius = 4;-var ticklength = 4;-var axesstroke = "black";-var gridstroke = "grey";-var backgroundstyle = "fill-opacity:0; fill:white";-var singlelettersitalic = true;--// internal variables (probably no need to change these)-var picturepos = null; // position of picture relative to top of HTML page-var xunitlength; // in pixels, used to convert to user coordinates-var yunitlength; // in pixels-var origin = [0,0]; // in pixels (default is bottom left corner)-var above = "above"; // shorthands (to avoid typing quotes)-var below = "below";-var left = "left";-var right = "right";-var aboveleft = "aboveleft";-var aboveright = "aboveright";-var belowleft = "belowleft";-var belowright = "belowright";-var xmin, xmax, ymin, ymax, xscl, yscl, - xgrid, ygrid, xtick, ytick, initialized;-var strokewidth, strokedasharray, stroke, fill, strokeopacity, fillopacity;-var fontstyle, fontfamily, fontsize, fontweight, fontstroke, fontfill;-var marker, endpoints, dynamic = {};-var picture, svgpicture, doc, width, height;-var isIE = document.createElementNS==null;--//this is not used! var cpi = "\u03C0", ctheta = "\u03B8"; // character for pi, theta-var log = function(x) { return ln(x)/ln(10) };-var pi = Math.PI, e = Math.E, ln = Math.log, sqrt = Math.sqrt;-var floor = Math.floor, ceil = Math.ceil, abs = Math.abs;-var sin = Math.sin, cos = Math.cos, tan = Math.tan;-var arcsin = Math.asin, arccos = Math.acos, arctan = Math.atan;-var sec = function(x) { return 1/Math.cos(x) };-var csc = function(x) { return 1/Math.sin(x) };-var cot = function(x) { return 1/Math.tan(x) };-var arcsec = function(x) { return arccos(1/x) };-var arccsc = function(x) { return arcsin(1/x) };-var arccot = function(x) { return arctan(1/x) };-var sinh = function(x) { return (Math.exp(x)-Math.exp(-x))/2 };-var cosh = function(x) { return (Math.exp(x)+Math.exp(-x))/2 };-var tanh = - function(x) { return (Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x)) };-var sech = function(x) { return 1/cosh(x) };-var csch = function(x) { return 1/sinh(x) };-var coth = function(x) { return 1/tanh(x) };-var arcsinh = function(x) { return ln(x+Math.sqrt(x*x+1)) };-var arccosh = function(x) { return ln(x+Math.sqrt(x*x-1)) };-var arctanh = function(x) { return ln((1+x)/(1-x))/2 };-var sech = function(x) { return 1/cosh(x) };-var csch = function(x) { return 1/sinh(x) };-var coth = function(x) { return 1/tanh(x) };-var arcsech = function(x) { return arccosh(1/x) };-var arccsch = function(x) { return arcsinh(1/x) };-var arccoth = function(x) { return arctanh(1/x) };-var sign = function(x) { return (x==0?0:(x<0?-1:1)) };--function factorial(x,n) { // Factorial function- if (n==null) n=1;- if (Math.abs(x-Math.round(x*1000000)/1000000)<1e-15)- x = Math.round(x*1000000)/1000000;- if (x-Math.floor(x)!=0) return NaN;- for (var i=x-n; i>0; i-=n) x*=i;- return (x<0?NaN:(x==0?1:x));-}--function C(x,k) { // Binomial coefficient function- var res=1;- for (var i=0; i<k; i++) res*=(x-i)/(k-i);- return res;-}--function chop(x,n) { // Truncate decimal number to n places after decimal point- if (n==null) n=0;- return Math.floor(x*Math.pow(10,n))/Math.pow(10,n);-}--function ran(a,b,n) { // Generate random number in [a,b] with n digits after .- if (n==null) n=0;- return chop((b+Math.pow(10,-n)-a)*Math.random()+a,n);-}--function myCreateElementSVG(t) {- if (isIE) return doc.createElement(t);- else return doc.createElementNS("http://www.w3.org/2000/svg",t);-}--function getElementsByClass(container, tagName, clsName){- var list = new Array(0);- var collection = container.getElementsByTagName(tagName);- for(var i = 0; i < collection.length; i++)- if(collection[i].className.slice(0,clsName.length)==clsName)- list[list.length] = collection[i];- return list;-}--function showobj(obj) {- var st="", i;- for (i in obj) - st += (obj.getAttribute(i)==null?"":" "+i+":"+obj.getAttribute(i));- return st;-}--function findPos(obj) { // top-left corner of obj on HTML page in pixel- var curleft = curtop = 0;- if (obj.offsetParent) {- curleft = obj.offsetLeft- curtop = obj.offsetTop- while (obj = obj.offsetParent) {- curleft += obj.offsetLeft- curtop += obj.offsetTop-//alert(showobj(obj)+[curleft,curtop])- }- }- return [curleft,curtop];-}--function checkSVG(){- if (navigator.appName.slice(0,8)=="Netscape") - if (window['SVGElement']) noSVG = null;- else noSVG = true;- else if (navigator.appName.slice(0,9)=="Microsoft")- try {- var oSVG=eval("new ActiveXObject('Adobe.SVGCtl.3');");- noSVG = null;- } catch (e) {- noSVG = true;- }- else if (navigator.appName.slice(0,5)=="Opera") // works only for 9.50b1- noSVG = null;- else noSVG = true;-//noSVG = true; //uncomment to check- if (noSVG && notifyIfNoSVG) {- var msg = "To view the ASCIIsvg images use Internet Explorer + Adobe SVGviewer or Mozilla Firefox 2.0 or later."- if (alertIfNoSVG)- alert(msg);- else return msg;- }-}--function setText(st,id) { // add text to an existing node with given id- var node = document.getElementById(id);- if (node!=null)- if (node.childNodes.length!=0) node.childNodes[0].nodeValue = st;- else node.appendChild(document.createTextNode(st));-}--function getX(evt) { // return mouse x-coord in user coordinate system- var svgroot = evt.target.parentNode;- pos = findPos(svgroot.parentNode);- return (evt.clientX+(isIE?0:window.pageXOffset)-pos[0]-svgroot.getAttribute("ox"))/parseFloat(svgroot.getAttribute("xunitlength"));-}--function getY(evt) { // return mouse y-coord in user coordinate system- var svgroot = evt.target.parentNode;- pos = findPos(svgroot.parentNode);-//alert(showobj(svgroot)+svgroot.getAttribute("mytop"))- return (svgroot.getAttribute("height")-svgroot.getAttribute("oy")-(evt.clientY+(isIE?0:window.pageYOffset)-pos[1]))/parseFloat(svgroot.getAttribute("yunitlength"));-}--function translateandeval(src) { //modify user input to JavaScript syntax- var errstr;- // replace plot(f(x),...) with plot("f(x)",...) - src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+?)\,/g,"plot\(\"$1\",");- src = src.replace(/plot\(\x20*([^\"f\[][^\n\r;]+)\)/g,"plot(\"$1\")");-- // replace (expr,expr) by [expr,expr] where expr has no (,) in it- src = src.replace(/([=[(,]\x20*)\(([-a-z0-9./+*]+?),([-a-z0-9./+*]+?)\)/g,"$1[$2,$3]");-//alert(src)- // insert * between digit and letter e.g. 2x --> 2*x- src = src.replace(/([0-9])([a-df-zA-Z]|e^)/g,"$1*$2");- src = src.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");-- try {- with (Math) eval(src); // here the svgpicture object is created- } catch(err) {- if (err!="wait") {-//alert(dsvglocation)- if (typeof err=="object") - errstr = err.name+" "+err.message+" "+err.number+" "+err.description;- else errstr = err;- alert(errstr+"\n"+src)- }- }-}--var lastSlot = 0;--function drawPictures() { // main routine; called after webpage has loaded- var src, id, dsvg, nd, node, ht, index, cols, arr, i, node2;- var ASbody = document.getElementsByTagName("body")[0];- pictures = getElementsByClass(ASbody,"embed","ASCIIsvg");- var len = pictures.length;- if(len==0) return;- for (index = lastSlot; index < len+lastSlot; index++) {- width = null; height = null; - xmin = null; xmax = null; ymin = null; ymax = null;- xscl = null; xgrid = null; yscl = null; ygrid = null;- initialized = false;- picture = pictures[index-lastSlot]; // current picture object- src = picture.getAttribute("script"); // get the ASCIIsvg code- if (src==null) src = "";- // insert "axes()" if not present ******** experimental- if (!/axes\b|initPicture/.test(src)) {- var i = 0;- while (/((yscl|ymax|ymin|xscl|xmax|xmin|\bwidth|\bheight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/.test(src.slice(i))) i++;- src = (i==0?"axes(); "+src: src.slice(0,i)+src.slice(i).replace(/((scl|max|min|idth|eight)\s*=\s*-?\d*(\d\.|\.\d|\d)\d*\s*;?)/,"$1\naxes();"));- }- ht = picture.getAttribute("height");- if (isIE) {- picture.setAttribute("wmode","transparent");-//alert("*"+picture.getAttribute("src")+dsvglocation);-//adding d.svg dynamically greates problems in IE...-// if (picture.getAttribute("src")=="") picture.setAttribute("src",dsvglocation+"d.svg");- }- if (document.getElementById("picture"+(index+1)+"mml")==null) {- picture.parentNode.style.position = "relative";- node = createElementXHTML("div");- node.style.position = "absolute";- node.style.top = "0px";- node.style.left = "0px";- node.setAttribute("id","picture"+(index+1)+"mml");- picture.parentNode.insertBefore(node,picture.nextSibling);- }- if (ht==null) ht ="";-// if (ht!="") defaultborder = 25;- if (ht=="" || src=="") - if (document.getElementById("picture"+(index+1)+"input")==null) {- node = createElementXHTML("textarea");- arr = src.split("\n");- cols = 0;- for (i=0;i<arr.length;i++) cols = Math.max(cols,arr[i].length);- node.setAttribute("rows",Math.min(10,arr.length)+1);- node.setAttribute("cols",Math.max(Math.min(60,cols),20)+5);-// node.setAttribute("style","display:block");- if (isIE) src = src.replace(/([^\r])\n/g,"$1\r");- node.appendChild(document.createTextNode(src));- if (src.indexOf("showcode()")==-1) node.style.display = "none";- node.setAttribute("id","picture"+(index+1)+"input");- picture.parentNode.insertBefore(node,picture.nextSibling);- picture.parentNode.insertBefore(createElementXHTML("br"),node);- node2 = createElementXHTML("button");- node2.setAttribute("id","picture"+(index+1)+"button");- if (isIE) node2.onclick = function() {updatePicture(this)};- else node2.setAttribute("onclick","updatePicture(this)");- node2.appendChild(document.createTextNode("Update"));- if (src.indexOf("showcode()")==-1) node2.style.display = "none";- picture.parentNode.insertBefore(node2,node);-// picture.parentNode.insertBefore(document.createTextNode("ASCII"),node);- picture.parentNode.insertBefore(createElementXHTML("br"),node);- } else src = document.getElementById("picture"+(index+1)+"input").value;- id = picture.getAttribute("id");- dsvg = picture.getAttribute("src");- if (id == null || id == "") {- id = "picture"+(index+1);- picture.setAttribute("id",id);- }- translateandeval(src);- }- lastSlot+=len;-}--function setdefaults() { //called before each graph is evaluated- strokewidth = defaultstrokewidth;- stroke = defaultstroke;- strokeopacity = defaultstrokeopacity;- strokedasharray = defaultstrokedasharray;- fill = defaultfill;- fillopacity = defaultfillopacity;- fontstyle = defaultfontstyle;- fontfamily = defaultfontfamily;- fontsize = defaultfontsize;- fontweight = defaultfontweight;- fontstroke = defaultfontstroke;- fontfill = defaultfontfill;- marker = defaultmarker;- endpoints = defaultendpoints;-}--function switchTo(id) { // used by dynamic code to select appropriate graph- if (id==undefined) return;- var name = id;- if (typeof name!="string") name = id.target.parentNode.getAttribute("name");- picture = document.getElementById(name);- width = picture.getAttribute("width")-0;- height = picture.getAttribute("height")-0;- setdefaults();- if ((picture.nodeName == "EMBED" || picture.nodeName == "embed") && isIE) {- svgpicture = picture.getSVGDocument().getElementById("root");- doc = picture.getSVGDocument();- } else {- svgpicture = picture;- doc = document;- }- xunitlength = parseFloat(svgpicture.getAttribute("xunitlength"));- yunitlength = parseFloat(svgpicture.getAttribute("yunitlength"));- xmin = parseFloat(svgpicture.getAttribute("xmin"));- xmax = parseFloat(svgpicture.getAttribute("xmax"));- ymin = parseFloat(svgpicture.getAttribute("ymin"));- ymax = parseFloat(svgpicture.getAttribute("ymax"));- origin = [svgpicture.getAttribute("ox")-0,svgpicture.getAttribute("oy")-0];-}--function updatePicture(obj) {- var node, src, id, top, left;- if (typeof obj=="object") id = obj.id.slice(0,-6);- else id = (typeof obj=="string"?obj:"picture"+(obj+1));- src = document.getElementById(id+"input").value;- xmin = null; xmax = null; ymin = null; ymax = null;- xscl = null; xgrid = null; yscl = null; ygrid = null;- initialized = false;- picture = document.getElementById(id);- translateandeval(src)-}--function changepicturesize(evt,factor) {- var obj = evt.target;- var name = obj.parentNode.getAttribute("name");- var pic = document.getElementById(name);- var src = document.getElementById(name+"input").value;- if (!/height/.test(src)) src = "height=0; "+src;- if (!/width/.test(src)) src = "width=0; "+src;- src = src.replace(/width\s*=\s*\d+/,"width="+(factor*(pic.getAttribute("width")-0)));- src = src.replace(/height\s*=\s*\d+/,"height="+(factor*(pic.getAttribute("height")-0)));- document.getElementById(name+"input").value = src;-//alert(getKey(evt.keycode))- updatePicture(name);-}--function zoom(evt,factor) {- switchTo(evt);- var obj = evt.target;- var name = obj.parentNode.getAttribute("name");- var pic = document.getElementById(name);- var src = document.getElementById(name+"input").value;- var xlen = (xmax-xmin)/2;- var ylen = (ymax-ymin)/2;- var xcen = getX(evt), ycen = getY(evt);- if (!/ymax/.test(src)) src = "ymax=0; "+src;- if (!/ymin/.test(src)) src = "ymin=0; "+src;- if (!/xmax/.test(src)) src = "xmax=0; "+src;- if (!/xmin/.test(src)) src = "xmin=0; "+src;- src = src.replace(/xmin\s*=\s*[-\d.e]+/,"xmin="+(xcen-factor*xlen));- src = src.replace(/xmax\s*=\s*[-\d.e]+/,"xmax="+(xcen+factor*xlen));- src = src.replace(/ymin\s*=\s*[-\d.e]+/,"ymin="+(ycen-factor*ylen));- src = src.replace(/ymax\s*=\s*[-\d.e]+/,"ymax="+(ycen+factor*ylen));- document.getElementById(name+"input").value = src;- updatePicture(name);-}--var sinceFirstClick = 0; // ondblclick simulation from -var dblClkTimer; // http://www.enja.org/david/?cat=13 Thanks!-function timer() {- if(sinceFirstClick<60) {- sinceFirstClick++;- setTimeout("timer()",10);- } else {- clearTimeout(dblClkTimer);- dblClkTimer = "";- }-}-function mClick(evt) {- if(sinceFirstClick!=0) {- if(sinceFirstClick <= 40) {- if (evt.shiftKey) {- if (evt.altKey) changepicturesize(evt,2);- else zoom(evt,.5);- } else if (evt.altKey) zoom(evt,2);//changepicturesize(evt,.5);- else showHideCode(evt); // do this on dblclick- clearTimeout(dblClkTimer);- dblClkTimer = "";- } else {- clearTimeout(dblClkTimer);- sinceFirstClick = 0;- dblClkTimer = setTimeout("timer()",10);- } - } else {- sinceFirstClick = 0;- dblClkTimer = setTimeout("timer()",10);- }-}--function showHideCode(evt) { // called by onclick event-// if (evt.getDetail()==2) {//getDetail unfortunately not in Firefox- var obj=evt.target;- var name = obj.parentNode.getAttribute("name");- var node = document.getElementById(name+"input");- node.style.display = (node.style.display == "none"?"":"none");- var node = document.getElementById(name+"button");- node.style.display = (node.style.display == "none"?"":"none");-// }-}--function showcode() {} // do nothing--function setBorder(x) { border = x } //deprecate--function initPicture(x_min,x_max,y_min,y_max) { // set up the graph-// usually called by axes() or noaxes(), but can be used directly- if (!initialized) {- setdefaults();- initialized = true;- if (x_min!=null) xmin = x_min;- if (x_max!=null) xmax = x_max;- if (y_min!=null) ymin = y_min;- if (y_max!=null) ymax = y_max;- if (xmin==null) xmin = defaultxmin;- if (xmax==null) xmax = defaultxmax;- if (typeof xmin != "number" || typeof xmax != "number" || xmin >= xmax) - alert("Picture requires at least two numbers: xmin < xmax");- else if (y_max != null && (typeof y_min != "number" || - typeof y_max != "number" || y_min >= y_max))- alert("initPicture(xmin,xmax,ymin,ymax) requires numbers ymin < ymax");- else {- if (width==null) {- width = picture.getAttribute("width");- if (width==null || width=="") width=defaultwidth;- }- picture.setAttribute("width",width);- if (height==null) { - height = picture.getAttribute("height");- if (height==null || height=="") height=defaultheight;- }- picture.setAttribute("height",height);- xunitlength = (width-2*border)/(xmax-xmin);- yunitlength = xunitlength;-//alert(xmin+" "+xmax+" "+ymin+" "+ymax)- if (ymin==null) {- origin = [-xmin*xunitlength+border,height/2];- ymin = -(height-2*border)/(2*yunitlength);- ymax = -ymin;- } else {- if (ymax!=null) yunitlength = (height-2*border)/(ymax-ymin);- else ymax = (height-2*border)/yunitlength + ymin;- origin = [-xmin*xunitlength+border,-ymin*yunitlength+border];- }- if (isIE) {- if (picture.FULLSCREEN==undefined) {- setTimeout('drawPictures()',50);- throw "wait";- }- svgpicture = picture.getSVGDocument().getElementById("root");- if (svgpicture==null) {- setTimeout('drawPictures()',50);- throw "wait";- }- svgpicture = picture.getSVGDocument().getElementById("root");- while (svgpicture.childNodes.length>0) - svgpicture.removeChild(svgpicture.lastChild); - svgpicture.setAttribute("width",width);- svgpicture.setAttribute("height",height);- svgpicture.setAttribute("name",picture.getAttribute("id"));- doc = picture.getSVGDocument();- } else {- var qnode = document.createElementNS("http://www.w3.org/2000/svg","svg");- qnode.setAttribute("id",picture.getAttribute("id"));- qnode.setAttribute("name",picture.getAttribute("id"));-// qnode.setAttribute("style","display:inline");- qnode.setAttribute("width",picture.getAttribute("width"));- qnode.setAttribute("height",picture.getAttribute("height"));- picturepos = findPos(picture);-// qnode.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");- if (picture.parentNode!=null) {- picture.parentNode.replaceChild(qnode,picture);- } else {- svgpicture.parentNode.replaceChild(qnode,svgpicture);- }- svgpicture = qnode;- doc = document;- }- var nd = document.getElementById(picture.getAttribute("id")+"mml");- if (nd!=null) // clear out MathML layer- while (nd.childNodes.length>0) nd.removeChild(nd.lastChild); - svgpicture.setAttribute("xunitlength",xunitlength);- svgpicture.setAttribute("yunitlength",yunitlength);- svgpicture.setAttribute("xmin",xmin);- svgpicture.setAttribute("xmax",xmax);- svgpicture.setAttribute("ymin",ymin);- svgpicture.setAttribute("ymax",ymax);- svgpicture.setAttribute("ox",origin[0]);- svgpicture.setAttribute("oy",origin[1]);- var node = myCreateElementSVG("rect");- node.setAttribute("x","0");- node.setAttribute("y","0");- node.setAttribute("width",width);- node.setAttribute("height",height);- node.setAttribute("style",backgroundstyle);- svgpicture.appendChild(node);- svgpicture.setAttribute("onmousemove","displayCoord(evt)");- svgpicture.setAttribute("onmouseout","removeCoord(evt)");- svgpicture.setAttribute("onclick","mClick(evt)");- node = myCreateElementSVG("text"); // used for displayCoord- node.appendChild(doc.createTextNode(" "));- node.setAttribute("id","coords");- svgpicture.appendChild(node);- node = myCreateElementSVG("text"); // used for text display- node.appendChild(doc.createTextNode(" "));- node.setAttribute("id","coords");- svgpicture.appendChild(node);- border = defaultborder;- }- }-}--//////////////////////////user graphics commands start/////////////////////////--function line(p,q,id,endpts) { // segment connecting points p,q (coordinates in units)- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("d","M"+(p[0]*xunitlength+origin[0])+","+- (height-p[1]*yunitlength-origin[1])+" "+- (q[0]*xunitlength+origin[0])+","+(height-q[1]*yunitlength-origin[1]));- node.setAttribute("stroke-width", strokewidth);- if (strokedasharray!=null) - node.setAttribute("stroke-dasharray", strokedasharray);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- if (marker=="dot" || marker=="arrowdot") {- ASdot(p,markersize,markerstroke,markerfill);- if (marker=="arrowdot") arrowhead(p,q);- ASdot(q,markersize,markerstroke,markerfill);- } else if (marker=="arrow") arrowhead(p,q);- if (endpts==null && endpoints!="") endpts = endpoints;- if (endpts!=null) {- if (endpts.indexOf("<-") != -1) arrowhead(q,p);- if (endpts.indexOf("o-") != -1) dot(p, "open");- if (endpts.indexOf("*-") != -1) dot(p, "closed");- if (endpts.indexOf("->") != -1) arrowhead(p,q);- if (endpts.indexOf("-o") != -1) dot(q, "open");- if (endpts.indexOf("-*") != -1) dot(q, "closed");- }-}--function path(plist,id,c,endpts) {- if (c==null) c="";- var node, st, i;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- if (typeof plist == "string") st = plist;- else {- st = "M";- st += (plist[0][0]*xunitlength+origin[0])+","+- (height-plist[0][1]*yunitlength-origin[1])+" "+c;- for (i=1; i<plist.length; i++)- st += (plist[i][0]*xunitlength+origin[0])+","+- (height-plist[i][1]*yunitlength-origin[1])+" ";- }- node.setAttribute("d", st);- node.setAttribute("stroke-width", strokewidth);- if (strokedasharray!=null) - node.setAttribute("stroke-dasharray", strokedasharray);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- if (marker=="dot" || marker=="arrowdot")- for (i=0; i<plist.length; i++)- if (c!="C" && c!="T" || i!=1 && i!=2)- ASdot(plist[i],markersize,markerstroke,markerfill);- if (endpts==null && endpoints!="") endpts = endpoints;- if (endpts!=null) {- if (endpts.indexOf("<-") != -1) arrowhead(plist[1],plist[0]);- if (endpts.indexOf("o-") != -1) dot(plist[0], "open");- if (endpts.indexOf("*-") != -1) dot(plist[0], "closed");- if (endpts.indexOf("->") != -1) arrowhead(plist[plist.length-2],plist[plist.length-1]);- if (endpts.indexOf("-o") != -1) dot(plist[plist.length-1], "open");- if (endpts.indexOf("-*") != -1) dot(plist[plist.length-1], "closed");- }-}--function curve(plist,id,endpts) {- path(plist,id,"T",endpts);-}--function vector(p,q,id) {- line(p,q,id,"","->");-}--function circle(center,radius,id) { // coordinates in units- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("circle");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("cx",center[0]*xunitlength+origin[0]);- node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);- node.setAttribute("r",radius*xunitlength);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);-}--function loop(p,d,id) { -// d is a direction vector e.g. [1,0] means loop starts in that direction- if (d==null) d=[1,0];- path([p,[p[0]+d[0],p[1]+d[1]],[p[0]-d[1],p[1]+d[0]],p],id,"C");- if (marker=="arrow" || marker=="arrowdot") - arrowhead([p[0]+Math.cos(1.4)*d[0]-Math.sin(1.4)*d[1],- p[1]+Math.sin(1.4)*d[0]+Math.cos(1.4)*d[1]],p);-}--function arc(start,end,radius,id,largearc) { // coordinates in units- var node, v;-//alert([fill, stroke, origin, xunitlength, yunitlength, height])- if (id!=null) node = doc.getElementById(id);- if (largearc==null) largearc=0;- if (radius==null) {- v=[end[0]-start[0],end[1]-start[1]];- radius = Math.sqrt(v[0]*v[0]+v[1]*v[1]);- }- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("d","M"+(start[0]*xunitlength+origin[0])+","+- (height-start[1]*yunitlength-origin[1])+" A"+radius*xunitlength+","+- radius*yunitlength+" 0 "+largearc+",0 "+(end[0]*xunitlength+origin[0])+","+- (height-end[1]*yunitlength-origin[1]));- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- if (marker=="arrow" || marker=="arrowdot") {- u = [(end[1]-start[1])/4,(start[0]-end[0])/4];- v = [(end[0]-start[0])/2,(end[1]-start[1])/2];-//alert([u,v])- v = [start[0]+v[0]+u[0],start[1]+v[1]+u[1]];- } else v=[start[0],start[1]];- if (marker=="dot" || marker=="arrowdot") {- ASdot(start,markersize,markerstroke,markerfill);- if (marker=="arrowdot") arrowhead(v,end);- ASdot(end,markersize,markerstroke,markerfill);- } else if (marker=="arrow") arrowhead(v,end);-}--function sector(center,start,end,id) { // center,start,end should be isoceles- var rx = start[0]-center[0], ry = start[1]-center[1];- arc(start,end,Math.sqrt(rx*rx+ry*ry),id+"arc");- path([end,center,start],id+"path");-}--function ellipse(center,rx,ry,id) { // coordinates in units- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("ellipse");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("cx",center[0]*xunitlength+origin[0]);- node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);- node.setAttribute("rx",rx*xunitlength);- node.setAttribute("ry",ry*yunitlength);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);-}--function triangle(p,q,r,id) {- path([p,q,r,p],id)-}--function rect(p,q,id,rx,ry) { // opposite corners in units, rounded by radii- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("rect");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("x",p[0]*xunitlength+origin[0]);- node.setAttribute("y",height-q[1]*yunitlength-origin[1]);- node.setAttribute("width",(q[0]-p[0])*xunitlength);- node.setAttribute("height",(q[1]-p[1])*yunitlength);- if (rx!=null) node.setAttribute("rx",rx*xunitlength);- if (ry!=null) node.setAttribute("ry",ry*yunitlength);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", fill);- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);-}--function text(p,st,pos,id,fontsty) {- var dnode, node, dx = 0, dy = fontsize/3, str = st.toString();- if (/(`|\$)/.test(str)) { // layer for ASCIIMathML and LaTeXMathML- dnode = document.getElementById(svgpicture.getAttribute("name")+"mml");- if (dnode!=null) {- if (id!=null) node = document.getElementById(id);- if (node==null) {-//alert(dnode.childNodes.length)- node = createElementXHTML("div");- node.setAttribute("id", id);- node.style.position = "absolute";- dnode.appendChild(node);- }- while (node.childNodes.length>0) node.removeChild(node.lastChild); - node.appendChild(document.createTextNode(str));- if (/`/.test(str)) AMprocessNode(node); else LMprocessNode(node);- dx = -node.offsetWidth/2;- dy = -node.offsetHeight/2;- if (pos!=null) {- if (/above/.test(pos)) dy = -node.offsetHeight;- if (/below/.test(pos)) dy = 0;- if (/right/.test(pos)) dx = 0;- if ( /left/.test(pos)) dx = -node.offsetWidth;- }- node.style.left = ""+(p[0]*xunitlength+origin[0]+dx)+"px";- node.style.top = ""+(height-p[1]*yunitlength-origin[1]+dy)+"px";- }- return p;- }- var textanchor = "middle"; // regular text goes into SVG- if (pos!=null) {- if (/above/.test(pos)) dy = -fontsize/2;- if (/below/.test(pos)) dy = fontsize-0;- if (/right/.test(pos)) {textanchor = "start"; dx = fontsize/4;}- if ( /left/.test(pos)) {textanchor = "end"; dx = -fontsize/4;}- }- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("text");- node.setAttribute("id", id);- svgpicture.appendChild(node);- node.appendChild(doc.createTextNode(str));- }- while (node.childNodes.length>1) node.removeChild(node.lastChild); - node.lastChild.nodeValue = "\xA0"+str+"\xA0";- node.setAttribute("x",p[0]*xunitlength+origin[0]+dx);- node.setAttribute("y",height-p[1]*yunitlength-origin[1]+dy);- node.setAttribute("font-style",(fontsty!=null?fontsty:- (str.search(/^[a-zA-Z]$/)!=-1?"italic":fontstyle)));- node.setAttribute("font-family",fontfamily);- node.setAttribute("font-size",fontsize);- node.setAttribute("font-weight",fontweight);- node.setAttribute("text-anchor",textanchor);- if (fontstroke!="none") node.setAttribute("stroke",fontstroke);- if (fontfill!="none") node.setAttribute("fill",fontfill);- return p;-}--function mtext(p,st,pos,fontsty,fontsz) { // method for updating text on an svg-// "this" is the text object or the svgpicture object- var textanchor = "middle";- var dx = 0; var dy = fontsize/3;- if (pos!=null) {- if (pos.slice(0,5)=="above") dy = -fontsize/2;- if (pos.slice(0,5)=="below") dy = fontsize-0;- if (pos.slice(0,5)=="right" || pos.slice(5,10)=="right") {- textanchor = "start";- dx = fontsize/2;- }- if (pos.slice(0,4)=="left" || pos.slice(5,9)=="left") {- textanchor = "end";- dx = -fontsize/2;- }- }- var node = this;- if (this.nodeName=="svg") {- node = myCreateElementSVG("text");- this.appendChild(node);- node.appendChild(doc.createTextNode(st));- }- node.lastChild.nodeValue = st;- node.setAttribute("x",p[0]+dx);- node.setAttribute("y",p[1]+dy);- node.setAttribute("font-style",(fontsty!=null?fontsty:fontstyle));- node.setAttribute("font-family",fontfamily);- node.setAttribute("font-size",(fontsz!=null?fontsz:fontsize));- node.setAttribute("font-weight",fontweight);- node.setAttribute("text-anchor",textanchor);- if (fontstroke!="none") node.setAttribute("stroke",fontstroke);- if (fontfill!="none") node.setAttribute("fill",fontfill);-}--function image(imgurl,p,w,h,id) { // not working yet- var node;- if (id!=null) node = doc.getElementById(id);- if (node==null) {- node = myCreateElementSVG("image");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("x",p[0]*xunitlength+origin[0]);- node.setAttribute("y",height-p[1]*yunitlength-origin[1]);- node.setAttribute("width",w);- node.setAttribute("height",h);- node.setAttribute("xlink:href", imgurl);-}--function ASdot(center,radius,s,f) { // coordinates in units, radius in pixel- if (s==null) s = stroke; if (f==null) f = fill;- var node = myCreateElementSVG("circle");- node.setAttribute("cx",center[0]*xunitlength+origin[0]);- node.setAttribute("cy",height-center[1]*yunitlength-origin[1]);- node.setAttribute("r",radius);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", s);- node.setAttribute("fill", f);- svgpicture.appendChild(node);-}--function dot(center, typ, label, pos, id) {- var node;- var cx = center[0]*xunitlength+origin[0];- var cy = height-center[1]*yunitlength-origin[1];- if (id!=null) node = doc.getElementById(id);- if (typ=="+" || typ=="-" || typ=="|") {- if (node==null) {- node = myCreateElementSVG("path");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- if (typ=="+") {- node.setAttribute("d",- " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy+- " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));- node.setAttribute("stroke-width", .5);- node.setAttribute("stroke", axesstroke);- } else {- if (typ=="-") node.setAttribute("d",- " M "+(cx-ticklength)+" "+cy+" L "+(cx+ticklength)+" "+cy);- else node.setAttribute("d",- " M "+cx+" "+(cy-ticklength)+" L "+cx+" "+(cy+ticklength));- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- }- } else {- if (node==null) {- node = myCreateElementSVG("circle");- node.setAttribute("id", id);- svgpicture.appendChild(node);- }- node.setAttribute("cx",cx);- node.setAttribute("cy",cy);- node.setAttribute("r",dotradius);- node.setAttribute("stroke-width", strokewidth);- node.setAttribute("stroke", stroke);- node.setAttribute("fill", (typ=="open"?"white":- (typ=="closed"?stroke:markerfill)));- }- if (label!=null) - text(center,label,(pos==null?"below":pos),(id==null?id:id+"label"))-}--point = dot; //alternative name--function arrowhead(p,q) { // draw arrowhead at q (in units) add size param- var up;- var v = [p[0]*xunitlength+origin[0],height-p[1]*yunitlength-origin[1]];- var w = [q[0]*xunitlength+origin[0],height-q[1]*yunitlength-origin[1]];- var u = [w[0]-v[0],w[1]-v[1]];- var d = Math.sqrt(u[0]*u[0]+u[1]*u[1]);- if (d > 0.00000001) {- u = [u[0]/d, u[1]/d];- up = [-u[1],u[0]];- var node = myCreateElementSVG("path");- node.setAttribute("d","M "+(w[0]-15*u[0]-4*up[0])+" "+- (w[1]-15*u[1]-4*up[1])+" L "+(w[0]-3*u[0])+" "+(w[1]-3*u[1])+" L "+- (w[0]-15*u[0]+4*up[0])+" "+(w[1]-15*u[1]+4*up[1])+" z");- node.setAttribute("stroke-width", markerstrokewidth);- node.setAttribute("stroke", stroke); /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */- node.setAttribute("fill", stroke); /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */- node.setAttribute("stroke-opacity", strokeopacity);- node.setAttribute("fill-opacity", fillopacity);- svgpicture.appendChild(node); - }-}--function chopZ(st) {- var k = st.indexOf(".");- if (k==-1) return st;- for (var i=st.length-1; i>k && st.charAt(i)=="0"; i--);- if (i==k) i--;- return st.slice(0,i+1);-}--function grid(dx,dy) { // for backward compatibility- axes(dx,dy,null,dx,dy)-}--function noaxes() {- if (!initialized) initPicture();-}--function axes(dx,dy,labels,gdx,gdy) {-//xscl=x is equivalent to xtick=x; xgrid=x; labels=true;- var x, y, ldx, ldy, lx, ly, lxp, lyp, pnode, st;- if (!initialized) initPicture();- if (typeof dx=="string") { labels = dx; dx = null; }- if (typeof dy=="string") { gdx = dy; dy = null; }- if (xscl!=null) {dx = xscl; gdx = xscl; labels = dx}- if (yscl!=null) {dy = yscl; gdy = yscl}- if (xtick!=null) {dx = xtick}- if (ytick!=null) {dy = ytick}- dx = (dx==null?xunitlength:dx*xunitlength);- dy = (dy==null?dx:dy*yunitlength);- fontsize = Math.min(dx/2,dy/2,16); //alert(fontsize)- ticklength = fontsize/4;- if (xgrid!=null) gdx = xgrid;- if (ygrid!=null) gdy = ygrid;- if (gdx!=null) {- gdx = (typeof gdx=="string"?dx:gdx*xunitlength);- gdy = (gdy==null?dy:gdy*yunitlength);- pnode = myCreateElementSVG("path");- st="";- for (x = origin[0]; x<width; x = x+gdx)- st += " M"+x+",0"+" "+x+","+height;- for (x = origin[0]-gdx; x>0; x = x-gdx)- st += " M"+x+",0"+" "+x+","+height;- for (y = height-origin[1]; y<height; y = y+gdy)- st += " M0,"+y+" "+width+","+y;- for (y = height-origin[1]-gdy; y>0; y = y-gdy)- st += " M0,"+y+" "+width+","+y;- pnode.setAttribute("d",st);- pnode.setAttribute("stroke-width", .5);- pnode.setAttribute("stroke", gridstroke);- pnode.setAttribute("fill", fill);- svgpicture.appendChild(pnode);- }- pnode = myCreateElementSVG("path");- st="M0,"+(height-origin[1])+" "+width+","+- (height-origin[1])+" M"+origin[0]+",0 "+origin[0]+","+height;- for (x = origin[0]+dx; x<width; x = x+dx)- st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+- (height-origin[1]-ticklength);- for (x = origin[0]-dx; x>0; x = x-dx)- st += " M"+x+","+(height-origin[1]+ticklength)+" "+x+","+- (height-origin[1]-ticklength);- for (y = height-origin[1]+dy; y<height; y = y+dy)- st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;- for (y = height-origin[1]-dy; y>0; y = y-dy)- st += " M"+(origin[0]+ticklength)+","+y+" "+(origin[0]-ticklength)+","+y;- if (labels!=null) with (Math) {- ldx = dx/xunitlength;- ldy = dy/yunitlength;- lx = (xmin>0 || xmax<0?xmin:0);- ly = (ymin>0 || ymax<0?ymin:0);- lxp = (ly==0?"below":"above");- lyp = (lx==0?"left":"right");- var ddx = floor(1.1-log(ldx)/log(10))+1;- var ddy = floor(1.1-log(ldy)/log(10))+1;- for (x = ldx; x<=xmax; x = x+ldx)- text([x,ly],chopZ(x.toFixed(ddx)),lxp);- for (x = -ldx; xmin<=x; x = x-ldx)- text([x,ly],chopZ(x.toFixed(ddx)),lxp);- for (y = ldy; y<=ymax; y = y+ldy)- text([lx,y],chopZ(y.toFixed(ddy)),lyp);- for (y = -ldy; ymin<=y; y = y-ldy)- text([lx,y],chopZ(y.toFixed(ddy)),lyp);- }- fontsize = defaultfontsize;- pnode.setAttribute("d",st);- pnode.setAttribute("stroke-width", .5);- pnode.setAttribute("stroke", axesstroke);- pnode.setAttribute("fill", fill);- pnode.setAttribute("stroke-opacity", strokeopacity);- pnode.setAttribute("fill-opacity", fillopacity);- svgpicture.appendChild(pnode);-}--function mathjs(st) {- //translate a math formula to js function notation- // a^b --> pow(a,b)- // na --> n*a- // (...)d --> (...)*d- // n! --> factorial(n)- // sin^-1 --> arcsin etc.- //while ^ in string, find term on left and right- //slice and concat new formula string- st = st.replace(/\s/g,"");- if (st.indexOf("^-1")!=-1) {- st = st.replace(/sin\^-1/g,"arcsin");- st = st.replace(/cos\^-1/g,"arccos");- st = st.replace(/tan\^-1/g,"arctan");- st = st.replace(/sec\^-1/g,"arcsec");- st = st.replace(/csc\^-1/g,"arccsc");- st = st.replace(/cot\^-1/g,"arccot");- st = st.replace(/sinh\^-1/g,"arcsinh");- st = st.replace(/cosh\^-1/g,"arccosh");- st = st.replace(/tanh\^-1/g,"arctanh");- st = st.replace(/sech\^-1/g,"arcsech");- st = st.replace(/csch\^-1/g,"arccsch");- st = st.replace(/coth\^-1/g,"arccoth");- }- st = st.replace(/^e$/g,"(Math.E)");- st = st.replace(/^e([^a-zA-Z])/g,"(Math.E)$1");- st = st.replace(/([^a-zA-Z])e/g,"$1(Math.E)");-// st = st.replace(/([^a-zA-Z])e([^a-zA-Z])/g,"$1(Math.E)$2");- st = st.replace(/([0-9])([\(a-zA-Z])/g,"$1*$2");- st = st.replace(/\)([\(0-9a-zA-Z])/g,"\)*$1");- var i,j,k, ch, nested;- while ((i=st.indexOf("^"))!=-1) {- //find left argument- if (i==0) return "Error: missing argument";- j = i-1;- ch = st.charAt(j);- if (ch>="0" && ch<="9") {// look for (decimal) number- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- if (ch==".") {- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- }- } else if (ch==")") {// look for matching opening bracket and function name- nested = 1;- j--;- while (j>=0 && nested>0) {- ch = st.charAt(j);- if (ch=="(") nested--;- else if (ch==")") nested++;- j--;- }- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable- j--;- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else { - return "Error: incorrect syntax in "+st+" at position "+j;- }- //find right argument- if (i==st.length-1) return "Error: missing argument";- k = i+1;- ch = st.charAt(k);- if (ch>="0" && ch<="9" || ch=="-") {// look for signed (decimal) number- k++;- while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;- if (ch==".") {- k++;- while (k<st.length && (ch=st.charAt(k))>="0" && ch<="9") k++;- }- } else if (ch=="(") {// look for matching closing bracket and function name- nested = 1;- k++;- while (k<st.length && nested>0) {- ch = st.charAt(k);- if (ch=="(") nested++;- else if (ch==")") nested--;- k++;- }- } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable- k++;- while (k<st.length && (ch=st.charAt(k))>="a" && ch<="z" ||- ch>="A" && ch<="Z") k++;- } else { - return "Error: incorrect syntax in "+st+" at position "+k;- }- st = st.slice(0,j+1)+"Math.pow("+st.slice(j+1,i)+","+st.slice(i+1,k)+")"+- st.slice(k);- }- while ((i=st.indexOf("!"))!=-1) {- //find left argument- if (i==0) return "Error: missing argument";- j = i-1;- ch = st.charAt(j);- if (ch>="0" && ch<="9") {// look for (decimal) number- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- if (ch==".") {- j--;- while (j>=0 && (ch=st.charAt(j))>="0" && ch<="9") j--;- }- } else if (ch==")") {// look for matching opening bracket and function name- nested = 1;- j--;- while (j>=0 && nested>0) {- ch = st.charAt(j);- if (ch=="(") nested--;- else if (ch==")") nested++;- j--;- }- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else if (ch>="a" && ch<="z" || ch>="A" && ch<="Z") {// look for variable- j--;- while (j>=0 && (ch=st.charAt(j))>="a" && ch<="z" || ch>="A" && ch<="Z")- j--;- } else { - return "Error: incorrect syntax in "+st+" at position "+j;- }- st = st.slice(0,j+1)+"factorial("+st.slice(j+1,i)+")"+st.slice(i+1);- }- return st;-}--function plot(fun,x_min,x_max,points,id,endpts) {- var pth = [];- var f = function(x) { return x }, g = fun;- var name = null;- if (typeof fun=="string") - eval("g = function(x){ with(Math) return "+mathjs(fun)+" }");- else if (typeof fun=="object") {- eval("f = function(t){ with(Math) return "+mathjs(fun[0])+" }");- eval("g = function(t){ with(Math) return "+mathjs(fun[1])+" }");- }- if (typeof x_min=="string") { name = x_min; x_min = xmin }- else name = id;- var min = (x_min==null?xmin:x_min);- var max = (x_max==null?xmax:x_max);- var inc = max-min-0.000001*(max-min);- inc = (points==null?inc/200:inc/points);- var gt;-//alert(typeof g(min))- for (var t = min; t <= max; t += inc) {- gt = g(t);- if (!(isNaN(gt)||Math.abs(gt)=="Infinity")) pth[pth.length] = [f(t), gt];- }- path(pth,name,null,endpts);- return pth;-}--// make polar plot--// make Riemann sums--function slopefield(fun,dx,dy) {- var g = fun;- if (typeof fun=="string") - eval("g = function(x,y){ with(Math) return "+mathjs(fun)+" }");- var gxy,x,y,u,v,dz;- if (dx==null) dx=1;- if (dy==null) dy=1;- dz = Math.sqrt(dx*dx+dy*dy)/6;- var x_min = Math.ceil(xmin/dx);- var y_min = Math.ceil(ymin/dy);- for (x = x_min; x <= xmax; x += dx)- for (y = y_min; y <= ymax; y += dy) {- gxy = g(x,y);- if (!isNaN(gxy)) {- if (Math.abs(gxy)=="Infinity") {u = 0; v = dz;}- else {u = dz/Math.sqrt(1+gxy*gxy); v = gxy*u;}- line([x-u,y-v],[x+u,y+v]);- }- }-}--///////////////////////user graphics commands end here/////////////////////////--function show_props(obj) {- var result = "";- for (var i=0; i< obj.childNodes.length; i++)- result += obj.childNodes.item(i) + "\n";- return result;-}--function displayCoord(evt) {- if (showcoordinates) {- var svgroot = evt.target.parentNode;- var nl = svgroot.childNodes;- for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++);- var cnode = nl.item(i);- cnode.mtext = mtext;- cnode.mtext([svgroot.getAttribute("width")-(-7),svgroot.getAttribute("height")-7],"("+getX(evt).toFixed(2)+", "+getY(evt).toFixed(2)+")", "left", "", "11");-/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */ }-}--function removeCoord(evt) {- var svgroot = evt.target.parentNode;- var nl = svgroot.childNodes;- for (var i=0; i<nl.length && nl.item(i).nodeName!="text"; i++);- var cnode = nl.item(i);- cnode.mtext = mtext;- cnode.mtext([svgroot.getAttribute("width")-0,svgroot.getAttribute("height")-0],"", "aboveleft", "");-/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL-See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */}--function initASCIIMathCalculators(li) {- var i;- for (i=0; i<li.length; i++) {- li[i].innerHTML = calcstr;- AMprocessNode(li[i]);- }- li = document.getElementsByTagName("textarea");- var st;- for (i=0; i<li.length; i++) {- st = li[i].getAttribute("onkeyup");- if (st!=null) eval(String(st).replace(/function anonymous\(\)/,""));- }-}--function calculate(inputId,outputId) {- var str = document.getElementById(inputId).value;- var err = "";- var ind = str.lastIndexOf("\n");- if (ind==str.length-1) str = str.slice(0,ind);- str = str.slice(str.lastIndexOf("\n")+1);- try {- var res = eval(mathjs(str));- } catch(e) {- err = "syntax incomplete";- }- if (!isNaN(res) && res!="Infinity") - str = "`"+str+" =` "+(Math.abs(res-Math.round(res*1000000)/1000000)<1e-15?Math.round(res*1000000)/1000000:res)+err; - else if (str!="") str = "`"+str+"` = undefined"; //debug:+mathjs(str);- var outnode = document.getElementById(outputId);- var n = outnode.childNodes.length;- for (var i=0; i<n; i++)- outnode.removeChild(outnode.firstChild);- outnode.appendChild(document.createTextNode(str));- AMprocessNode(outnode);-}--function append(st){- document.getElementById('in').value+=st;- calculate('in','out');- document.getElementById('in').scrollTop = 1000;- document.getElementById('in').focus();-}--function clearTextArea(){- document.getElementById('in').value="";- calculate('in','out');- document.getElementById('in').focus();-}--var calcstr = "<table align=\"center\">\n<tr><th>\nASCIIMath Scientific Calculator\n</th></tr>\n<tr><td>\nClick in the box to use your keyboard or use the buttons\n</td></tr>\n<tr><td>\n<textarea id=\"in\" rows=\"3\" cols=\"40\" onkeyup=\"calculate('in','out')\"></textarea></td></tr>\n<tr><td height=\"50\">Result: <span id=\"out\"></span></td></tr>\n</table>\n<table align=\"center\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody align=\"center\">\n<tr>\n<td colspan=\"4\">\n<button onclick=\"append('sin^-1(')\"><font size=2>`sin^-1`</font></button><button onclick=\"append('cos^-1(')\"><font size=2>`cos^-1`</font></button><button onclick=\"append('tan^-1(')\"><font size=2>`tan^-1`</font></button></td>\n<td><button onclick=\"clearTextArea()\"> `C` </button></td>\n\n</tr>\n<tr>\n<td><button onclick=\"append('pi')\"> `pi` </button></td>\n<td><button onclick=\"append('sin(')\"> `sin`</button></td>\n<td><button onclick=\"append('cos(')\"> `cos`</button></td>\n<td><button onclick=\"append('tan(')\"> `tan`</button></td>\n<td><button onclick=\"append('^')\">`x^y`</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('!')\"> `!` </button></td>\n\n<td><button onclick=\"append('(')\"><font size=2> `(` </font></button></td>\n<td><button onclick=\"append(')')\"><font size=2> `)` </font></button></td>\n<td><button onclick=\"append('sqrt(')\"><font size=2>`sqrt({::}^\ )`</font></button></td>\n<td><button onclick=\"append('/')\"> `-:\ `</button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('log(')\">`log`</button></td>\n<td><button onclick=\"append('7')\"> `7` </button></td>\n<td><button onclick=\"append('8')\"> `8` </button></td>\n\n<td><button onclick=\"append('9')\"> `9` </button></td>\n<td><button onclick=\"append('*')\"> `times` </button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('ln(')\"> `ln` </button></td>\n<td><button onclick=\"append('4')\"> `4` </button></td>\n<td><button onclick=\"append('5')\"> `5` </button></td>\n<td><button onclick=\"append('6')\"> `6` </button></td>\n\n<td><button onclick=\"append('-')\"> `-{::}` </button></td>\n</tr>\n<tr>\n<td><button onclick=\"append('e')\"> `e` </button></td>\n<td><button onclick=\"append('1')\"> `1` </button></td>\n<td><button onclick=\"append('2')\"> `2` </button></td>\n<td><button onclick=\"append('3')\"> `3` </button></td>\n<td><button onclick=\"append('+')\"> `+{::}` </button></td>\n\n</tr>\n<tr>\n<td> <!--button onclick=\"append('pi')\"> `pi` </button--></td>\n<td><button onclick=\"append('0')\"> `0` </button></td>\n<td><button onclick=\"append('.')\"> `.` </button></td>\n<td><button onclick=\"append('\\n')\"> `\"ent\"`</button></td>\n</tr>\n</tbody>\n</table>";--// GO1.1 Generic onload by Brothercake-// http://www.brothercake.com/-//onload function (replaces the onload="translate()" in the <body> tag)-function generic()-{- if(!init()) return;- if (translateOnLoad) {- var nd = document.getElementById("processasciimathinmoodle");- if (nd!=null) dsvglocation = nd.className;- if (nd!=null || !checkforprocessasciimathinmoodle) {- translate();- if (!noSVG && translateASCIIsvg) drawPictures();- }- var li = getElementsByClass(document,"div","ASCIIMathCalculator");- if (!noMathML && li.length>0) initASCIIMathCalculators(li);- }-};-//setup onload function-if(typeof window.addEventListener != 'undefined')-{- //.. gecko, safari, konqueror and standard- window.addEventListener('load', generic, false);-}-else if(typeof document.addEventListener != 'undefined')-{- //.. opera 7- document.addEventListener('load', generic, false);-}-else if(typeof window.attachEvent != 'undefined')-{- //.. win/ie- window.attachEvent('onload', generic);-}-//** remove this condition to degrade older browsers-else-{- //.. mac/ie5 and anything else that gets this far- //if there's an existing onload function- if(typeof window.onload == 'function')- {- //store it- var existing = onload;- //add new onload handler- window.onload = function()- {- //call existing onload function- existing();- //call generic onload function- generic();- };- }- else- {- //setup onload function- window.onload = generic;- }-}-</script>-<!-- configuration parameters -->-<meta name="defaultView" content="slideshow" />-<meta name="controlVis" content="hidden" />-<style type="text/css" media="projection" id="slideProj">-/* Do not edit or override these styles! The system will likely break if you do. */--div#header, div#footer, div#controls, .slide {position: absolute;}-html>body div#header, html>body div#footer, - html>body div#controls, html>body .slide {position: fixed;}-.handout {display: none;}-.layout {display: block;}-.slide, .hideme, .incremental {visibility: hidden;}-#slide0 {visibility: visible;}--/* The following styles size, place, and layer the slide components.- Edit these if you want to change the overall slide layout.- The commented lines can be uncommented (and modified, if necessary) - to help you with the rearrangement process. */--/* target = 1024x768 */--div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}-div#header {top: 0; height: 3em; z-index: 1;}-div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}-.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}-div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}-div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;- margin: 0;}-#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}-html>body #currentSlide {position: fixed;}--/*-div#header {background: #FCC;}-div#footer {background: #CCF;}-div#controls {background: #BBD;}-div#currentSlide {background: #FFC;}-*/--/* Following are the presentation styles -- edit away! */--body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}-:link, :visited {text-decoration: none; color: #00C;}-#controls :active {color: #88A !important;}-#controls :focus {outline: 1px dotted #227;}-h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}-ul, pre {margin: 0; line-height: 1em;}-html, body {margin: 0; padding: 0;}--blockquote, q {font-style: italic;}-blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}-blockquote p {margin: 0;}-blockquote i {font-style: normal;}-blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}-blockquote b i {font-style: italic;}--kbd {font-weight: bold; font-size: 1em;}-sup {font-size: smaller; line-height: 1px;}--.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}-.slide code.bad, code del {color: red;}-.slide code.old {color: silver;}-.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}-.slide pre code {display: block;}-.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}-.slide li {margin-top: 0.75em; margin-right: 0;}-.slide ul ul {line-height: 1;}-.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}-.slide img.leader {display: block; margin: 0 auto;}--div#header, div#footer {background: #005; color: #AAB;- font-family: Verdana, Helvetica, sans-serif;}-div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;- line-height: 1px;}-div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}-#footer h1, #footer h2 {display: block; padding: 0 1em;}-#footer h2 {font-style: italic;}--div.long {font-size: 0.75em;}-.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;- margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;- font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;- color: #DDE; background: #005;}-.slide h3 {font-size: 130%;}-h1 abbr {font-variant: small-caps;}--div#controls {position: absolute; left: 50%; bottom: 0;- width: 50%;- text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}-html>body div#controls {position: fixed; padding: 0 0 1em 0;- top: auto;}-div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;- margin: 0; padding: 0;}-#controls #navLinks a {padding: 0; margin: 0 0.5em; - background: #005; border: none; color: #779; - cursor: pointer;}-#controls #navList {height: 1em;}-#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}--#currentSlide {text-align: center; font-size: 0.5em; color: #449;}--#slide0 {padding-top: 3.5em; font-size: 90%;}-#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;- font: bold 2em Helvetica, sans-serif; white-space: normal;- color: #000; background: transparent;}-#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}-#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}-#slide0 h4 {margin-top: 0; font-size: 1em;}--ul.urls {list-style: none; display: inline; margin: 0;}-.urls li {display: inline; margin: 0;}-.note {display: none;}-.external {border-bottom: 1px dotted gray;}-html>body .external {border-bottom: none;}-.external:after {content: " \274F"; font-size: smaller; color: #77B;}--.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}-img.incremental {visibility: hidden;}-.slide .current {color: #B02;}---/* diagnostics--li:after {content: " [" attr(class) "]"; color: #F88;}- */-</style>-<style type="text/css" media="projection" id="operaFix">-/* DO NOT CHANGE THESE unless you really want to break Opera Show */-.slide {- visibility: visible !important;- position: static !important;- page-break-before: always;-}-#slide0 {page-break-before: avoid;}--</style>-<style type="text/css" media="screen" id="outlineStyle">-/* don't change this unless you want the layout stuff to show up in the outline view! */--.layout div, #footer *, #controlForm * {display: none;}-#footer, #controls, #controlForm, #navLinks, #toggle {- display: block; visibility: visible; margin: 0; padding: 0;}-#toggle {float: right; padding: 0.5em;}-html>body #toggle {position: fixed; top: 0; right: 0;}--/* making the outline look pretty-ish */--#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}-#slide0 h1 {padding-top: 1.5em;}-.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;- border-top: 1px solid #888; border-bottom: 1px solid #AAA;}-#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}--</style>-<style type="text/css" media="print" id="slidePrint">-/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */-.slide, ul {page-break-inside: avoid; visibility: visible !important;}-h1 {page-break-after: avoid;}--body {font-size: 12pt; background: white;}-* {color: black;}--#slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;}-#slide0 h3 {margin: 0; padding: 0;}-#slide0 h4 {margin: 0 0 0.5em; padding: 0;}-#slide0 {margin-bottom: 3em;}--h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;}-.extra {background: transparent !important;}-div.extra, pre.extra, .example {font-size: 10pt; color: #333;}-ul.extra a {font-weight: bold;}-p.example {display: none;}--#header {display: none;}-#footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;}-#footer h2, #controls {display: none;}--/* The following rule keeps the layout stuff out of print. Remove at your own risk! */-.layout, .layout * {display: none !important;}--</style>-<script type="text/javascript">-// S5 v1.1 slides.js -- released into the Public Domain-//-// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information -// about all the wonderful and talented contributors to this code!--var undef;-var slideCSS = '';-var snum = 0;-var smax = 1;-var incpos = 0;-var number = undef;-var s5mode = true;-var defaultView = 'slideshow';-var controlVis = 'visible';--var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;-var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;-var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;--function hasClass(object, className) {- if (!object.className) return false;- return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);-}--function hasValue(object, value) {- if (!object) return false;- return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);-}--function removeClass(object,className) {- if (!object) return;- object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);-}--function addClass(object,className) {- if (!object || hasClass(object, className)) return;- if (object.className) {- object.className += ' '+className;- } else {- object.className = className;- }-}--function GetElementsWithClassName(elementName,className) {- var allElements = document.getElementsByTagName(elementName);- var elemColl = new Array();- for (var i = 0; i< allElements.length; i++) {- if (hasClass(allElements[i], className)) {- elemColl[elemColl.length] = allElements[i];- }- }- return elemColl;-}--function isParentOrSelf(element, id) {- if (element == null || element.nodeName=='BODY') return false;- else if (element.id == id) return true;- else return isParentOrSelf(element.parentNode, id);-}--function nodeValue(node) {- var result = "";- if (node.nodeType == 1) {- var children = node.childNodes;- for (var i = 0; i < children.length; ++i) {- result += nodeValue(children[i]);- } - }- else if (node.nodeType == 3) {- result = node.nodeValue;- }- return(result);-}--function slideLabel() {- var slideColl = GetElementsWithClassName('*','slide');- var list = document.getElementById('jumplist');- smax = slideColl.length;- for (var n = 0; n < smax; n++) {- var obj = slideColl[n];-- var did = 'slide' + n.toString();- obj.setAttribute('id',did);- if (isOp) continue;-- var otext = '';- var menu = obj.firstChild;- if (!menu) continue; // to cope with empty slides- while (menu && menu.nodeType == 3) {- menu = menu.nextSibling;- }- if (!menu) continue; // to cope with slides with only text nodes-- var menunodes = menu.childNodes;- for (var o = 0; o < menunodes.length; o++) {- otext += nodeValue(menunodes[o]);- }- list.options[list.length] = new Option(n + ' : ' + otext, n);- }-}--function currentSlide() {- var cs;- if (document.getElementById) {- cs = document.getElementById('currentSlide');- } else {- cs = document.currentSlide;- }- cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' + - '<span id="csSep">\/<\/span> ' + - '<span id="csTotal">' + (smax-1) + '<\/span>';- if (snum == 0) {- cs.style.visibility = 'hidden';- } else {- cs.style.visibility = 'visible';- }-}--function go(step) {- if (document.getElementById('slideProj').disabled || step == 0) return;- var jl = document.getElementById('jumplist');- var cid = 'slide' + snum;- var ce = document.getElementById(cid);- if (incrementals[snum].length > 0) {- for (var i = 0; i < incrementals[snum].length; i++) {- removeClass(incrementals[snum][i], 'current');- removeClass(incrementals[snum][i], 'incremental');- }- }- if (step != 'j') {- snum += step;- lmax = smax - 1;- if (snum > lmax) snum = lmax;- if (snum < 0) snum = 0;- } else- snum = parseInt(jl.value);- var nid = 'slide' + snum;- var ne = document.getElementById(nid);- if (!ne) {- ne = document.getElementById('slide0');- snum = 0;- }- if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}- if (incrementals[snum].length > 0 && incpos == 0) {- for (var i = 0; i < incrementals[snum].length; i++) {- if (hasClass(incrementals[snum][i], 'current'))- incpos = i + 1;- else- addClass(incrementals[snum][i], 'incremental');- }- }- if (incrementals[snum].length > 0 && incpos > 0)- addClass(incrementals[snum][incpos - 1], 'current');- ce.style.visibility = 'hidden';- ne.style.visibility = 'visible';- jl.selectedIndex = snum;- currentSlide();- number = 0;-}--function goTo(target) {- if (target >= smax || target == snum) return;- go(target - snum);-}--function subgo(step) {- if (step > 0) {- removeClass(incrementals[snum][incpos - 1],'current');- removeClass(incrementals[snum][incpos], 'incremental');- addClass(incrementals[snum][incpos],'current');- incpos++;- } else {- incpos--;- removeClass(incrementals[snum][incpos],'current');- addClass(incrementals[snum][incpos], 'incremental');- addClass(incrementals[snum][incpos - 1],'current');- }-}--function toggle() {- var slideColl = GetElementsWithClassName('*','slide');- var slides = document.getElementById('slideProj');- var outline = document.getElementById('outlineStyle');- if (!slides.disabled) {- slides.disabled = true;- outline.disabled = false;- s5mode = false;- fontSize('1em');- for (var n = 0; n < smax; n++) {- var slide = slideColl[n];- slide.style.visibility = 'visible';- }- } else {- slides.disabled = false;- outline.disabled = true;- s5mode = true;- fontScale();- for (var n = 0; n < smax; n++) {- var slide = slideColl[n];- slide.style.visibility = 'hidden';- }- slideColl[snum].style.visibility = 'visible';- }-}--function showHide(action) {- var obj = GetElementsWithClassName('*','hideme')[0];- switch (action) {- case 's': obj.style.visibility = 'visible'; break;- case 'h': obj.style.visibility = 'hidden'; break;- case 'k':- if (obj.style.visibility != 'visible') {- obj.style.visibility = 'visible';- } else {- obj.style.visibility = 'hidden';- }- break;- }-}--// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)-function keys(key) {- if (!key) {- key = event;- key.which = key.keyCode;- }- if (key.which == 84) {- toggle();- return;- }- if (s5mode) {- switch (key.which) {- case 10: // return- case 13: // enter- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;- if (key.target && isParentOrSelf(key.target, 'controls')) return;- if(number != undef) {- goTo(number);- break;- }- case 32: // spacebar- case 34: // page down- case 39: // rightkey- case 40: // downkey- if(number != undef) {- go(number);- } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {- go(1);- } else {- subgo(1);- }- break;- case 33: // page up- case 37: // leftkey- case 38: // upkey- if(number != undef) {- go(-1 * number);- } else if (!incrementals[snum] || incpos <= 0) {- go(-1);- } else {- subgo(-1);- }- break;- case 36: // home- goTo(0);- break;- case 35: // end- goTo(smax-1);- break;- case 67: // c- showHide('k');- break;- }- if (key.which < 48 || key.which > 57) {- number = undef;- } else {- if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;- if (key.target && isParentOrSelf(key.target, 'controls')) return;- number = (((number != undef) ? number : 0) * 10) + (key.which - 48);- }- }- return false;-}--function clicker(e) {- number = undef;- var target;- if (window.event) {- target = window.event.srcElement;- e = window.event;- } else target = e.target;- if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;- if (!e.which || e.which == 1) {- if (!incrementals[snum] || incpos >= incrementals[snum].length) {- go(1);- } else {- subgo(1);- }- }-}--function findSlide(hash) {- var target = null;- var slides = GetElementsWithClassName('*','slide');- for (var i = 0; i < slides.length; i++) {- var targetSlide = slides[i];- if ( (targetSlide.name && targetSlide.name == hash)- || (targetSlide.id && targetSlide.id == hash) ) {- target = targetSlide;- break;- }- }- while(target != null && target.nodeName != 'BODY') {- if (hasClass(target, 'slide')) {- return parseInt(target.id.slice(5));- }- target = target.parentNode;- }- return null;-}--function slideJump() {- if (window.location.hash == null) return;- var sregex = /^#slide(\d+)$/;- var matches = sregex.exec(window.location.hash);- var dest = null;- if (matches != null) {- dest = parseInt(matches[1]);- } else {- dest = findSlide(window.location.hash.slice(1));- }- if (dest != null)- go(dest - snum);-}--function fixLinks() {- var thisUri = window.location.href;- thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);- var aelements = document.getElementsByTagName('A');- for (var i = 0; i < aelements.length; i++) {- var a = aelements[i].href;- var slideID = a.match('\#slide[0-9]{1,2}');- if ((slideID) && (slideID[0].slice(0,1) == '#')) {- var dest = findSlide(slideID[0].slice(1));- if (dest != null) {- if (aelements[i].addEventListener) {- aelements[i].addEventListener("click", new Function("e",- "if (document.getElementById('slideProj').disabled) return;" +- "go("+dest+" - snum); " +- "if (e.preventDefault) e.preventDefault();"), true);- } else if (aelements[i].attachEvent) {- aelements[i].attachEvent("onclick", new Function("",- "if (document.getElementById('slideProj').disabled) return;" +- "go("+dest+" - snum); " +- "event.returnValue = false;"));- }- }- }- }-}--function externalLinks() {- if (!document.getElementsByTagName) return;- var anchors = document.getElementsByTagName('a');- for (var i=0; i<anchors.length; i++) {- var anchor = anchors[i];- if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {- anchor.target = '_blank';- addClass(anchor,'external');- }- }-}--function createControls() {- var controlsDiv = document.getElementById("controls");- if (!controlsDiv) return;- var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';- var hideDiv, hideList = '';- if (controlVis == 'hidden') {- hideDiv = hider;- } else {- hideList = hider;- }- controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +- '<div id="navLinks">' +- '<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>' +- '<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>' +- '<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>' +- '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +- '<\/div><\/form>';- if (controlVis == 'hidden') {- var hidden = document.getElementById('navLinks');- } else {- var hidden = document.getElementById('jumplist');- }- addClass(hidden,'hideme');-}--function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers- if (!s5mode) return false;- var vScale = 22; // both yield 32 (after rounding) at 1024x768- var hScale = 32; // perhaps should auto-calculate based on theme's declared value?- if (window.innerHeight) {- var vSize = window.innerHeight;- var hSize = window.innerWidth;- } else if (document.documentElement.clientHeight) {- var vSize = document.documentElement.clientHeight;- var hSize = document.documentElement.clientWidth;- } else if (document.body.clientHeight) {- var vSize = document.body.clientHeight;- var hSize = document.body.clientWidth;- } else {- var vSize = 700; // assuming 1024x768, minus chrome and such- var hSize = 1024; // these do not account for kiosk mode or Opera Show- }- var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));- fontSize(newSize + 'px');- if (isGe) { // hack to counter incremental reflow bugs- var obj = document.getElementsByTagName('body')[0];- obj.style.display = 'none';- obj.style.display = 'block';- }-}--function fontSize(value) {- if (!(s5ss = document.getElementById('s5ss'))) {- if (!isIE) {- document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));- s5ss.setAttribute('media','screen, projection');- s5ss.setAttribute('id','s5ss');- } else {- document.createStyleSheet();- document.s5ss = document.styleSheets[document.styleSheets.length - 1];- }- }- if (!isIE) {- while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);- s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));- } else {- document.s5ss.addRule('body','font-size: ' + value + ' !important;');- }-}--function notOperaFix() {- slideCSS = document.getElementById('slideProj').href;- var slides = document.getElementById('slideProj');- var outline = document.getElementById('outlineStyle');- slides.setAttribute('media','screen');- outline.disabled = true;- if (isGe) {- slides.setAttribute('href','null'); // Gecko fix- slides.setAttribute('href',slideCSS); // Gecko fix- }- if (isIE && document.styleSheets && document.styleSheets[0]) {- document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');- document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');- document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');- }-}--function getIncrementals(obj) {- var incrementals = new Array();- if (!obj) - return incrementals;- var children = obj.childNodes;- for (var i = 0; i < children.length; i++) {- var child = children[i];- if (hasClass(child, 'incremental')) {- if (child.nodeName == 'OL' || child.nodeName == 'UL') {- removeClass(child, 'incremental');- for (var j = 0; j < child.childNodes.length; j++) {- if (child.childNodes[j].nodeType == 1) {- addClass(child.childNodes[j], 'incremental');- }- }- } else {- incrementals[incrementals.length] = child;- removeClass(child,'incremental');- }- }- if (hasClass(child, 'show-first')) {- if (child.nodeName == 'OL' || child.nodeName == 'UL') {- removeClass(child, 'show-first');- if (child.childNodes[isGe].nodeType == 1) {- removeClass(child.childNodes[isGe], 'incremental');- }- } else {- incrementals[incrementals.length] = child;- }- }- incrementals = incrementals.concat(getIncrementals(child));- }- return incrementals;-}--function createIncrementals() {- var incrementals = new Array();- for (var i = 0; i < smax; i++) {- incrementals[i] = getIncrementals(document.getElementById('slide'+i));- }- return incrementals;-}--function defaultCheck() {- var allMetas = document.getElementsByTagName('meta');- for (var i = 0; i< allMetas.length; i++) {- if (allMetas[i].name == 'defaultView') {- defaultView = allMetas[i].content;- }- if (allMetas[i].name == 'controlVis') {- controlVis = allMetas[i].content;- }- }-}--// Key trap fix, new function body for trap()-function trap(e) {- if (!e) {- e = event;- e.which = e.keyCode;- }- try {- modifierKey = e.ctrlKey || e.altKey || e.metaKey;- }- catch(e) {- modifierKey = false;- }- return modifierKey || e.which == 0;-}--function startup() {- defaultCheck();- if (!isOp) - createControls();- slideLabel();- fixLinks();- externalLinks();- fontScale();- if (!isOp) {- notOperaFix();- incrementals = createIncrementals();- slideJump();- if (defaultView == 'outline') {- toggle();- }- document.onkeyup = keys;- document.onkeypress = trap;- document.onclick = clicker;- }-}--window.onload = startup;-window.onresize = function(){setTimeout('fontScale()', 50);}</script>+/*+LaTeXMathML.js from http://math.etsu.edu/LaTeXMathML/+Adapted by Jeff Knisely and Douglas Woodall from ASCIIMathML.js v. 1.4.7,+(c) 2005 Peter Jipsen http://www.chapman.edu/~jipsen.++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;var notifyIfNoMathML=true;var alertIfNoMathML=false;var mathcolor="";var mathfontfamily="";var showasciiformulaonhover=true;var isIE=document.createElementNS==null;if(document.getElementById==null)+alert("This webpage requires a recent browser such as \nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")+function AMcreateElementXHTML(t){if(isIE)return document.createElement(t);else return document.createElementNS("http://www.w3.org/1999/xhtml",t);}+function AMnoMathMLNote(){var nd=AMcreateElementXHTML("h3");nd.setAttribute("align","center")+nd.appendChild(AMcreateElementXHTML("p"));nd.appendChild(document.createTextNode("To view the "));var an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("LaTeXMathML"));an.setAttribute("href","http://www.maths.nott.ac.uk/personal/drw/lm.html");nd.appendChild(an);nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));an=AMcreateElementXHTML("a");an.appendChild(document.createTextNode("MathPlayer"));an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");nd.appendChild(an);nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));nd.appendChild(AMcreateElementXHTML("p"));return nd;}+function AMisMathMLavailable(){if(navigator.appName.slice(0,8)=="Netscape")+if(navigator.appVersion.slice(0,1)>="5")return null;else return AMnoMathMLNote();else if(navigator.appName.slice(0,9)=="Microsoft")+try{var ActiveX=new ActiveXObject("MathPlayer.Factory.1");return null;}catch(e){return AMnoMathMLNote();}+else return AMnoMathMLNote();}+var AMcal=[0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];var AMfrk=[0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];var AMbbb=[0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];var CONST=0,UNARY=1,BINARY=2,INFIX=3,LEFTBRACKET=4,RIGHTBRACKET=5,SPACE=6,UNDEROVER=7,DEFINITION=8,TEXT=9,BIG=10,LONG=11,STRETCHY=12,MATRIX=13;var AMsqrt={input:"\\sqrt",tag:"msqrt",output:"sqrt",ttype:UNARY},AMroot={input:"\\root",tag:"mroot",output:"root",ttype:BINARY},AMfrac={input:"\\frac",tag:"mfrac",output:"/",ttype:BINARY},AMover={input:"\\stackrel",tag:"mover",output:"stackrel",ttype:BINARY},AMatop={input:"\\atop",tag:"mfrac",output:"",ttype:INFIX},AMchoose={input:"\\choose",tag:"mfrac",output:"",ttype:INFIX},AMsub={input:"_",tag:"msub",output:"_",ttype:INFIX},AMsup={input:"^",tag:"msup",output:"^",ttype:INFIX},AMtext={input:"\\mathrm",tag:"mtext",output:"text",ttype:TEXT},AMmbox={input:"\\mbox",tag:"mtext",output:"mbox",ttype:TEXT};var AMsymbols=[{input:"\\alpha",tag:"mi",output:"\u03B1",ttype:CONST},{input:"\\beta",tag:"mi",output:"\u03B2",ttype:CONST},{input:"\\gamma",tag:"mi",output:"\u03B3",ttype:CONST},{input:"\\delta",tag:"mi",output:"\u03B4",ttype:CONST},{input:"\\epsilon",tag:"mi",output:"\u03B5",ttype:CONST},{input:"\\varepsilon",tag:"mi",output:"\u025B",ttype:CONST},{input:"\\zeta",tag:"mi",output:"\u03B6",ttype:CONST},{input:"\\eta",tag:"mi",output:"\u03B7",ttype:CONST},{input:"\\theta",tag:"mi",output:"\u03B8",ttype:CONST},{input:"\\vartheta",tag:"mi",output:"\u03D1",ttype:CONST},{input:"\\iota",tag:"mi",output:"\u03B9",ttype:CONST},{input:"\\kappa",tag:"mi",output:"\u03BA",ttype:CONST},{input:"\\lambda",tag:"mi",output:"\u03BB",ttype:CONST},{input:"\\mu",tag:"mi",output:"\u03BC",ttype:CONST},{input:"\\nu",tag:"mi",output:"\u03BD",ttype:CONST},{input:"\\xi",tag:"mi",output:"\u03BE",ttype:CONST},{input:"\\pi",tag:"mi",output:"\u03C0",ttype:CONST},{input:"\\varpi",tag:"mi",output:"\u03D6",ttype:CONST},{input:"\\rho",tag:"mi",output:"\u03C1",ttype:CONST},{input:"\\varrho",tag:"mi",output:"\u03F1",ttype:CONST},{input:"\\varsigma",tag:"mi",output:"\u03C2",ttype:CONST},{input:"\\sigma",tag:"mi",output:"\u03C3",ttype:CONST},{input:"\\tau",tag:"mi",output:"\u03C4",ttype:CONST},{input:"\\upsilon",tag:"mi",output:"\u03C5",ttype:CONST},{input:"\\phi",tag:"mi",output:"\u03C6",ttype:CONST},{input:"\\varphi",tag:"mi",output:"\u03D5",ttype:CONST},{input:"\\chi",tag:"mi",output:"\u03C7",ttype:CONST},{input:"\\psi",tag:"mi",output:"\u03C8",ttype:CONST},{input:"\\omega",tag:"mi",output:"\u03C9",ttype:CONST},{input:"\\Gamma",tag:"mo",output:"\u0393",ttype:CONST},{input:"\\Delta",tag:"mo",output:"\u0394",ttype:CONST},{input:"\\Theta",tag:"mo",output:"\u0398",ttype:CONST},{input:"\\Lambda",tag:"mo",output:"\u039B",ttype:CONST},{input:"\\Xi",tag:"mo",output:"\u039E",ttype:CONST},{input:"\\Pi",tag:"mo",output:"\u03A0",ttype:CONST},{input:"\\Sigma",tag:"mo",output:"\u03A3",ttype:CONST},{input:"\\Upsilon",tag:"mo",output:"\u03A5",ttype:CONST},{input:"\\Phi",tag:"mo",output:"\u03A6",ttype:CONST},{input:"\\Psi",tag:"mo",output:"\u03A8",ttype:CONST},{input:"\\Omega",tag:"mo",output:"\u03A9",ttype:CONST},{input:"\\frac12",tag:"mo",output:"\u00BD",ttype:CONST},{input:"\\frac14",tag:"mo",output:"\u00BC",ttype:CONST},{input:"\\frac34",tag:"mo",output:"\u00BE",ttype:CONST},{input:"\\frac13",tag:"mo",output:"\u2153",ttype:CONST},{input:"\\frac23",tag:"mo",output:"\u2154",ttype:CONST},{input:"\\frac15",tag:"mo",output:"\u2155",ttype:CONST},{input:"\\frac25",tag:"mo",output:"\u2156",ttype:CONST},{input:"\\frac35",tag:"mo",output:"\u2157",ttype:CONST},{input:"\\frac45",tag:"mo",output:"\u2158",ttype:CONST},{input:"\\frac16",tag:"mo",output:"\u2159",ttype:CONST},{input:"\\frac56",tag:"mo",output:"\u215A",ttype:CONST},{input:"\\frac18",tag:"mo",output:"\u215B",ttype:CONST},{input:"\\frac38",tag:"mo",output:"\u215C",ttype:CONST},{input:"\\frac58",tag:"mo",output:"\u215D",ttype:CONST},{input:"\\frac78",tag:"mo",output:"\u215E",ttype:CONST},{input:"\\pm",tag:"mo",output:"\u00B1",ttype:CONST},{input:"\\mp",tag:"mo",output:"\u2213",ttype:CONST},{input:"\\triangleleft",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\triangleright",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\cdot",tag:"mo",output:"\u22C5",ttype:CONST},{input:"\\star",tag:"mo",output:"\u22C6",ttype:CONST},{input:"\\ast",tag:"mo",output:"\u002A",ttype:CONST},{input:"\\times",tag:"mo",output:"\u00D7",ttype:CONST},{input:"\\div",tag:"mo",output:"\u00F7",ttype:CONST},{input:"\\circ",tag:"mo",output:"\u2218",ttype:CONST},{input:"\\bullet",tag:"mo",output:"\u2022",ttype:CONST},{input:"\\oplus",tag:"mo",output:"\u2295",ttype:CONST},{input:"\\ominus",tag:"mo",output:"\u2296",ttype:CONST},{input:"\\otimes",tag:"mo",output:"\u2297",ttype:CONST},{input:"\\bigcirc",tag:"mo",output:"\u25CB",ttype:CONST},{input:"\\oslash",tag:"mo",output:"\u2298",ttype:CONST},{input:"\\odot",tag:"mo",output:"\u2299",ttype:CONST},{input:"\\land",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\wedge",tag:"mo",output:"\u2227",ttype:CONST},{input:"\\lor",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\vee",tag:"mo",output:"\u2228",ttype:CONST},{input:"\\cap",tag:"mo",output:"\u2229",ttype:CONST},{input:"\\cup",tag:"mo",output:"\u222A",ttype:CONST},{input:"\\sqcap",tag:"mo",output:"\u2293",ttype:CONST},{input:"\\sqcup",tag:"mo",output:"\u2294",ttype:CONST},{input:"\\uplus",tag:"mo",output:"\u228E",ttype:CONST},{input:"\\amalg",tag:"mo",output:"\u2210",ttype:CONST},{input:"\\bigtriangleup",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\bigtriangledown",tag:"mo",output:"\u25BD",ttype:CONST},{input:"\\dag",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\dagger",tag:"mo",output:"\u2020",ttype:CONST},{input:"\\ddag",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\ddagger",tag:"mo",output:"\u2021",ttype:CONST},{input:"\\lhd",tag:"mo",output:"\u22B2",ttype:CONST},{input:"\\rhd",tag:"mo",output:"\u22B3",ttype:CONST},{input:"\\unlhd",tag:"mo",output:"\u22B4",ttype:CONST},{input:"\\unrhd",tag:"mo",output:"\u22B5",ttype:CONST},{input:"\\sum",tag:"mo",output:"\u2211",ttype:UNDEROVER},{input:"\\prod",tag:"mo",output:"\u220F",ttype:UNDEROVER},{input:"\\bigcap",tag:"mo",output:"\u22C2",ttype:UNDEROVER},{input:"\\bigcup",tag:"mo",output:"\u22C3",ttype:UNDEROVER},{input:"\\bigwedge",tag:"mo",output:"\u22C0",ttype:UNDEROVER},{input:"\\bigvee",tag:"mo",output:"\u22C1",ttype:UNDEROVER},{input:"\\bigsqcap",tag:"mo",output:"\u2A05",ttype:UNDEROVER},{input:"\\bigsqcup",tag:"mo",output:"\u2A06",ttype:UNDEROVER},{input:"\\coprod",tag:"mo",output:"\u2210",ttype:UNDEROVER},{input:"\\bigoplus",tag:"mo",output:"\u2A01",ttype:UNDEROVER},{input:"\\bigotimes",tag:"mo",output:"\u2A02",ttype:UNDEROVER},{input:"\\bigodot",tag:"mo",output:"\u2A00",ttype:UNDEROVER},{input:"\\biguplus",tag:"mo",output:"\u2A04",ttype:UNDEROVER},{input:"\\int",tag:"mo",output:"\u222B",ttype:CONST},{input:"\\oint",tag:"mo",output:"\u222E",ttype:CONST},{input:":=",tag:"mo",output:":=",ttype:CONST},{input:"\\lt",tag:"mo",output:"<",ttype:CONST},{input:"\\gt",tag:"mo",output:">",ttype:CONST},{input:"\\ne",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\neq",tag:"mo",output:"\u2260",ttype:CONST},{input:"\\le",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leq",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\leqslant",tag:"mo",output:"\u2264",ttype:CONST},{input:"\\ge",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geq",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\geqslant",tag:"mo",output:"\u2265",ttype:CONST},{input:"\\equiv",tag:"mo",output:"\u2261",ttype:CONST},{input:"\\ll",tag:"mo",output:"\u226A",ttype:CONST},{input:"\\gg",tag:"mo",output:"\u226B",ttype:CONST},{input:"\\doteq",tag:"mo",output:"\u2250",ttype:CONST},{input:"\\prec",tag:"mo",output:"\u227A",ttype:CONST},{input:"\\succ",tag:"mo",output:"\u227B",ttype:CONST},{input:"\\preceq",tag:"mo",output:"\u227C",ttype:CONST},{input:"\\succeq",tag:"mo",output:"\u227D",ttype:CONST},{input:"\\subset",tag:"mo",output:"\u2282",ttype:CONST},{input:"\\supset",tag:"mo",output:"\u2283",ttype:CONST},{input:"\\subseteq",tag:"mo",output:"\u2286",ttype:CONST},{input:"\\supseteq",tag:"mo",output:"\u2287",ttype:CONST},{input:"\\sqsubset",tag:"mo",output:"\u228F",ttype:CONST},{input:"\\sqsupset",tag:"mo",output:"\u2290",ttype:CONST},{input:"\\sqsubseteq",tag:"mo",output:"\u2291",ttype:CONST},{input:"\\sqsupseteq",tag:"mo",output:"\u2292",ttype:CONST},{input:"\\sim",tag:"mo",output:"\u223C",ttype:CONST},{input:"\\simeq",tag:"mo",output:"\u2243",ttype:CONST},{input:"\\approx",tag:"mo",output:"\u2248",ttype:CONST},{input:"\\cong",tag:"mo",output:"\u2245",ttype:CONST},{input:"\\Join",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\bowtie",tag:"mo",output:"\u22C8",ttype:CONST},{input:"\\in",tag:"mo",output:"\u2208",ttype:CONST},{input:"\\ni",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\owns",tag:"mo",output:"\u220B",ttype:CONST},{input:"\\propto",tag:"mo",output:"\u221D",ttype:CONST},{input:"\\vdash",tag:"mo",output:"\u22A2",ttype:CONST},{input:"\\dashv",tag:"mo",output:"\u22A3",ttype:CONST},{input:"\\models",tag:"mo",output:"\u22A8",ttype:CONST},{input:"\\perp",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\smile",tag:"mo",output:"\u2323",ttype:CONST},{input:"\\frown",tag:"mo",output:"\u2322",ttype:CONST},{input:"\\asymp",tag:"mo",output:"\u224D",ttype:CONST},{input:"\\notin",tag:"mo",output:"\u2209",ttype:CONST},{input:"\\begin{eqnarray}",output:"X",ttype:MATRIX,invisible:true},{input:"\\begin{array}",output:"X",ttype:MATRIX,invisible:true},{input:"\\\\",output:"}&{",ttype:DEFINITION},{input:"\\end{eqnarray}",output:"}}",ttype:DEFINITION},{input:"\\end{array}",output:"}}",ttype:DEFINITION},{input:"\\big",tag:"mo",output:"X",atval:"1.2",ieval:"2.2",ttype:BIG},{input:"\\Big",tag:"mo",output:"X",atval:"1.6",ieval:"2.6",ttype:BIG},{input:"\\bigg",tag:"mo",output:"X",atval:"2.2",ieval:"3.2",ttype:BIG},{input:"\\Bigg",tag:"mo",output:"X",atval:"2.9",ieval:"3.9",ttype:BIG},{input:"\\left",tag:"mo",output:"X",ttype:LEFTBRACKET},{input:"\\right",tag:"mo",output:"X",ttype:RIGHTBRACKET},{input:"{",output:"{",ttype:LEFTBRACKET,invisible:true},{input:"}",output:"}",ttype:RIGHTBRACKET,invisible:true},{input:"(",tag:"mo",output:"(",atval:"1",ttype:STRETCHY},{input:"[",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\lbrack",tag:"mo",output:"[",atval:"1",ttype:STRETCHY},{input:"\\{",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\lbrace",tag:"mo",output:"{",atval:"1",ttype:STRETCHY},{input:"\\langle",tag:"mo",output:"\u2329",atval:"1",ttype:STRETCHY},{input:"\\lfloor",tag:"mo",output:"\u230A",atval:"1",ttype:STRETCHY},{input:"\\lceil",tag:"mo",output:"\u2308",atval:"1",ttype:STRETCHY},{input:")",tag:"mo",output:")",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"]",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrack",tag:"mo",output:"]",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\}",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rbrace",tag:"mo",output:"}",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rangle",tag:"mo",output:"\u232A",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rfloor",tag:"mo",output:"\u230B",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"\\rceil",tag:"mo",output:"\u2309",rtag:"mi",atval:"1",ttype:STRETCHY},{input:"|",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\|",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\vert",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\Vert",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"\\mid",tag:"mo",output:"\u2223",atval:"1",ttype:STRETCHY},{input:"\\parallel",tag:"mo",output:"\u2225",atval:"1",ttype:STRETCHY},{input:"/",tag:"mo",output:"/",atval:"1.01",ttype:STRETCHY},{input:"\\backslash",tag:"mo",output:"\u2216",atval:"1",ttype:STRETCHY},{input:"\\setminus",tag:"mo",output:"\\",ttype:CONST},{input:"\\!",tag:"mspace",atname:"width",atval:"-0.167em",ttype:SPACE},{input:"\\,",tag:"mspace",atname:"width",atval:"0.167em",ttype:SPACE},{input:"\\>",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\:",tag:"mspace",atname:"width",atval:"0.222em",ttype:SPACE},{input:"\\;",tag:"mspace",atname:"width",atval:"0.278em",ttype:SPACE},{input:"~",tag:"mspace",atname:"width",atval:"0.333em",ttype:SPACE},{input:"\\quad",tag:"mspace",atname:"width",atval:"1em",ttype:SPACE},{input:"\\qquad",tag:"mspace",atname:"width",atval:"2em",ttype:SPACE},{input:"\\prime",tag:"mo",output:"\u2032",ttype:CONST},{input:"'",tag:"mo",output:"\u02B9",ttype:CONST},{input:"''",tag:"mo",output:"\u02BA",ttype:CONST},{input:"'''",tag:"mo",output:"\u2034",ttype:CONST},{input:"''''",tag:"mo",output:"\u2057",ttype:CONST},{input:"\\ldots",tag:"mo",output:"\u2026",ttype:CONST},{input:"\\cdots",tag:"mo",output:"\u22EF",ttype:CONST},{input:"\\vdots",tag:"mo",output:"\u22EE",ttype:CONST},{input:"\\ddots",tag:"mo",output:"\u22F1",ttype:CONST},{input:"\\forall",tag:"mo",output:"\u2200",ttype:CONST},{input:"\\exists",tag:"mo",output:"\u2203",ttype:CONST},{input:"\\Re",tag:"mo",output:"\u211C",ttype:CONST},{input:"\\Im",tag:"mo",output:"\u2111",ttype:CONST},{input:"\\aleph",tag:"mo",output:"\u2135",ttype:CONST},{input:"\\hbar",tag:"mo",output:"\u210F",ttype:CONST},{input:"\\ell",tag:"mo",output:"\u2113",ttype:CONST},{input:"\\wp",tag:"mo",output:"\u2118",ttype:CONST},{input:"\\emptyset",tag:"mo",output:"\u2205",ttype:CONST},{input:"\\infty",tag:"mo",output:"\u221E",ttype:CONST},{input:"\\surd",tag:"mo",output:"\\sqrt{}",ttype:DEFINITION},{input:"\\partial",tag:"mo",output:"\u2202",ttype:CONST},{input:"\\nabla",tag:"mo",output:"\u2207",ttype:CONST},{input:"\\triangle",tag:"mo",output:"\u25B3",ttype:CONST},{input:"\\therefore",tag:"mo",output:"\u2234",ttype:CONST},{input:"\\angle",tag:"mo",output:"\u2220",ttype:CONST},{input:"\\diamond",tag:"mo",output:"\u22C4",ttype:CONST},{input:"\\Diamond",tag:"mo",output:"\u25C7",ttype:CONST},{input:"\\neg",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\lnot",tag:"mo",output:"\u00AC",ttype:CONST},{input:"\\bot",tag:"mo",output:"\u22A5",ttype:CONST},{input:"\\top",tag:"mo",output:"\u22A4",ttype:CONST},{input:"\\square",tag:"mo",output:"\u25AB",ttype:CONST},{input:"\\Box",tag:"mo",output:"\u25A1",ttype:CONST},{input:"\\wr",tag:"mo",output:"\u2240",ttype:CONST},{input:"\\arccos",tag:"mi",output:"arccos",ttype:UNARY,func:true},{input:"\\arcsin",tag:"mi",output:"arcsin",ttype:UNARY,func:true},{input:"\\arctan",tag:"mi",output:"arctan",ttype:UNARY,func:true},{input:"\\arg",tag:"mi",output:"arg",ttype:UNARY,func:true},{input:"\\cos",tag:"mi",output:"cos",ttype:UNARY,func:true},{input:"\\cosh",tag:"mi",output:"cosh",ttype:UNARY,func:true},{input:"\\cot",tag:"mi",output:"cot",ttype:UNARY,func:true},{input:"\\coth",tag:"mi",output:"coth",ttype:UNARY,func:true},{input:"\\csc",tag:"mi",output:"csc",ttype:UNARY,func:true},{input:"\\deg",tag:"mi",output:"deg",ttype:UNARY,func:true},{input:"\\det",tag:"mi",output:"det",ttype:UNARY,func:true},{input:"\\dim",tag:"mi",output:"dim",ttype:UNARY,func:true},{input:"\\exp",tag:"mi",output:"exp",ttype:UNARY,func:true},{input:"\\gcd",tag:"mi",output:"gcd",ttype:UNARY,func:true},{input:"\\hom",tag:"mi",output:"hom",ttype:UNARY,func:true},{input:"\\inf",tag:"mo",output:"inf",ttype:UNDEROVER},{input:"\\ker",tag:"mi",output:"ker",ttype:UNARY,func:true},{input:"\\lg",tag:"mi",output:"lg",ttype:UNARY,func:true},{input:"\\lim",tag:"mo",output:"lim",ttype:UNDEROVER},{input:"\\liminf",tag:"mo",output:"liminf",ttype:UNDEROVER},{input:"\\limsup",tag:"mo",output:"limsup",ttype:UNDEROVER},{input:"\\ln",tag:"mi",output:"ln",ttype:UNARY,func:true},{input:"\\log",tag:"mi",output:"log",ttype:UNARY,func:true},{input:"\\max",tag:"mo",output:"max",ttype:UNDEROVER},{input:"\\min",tag:"mo",output:"min",ttype:UNDEROVER},{input:"\\Pr",tag:"mi",output:"Pr",ttype:UNARY,func:true},{input:"\\sec",tag:"mi",output:"sec",ttype:UNARY,func:true},{input:"\\sin",tag:"mi",output:"sin",ttype:UNARY,func:true},{input:"\\sinh",tag:"mi",output:"sinh",ttype:UNARY,func:true},{input:"\\sup",tag:"mo",output:"sup",ttype:UNDEROVER},{input:"\\tan",tag:"mi",output:"tan",ttype:UNARY,func:true},{input:"\\tanh",tag:"mi",output:"tanh",ttype:UNARY,func:true},{input:"\\gets",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\leftarrow",tag:"mo",output:"\u2190",ttype:CONST},{input:"\\to",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\rightarrow",tag:"mo",output:"\u2192",ttype:CONST},{input:"\\leftrightarrow",tag:"mo",output:"\u2194",ttype:CONST},{input:"\\uparrow",tag:"mo",output:"\u2191",ttype:CONST},{input:"\\downarrow",tag:"mo",output:"\u2193",ttype:CONST},{input:"\\updownarrow",tag:"mo",output:"\u2195",ttype:CONST},{input:"\\Leftarrow",tag:"mo",output:"\u21D0",ttype:CONST},{input:"\\Rightarrow",tag:"mo",output:"\u21D2",ttype:CONST},{input:"\\Leftrightarrow",tag:"mo",output:"\u21D4",ttype:CONST},{input:"\\iff",tag:"mo",output:"~\\Longleftrightarrow~",ttype:DEFINITION},{input:"\\Uparrow",tag:"mo",output:"\u21D1",ttype:CONST},{input:"\\Downarrow",tag:"mo",output:"\u21D3",ttype:CONST},{input:"\\Updownarrow",tag:"mo",output:"\u21D5",ttype:CONST},{input:"\\mapsto",tag:"mo",output:"\u21A6",ttype:CONST},{input:"\\longleftarrow",tag:"mo",output:"\u2190",ttype:LONG},{input:"\\longrightarrow",tag:"mo",output:"\u2192",ttype:LONG},{input:"\\longleftrightarrow",tag:"mo",output:"\u2194",ttype:LONG},{input:"\\Longleftarrow",tag:"mo",output:"\u21D0",ttype:LONG},{input:"\\Longrightarrow",tag:"mo",output:"\u21D2",ttype:LONG},{input:"\\Longleftrightarrow",tag:"mo",output:"\u21D4",ttype:LONG},{input:"\\longmapsto",tag:"mo",output:"\u21A6",ttype:CONST},AMsqrt,AMroot,AMfrac,AMover,AMsub,AMsup,AMtext,AMmbox,AMatop,AMchoose,{input:"\\acute",tag:"mover",output:"\u00B4",ttype:UNARY,acc:true},{input:"\\grave",tag:"mover",output:"\u0060",ttype:UNARY,acc:true},{input:"\\breve",tag:"mover",output:"\u02D8",ttype:UNARY,acc:true},{input:"\\check",tag:"mover",output:"\u02C7",ttype:UNARY,acc:true},{input:"\\dot",tag:"mover",output:".",ttype:UNARY,acc:true},{input:"\\ddot",tag:"mover",output:"..",ttype:UNARY,acc:true},{input:"\\mathring",tag:"mover",output:"\u00B0",ttype:UNARY,acc:true},{input:"\\vec",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overrightarrow",tag:"mover",output:"\u20D7",ttype:UNARY,acc:true},{input:"\\overleftarrow",tag:"mover",output:"\u20D6",ttype:UNARY,acc:true},{input:"\\hat",tag:"mover",output:"\u005E",ttype:UNARY,acc:true},{input:"\\widehat",tag:"mover",output:"\u0302",ttype:UNARY,acc:true},{input:"\\tilde",tag:"mover",output:"~",ttype:UNARY,acc:true},{input:"\\widetilde",tag:"mover",output:"\u02DC",ttype:UNARY,acc:true},{input:"\\bar",tag:"mover",output:"\u203E",ttype:UNARY,acc:true},{input:"\\overbrace",tag:"mover",output:"\uFE37",ttype:UNARY,acc:true},{input:"\\overbracket",tag:"mover",output:"\u23B4",ttype:UNARY,acc:true},{input:"\\overline",tag:"mover",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\underbrace",tag:"munder",output:"\uFE38",ttype:UNARY,acc:true},{input:"\\underbracket",tag:"munder",output:"\u23B5",ttype:UNARY,acc:true},{input:"\\underline",tag:"munder",output:"\u00AF",ttype:UNARY,acc:true},{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true",ttype:UNARY},{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false",ttype:UNARY},{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1",ttype:UNARY},{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2",ttype:UNARY},{input:"\\textrm",tag:"mstyle",output:"\\mathrm",ttype:DEFINITION},{input:"\\mathbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\textbf",tag:"mstyle",atname:"mathvariant",atval:"bold",ttype:UNARY},{input:"\\mathit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\textit",tag:"mstyle",atname:"mathvariant",atval:"italic",ttype:UNARY},{input:"\\mathtt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\texttt",tag:"mstyle",atname:"mathvariant",atval:"monospace",ttype:UNARY},{input:"\\mathsf",tag:"mstyle",atname:"mathvariant",atval:"sans-serif",ttype:UNARY},{input:"\\mathbb",tag:"mstyle",atname:"mathvariant",atval:"double-struck",ttype:UNARY,codes:AMbbb},{input:"\\mathcal",tag:"mstyle",atname:"mathvariant",atval:"script",ttype:UNARY,codes:AMcal},{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant",atval:"fraktur",ttype:UNARY,codes:AMfrk},{input:"\\textcolor",tag:"mstyle",atname:"mathvariant",atval:"mathcolor",ttype:BINARY},{input:"\\colorbox",tag:"mstyle",atname:"mathvariant",atval:"background",ttype:BINARY}];function compareNames(s1,s2){if(s1.input>s2.input)return 1+else return-1;}+var AMnames=[];function AMinitSymbols(){AMsymbols.sort(compareNames);for(i=0;i<AMsymbols.length;i++)AMnames[i]=AMsymbols[i].input;}+var AMmathml="http://www.w3.org/1998/Math/MathML";function AMcreateElementMathML(t){if(isIE)return document.createElement("m:"+t);else return document.createElementNS(AMmathml,t);}+function AMcreateMmlNode(t,frag){if(isIE)var node=document.createElement("m:"+t);else var node=document.createElementNS(AMmathml,t);node.appendChild(frag);return node;}+function newcommand(oldstr,newstr){AMsymbols=AMsymbols.concat([{input:oldstr,tag:"mo",output:newstr,ttype:DEFINITION}]);}+function AMremoveCharsAndBlanks(str,n){var st;st=str.slice(n);for(var i=0;i<st.length&&st.charCodeAt(i)<=32;i=i+1);return st.slice(i);}+function AMposition(arr,str,n){if(n==0){var h,m;n=-1;h=arr.length;while(n+1<h){m=(n+h)>>1;if(arr[m]<str)n=m;else h=m;}+return h;}else+for(var i=n;i<arr.length&&arr[i]<str;i++);return i;}+function AMgetSymbol(str){var k=0;var j=0;var mk;var st;var tagst;var match="";var more=true;for(var i=1;i<=str.length&&more;i++){st=str.slice(0,i);j=k;k=AMposition(AMnames,st,j);if(k<AMnames.length&&str.slice(0,AMnames[k].length)==AMnames[k]){match=AMnames[k];mk=k;i=match.length;}+more=k<AMnames.length&&str.slice(0,AMnames[k].length)>=AMnames[k];}+AMpreviousSymbol=AMcurrentSymbol;if(match!=""){AMcurrentSymbol=AMsymbols[mk].ttype;return AMsymbols[mk];}+AMcurrentSymbol=CONST;k=1;st=str.slice(0,1);if("0"<=st&&st<="9")tagst="mn";else tagst=(("A">st||st>"Z")&&("a">st||st>"z")?"mo":"mi");return{input:st,tag:tagst,output:st,ttype:CONST};}+var AMpreviousSymbol,AMcurrentSymbol;function AMparseSexpr(str){var symbol,node,result,result2,i,st,newFrag=document.createDocumentFragment();str=AMremoveCharsAndBlanks(str,0);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)+return[null,str,null];if(symbol.ttype==DEFINITION){str=symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol==null||symbol.ttype==RIGHTBRACKET)+return[null,str,null];}+str=AMremoveCharsAndBlanks(str,symbol.input.length);switch(symbol.ttype){case SPACE:node=AMcreateElementMathML(symbol.tag);node.setAttribute(symbol.atname,symbol.atval);return[node,str,symbol.tag];case UNDEROVER:if(isIE){if(symbol.input.substr(0,4)=="\\big"){str="\\"+symbol.input.substr(4)+str;symbol=AMgetSymbol(str);symbol.ttype=UNDEROVER;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}+return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];case CONST:var output=symbol.output;if(isIE){if(symbol.input=="'")+output="\u2032";else if(symbol.input=="''")+output="\u2033";else if(symbol.input=="'''")+output="\u2033\u2032";else if(symbol.input=="''''")+output="\u2033\u2033";else if(symbol.input=="\\square")+output="\u25A1";else if(symbol.input.substr(0,5)=="\\frac"){var denom=symbol.input.substr(6,1);if(denom=="5"||denom=="6"){str=symbol.input.replace(/\\frac/,"\\frac ")+str;return[node,str,symbol.tag];}}}+node=AMcreateMmlNode(symbol.tag,document.createTextNode(output));return[node,str,symbol.tag];case LONG:node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));node.setAttribute("minsize","1.5");node.setAttribute("maxsize","1.5");node=AMcreateMmlNode("mover",node);node.appendChild(AMcreateElementMathML("mspace"));return[node,str,symbol.tag];case STRETCHY:if(isIE&&symbol.input=="\\backslash")+symbol.output="\\";node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(symbol.input=="|"||symbol.input=="\\vert"||symbol.input=="\\|"||symbol.input=="\\Vert"){node.setAttribute("lspace","0em");node.setAttribute("rspace","0em");}+node.setAttribute("maxsize",symbol.atval);if(symbol.rtag!=null)+return[node,str,symbol.rtag];else+return[node,str,symbol.tag];case BIG:var atval=symbol.atval;if(isIE)+atval=symbol.ieval;symbol=AMgetSymbol(str);if(symbol==null)+return[null,str,null];str=AMremoveCharsAndBlanks(str,symbol.input.length);node=AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height",atval+"ex");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}else{node.setAttribute("minsize",atval);node.setAttribute("maxsize",atval);}+return[node,str,symbol.tag];case LEFTBRACKET:if(symbol.input=="\\left"){symbol=AMgetSymbol(str);if(symbol!=null){if(symbol.input==".")+symbol.invisible=true;str=AMremoveCharsAndBlanks(str,symbol.input.length);}}+result=AMparseExpr(str,true,false);if(symbol==null||(typeof symbol.invisible=="boolean"&&symbol.invisible))+node=AMcreateMmlNode("mrow",result[0]);else{node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));node=AMcreateMmlNode("mrow",node);node.appendChild(result[0]);}+return[node,result[1],result[2]];case MATRIX:if(symbol.input=="\\begin{array}"){var mask="";symbol=AMgetSymbol(str);str=AMremoveCharsAndBlanks(str,0);if(symbol==null)+mask="l";else{str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="{")+mask="l";else do{symbol=AMgetSymbol(str);if(symbol!=null){str=AMremoveCharsAndBlanks(str,symbol.input.length);if(symbol.input!="}")+mask=mask+symbol.input;}}while(symbol!=null&&symbol.input!=""&&symbol.input!="}");}+result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);mask=mask.replace(/l/g,"left ");mask=mask.replace(/r/g,"right ");mask=mask.replace(/c/g,"center ");node.setAttribute("columnalign",mask);node.setAttribute("displaystyle","false");if(isIE)+return[node,result[1],null];var lspace=AMcreateElementMathML("mspace");lspace.setAttribute("width","0.167em");var rspace=AMcreateElementMathML("mspace");rspace.setAttribute("width","0.167em");var node1=AMcreateMmlNode("mrow",lspace);node1.appendChild(node);node1.appendChild(rspace);return[node1,result[1],null];}else{result=AMparseExpr("{"+str,true,true);node=AMcreateMmlNode("mtable",result[0]);if(isIE)+node.setAttribute("columnspacing","0.25em");else+node.setAttribute("columnspacing","0.167em");node.setAttribute("columnalign","right center left");node.setAttribute("displaystyle","true");node=AMcreateMmlNode("mrow",node);return[node,result[1],null];}+case TEXT:if(str.charAt(0)=="{")i=str.indexOf("}");else i=0;if(i==-1)+i=str.length;st=str.slice(1,i);if(st.charAt(0)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}+newFrag.appendChild(AMcreateMmlNode(symbol.tag,document.createTextNode(st)));if(st.charAt(st.length-1)==" "){node=AMcreateElementMathML("mspace");node.setAttribute("width","0.33em");newFrag.appendChild(node);}+str=AMremoveCharsAndBlanks(str,i+1);return[AMcreateMmlNode("mrow",newFrag),str,null];case UNARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str];if(typeof symbol.func=="boolean"&&symbol.func){st=str.charAt(0);if(st=="^"||st=="_"||st==","){return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}else{node=AMcreateMmlNode("mrow",AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node.appendChild(space);}+node.appendChild(result[0]);return[node,result[1],symbol.tag];}}+if(symbol.input=="\\sqrt"){if(isIE){var space=AMcreateElementMathML("mspace");space.setAttribute("height","1.2ex");space.setAttribute("width","0em");node=AMcreateMmlNode(symbol.tag,result[0])+node.appendChild(space);return[node,result[1],symbol.tag];}else+return[AMcreateMmlNode(symbol.tag,result[0]),result[1],symbol.tag];}else if(typeof symbol.acc=="boolean"&&symbol.acc){node=AMcreateMmlNode(symbol.tag,result[0]);var output=symbol.output;if(isIE){if(symbol.input=="\\hat")+output="\u0302";else if(symbol.input=="\\widehat")+output="\u005E";else if(symbol.input=="\\bar")+output="\u00AF";else if(symbol.input=="\\grave")+output="\u0300";else if(symbol.input=="\\tilde")+output="\u0303";}+var node1=AMcreateMmlNode("mo",document.createTextNode(output));if(symbol.input=="\\vec"||symbol.input=="\\check")+node1.setAttribute("maxsize","1.2");if(isIE&&symbol.input=="\\bar")+node1.setAttribute("maxsize","0.5");if(symbol.input=="\\underbrace"||symbol.input=="\\underline")+node1.setAttribute("accentunder","true");else+node1.setAttribute("accent","true");node.appendChild(node1);if(symbol.input=="\\overbrace"||symbol.input=="\\underbrace")+node.ttype=UNDEROVER;return[node,result[1],symbol.tag];}else{if(!isIE&&typeof symbol.codes!="undefined"){for(i=0;i<result[0].childNodes.length;i++)+if(result[0].childNodes[i].nodeName=="mi"||result[0].nodeName=="mi"){st=(result[0].nodeName=="mi"?result[0].firstChild.nodeValue:result[0].childNodes[i].firstChild.nodeValue);var newst=[];for(var j=0;j<st.length;j++)+if(st.charCodeAt(j)>64&&st.charCodeAt(j)<91)newst=newst++String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);else newst=newst+st.charAt(j);if(result[0].nodeName=="mi")+result[0]=AMcreateElementMathML("mo").appendChild(document.createTextNode(newst));else result[0].replaceChild(AMcreateElementMathML("mo").appendChild(document.createTextNode(newst)),result[0].childNodes[i]);}}+node=AMcreateMmlNode(symbol.tag,result[0]);node.setAttribute(symbol.atname,symbol.atval);if(symbol.input=="\\scriptstyle"||symbol.input=="\\scriptscriptstyle")+node.setAttribute("displaystyle","false");return[node,result[1],symbol.tag];}+case BINARY:result=AMparseSexpr(str);if(result[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];result2=AMparseSexpr(result[1]);if(result2[0]==null)return[AMcreateMmlNode("mo",document.createTextNode(symbol.input)),str,null];if(symbol.input=="\\textcolor"||symbol.input=="\\colorbox"){var tclr=str.match(/\{\s*([#\w]+)\s*\}/);str=str.replace(/\{\s*[#\w]+\s*\}/,"");if(tclr!=null){if(IsColorName.test(tclr[1].toLowerCase())){tclr=LaTeXColor[tclr[1].toLowerCase()];}else{tclr=tclr[1];}+node=AMcreateElementMathML("mstyle");node.setAttribute(symbol.atval,tclr);node.appendChild(result2[0]);return[node,result2[1],symbol.tag];}}+if(symbol.input=="\\root"||symbol.input=="\\stackrel")newFrag.appendChild(result2[0]);newFrag.appendChild(result[0]);if(symbol.input=="\\frac")newFrag.appendChild(result2[0]);return[AMcreateMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];case INFIX:str=AMremoveCharsAndBlanks(str,symbol.input.length);return[AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str,symbol.tag];default:return[AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)),str,symbol.tag];}}+function AMparseIexpr(str){var symbol,sym1,sym2,node,result,tag,underover;str=AMremoveCharsAndBlanks(str,0);sym1=AMgetSymbol(str);result=AMparseSexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(symbol.ttype==INFIX){str=AMremoveCharsAndBlanks(str,symbol.input.length);result=AMparseSexpr(str);if(result[0]==null)+result[0]=AMcreateMmlNode("mo",document.createTextNode("\u25A1"));str=result[1];tag=result[2];if(symbol.input=="_"||symbol.input=="^"){sym2=AMgetSymbol(str);tag=null;underover=((sym1.ttype==UNDEROVER)||(node.ttype==UNDEROVER));if(symbol.input=="_"&&sym2.input=="^"){str=AMremoveCharsAndBlanks(str,sym2.input.length);var res2=AMparseSexpr(str);str=res2[1];tag=res2[2];node=AMcreateMmlNode((underover?"munderover":"msubsup"),node);node.appendChild(result[0]);node.appendChild(res2[0]);}else if(symbol.input=="_"){node=AMcreateMmlNode((underover?"munder":"msub"),node);node.appendChild(result[0]);}else{node=AMcreateMmlNode((underover?"mover":"msup"),node);node.appendChild(result[0]);}+node=AMcreateMmlNode("mrow",node);}else{node=AMcreateMmlNode(symbol.tag,node);if(symbol.input=="\\atop"||symbol.input=="\\choose")+node.setAttribute("linethickness","0ex");node.appendChild(result[0]);if(symbol.input=="\\choose")+node=AMcreateMmlNode("mfenced",node);}}+return[node,str,tag];}+function AMparseExpr(str,rightbracket,matrix){var symbol,node,result,i,tag,newFrag=document.createDocumentFragment();do{str=AMremoveCharsAndBlanks(str,0);result=AMparseIexpr(str);node=result[0];str=result[1];tag=result[2];symbol=AMgetSymbol(str);if(node!=undefined){if((tag=="mn"||tag=="mi")&&symbol!=null&&typeof symbol.func=="boolean"&&symbol.func){var space=AMcreateElementMathML("mspace");space.setAttribute("width","0.167em");node=AMcreateMmlNode("mrow",node);node.appendChild(space);}+newFrag.appendChild(node);}}while((symbol.ttype!=RIGHTBRACKET)&&symbol!=null&&symbol.output!="");tag=null;if(symbol.ttype==RIGHTBRACKET){if(symbol.input=="\\right"){str=AMremoveCharsAndBlanks(str,symbol.input.length);symbol=AMgetSymbol(str);if(symbol!=null&&symbol.input==".")+symbol.invisible=true;if(symbol!=null)+tag=symbol.rtag;}+if(symbol!=null)+str=AMremoveCharsAndBlanks(str,symbol.input.length);var len=newFrag.childNodes.length;if(matrix&&len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue=="&"){var pos=[];var m=newFrag.childNodes.length;for(i=0;matrix&&i<m;i=i+2){pos[i]=[];node=newFrag.childNodes[i];for(var j=0;j<node.childNodes.length;j++)+if(node.childNodes[j].firstChild.nodeValue=="&")+pos[i][pos[i].length]=j;}+var row,frag,n,k,table=document.createDocumentFragment();for(i=0;i<m;i=i+2){row=document.createDocumentFragment();frag=document.createDocumentFragment();node=newFrag.firstChild;n=node.childNodes.length;k=0;for(j=0;j<n;j++){if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){node.removeChild(node.firstChild);row.appendChild(AMcreateMmlNode("mtd",frag));k++;}else frag.appendChild(node.firstChild);}+row.appendChild(AMcreateMmlNode("mtd",frag));if(newFrag.childNodes.length>2){newFrag.removeChild(newFrag.firstChild);newFrag.removeChild(newFrag.firstChild);}+table.appendChild(AMcreateMmlNode("mtr",row));}+return[table,str];}+if(typeof symbol.invisible!="boolean"||!symbol.invisible){node=AMcreateMmlNode("mo",document.createTextNode(symbol.output));newFrag.appendChild(node);}}+return[newFrag,str,tag];}+function AMparseMath(str){var result,node=AMcreateElementMathML("mstyle");var cclr=str.match(/\\color\s*\{\s*([#\w]+)\s*\}/);str=str.replace(/\\color\s*\{\s*[#\w]+\s*\}/g,"");if(cclr!=null){if(IsColorName.test(cclr[1].toLowerCase())){cclr=LaTeXColor[cclr[1].toLowerCase()];}else{cclr=cclr[1];}+node.setAttribute("mathcolor",cclr);}else{if(mathcolor!="")node.setAttribute("mathcolor",mathcolor);};if(mathfontfamily!="")node.setAttribute("fontfamily",mathfontfamily);node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false,false)[0]);node=AMcreateMmlNode("math",node);if(showasciiformulaonhover)+node.setAttribute("title",str.replace(/\s+/g," "));if(false){var fnode=AMcreateElementXHTML("font");fnode.setAttribute("face",mathfontfamily);fnode.appendChild(node);return fnode;}+return node;}+function AMstrarr2docFrag(arr,linebreaks){var newFrag=document.createDocumentFragment();var expr=false;for(var i=0;i<arr.length;i++){if(expr)newFrag.appendChild(AMparseMath(arr[i]));else{var arri=(linebreaks?arr[i].split("\n\n"):[arr[i]]);newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[0])));for(var j=1;j<arri.length;j++){newFrag.appendChild(AMcreateElementXHTML("p"));newFrag.appendChild(AMcreateElementXHTML("span").appendChild(document.createTextNode(arri[j])));}}+expr=!expr;}+return newFrag;}+function AMprocessNodeR(n,linebreaks){var mtch,str,arr,frg,i;if(n.childNodes.length==0){if((n.nodeType!=8||linebreaks)&&n.parentNode.nodeName!="form"&&n.parentNode.nodeName!="FORM"&&n.parentNode.nodeName!="textarea"&&n.parentNode.nodeName!="TEXTAREA"&&n.parentNode.nodeName!="pre"&&n.parentNode.nodeName!="PRE"){str=n.nodeValue;if(!(str==null)){str=str.replace(/\r\n\r\n/g,"\n\n");str=str.replace(/\x20+/g," ");str=str.replace(/\s*\r\n/g," ");mtch=(str.indexOf("\$")==-1?false:true);str=str.replace(/([^\\])\$/g,"$1 \$");str=str.replace(/^\$/," \$");arr=str.split(" \$");for(i=0;i<arr.length;i++)+arr[i]=arr[i].replace(/\\\$/g,"\$");if(arr.length>1||mtch){if(checkForMathML){checkForMathML=false;var nd=AMisMathMLavailable();AMnoMathML=nd!=null;if(AMnoMathML&¬ifyIfNoMathML)+if(alertIfNoMathML)+alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\nor Firefox/Mozilla/Netscape");else AMbody.insertBefore(nd,AMbody.childNodes[0]);}+if(!AMnoMathML){frg=AMstrarr2docFrag(arr,n.nodeType==8);var len=frg.childNodes.length;n.parentNode.replaceChild(frg,n);return len-1;}else return 0;}}}else return 0;}else if(n.nodeName!="math"){for(i=0;i<n.childNodes.length;i++)+i+=AMprocessNodeR(n.childNodes[i],linebreaks);}+return 0;}+function AMprocessNode(n,linebreaks,spanclassAM){var frag,st;if(spanclassAM!=null){frag=document.getElementsByTagName("span")+for(var i=0;i<frag.length;i++)+if(frag[i].className=="AM")+AMprocessNodeR(frag[i],linebreaks);}else{try{st=n.innerHTML;}catch(err){}+if(st==null||st.indexOf("\$")!=-1)+AMprocessNodeR(n,linebreaks);}+if(isIE){frag=document.getElementsByTagName('math');for(var i=0;i<frag.length;i++)frag[i].update()}}+var inAppendix=false;var sectionCntr=0;var IEcommentWarning=true;var biblist=[];var bibcntr=0;var LaTeXCounter=[];LaTeXCounter["definition"]=0;LaTeXCounter["proposition"]=0;LaTeXCounter["lemma"]=0;LaTeXCounter["theorem"]=0;LaTeXCounter["corollary"]=0;LaTeXCounter["example"]=0;LaTeXCounter["exercise"]=0;LaTeXCounter["subsection"]=0;LaTeXCounter["subsubsection"]=0;LaTeXCounter["figure"]=0;LaTeXCounter["equation"]=0;LaTeXCounter["table"]=0;var LaTeXColor=[];LaTeXColor["greenyellow"]="#D9FF4F";LaTeXColor["yellow"]="#FFFF00";LaTeXColor["goldenrod"]="#FFE529";LaTeXColor["dandelion"]="#FFB529";LaTeXColor["apricot"]="#FFAD7A";LaTeXColor["peach"]="#FF804D";LaTeXColor["melon"]="#FF8A80";LaTeXColor["yelloworange"]="#FF9400";LaTeXColor["orange"]="#FF6321";LaTeXColor["burntorange"]="#FF7D00";LaTeXColor["bittersweet"]="#C20300";LaTeXColor["redorange"]="#FF3B21";LaTeXColor["mahogany"]="#A60000";LaTeXColor["maroon"]="#AD0000";LaTeXColor["brickred"]="#B80000";LaTeXColor["red"]="#FF0000";LaTeXColor["orangered"]="#FF0080";LaTeXColor["rubinered"]="#FF00DE";LaTeXColor["wildstrawberry"]="#FF0A9C";LaTeXColor["salmon"]="#FF789E";LaTeXColor["carnationpink"]="#FF5EFF";LaTeXColor["magenta"]="#FF00FF";LaTeXColor["violetred"]="#FF30FF";LaTeXColor["rhodamine"]="#FF2EFF";LaTeXColor["mulberry"]="#A314FA";LaTeXColor["redviolet"]="#9600A8";LaTeXColor["fuchsia"]="#7303EB";LaTeXColor["lavender"]="#FF85FF";LaTeXColor["thistle"]="#E069FF";LaTeXColor["orchid"]="#AD5CFF";LaTeXColor["darkorchid"]="#9933CC";LaTeXColor["purple"]="#8C24FF";LaTeXColor["plum"]="#8000FF";LaTeXColor["violet"]="#361FFF";LaTeXColor["royalpurple"]="#401AFF";LaTeXColor["blueviolet"]="#1A0DF5";LaTeXColor["periwinkle"]="#6E73FF";LaTeXColor["cadetblue"]="#616EC4";LaTeXColor["cornflowerblue"]="#59DEFF";LaTeXColor["midnightblue"]="#007091";LaTeXColor["navyblue"]="#0F75FF";LaTeXColor["royalblue"]="#0080FF";LaTeXColor["blue"]="#0000FF";LaTeXColor["cerulean"]="#0FE3FF";LaTeXColor["cyan"]="#00FFFF";LaTeXColor["processblue"]="#0AFFFF";LaTeXColor["skyblue"]="#61FFE0";LaTeXColor["turquoise"]="#26FFCC";LaTeXColor["tealblue"]="#1FFAA3";LaTeXColor["aquamarine"]="#2EFFB2";LaTeXColor["bluegreen"]="#26FFAB";LaTeXColor["emerald"]="#00FF80";LaTeXColor["junglegreen"]="#03FF7A";LaTeXColor["seagreen"]="#4FFF80";LaTeXColor["green"]="#00FF00";LaTeXColor["forestgreen"]="#00E000";LaTeXColor["pinegreen"]="#00BF29";LaTeXColor["limegreen"]="#80FF00";LaTeXColor["yellowgreen"]="#8FFF42";LaTeXColor["springgreen"]="#BDFF3D";LaTeXColor["olivegreen"]="#009900";LaTeXColor["rawsienna"]="#8C0000";LaTeXColor["sepia"]="#4D0000";LaTeXColor["brown"]="#660000";LaTeXColor["tan"]="#DB9470";LaTeXColor["gray"]="#808080";LaTeXColor["grey"]="#808080";LaTeXColor["black"]="#000000";LaTeXColor["white"]="#FFFFFF";var IsColorName=/^(?:greenyellow|yellow|goldenrod|dandelion|apricot|peach|melon|yelloworange|orange|burntorange|bittersweet|redorange|mahogany|maroon|brickred|red|orangered|rubinered|wildstrawberry|salmon|carnationpink|magenta|violetred|rhodamine|mulberry|redviolet|fuchsia|lavender|thistle|orchid|darkorchid|purple|plum|violet|royalpurple|blueviolet|periwinkle|cadetblue|cornflowerblue|midnightblue|navyblue|royalblue|blue|cerulean|cyan|processblue|skyblue|turquoise|tealblue|aquamarine|bluegreen|emerald|junglegreen|seagreen|green|forestgreen|pinegreen|limegreen|yellowgreen|springgreen|olivegreen|rawsienna|sepia|brown|tan|gray|grey|black|white)$/;var IsCounter=/^(?:definition|proposition|lemma|theorem|corollary|example|exercise|subsection|subsubsection|figure|equation|table)$/;var IsLaTeXElement=/^(?:displayequation|title|author|address|date|abstract|keyword|section|subsection|subsubsection|ref|cite|thebibliography|definition|proposition|lemma|theorem|corollary|example|exercise|itemize|enumerate|enddefinition|endproposition|endlemma|endtheorem|endcorollary|endexample|endexercise|enditemize|endenumerate|LaTeXMathMLlabel|LaTeXMathML|smallskip|medskip|bigskip|quote|quotation|endquote|endquotation|center|endcenter|description|enddescription|inlinemath)$/;var IsTextOnlyArea=/^(?:form|textarea|pre)$/i;var tableid=0;function makeNumberString(cntr){if(sectionCntr>0){if(inAppendix){return"A"+sectionCntr+"."+cntr;}else{return sectionCntr+"."+cntr;}}else{return""+cntr;}};function LaTeXpreProcess(thebody){var TheBody=thebody;if(TheBody.hasChildNodes()){if(!(IsLaTeXElement.test(TheBody.className)))+{for(var i=0;i<TheBody.childNodes.length;i++){LaTeXpreProcess(TheBody.childNodes[i])}}}+else{if(TheBody.nodeType==3&&!(IsTextOnlyArea.test(TheBody.parentNode.nodeName)))+{var str=TheBody.nodeValue;if(!(str==null)){str=str.replace(/\\%/g,"<per>");str=str.replace(/%[^\n]*(?=\n)/g,"");str=str.replace(/%[^\r]*(?=\r)/g,"");str=str.replace(/%[^\n]*$/,"")+if(isIE&&str.match(/%/g)!=null&&IEcommentWarning){alert("Comments may not have parsed properly. Try putting in <pre class='LaTeX><div>..</div></pre> structure.");IEcommentWarning=false;}+str=str.replace(/<per>/g,"%");if(str.match(/XXX[\s\S]*/)!=null){var tmp=str.match(/XXX[\s\S]*/)[0];var tmpstr=tmp.charCodeAt(7)+"::"+tmp.charCodeAt(8)+"::"+tmp.charCodeAt(9)+"::"+tmp.charCodeAt(10)+"::"+tmp.charCodeAt(11)+"::"+tmp.charCodeAt(12)+"::"+tmp.charCodeAt(13);alert(tmpstr);}+str=str.replace(/([^\\])\\(\s)/g,"$1\u00A0$2");str=str.replace(/\\quad/g,"\u2001");str=str.replace(/\\qquad/g,"\u2001\u2001");str=str.replace(/\\enspace/g,"\u2002");str=str.replace(/\\;/g,"\u2004");str=str.replace(/\\:/g,"\u2005");str=str.replace(/\\,/g,"\u2006");str=str.replace(/\\thinspace/g,"\u200A");str=str.replace(/([^\\])~/g,"$1\u00A0");str=str.replace(/\\~/g,"~");str=str.replace(/\\\[/g," <DEQ> $\\displaystyle{");str=str.replace(/\\\]/g,"}$ <DEQ> ");str=str.replace(/\$\$/g,"${$<DEQ>$}$");str=str.replace(/\\begin\s*\{\s*array\s*\}/g,"\\begin{array}");str=str.replace(/\\end\s*\{\s*array\s*\}/g,"\\end{array}");str=str.replace(/\\begin\s*\{\s*eqnarray\s*\}/g," <DEQ>eqno$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*eqnarray\*\s*\}/g," <DEQ>$\\begin{eqnarray}");str=str.replace(/\\end\s*\{\s*eqnarray\*\s*\}/g,"\\end{eqnarray}$<DEQ> ");str=str.replace(/\\begin\s*\{\s*displaymath\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*displaymath\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\*\s*\}/g," <DEQ> $\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\*\s*\}/g,"}$ <DEQ> ");str=str.replace(/\\begin\s*\{\s*equation\s*\}/g," <DEQ>eqno$\\displaystyle{");str=str.replace(/\\end\s*\{\s*equation\s*\}/g,"}$ <DEQ> ");str=str.split("<DEQ>");var newFrag=document.createDocumentFragment();for(var i=0;i<str.length;i++){if(i%2){var DEQtable=document.createElement("table");DEQtable.className='displayequation';var DEQtbody=document.createElement("tbody");var DEQtr=document.createElement("tr");var DEQtdeq=document.createElement("td");DEQtdeq.className='eq';str[i]=str[i].replace(/\$\}\$/g,"$\\displaystyle{");str[i]=str[i].replace(/\$\{\$/g,"}");var lbl=str[i].match(/\\label\s*\{\s*(\w+)\s*\}/);var ISeqno=str[i].match(/^eqno/);str[i]=str[i].replace(/^eqno/," ");str[i]=str[i].replace(/\\label\s*\{\s*\w+\s*\}/," ");DEQtdeq.appendChild(document.createTextNode(str[i]));DEQtr.appendChild(DEQtdeq);str[i]=str[i].replace(/\\nonumber/g,"");if(ISeqno!=null||lbl!=null){var DEQtdno=document.createElement("td");DEQtdno.className='eqno';LaTeXCounter["equation"]++;var eqnoString=makeNumberString(LaTeXCounter["equation"]);var DEQanchor=document.createElement("a");if(lbl!=null){DEQanchor.id=lbl[1]};DEQanchor.className="eqno";var anchorSpan=document.createElement("span");anchorSpan.className="eqno";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(eqnoString));DEQanchor.appendChild(anchorSpan);DEQtdno.appendChild(DEQanchor);var DEQspan=document.createElement("span");DEQspan.className="eqno";DEQspan.appendChild(document.createTextNode("("+eqnoString+")"));DEQtdno.appendChild(DEQspan);DEQtr.appendChild(DEQtdno);}+DEQtbody.appendChild(DEQtr);DEQtable.appendChild(DEQtbody);newFrag.appendChild(DEQtable);}+else{str[i]=str[i].replace(/\$\}\$/g,"");str[i]=str[i].replace(/\$\{\$/g,"");str[i]=str[i].replace(/\\maketitle/g,"");str[i]=str[i].replace(/\\begin\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\end\s*\{\s*document\s*\}/g,"");str[i]=str[i].replace(/\\documentclass[^\}]*?\}/g,"");str[i]=str[i].replace(/\\usepackage[^\}]*?\}/g,"");str[i]=str[i].replace(/\\noindent/g,"");str[i]=str[i].replace(/\\notag/g,"");str[i]=str[i].replace(/\\ref\s*\{\s*(\w+)\}/g," \\[ref\\]$1\\[ ");str[i]=str[i].replace(/\\url\s*\{\s*([^\}\n]+)\}/g," \\[url\\]$1\\[ ");str[i]=str[i].replace(/\\href\s*\{\s*([^\}]+)\}\s*\{\s*([^\}]+)\}/g," \\[href\\]$1\\]$2\\[ ");str[i]=str[i].replace(/\\cite\s*\{\s*(\w+)\}/g," \\[cite\\]$1\\[ ");str[i]=str[i].replace(/\\qed/g,"\u220E");str[i]=str[i].replace(/\\endproof/g,"\u220E");str[i]=str[i].replace(/\\proof/g,"\\textbf{Proof: }");str[i]=str[i].replace(/\\n(?=\s)/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\newline/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\linebreak/g," \\[br\\] \\[ ");str[i]=str[i].replace(/\\smallskip/g," \\[logicalbreak\\]smallskip\\[ ");str[i]=str[i].replace(/\\medskip/g," \\[logicalbreak\\]medskip\\[ ");str[i]=str[i].replace(/\\bigskip/g," \\[logicalbreak\\]bigskip\\[ ");str[i]=str[i].replace(/[\n\r]+[ \f\n\r\t\v\u2028\u2029]*[\n\r]+/g," \\[logicalbreak\\]LaTeXMathML\\[ ");if(isIE){str[i]=str[i].replace(/\r/g," ");}+str[i]=str[i].replace(/\\bibitem\s*([^\{]*\{\s*\w*\s*\})/g," \\[bibitem\\]$1\\[ ");str[i]=str[i].replace(/\\bibitem\s*/g," \\[bibitem\\] \\[ ");str[i]=str[i].replace(/\\item\s*\[\s*(\w+)\s*\]/g," \\[alistitem\\]$1\\[ ");str[i]=str[i].replace(/\\item\s*/g," \\[alistitem\\] \\[ ");str[i]=str[i].replace(/\\appendix/g," \\[appendix\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*figure\s*\}([\s\S]+?)\\end\s*\{\s*figure\s*\}/g," \\[figure\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*table\s*\}([\s\S]+?)\\end\s*\{\s*table\s*\}/g," \\[table\\]$1\\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*theorem\s*\}/g," \\[theorem\\]Theorem \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*theorem\s*\}/g," \\[endtheorem\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*definition\s*\}/g," \\[definition\\]Definition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*definition\s*\}/g," \\[enddefinition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*lemma\s*\}/g," \\[lemma\\]Lemma \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*lemma\s*\}/g," \\[endlemma\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*corollary\s*\}/g," \\[corollary\\]Corollary \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*corollary\s*\}/g," \\[endcorollary\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proposition\s*\}/g," \\[proposition\\]Proposition \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*proposition\s*\}/g," \\[endproposition\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*example\s*\}/g," \\[example\\]Example \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*example\s*\}/g," \\[endexample\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*exercise\s*\}/g," \\[exercise\\]Exercise \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*exercise\s*\}/g," \\[endexercise\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}\s*\{\s*\w+\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*thebibliography\s*\}/g," \\[thebibliography\\]References \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*thebibliography\s*\}/g," \\[endthebibliography\\]References \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*proof\s*\}/g," \\[proof\\]Proof: \\[ ");if(isIE){str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g,"\u220E \\[endproof\\] \\[ ");}else{str[i]=str[i].replace(/\\end\s*\{\s*proof\s*\}/g," \\[endproof\\] \\[ ");}+str[i]=str[i].replace(/\\title\s*\{\s*([^\}]+)\}/g," \\[title\\] \\[$1 \\[endtitle\\] \\[ ");str[i]=str[i].replace(/\\author\s*\{\s*([^\}]+)\}/g," \\[author\\] \\[$1 \\[endauthor\\] \\[ ");str[i]=str[i].replace(/\\address\s*\{\s*([^\}]+)\}/g," \\[address\\] \\[$1 \\[endaddress\\] \\[ ");str[i]=str[i].replace(/\\date\s*\{\s*([^\}]+)\}/g," \\[date\\] \\[$1 \\[enddate\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*keyword\s*\}/g," \\[keyword\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*keyword\s*\}/g," \\[endkeyword\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*abstract\s*\}/g," \\[abstract\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*abstract\s*\}/g," \\[endabstract\\] \\[ ");str[i]=str[i].replace(/\\begin\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[$1\\] \\[ ");str[i]=str[i].replace(/\\end\s*\{\s*(?!array|tabular)(\w+)\s*\}/g," \\[end$1\\] \\[ ");var sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\section\s*\{/," \\[section\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\section\s*\{\s*[\s\S]+\}/);}+sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsection\s*\{/," \\[subsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsection\s*\{\s*[\s\S]+\}/);}+sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);while(sectionIndex>=0){str[i]=str[i].replace(/\\subsubsection\s*\{/," \\[subsubsection\\]");var delimcnt=1;for(var ii=sectionIndex;ii<str[i].length;ii++){if(str[i].charAt(ii)=="{"){delimcnt++};if(str[i].charAt(ii)=="}"){delimcnt--};if(delimcnt==0){str[i]=str[i].substring(0,ii)+"\\[ "+str[i].substring(ii+1,str[i].length);break;}};sectionIndex=str[i].search(/\\subsubsection\s*\{\s*[\s\S]+\}/);}+var CatToNextEven="";var strtmp=str[i].split("\\[");for(var j=0;j<strtmp.length;j++){if(j%2){var strtmparray=strtmp[j].split("\\]");switch(strtmparray[0]){case"section":var nodeTmp=document.createElement("H2");nodeTmp.className='section';sectionCntr++;for(var div in LaTeXCounter){LaTeXCounter[div]=0};var nodeAnchor=document.createElement("a");if(inAppendix){nodeAnchor.className='appendixsection';}else{nodeAnchor.className='section';}+var nodeNumString=makeNumberString("");var anchorSpan=document.createElement("span");anchorSpan.className="section";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='section';nodeSpan.appendChild(document.createTextNode(nodeNumString+" "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsection":var nodeTmp=document.createElement("H3");nodeTmp.className='subsection';LaTeXCounter["subsection"]++;LaTeXCounter["subsubsection"]=0;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"subsubsection":var nodeTmp=document.createElement("H4");nodeTmp.className='subsubsection';LaTeXCounter["subsubsection"]++;var nodeAnchor=document.createElement("a");nodeAnchor.className='subsubsection';var nodeNumString=makeNumberString(LaTeXCounter["subsection"]+"."+LaTeXCounter["subsubsection"]);var anchorSpan=document.createElement("span");anchorSpan.className="subsubsection";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(nodeNumString));nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className='subsubsection';nodeSpan.appendChild(document.createTextNode(nodeNumString+". "));nodeTmp.appendChild(nodeSpan);nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"href":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"url":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathML';nodeTmp.href=strtmparray[1];nodeTmp.appendChild(document.createTextNode(strtmparray[1]));newFrag.appendChild(nodeTmp);break;case"figure":var nodeTmp=document.createElement("table");nodeTmp.className='figure';var FIGtbody=document.createElement("tbody");var FIGlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var FIGcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;FIGcap=tmp.substring(capstart,pos);break}}}+var FIGtr2=document.createElement("tr");var FIGtd2=document.createElement("td");FIGtd2.className="caption";var FIGanchor=document.createElement("a");FIGanchor.className="figure";if(FIGlbl!=null){FIGanchor.id=FIGlbl[1];}+LaTeXCounter["figure"]++;var fignmbr=makeNumberString(LaTeXCounter["figure"]);var anchorSpan=document.createElement("span");anchorSpan.className="figure";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(fignmbr));FIGanchor.appendChild(anchorSpan);FIGtd2.appendChild(FIGanchor);var FIGspan=document.createElement("span");FIGspan.className="figure";FIGspan.appendChild(document.createTextNode("Figure "+fignmbr+". "));FIGtd2.appendChild(FIGspan);FIGtd2.appendChild(document.createTextNode(""+FIGcap));FIGtr2.appendChild(FIGtd2);FIGtbody.appendChild(FIGtr2);var IsSpecial=false;var FIGinfo=strtmparray[1].match(/\\includegraphics\s*\{([^\}]+)\}/);if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\includegraphics\s*\[[^\]]*\]\s*\{\s*([^\}]+)\s*\}/);}+if(FIGinfo==null){FIGinfo=strtmparray[1].match(/\\special\s*\{\s*([^\}]+)\}/);IsSpecial=true};if(FIGinfo!=null){var FIGtr1=document.createElement("tr");var FIGtd1=document.createElement("td");FIGtd1.className="image";var FIGimg=document.createElement("img");var FIGsrc=FIGinfo[1];FIGimg.src=FIGsrc;FIGimg.alt="Figure "+FIGsrc+" did not load";FIGimg.title="Figure "+fignmbr+". "+FIGcap;FIGimg.id="figure"+fignmbr;FIGtd1.appendChild(FIGimg);FIGtr1.appendChild(FIGtd1);FIGtbody.appendChild(FIGtr1);}+nodeTmp.appendChild(FIGtbody);newFrag.appendChild(nodeTmp);break;case"table":var nodeTmp=document.createElement("table");if(strtmparray[1].search(/\\centering/)>=0){nodeTmp.className='LaTeXtable centered';nodeTmp.align="center";}else{nodeTmp.className='LaTeXtable';};tableid++;nodeTmp.id="LaTeXtable"+tableid;var TABlbl=strtmparray[1].match(/\\label\s*\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\\label\s*\{\w+\}/g,"");var capIndex=strtmparray[1].search(/\\caption\s*\{[\s\S]+\}/);var TABcap="";if(capIndex>=0){var tmp=strtmparray[1];var delimcnt=0;var capstart=-1;for(var pos=capIndex;pos<tmp.length;pos++){if(tmp.charAt(pos)=="{"){delimcnt++};if(tmp.charAt(pos)=="}"){delimcnt--};if(delimcnt==1&&capstart<0){capstart=pos+1};if(delimcnt==0&&capstart>0){capend=pos-1;TABcap=tmp.substring(capstart,pos);break}}}+if(TABcap!=""){var TABtbody=document.createElement("tbody");var TABcaption=document.createElement("caption");TABcaption.className="LaTeXtable centered";var TABanchor=document.createElement("a");TABanchor.className="LaTeXtable";if(TABlbl!=null){TABanchor.id=TABlbl[1];}+LaTeXCounter["table"]++;var tabnmbr=makeNumberString(LaTeXCounter["table"]);var anchorSpan=document.createElement("span");anchorSpan.className="LaTeXtable";anchorSpan.style.display="none";anchorSpan.appendChild(document.createTextNode(tabnmbr));TABanchor.appendChild(anchorSpan);TABcaption.appendChild(TABanchor);var TABspan=document.createElement("span");TABspan.className="LaTeXtable";TABspan.appendChild(document.createTextNode("Table "+tabnmbr+". "));TABcaption.appendChild(TABspan);TABcaption.appendChild(document.createTextNode(""+TABcap));nodeTmp.appendChild(TABcaption);}+var TABinfo=strtmparray[1].match(/\\begin\s*\{\s*tabular\s*\}([\s\S]+)\\end\s*\{\s*tabular\s*\}/);if(TABinfo!=null){var TABtbody=document.createElement('tbody');var TABrow=null;var TABcell=null;var row=0;var col=0;var TABalign=TABinfo[1].match(/^\s*\{([^\}]+)\}/);TABinfo=TABinfo[1].replace(/^\s*\{[^\}]+\}/,"");TABinfo=TABinfo.replace(/\\hline/g,"");TABalign[1]=TABalign[1].replace(/\|/g,"");TABalign[1]=TABalign[1].replace(/\s/g,"");TABinfo=TABinfo.split("\\\\");for(row=0;row<TABinfo.length;row++){TABrow=document.createElement("tr");TABinfo[row]=TABinfo[row].split("&");for(col=0;col<TABinfo[row].length;col++){TABcell=document.createElement("td");switch(TABalign[1].charAt(col)){case"l":TABcell.align="left";break;case"c":TABcell.align="center";break;case"r":TABcell.align="right";break;default:TABcell.align="left";};TABcell.appendChild(document.createTextNode(TABinfo[row][col]));TABrow.appendChild(TABcell);}+TABtbody.appendChild(TABrow);}+nodeTmp.appendChild(TABtbody);}+newFrag.appendChild(nodeTmp);break;case"logicalbreak":var nodeTmp=document.createElement("p");nodeTmp.className=strtmparray[1];nodeTmp.appendChild(document.createTextNode("\u00A0"));newFrag.appendChild(nodeTmp);break;case"appendix":inAppendix=true;sectionCntr=0;break;case"alistitem":var EndDiv=document.createElement("div");EndDiv.className="endlistitem";newFrag.appendChild(EndDiv);var BegDiv=document.createElement("div");BegDiv.className="listitem";if(strtmparray[1]!=" "){var BegSpan=document.createElement("span");BegSpan.className="listitemmarker";var boldBegSpan=document.createElement("b");boldBegSpan.appendChild(document.createTextNode(strtmparray[1]+" "));BegSpan.appendChild(boldBegSpan);BegDiv.appendChild(BegSpan);}+newFrag.appendChild(BegDiv);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"bibitem":newFrag.appendChild(document.createElement("br"));var nodeTmp=document.createElement("a");nodeTmp.className='bibitem';var nodeSpan=document.createElement("span");nodeSpan.className='bibitem';bibcntr++;var lbl=strtmparray[1].match(/\{\s*(\w+)\s*\}/);strtmparray[1]=strtmparray[1].replace(/\s*\{\s*\w+\s*\}/g,"");strtmparray[1]=strtmparray[1].replace(/^\s*\[/,"");strtmparray[1]=strtmparray[1].replace(/\s*\]$/,"");strtmparray[1]=strtmparray[1].replace(/^\s+|\s+$/g,"");if(lbl==null){biblist[bibcntr]="bibitem"+bibcntr}else{biblist[bibcntr]=lbl[1];};nodeTmp.name=biblist[bibcntr];nodeTmp.id=biblist[bibcntr];if(strtmparray[1]!=""){nodeSpan.appendChild(document.createTextNode(strtmparray[1]));}else{nodeSpan.appendChild(document.createTextNode("["+bibcntr+"]"));}+nodeTmp.appendChild(nodeSpan);newFrag.appendChild(nodeTmp);break;case"cite":var nodeTmp=document.createElement("a");nodeTmp.className='cite';nodeTmp.name='cite';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;case"ref":var nodeTmp=document.createElement("a");nodeTmp.className='ref';nodeTmp.name='ref';nodeTmp.href="#"+strtmparray[1];newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("div");nodeTmp.className=strtmparray[0];if(IsCounter.test(strtmparray[0])){LaTeXCounter[strtmparray[0]]++;var nodeAnchor=document.createElement("a");nodeAnchor.className=strtmparray[0];var divnum=makeNumberString(LaTeXCounter[strtmparray[0]]);var anchorSpan=document.createElement("span");anchorSpan.className=strtmparray[0];anchorSpan.appendChild(document.createTextNode(divnum));anchorSpan.style.display="none";nodeAnchor.appendChild(anchorSpan);nodeTmp.appendChild(nodeAnchor);var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]+" "+divnum+". "));nodeTmp.appendChild(nodeSpan);}+if(isIE){if(strtmparray[0]==("thebibliography"||"abstract"||"keyword"||"proof")){var nodeSpan=document.createElement("span");nodeSpan.className=strtmparray[0];nodeSpan.appendChild(document.createTextNode(strtmparray[1]));nodeTmp.appendChild(nodeSpan);}}+if(strtmparray[0]=="endenumerate"||strtmparray[0]=="enditemize"||strtmparray[0]=="enddescription"){var endDiv=document.createElement("div");endDiv.className="endlistitem";newFrag.appendChild(endDiv);}+newFrag.appendChild(nodeTmp);if(strtmparray[0]=="enumerate"||strtmparray[0]=="itemize"||strtmparray[0]=="description"){var endDiv=document.createElement("div");endDiv.className="listitem";newFrag.appendChild(endDiv);}}}else{strtmp[j]=strtmp[j].replace(/\\\$/g,"<per>");strtmp[j]=strtmp[j].replace(/\$([^\$]+)\$/g," \\[$1\\[ ");strtmp[j]=strtmp[j].replace(/<per>/g,"\\$");strtmp[j]=strtmp[j].replace(/\\begin\s*\{\s*math\s*\}([\s\S]+?)\\end\s*\{\s*math\s*\}/g," \\[$1\\[ ");var strtmptmp=strtmp[j].split("\\[");for(var jjj=0;jjj<strtmptmp.length;jjj++){if(jjj%2){var nodeTmp=document.createElement("span");nodeTmp.className='inlinemath';nodeTmp.appendChild(document.createTextNode("$"+strtmptmp[jjj]+"$"));newFrag.appendChild(nodeTmp);}else{var TagIndex=strtmptmp[jjj].search(/\\\w+/);var tmpIndex=TagIndex;while(tmpIndex>-1){if(/^\\textcolor/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\textcolor\s*\{\s*(\w+)\s*\}\s*/," \\[textcolor\\]$1\\]|");}else{if(/^\\colorbox/.test(strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length))){strtmptmp[jjj]=strtmptmp[jjj].replace(/\\colorbox\s*\{\s*(\w+)\s*\}\s*/," \\[colorbox\\]$1\\]|");}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).replace(/\\\s*(\w+)\s*/," \\[$1\\]|");}}+TagIndex+=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\|/);TagIndex++;strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\]\|/,"\\] ");if(strtmptmp[jjj].charAt(TagIndex)=="{"){strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);var delimcnt=1;for(var kk=TagIndex;kk<strtmptmp[jjj].length;kk++){if(strtmptmp[jjj].charAt(kk)=="{"){delimcnt++};if(strtmptmp[jjj].charAt(kk)=="}"){delimcnt--};if(delimcnt==0){break;}}+strtmptmp[jjj]=strtmptmp[jjj].substring(0,kk)+"\\[ "+strtmptmp[jjj].substring(kk+1,strtmptmp[jjj].length);TagIndex=kk+3;}else{strtmptmp[jjj]=strtmptmp[jjj].substring(0,TagIndex)+"\\[ "+strtmptmp[jjj].substring(TagIndex+1,strtmptmp[jjj].length);TagIndex=TagIndex+3;}+if(TagIndex<strtmptmp[jjj].length){tmpIndex=strtmptmp[jjj].substring(TagIndex,strtmptmp[jjj].length).search(/\\\w+/);}+else{tmpIndex=-1};TagIndex+=tmpIndex;}+strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\\s*\\\\/g,"\\\\");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\\\/g," \\[br\\] \\[ ");strtmptmp[jjj]=strtmptmp[jjj].replace(/\\label\s*\{\s*(\w+)\s*\}/g," \\[a\\]$1\\[ ");var strlbls=strtmptmp[jjj].split("\\[");for(var jj=0;jj<strlbls.length;jj++){if(jj%2){var strtmparray=strlbls[jj].split("\\]");switch(strtmparray[0]){case"textcolor":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.color=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.color=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"colorbox":var nodeTmp=document.createElement("span");nodeTmp.className='LaTeXColor';if(IsColorName.test(strtmparray[1].toLowerCase())){nodeTmp.style.background=LaTeXColor[strtmparray[1].toLowerCase()];}else{nodeTmp.style.background=strtmparray[1];};nodeTmp.appendChild(document.createTextNode(strtmparray[2]));newFrag.appendChild(nodeTmp);break;case"br":newFrag.appendChild(document.createElement("br"));break;case"a":var nodeTmp=document.createElement("a");nodeTmp.className='LaTeXMathMLlabel';nodeTmp.id=strtmparray[1];nodeTmp.style.display="none";newFrag.appendChild(nodeTmp);break;default:var nodeTmp=document.createElement("span");nodeTmp.className=strtmparray[0];nodeTmp.appendChild(document.createTextNode(strtmparray[1]))+newFrag.appendChild(nodeTmp);}}else{newFrag.appendChild(document.createTextNode(strlbls[jj]));}}}}}}}};TheBody.parentNode.replaceChild(newFrag,TheBody);}}}+return TheBody;}+function LaTeXDivsAndRefs(thebody){var TheBody=thebody;var EndDivClass=null;var AllDivs=TheBody.getElementsByTagName("div");var lbl2id="";var lblnode=null;for(var i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){EndDivClass=EndDivClass[0];var DivClass=EndDivClass.substring(3,EndDivClass.length);var EndDivNode=AllDivs[i];break;}}+while(EndDivClass!=null){var newFrag=document.createDocumentFragment();var RootNode=EndDivNode.parentNode;var ClassCount=1;while(EndDivNode.previousSibling!=null&&ClassCount>0){switch(EndDivNode.previousSibling.className){case EndDivClass:ClassCount++;newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);break;case DivClass:if(EndDivNode.previousSibling.nodeName=="DIV"){ClassCount--;if(lbl2id!=""){EndDivNode.previousSibling.id=lbl2id;lbl2id=""}+if(ClassCount==0){RootNode=EndDivNode.previousSibling;}else{newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}};break;case'LaTeXMathMLlabel':lbl2id=EndDivNode.previousSibling.id;EndDivNode.parentNode.removeChild(EndDivNode.previousSibling);break;default:newFrag.insertBefore(EndDivNode.previousSibling,newFrag.firstChild);}}+RootNode.appendChild(newFrag);EndDivNode.parentNode.removeChild(EndDivNode);AllDivs=TheBody.getElementsByTagName("DIV");for(i=AllDivs.length-1;i>=0;i--){EndDivClass=AllDivs[i].className.match(/end\w+/);if(EndDivClass!=null){ClassCount=0;EndDivClass=EndDivClass[0];DivClass=EndDivClass.substring(3,EndDivClass.length);EndDivNode=AllDivs[i];RootNode=EndDivNode.parentNode;break;}}}+var AllDivs=TheBody.getElementsByTagName("div");var DIV2LI=null;for(var i=0;i<AllDivs.length;i++){if(AllDivs[i].className=="itemize"||AllDivs[i].className=="enumerate"||AllDivs[i].className=="description"){if(AllDivs[i].className=="itemize"){RootNode=document.createElement("UL");}else{RootNode=document.createElement("OL");}+RootNode.className='LaTeXMathML';if(AllDivs[i].hasChildNodes()){AllDivs[i].removeChild(AllDivs[i].firstChild)};while(AllDivs[i].hasChildNodes()){if(AllDivs[i].firstChild.hasChildNodes()){DIV2LI=document.createElement("LI");while(AllDivs[i].firstChild.hasChildNodes()){DIV2LI.appendChild(AllDivs[i].firstChild.firstChild);}+if(DIV2LI.firstChild.className=="listitemmarker"){DIV2LI.style.listStyleType="none";}+RootNode.appendChild(DIV2LI)}+AllDivs[i].removeChild(AllDivs[i].firstChild);}+AllDivs[i].appendChild(RootNode);}}+var AllAnchors=TheBody.getElementsByTagName("a");for(var i=0;i<AllAnchors.length;i++){if(AllAnchors[i].className=="ref"||AllAnchors[i].className=="cite"){var label=AllAnchors[i].href.match(/\#(\w+)/);if(label!=null){var labelNode=document.getElementById(label[1]);if(labelNode!=null){var TheSpans=labelNode.getElementsByTagName("SPAN");if(TheSpans!=null){var refNode=TheSpans[0].cloneNode(true);refNode.style.display="inline"+refNode.className=AllAnchors[i].className;AllAnchors[i].appendChild(refNode);}}}}}+return TheBody;}+var AMbody;var AMnoMathML=false,AMtranslated=false;function translate(spanclassAM){if(!AMtranslated){AMtranslated=true;AMinitSymbols();var LaTeXContainers=[];var AllContainers=document.getElementsByTagName('*');var ExtendName="";for(var k=0,l=0;k<AllContainers.length;k++){ExtendName=" "+AllContainers[k].className+" ";if(ExtendName.match(/\sLaTeX\s/)!=null){LaTeXContainers[l]=AllContainers[k];l++;}};if(LaTeXContainers.length>0){for(var m=0;m<LaTeXContainers.length;m++){AMbody=LaTeXContainers[m];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}+if(AMbody.tagName=="PRE"){var PreChilds=document.createDocumentFragment();var DivChilds=document.createElement("DIV");while(AMbody.hasChildNodes()){DivChilds.appendChild(AMbody.firstChild);}+PreChilds.appendChild(DivChilds);AMbody.parentNode.replaceChild(PreChilds,AMbody);AMbody=DivChilds;}+AMprocessNode(AMbody,false,spanclassAM);}}else{AMbody=document.getElementsByTagName("body")[0];try{AMbody=LaTeXDivsAndRefs(LaTeXpreProcess(AMbody));}catch(err){alert("Unknown Error: Defaulting to Original LaTeXMathML");}+AMprocessNode(AMbody,false,spanclassAM);}}}+if(isIE){document.write("<object id=\"mathplayer\" classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");}+function generic()+{translate();};if(typeof window.addEventListener!='undefined')+{window.addEventListener('load',generic,false);}+else if(typeof document.addEventListener!='undefined')+{document.addEventListener('load',generic,false);}+else if(typeof window.attachEvent!='undefined')+{window.attachEvent('onload',generic);}+else+{if(typeof window.onload=='function')+{var existing=onload;window.onload=function()+{existing();generic();};}+else+{window.onload=generic;}}</script>+<!-- configuration parameters -->+<meta name="defaultView" content="slideshow" />+<meta name="controlVis" content="hidden" />+<style type="text/css" media="projection" id="slideProj">+/* Do not edit or override these styles! The system will likely break if you do. */++div#header, div#footer, div#controls, .slide {position: absolute;}+html>body div#header, html>body div#footer, + html>body div#controls, html>body .slide {position: fixed;}+.handout {display: none;}+.layout {display: block;}+.slide, .hideme, .incremental {visibility: hidden;}+#slide0 {visibility: visible;}++/* The following styles size, place, and layer the slide components.+ Edit these if you want to change the overall slide layout.+ The commented lines can be uncommented (and modified, if necessary) + to help you with the rearrangement process. */++/* target = 1024x768 */++div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}+div#header {top: 0; height: 3em; z-index: 1;}+div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}+.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}+div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;+ margin: 0;}+#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}+html>body #currentSlide {position: fixed;}++/*+div#header {background: #FCC;}+div#footer {background: #CCF;}+div#controls {background: #BBD;}+div#currentSlide {background: #FFC;}+*/++/* Following are the presentation styles -- edit away! */++body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}+:link, :visited {text-decoration: none; color: #00C;}+#controls :active {color: #88A !important;}+#controls :focus {outline: 1px dotted #227;}+h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}+ul, pre {margin: 0; line-height: 1em;}+html, body {margin: 0; padding: 0;}++blockquote, q {font-style: italic;}+blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}+blockquote p {margin: 0;}+blockquote i {font-style: normal;}+blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}+blockquote b i {font-style: italic;}++kbd {font-weight: bold; font-size: 1em;}+sup {font-size: smaller; line-height: 1px;}++.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}+.slide code.bad, code del {color: red;}+.slide code.old {color: silver;}+.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}+.slide pre code {display: block;}+.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}+.slide li {margin-top: 0.75em; margin-right: 0;}+.slide ul ul {line-height: 1;}+.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}+.slide img.leader {display: block; margin: 0 auto;}++div#header, div#footer {background: #005; color: #AAB;+ font-family: Verdana, Helvetica, sans-serif;}+div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;+ line-height: 1px;}+div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}+#footer h1, #footer h2 {display: block; padding: 0 1em;}+#footer h2 {font-style: italic;}++div.long {font-size: 0.75em;}+.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;+ margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;+ font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;+ color: #DDE; background: #005;}+.slide h3 {font-size: 130%;}+h1 abbr {font-variant: small-caps;}++div#controls {position: absolute; left: 50%; bottom: 0;+ width: 50%;+ text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}+html>body div#controls {position: fixed; padding: 0 0 1em 0;+ top: auto;}+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;+ margin: 0; padding: 0;}+#controls #navLinks a {padding: 0; margin: 0 0.5em; + background: #005; border: none; color: #779; + cursor: pointer;}+#controls #navList {height: 1em;}+#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}++#currentSlide {text-align: center; font-size: 0.5em; color: #449;}++#slide0 {padding-top: 3.5em; font-size: 90%;}+#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;+ font: bold 2em Helvetica, sans-serif; white-space: normal;+ color: #000; background: transparent;}+#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}+#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}+#slide0 h4 {margin-top: 0; font-size: 1em;}++ul.urls {list-style: none; display: inline; margin: 0;}+.urls li {display: inline; margin: 0;}+.note {display: none;}+.external {border-bottom: 1px dotted gray;}+html>body .external {border-bottom: none;}+.external:after {content: " \274F"; font-size: smaller; color: #77B;}++.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}+img.incremental {visibility: hidden;}+.slide .current {color: #B02;}+++/* diagnostics++li:after {content: " [" attr(class) "]"; color: #F88;}+*/++</style>+<style type="text/css" media="projection" id="operaFix">+/* DO NOT CHANGE THESE unless you really want to break Opera Show */+.slide {+ visibility: visible !important;+ position: static !important;+ page-break-before: always;+}+#slide0 {page-break-before: avoid;}++</style>+<style type="text/css" media="screen" id="outlineStyle">+/* don't change this unless you want the layout stuff to show up in the outline view! */++.layout div, #footer *, #controlForm * {display: none;}+#footer, #controls, #controlForm, #navLinks, #toggle {+ display: block; visibility: visible; margin: 0; padding: 0;}+#toggle {float: right; padding: 0.5em;}+html>body #toggle {position: fixed; top: 0; right: 0;}++/* making the outline look pretty-ish */++#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}+#slide0 h1 {padding-top: 1.5em;}+.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;+ border-top: 1px solid #888; border-bottom: 1px solid #AAA;}+#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}++</style>+<style type="text/css" media="print" id="slidePrint">+/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */+.slide, ul {page-break-inside: avoid; visibility: visible !important;}+h1 {page-break-after: avoid;}++body {font-size: 12pt; background: white;}+* {color: black;}++#slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;}+#slide0 h3 {margin: 0; padding: 0;}+#slide0 h4 {margin: 0 0 0.5em; padding: 0;}+#slide0 {margin-bottom: 3em;}++h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;}+.extra {background: transparent !important;}+div.extra, pre.extra, .example {font-size: 10pt; color: #333;}+ul.extra a {font-weight: bold;}+p.example {display: none;}++#header {display: none;}+#footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;}+#footer h2, #controls {display: none;}++/* The following rule keeps the layout stuff out of print. Remove at your own risk! */+.layout, .layout * {display: none !important;}++</style>+<script type="text/javascript">+// S5 v1.1 slides.js -- released into the Public Domain+//+// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information +// about all the wonderful and talented contributors to this code!+var undef;var slideCSS='';var snum=0;var smax=1;var incpos=0;var number=undef;var s5mode=true;var defaultView='slideshow';var controlVis='visible';var isIE=navigator.appName=='Microsoft Internet Explorer'&&navigator.userAgent.indexOf('Opera')<1?1:0;var isOp=navigator.userAgent.indexOf('Opera')>-1?1:0;var isGe=navigator.userAgent.indexOf('Gecko')>-1&&navigator.userAgent.indexOf('Safari')<1?1:0;function hasClass(object,className){if(!object.className)return false;return(object.className.search('(^|\\s)'+className+'(\\s|$)')!=-1);}+function hasValue(object,value){if(!object)return false;return(object.search('(^|\\s)'+value+'(\\s|$)')!=-1);}+function removeClass(object,className){if(!object)return;object.className=object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'),RegExp.$1+RegExp.$2);}+function addClass(object,className){if(!object||hasClass(object,className))return;if(object.className){object.className+=' '+className;}else{object.className=className;}}+function GetElementsWithClassName(elementName,className){var allElements=document.getElementsByTagName(elementName);var elemColl=new Array();for(var i=0;i<allElements.length;i++){if(hasClass(allElements[i],className)){elemColl[elemColl.length]=allElements[i];}}+return elemColl;}+function isParentOrSelf(element,id){if(element==null||element.nodeName=='BODY')return false;else if(element.id==id)return true;else return isParentOrSelf(element.parentNode,id);}+function nodeValue(node){var result="";if(node.nodeType==1){var children=node.childNodes;for(var i=0;i<children.length;++i){result+=nodeValue(children[i]);}}+else if(node.nodeType==3){result=node.nodeValue;}+return(result);}+function slideLabel(){var slideColl=GetElementsWithClassName('*','slide');var list=document.getElementById('jumplist');smax=slideColl.length;for(var n=0;n<smax;n++){var obj=slideColl[n];var did='slide'+n.toString();obj.setAttribute('id',did);if(isOp)continue;var otext='';var menu=obj.firstChild;if(!menu)continue;while(menu&&menu.nodeType==3){menu=menu.nextSibling;}+if(!menu)continue;var menunodes=menu.childNodes;for(var o=0;o<menunodes.length;o++){otext+=nodeValue(menunodes[o]);}+list.options[list.length]=new Option(n+' : '+otext,n);}}+function currentSlide(){var cs;if(document.getElementById){cs=document.getElementById('currentSlide');}else{cs=document.currentSlide;}+cs.innerHTML='<span id="csHere">'+snum+'<\/span> '+'<span id="csSep">\/<\/span> '+'<span id="csTotal">'+(smax-1)+'<\/span>';if(snum==0){cs.style.visibility='hidden';}else{cs.style.visibility='visible';}}+function go(step){if(document.getElementById('slideProj').disabled||step==0)return;var jl=document.getElementById('jumplist');var cid='slide'+snum;var ce=document.getElementById(cid);if(incrementals[snum].length>0){for(var i=0;i<incrementals[snum].length;i++){removeClass(incrementals[snum][i],'current');removeClass(incrementals[snum][i],'incremental');}}+if(step!='j'){snum+=step;lmax=smax-1;if(snum>lmax)snum=lmax;if(snum<0)snum=0;}else+snum=parseInt(jl.value);var nid='slide'+snum;var ne=document.getElementById(nid);if(!ne){ne=document.getElementById('slide0');snum=0;}+if(step<0){incpos=incrementals[snum].length}else{incpos=0;}+if(incrementals[snum].length>0&&incpos==0){for(var i=0;i<incrementals[snum].length;i++){if(hasClass(incrementals[snum][i],'current'))+incpos=i+1;else+addClass(incrementals[snum][i],'incremental');}}+if(incrementals[snum].length>0&&incpos>0)+addClass(incrementals[snum][incpos-1],'current');ce.style.visibility='hidden';ne.style.visibility='visible';jl.selectedIndex=snum;currentSlide();number=0;}+function goTo(target){if(target>=smax||target==snum)return;go(target-snum);}+function subgo(step){if(step>0){removeClass(incrementals[snum][incpos-1],'current');removeClass(incrementals[snum][incpos],'incremental');addClass(incrementals[snum][incpos],'current');incpos++;}else{incpos--;removeClass(incrementals[snum][incpos],'current');addClass(incrementals[snum][incpos],'incremental');addClass(incrementals[snum][incpos-1],'current');}}+function toggle(){var slideColl=GetElementsWithClassName('*','slide');var slides=document.getElementById('slideProj');var outline=document.getElementById('outlineStyle');if(!slides.disabled){slides.disabled=true;outline.disabled=false;s5mode=false;fontSize('1em');for(var n=0;n<smax;n++){var slide=slideColl[n];slide.style.visibility='visible';}}else{slides.disabled=false;outline.disabled=true;s5mode=true;fontScale();for(var n=0;n<smax;n++){var slide=slideColl[n];slide.style.visibility='hidden';}+slideColl[snum].style.visibility='visible';}}+function showHide(action){var obj=GetElementsWithClassName('*','hideme')[0];switch(action){case's':obj.style.visibility='visible';break;case'h':obj.style.visibility='hidden';break;case'k':if(obj.style.visibility!='visible'){obj.style.visibility='visible';}else{obj.style.visibility='hidden';}+break;}}+function keys(key){if(!key){key=event;key.which=key.keyCode;}+if(key.which==84){toggle();return;}+if(s5mode){switch(key.which){case 10:case 13:if(window.event&&isParentOrSelf(window.event.srcElement,'controls'))return;if(key.target&&isParentOrSelf(key.target,'controls'))return;if(number!=undef){goTo(number);break;}+case 32:case 34:case 39:case 40:if(number!=undef){go(number);}else if(!incrementals[snum]||incpos>=incrementals[snum].length){go(1);}else{subgo(1);}+break;case 33:case 37:case 38:if(number!=undef){go(-1*number);}else if(!incrementals[snum]||incpos<=0){go(-1);}else{subgo(-1);}+break;case 36:goTo(0);break;case 35:goTo(smax-1);break;case 67:showHide('k');break;}+if(key.which<48||key.which>57){number=undef;}else{if(window.event&&isParentOrSelf(window.event.srcElement,'controls'))return;if(key.target&&isParentOrSelf(key.target,'controls'))return;number=(((number!=undef)?number:0)*10)+(key.which-48);}}+return false;}+function clicker(e){number=undef;var target;if(window.event){target=window.event.srcElement;e=window.event;}else target=e.target;if(target.getAttribute('href')!=null||hasValue(target.rel,'external')||isParentOrSelf(target,'controls')||isParentOrSelf(target,'embed')||isParentOrSelf(target,'object'))return true;if(!e.which||e.which==1){if(!incrementals[snum]||incpos>=incrementals[snum].length){go(1);}else{subgo(1);}}}+function findSlide(hash){var target=null;var slides=GetElementsWithClassName('*','slide');for(var i=0;i<slides.length;i++){var targetSlide=slides[i];if((targetSlide.name&&targetSlide.name==hash)||(targetSlide.id&&targetSlide.id==hash)){target=targetSlide;break;}}+while(target!=null&&target.nodeName!='BODY'){if(hasClass(target,'slide')){return parseInt(target.id.slice(5));}+target=target.parentNode;}+return null;}+function slideJump(){if(window.location.hash==null)return;var sregex=/^#slide(\d+)$/;var matches=sregex.exec(window.location.hash);var dest=null;if(matches!=null){dest=parseInt(matches[1]);}else{dest=findSlide(window.location.hash.slice(1));}+if(dest!=null)+go(dest-snum);}+function fixLinks(){var thisUri=window.location.href;thisUri=thisUri.slice(0,thisUri.length-window.location.hash.length);var aelements=document.getElementsByTagName('A');for(var i=0;i<aelements.length;i++){var a=aelements[i].href;var slideID=a.match('\#slide[0-9]{1,2}');if((slideID)&&(slideID[0].slice(0,1)=='#')){var dest=findSlide(slideID[0].slice(1));if(dest!=null){if(aelements[i].addEventListener){aelements[i].addEventListener("click",new Function("e","if (document.getElementById('slideProj').disabled) return;"+"go("+dest+" - snum); "+"if (e.preventDefault) e.preventDefault();"),true);}else if(aelements[i].attachEvent){aelements[i].attachEvent("onclick",new Function("","if (document.getElementById('slideProj').disabled) return;"+"go("+dest+" - snum); "+"event.returnValue = false;"));}}}}}+function externalLinks(){if(!document.getElementsByTagName)return;var anchors=document.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&hasValue(anchor.rel,'external')){anchor.target='_blank';addClass(anchor,'external');}}}+function createControls(){var controlsDiv=document.getElementById("controls");if(!controlsDiv)return;var hider=' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';var hideDiv,hideList='';if(controlVis=='hidden'){hideDiv=hider;}else{hideList=hider;}+controlsDiv.innerHTML='<form action="#" id="controlForm"'+hideDiv+'>'+'<div id="navLinks">'+'<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>'+'<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>'+'<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>'+'<div id="navList"'+hideList+'><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>'+'<\/div><\/form>';if(controlVis=='hidden'){var hidden=document.getElementById('navLinks');}else{var hidden=document.getElementById('jumplist');}+addClass(hidden,'hideme');}+function fontScale(){if(!s5mode)return false;var vScale=22;var hScale=32;if(window.innerHeight){var vSize=window.innerHeight;var hSize=window.innerWidth;}else if(document.documentElement.clientHeight){var vSize=document.documentElement.clientHeight;var hSize=document.documentElement.clientWidth;}else if(document.body.clientHeight){var vSize=document.body.clientHeight;var hSize=document.body.clientWidth;}else{var vSize=700;var hSize=1024;}+var newSize=Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));fontSize(newSize+'px');if(isGe){var obj=document.getElementsByTagName('body')[0];obj.style.display='none';obj.style.display='block';}}+function fontSize(value){if(!(s5ss=document.getElementById('s5ss'))){if(!isIE){document.getElementsByTagName('head')[0].appendChild(s5ss=document.createElement('style'));s5ss.setAttribute('media','screen, projection');s5ss.setAttribute('id','s5ss');}else{document.createStyleSheet();document.s5ss=document.styleSheets[document.styleSheets.length-1];}}+if(!isIE){while(s5ss.lastChild)s5ss.removeChild(s5ss.lastChild);s5ss.appendChild(document.createTextNode('body {font-size: '+value+' !important;}'));}else{document.s5ss.addRule('body','font-size: '+value+' !important;');}}+function notOperaFix(){slideCSS=document.getElementById('slideProj').href;var slides=document.getElementById('slideProj');var outline=document.getElementById('outlineStyle');slides.setAttribute('media','screen');outline.disabled=true;if(isGe){slides.setAttribute('href','null');slides.setAttribute('href',slideCSS);}+if(isIE&&document.styleSheets&&document.styleSheets[0]){document.styleSheets[0].addRule('img','behavior: url(ui/default/iepngfix.htc)');document.styleSheets[0].addRule('div','behavior: url(ui/default/iepngfix.htc)');document.styleSheets[0].addRule('.slide','behavior: url(ui/default/iepngfix.htc)');}}+function getIncrementals(obj){var incrementals=new Array();if(!obj)+return incrementals;var children=obj.childNodes;for(var i=0;i<children.length;i++){var child=children[i];if(hasClass(child,'incremental')){if(child.nodeName=='OL'||child.nodeName=='UL'){removeClass(child,'incremental');for(var j=0;j<child.childNodes.length;j++){if(child.childNodes[j].nodeType==1){addClass(child.childNodes[j],'incremental');}}}else{incrementals[incrementals.length]=child;removeClass(child,'incremental');}}+if(hasClass(child,'show-first')){if(child.nodeName=='OL'||child.nodeName=='UL'){removeClass(child,'show-first');if(child.childNodes[isGe].nodeType==1){removeClass(child.childNodes[isGe],'incremental');}}else{incrementals[incrementals.length]=child;}}+incrementals=incrementals.concat(getIncrementals(child));}+return incrementals;}+function createIncrementals(){var incrementals=new Array();for(var i=0;i<smax;i++){incrementals[i]=getIncrementals(document.getElementById('slide'+i));}+return incrementals;}+function defaultCheck(){var allMetas=document.getElementsByTagName('meta');for(var i=0;i<allMetas.length;i++){if(allMetas[i].name=='defaultView'){defaultView=allMetas[i].content;}+if(allMetas[i].name=='controlVis'){controlVis=allMetas[i].content;}}}+function trap(e){if(!e){e=event;e.which=e.keyCode;}+try{modifierKey=e.ctrlKey||e.altKey||e.metaKey;}+catch(e){modifierKey=false;}+return modifierKey||e.which==0;}+function startup(){defaultCheck();if(!isOp)+createControls();slideLabel();fixLinks();externalLinks();fontScale();if(!isOp){notOperaFix();incrementals=createIncrementals();slideJump();if(defaultView=='outline'){toggle();}+document.onkeyup=keys;document.onkeypress=trap;document.onclick=clicker;}}+window.onload=startup;window.onresize=function(){setTimeout('fontScale()',50);}+</script> </head ><body ><div class="layout">
tests/s5.native view
@@ -5,5 +5,5 @@ , [ Plain [Str "second",Space,Str "bullet"] ] ] , Header 1 [Str "Math"] , BulletList- [ [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]+ [ [ Plain [Math InlineMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ] ] ]
+ tests/tables.mediawiki view
@@ -0,0 +1,123 @@+Simple table with caption:++<table>+<caption>Demonstration of simple table syntax.</caption><tr>+<th align="right" style="width: 15%;">Right<th>+<th align="left" style="width: 8%;">Left<th>+<th align="center" style="width: 16%;">Center<th>+<th align="left" style="width: 12%;">Default<th>+</tr><tr>+<td align="right">12<td>+<td align="left">12<td>+<td align="center">12<td>+<td align="left">12<td>+</tr>+<tr>+<td align="right">123<td>+<td align="left">123<td>+<td align="center">123<td>+<td align="left">123<td>+</tr>+<tr>+<td align="right">1<td>+<td align="left">1<td>+<td align="center">1<td>+<td align="left">1<td>+</tr>+</table>+Simple table without caption:++<table>+<tr>+<th align="right" style="width: 15%;">Right<th>+<th align="left" style="width: 8%;">Left<th>+<th align="center" style="width: 16%;">Center<th>+<th align="left" style="width: 12%;">Default<th>+</tr><tr>+<td align="right">12<td>+<td align="left">12<td>+<td align="center">12<td>+<td align="left">12<td>+</tr>+<tr>+<td align="right">123<td>+<td align="left">123<td>+<td align="center">123<td>+<td align="left">123<td>+</tr>+<tr>+<td align="right">1<td>+<td align="left">1<td>+<td align="center">1<td>+<td align="left">1<td>+</tr>+</table>+Simple table indented two spaces:++<table>+<caption>Demonstration of simple table syntax.</caption><tr>+<th align="right" style="width: 15%;">Right<th>+<th align="left" style="width: 8%;">Left<th>+<th align="center" style="width: 16%;">Center<th>+<th align="left" style="width: 12%;">Default<th>+</tr><tr>+<td align="right">12<td>+<td align="left">12<td>+<td align="center">12<td>+<td align="left">12<td>+</tr>+<tr>+<td align="right">123<td>+<td align="left">123<td>+<td align="center">123<td>+<td align="left">123<td>+</tr>+<tr>+<td align="right">1<td>+<td align="left">1<td>+<td align="center">1<td>+<td align="left">1<td>+</tr>+</table>+Multiline table with caption:++<table>+<caption>Here's the caption. It may span multiple lines.</caption><tr>+<th align="center" style="width: 15%;">Centered Header<th>+<th align="left" style="width: 13%;">Left Aligned<th>+<th align="right" style="width: 16%;">Right Aligned<th>+<th align="left" style="width: 33%;">Default aligned<th>+</tr><tr>+<td align="center">First<td>+<td align="left">row<td>+<td align="right">12.0<td>+<td align="left">Example of a row that spans multiple lines.<td>+</tr>+<tr>+<td align="center">Second<td>+<td align="left">row<td>+<td align="right">5.0<td>+<td align="left">Here's another one. Note the blank line between rows.<td>+</tr>+</table>+Multiline table without caption:++<table>+<tr>+<th align="center" style="width: 15%;">Centered Header<th>+<th align="left" style="width: 13%;">Left Aligned<th>+<th align="right" style="width: 16%;">Right Aligned<th>+<th align="left" style="width: 33%;">Default aligned<th>+</tr><tr>+<td align="center">First<td>+<td align="left">row<td>+<td align="right">12.0<td>+<td align="left">Example of a row that spans multiple lines.<td>+</tr>+<tr>+<td align="center">Second<td>+<td align="left">row<td>+<td align="right">5.0<td>+<td align="left">Here's another one. Note the blank line between rows.<td>+</tr>+</table>
+ tests/tables.opendocument view
@@ -0,0 +1,466 @@+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">+ <office:scripts />+ <office:font-face-decls>+ <style:font-face style:name="&apos;Lucida Sans Unicode&apos;" svg:font-family="Lucida Sans Unicode" />+ <style:font-face style:name="&apos;Tahoma&apos;" svg:font-family="Tahoma" />+ <style:font-face style:name="&apos;Times New Roman&apos;" svg:font-family="Times New Roman" />+ </office:font-face-decls>+ <office:automatic-styles>+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P11" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P12" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P13" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P14" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P15" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P16" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P17" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P18" style:family="paragraph" style:parent-style-name="Table_20_Heading">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P19" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="P20" style:family="paragraph" style:parent-style-name="Table_20_Contents">+ <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />+ </style:style>+ <style:style style:name="Table1">+ <style:table-properties style:rel-width="100%" table:align="center" />+ </style:style>+ <style:style style:name="Table1.A" style:family="table-column">+ <style:table-column-properties style:column-width="1.05in" />+ </style:style>+ <style:style style:name="Table1.B" style:family="table-column">+ <style:table-column-properties style:column-width="0.61in" />+ </style:style>+ <style:style style:name="Table1.C" style:family="table-column">+ <style:table-column-properties style:column-width="1.14in" />+ </style:style>+ <style:style style:name="Table1.D" style:family="table-column">+ <style:table-column-properties style:column-width="0.88in" />+ </style:style>+ <style:style style:name="Table1.A1" style:family="table-cell">+ <style:table-cell-properties fo:border="none" />+ </style:style>+ <style:style style:name="Table2">+ <style:table-properties style:rel-width="100%" table:align="center" />+ </style:style>+ <style:style style:name="Table2.A" style:family="table-column">+ <style:table-column-properties style:column-width="1.05in" />+ </style:style>+ <style:style style:name="Table2.B" style:family="table-column">+ <style:table-column-properties style:column-width="0.61in" />+ </style:style>+ <style:style style:name="Table2.C" style:family="table-column">+ <style:table-column-properties style:column-width="1.14in" />+ </style:style>+ <style:style style:name="Table2.D" style:family="table-column">+ <style:table-column-properties style:column-width="0.88in" />+ </style:style>+ <style:style style:name="Table2.A1" style:family="table-cell">+ <style:table-cell-properties fo:border="none" />+ </style:style>+ <style:style style:name="Table3">+ <style:table-properties style:rel-width="100%" table:align="center" />+ </style:style>+ <style:style style:name="Table3.A" style:family="table-column">+ <style:table-column-properties style:column-width="1.05in" />+ </style:style>+ <style:style style:name="Table3.B" style:family="table-column">+ <style:table-column-properties style:column-width="0.61in" />+ </style:style>+ <style:style style:name="Table3.C" style:family="table-column">+ <style:table-column-properties style:column-width="1.14in" />+ </style:style>+ <style:style style:name="Table3.D" style:family="table-column">+ <style:table-column-properties style:column-width="0.88in" />+ </style:style>+ <style:style style:name="Table3.A1" style:family="table-cell">+ <style:table-cell-properties fo:border="none" />+ </style:style>+ <style:style style:name="Table4">+ <style:table-properties style:rel-width="100%" table:align="center" />+ </style:style>+ <style:style style:name="Table4.A" style:family="table-column">+ <style:table-column-properties style:column-width="1.05in" />+ </style:style>+ <style:style style:name="Table4.B" style:family="table-column">+ <style:table-column-properties style:column-width="0.96in" />+ </style:style>+ <style:style style:name="Table4.C" style:family="table-column">+ <style:table-column-properties style:column-width="1.14in" />+ </style:style>+ <style:style style:name="Table4.D" style:family="table-column">+ <style:table-column-properties style:column-width="2.36in" />+ </style:style>+ <style:style style:name="Table4.A1" style:family="table-cell">+ <style:table-cell-properties fo:border="none" />+ </style:style>+ <style:style style:name="Table5">+ <style:table-properties style:rel-width="100%" table:align="center" />+ </style:style>+ <style:style style:name="Table5.A" style:family="table-column">+ <style:table-column-properties style:column-width="1.05in" />+ </style:style>+ <style:style style:name="Table5.B" style:family="table-column">+ <style:table-column-properties style:column-width="0.96in" />+ </style:style>+ <style:style style:name="Table5.C" style:family="table-column">+ <style:table-column-properties style:column-width="1.14in" />+ </style:style>+ <style:style style:name="Table5.D" style:family="table-column">+ <style:table-column-properties style:column-width="2.36in" />+ </style:style>+ <style:style style:name="Table5.A1" style:family="table-cell">+ <style:table-cell-properties fo:border="none" />+ </style:style>+ </office:automatic-styles>+ <text:p text:style-name="Text_20_body">Simple table with+ caption:</text:p>+ <table:table table:name="Table1" table:style-name="Table1">+ <table:table-column table:style-name="Table1.A" />+ <table:table-column table:style-name="Table1.B" />+ <table:table-column table:style-name="Table1.C" />+ <table:table-column table:style-name="Table1.D" />+ <table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P1">Right</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Left</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P2">Center</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Default</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P3">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P4">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">12</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P3">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P4">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">123</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P3">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="P4">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">1</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table>+ <text:p text:style-name="Caption">Demonstration of simple table syntax.</text:p>+ <text:p text:style-name="Text_20_body">Simple table without+ caption:</text:p>+ <table:table table:name="Table2" table:style-name="Table2">+ <table:table-column table:style-name="Table2.A" />+ <table:table-column table:style-name="Table2.B" />+ <table:table-column table:style-name="Table2.C" />+ <table:table-column table:style-name="Table2.D" />+ <table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P5">Right</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Left</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P6">Center</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Default</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P7">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P8">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">12</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P7">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P8">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">123</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P7">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="P8">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">1</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table>+ <text:p text:style-name="Text_20_body">Simple table indented two+ spaces:</text:p>+ <table:table table:name="Table3" table:style-name="Table3">+ <table:table-column table:style-name="Table3.A" />+ <table:table-column table:style-name="Table3.B" />+ <table:table-column table:style-name="Table3.C" />+ <table:table-column table:style-name="Table3.D" />+ <table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P9">Right</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Left</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P10">Center</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Default</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P11">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P12">12</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">12</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P11">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P12">123</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">123</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P11">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="P12">1</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">1</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table>+ <text:p text:style-name="Caption">Demonstration of simple table syntax.</text:p>+ <text:p text:style-name="Text_20_body">Multiline table with+ caption:</text:p>+ <table:table table:name="Table4" table:style-name="Table4">+ <table:table-column table:style-name="Table4.A" />+ <table:table-column table:style-name="Table4.B" />+ <table:table-column table:style-name="Table4.C" />+ <table:table-column table:style-name="Table4.D" />+ <table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="P13">Centered Header</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Left Aligned</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="P14">Right Aligned</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Default aligned</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="P15">First</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">row</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="P16">12.0</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Example of a row that spans multiple lines.</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="P15">Second</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">row</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="P16">5.0</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table4.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Here's another one. Note the blank line between rows.</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table>+ <text:p text:style-name="Caption">Here's the caption. It may span multiple lines.</text:p>+ <text:p text:style-name="Text_20_body">Multiline table without+ caption:</text:p>+ <table:table table:name="Table5" table:style-name="Table5">+ <table:table-column table:style-name="Table5.A" />+ <table:table-column table:style-name="Table5.B" />+ <table:table-column table:style-name="Table5.C" />+ <table:table-column table:style-name="Table5.D" />+ <table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="P17">Centered Header</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Left Aligned</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="P18">Right Aligned</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Default aligned</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table-header-rows>+ <table:table-row>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="P19">First</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">row</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="P20">12.0</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Example of a row that spans multiple lines.</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="P19">Second</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">row</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="P20">5.0</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="Table5.A1" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Here's another one. Note the blank line between rows.</text:p>+ </table:table-cell>+ </table:table-row>+ </table:table>+ +</office:document-content>
+ tests/tables.texinfo view
@@ -0,0 +1,124 @@+@node Top+@top Top++Simple table with caption:++@float+@multitable @columnfractions 0.15 0.09 0.16 0.13 +@headitem +Right+ @tab Left+ @tab Center+ @tab Default+@item +12+ @tab 12+ @tab 12+ @tab 12+@item +123+ @tab 123+ @tab 123+ @tab 123+@item +1+ @tab 1+ @tab 1+ @tab 1+@end multitable+@caption{Demonstration of simple table syntax.}+@end float+Simple table without caption:++@multitable @columnfractions 0.15 0.09 0.16 0.13 +@headitem +Right+ @tab Left+ @tab Center+ @tab Default+@item +12+ @tab 12+ @tab 12+ @tab 12+@item +123+ @tab 123+ @tab 123+ @tab 123+@item +1+ @tab 1+ @tab 1+ @tab 1+@end multitable++Simple table indented two spaces:++@float+@multitable @columnfractions 0.15 0.09 0.16 0.13 +@headitem +Right+ @tab Left+ @tab Center+ @tab Default+@item +12+ @tab 12+ @tab 12+ @tab 12+@item +123+ @tab 123+ @tab 123+ @tab 123+@item +1+ @tab 1+ @tab 1+ @tab 1+@end multitable+@caption{Demonstration of simple table syntax.}+@end float+Multiline table with caption:++@float+@multitable @columnfractions 0.15 0.14 0.16 0.34 +@headitem +Centered Header+ @tab Left Aligned+ @tab Right Aligned+ @tab Default aligned+@item +First+ @tab row+ @tab 12.0+ @tab Example of a row that spans multiple lines.+@item +Second+ @tab row+ @tab 5.0+ @tab Here's another one. Note the blank line between rows.+@end multitable+@caption{Here's the caption. It may span multiple lines.}+@end float+Multiline table without caption:++@multitable @columnfractions 0.15 0.14 0.16 0.34 +@headitem +Centered Header+ @tab Left Aligned+ @tab Right Aligned+ @tab Default aligned+@item +First+ @tab row+ @tab 12.0+ @tab Example of a row that spans multiple lines.+@item +Second+ @tab row+ @tab 5.0+ @tab Here's another one. Note the blank line between rows.+@end multitable+
tests/testsuite.native view
@@ -26,7 +26,7 @@ , BlockQuote [ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]- , CodeBlock "sub status {\n print \"working\";\n}"+ , CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" , Para [Str "A",Space,Str "list:"] , OrderedList (1,Decimal,Period) [ [ Plain [Str "item",Space,Str "one"] ]@@ -43,9 +43,9 @@ , HorizontalRule , Header 1 [Str "Code",Space,Str "Blocks"] , Para [Str "Code:"]-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"+, CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab" , Para [Str "And:"]-, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"+, CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" , HorizontalRule , Header 1 [Str "Lists"] , Header 2 [Str "Unordered"]@@ -165,7 +165,7 @@ [ [ Plain [Str "Nested",Str "."] ] ] ] ] , Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]-, Para [Str "M",Str ".",Str "A",Str ".",Space,Str "2007"]+, Para [Str "M",Str ".",Str "A.\160",Str "2007"] , Para [Str "B",Str ".",Space,Str "Williams"] , HorizontalRule , Header 1 [Str "Definition",Space,Str "Lists"]@@ -209,7 +209,7 @@ , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ] ), ([Emph [Str "orange"]], [ Para [Str "orange",Space,Str "fruit"]- , CodeBlock "{ orange code block }"+ , CodeBlock ("",[],[]) "{ orange code block }" , BlockQuote [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ] ] ) ]@@ -235,9 +235,9 @@ , Plain [Str "foo"] , RawHtml "</div>\n" , Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]-, CodeBlock "<div>\n foo\n</div>"+, CodeBlock ("",[],[]) "<div>\n foo\n</div>" , Para [Str "As",Space,Str "should",Space,Str "this:"]-, CodeBlock "<div>foo</div>"+, CodeBlock ("",[],[]) "<div>foo</div>" , Para [Str "Now,",Space,Str "nested:"] , RawHtml "<div>\n <div>\n <div>\n " , Plain [Str "foo"]@@ -247,11 +247,11 @@ , Para [Str "Multiline:"] , RawHtml "<!--\nBlah\nBlah\n-->\n\n<!--\n This is another comment.\n-->\n" , Para [Str "Code",Space,Str "block:"]-, CodeBlock "<!-- Comment -->"+, CodeBlock ("",[],[]) "<!-- Comment -->" , Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"] , RawHtml "<!-- foo --> \n" , Para [Str "Code:"]-, CodeBlock "<hr />"+, CodeBlock ("",[],[]) "<hr />" , Para [Str "Hr",Apostrophe,Str "s:"] , RawHtml "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n" , HorizontalRule@@ -265,8 +265,8 @@ , Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."] , Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ">",Str ",",Space,Code "$",Str ",",Space,Code "\\",Str ",",Space,Code "\\$",Str ",",Space,Code "<html>",Str "."] , Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]-, Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello",Str " ",Str "there"],Str "."]-, Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many",Str " ",Str "of",Str " ",Str "them"],Str "O",Str "."]+, Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello",Str "\160",Str "there"],Str "."]+, Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many",Str "\160",Str "of",Str "\160",Str "them"],Str "O",Str "."] , Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",Space,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces:",Space,Str "a",Str "^",Str "b",Space,Str "c",Str "^",Str "d,",Space,Str "a",Str "~",Str "b",Space,Str "c",Str "~",Str "d",Str "."] , HorizontalRule , Header 1 [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]@@ -275,25 +275,25 @@ , Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees",Str ".",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine",Str "."]] , Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70",Apostrophe,Str "s?"] , Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]-, Para [Str "Some",Space,Str "dashes:",Space,Str "one",EmDash,Str "two",EmDash,Str "three",EmDash,Str "four",EmDash,Str "five",Str "."]+, Para [Str "Some",Space,Str "dashes:",Space,Str "one",EmDash,Str "two",Space,EmDash,Space,Str "three",EmDash,Str "four",Space,EmDash,Space,Str "five",Str "."] , Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5",EnDash,Str "7,",Space,Str "255",EnDash,Str "66,",Space,Str "1987",EnDash,Str "1999",Str "."] , Para [Str "Ellipses",Ellipses,Str "and",Ellipses,Str "and",Ellipses,Str "."] , HorizontalRule , Header 1 [Str "LaTeX"] , BulletList [ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]- , [ Plain [TeX "\\doublespacing"] ]- , [ Plain [Math "2+2=4"] ]- , [ Plain [Math "x \\in y"] ]- , [ Plain [Math "\\alpha \\wedge \\omega"] ]- , [ Plain [Math "223"] ]- , [ Plain [Math "p",Str "-",Str "Tree"] ]- , [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]- , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ]+ , [ Plain [Math InlineMath "2+2=4"] ]+ , [ Plain [Math InlineMath "x \\in y"] ]+ , [ Plain [Math InlineMath "\\alpha \\wedge \\omega"] ]+ , [ Plain [Math InlineMath "223"] ]+ , [ Plain [Math InlineMath "p",Str "-",Str "Tree"] ]+ , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "some",Space,Str "display",Space,Str "math:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]+ , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ] , Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"] , BulletList [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ] , [ Plain [Str "$",Str "22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money",Str ".",Space,Str "So",Space,Str "is",Space,Str "$",Str "34,000",Str ".",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized",Str ".",Str ")"] ]+ , [ Plain [Str "Shoes",Space,Str "(",Str "$",Str "20)",Space,Str "and",Space,Str "socks",Space,Str "(",Str "$",Str "5)",Str "."] ] , [ Plain [Str "Escaped",Space,Code "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."] ] ] , Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"] , Para [TeX "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"]@@ -349,7 +349,7 @@ , Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."] , Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."] , Para [Str "This",Space,Str "should",Space,Str "[",Str "not",Str "]",Str "[",Str "]",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]-, CodeBlock "[not]: /url"+, CodeBlock ("",[],[]) "[not]: /url" , Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."] , Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."] , Header 2 [Str "With",Space,Str "ampersands"]@@ -368,7 +368,7 @@ [ Para [Str "Blockquoted:",Space,Link [Code "http://example.com/"] ("http://example.com/","")] ] , Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code "<http://example.com/>"]-, CodeBlock "or here: <http://example.com/>"+, CodeBlock ("",[],[]) "or here: <http://example.com/>" , HorizontalRule , Header 1 [Str "Images"] , Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]@@ -376,7 +376,7 @@ , Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."] , HorizontalRule , Header 1 [Str "Footnotes"]-, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)",Str "."],CodeBlock " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]]+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] , BlockQuote [ Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes",Str ".",Note [Para [Str "In",Space,Str "quote",Str "."]]] ]
tests/testsuite.txt view
@@ -467,13 +467,13 @@ # LaTeX - \cite[22-23]{smith.1899}-- \doublespacing - $2+2=4$ - $x \in y$ - $\alpha \wedge \omega$ - $223$ - $p$-Tree-- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ +- Here's some display math:+ $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ - Here's one that has a line break in it: $\alpha + \omega \times x^2$. @@ -482,6 +482,7 @@ - To get the famous equation, write `$e = mc^2$`. - $22,000 is a *lot* of money. So is $34,000. (It worked if "lot" is emphasized.)+- Shoes ($20) and socks ($5). - Escaped `$`: $73 *this should be emphasized* 23\$. Here's a LaTeX table:
tests/writer.context view
@@ -37,6 +37,9 @@ headstyle=bold,style=normal,align=left,location=hanging, width=broad,margin=1cm] +% prevent orphaned list intros+\setupitemize[autointro]+ % define defaults for bulleted lists \setupitemize[1][symbol=1][indentnext=no] \setupitemize[2][symbol=2][indentnext=no]@@ -136,9 +139,9 @@ A list: \startitemize[n][stopper=.]-\item +\item item one-\item +\item item two \stopitemize @@ -190,66 +193,66 @@ Asterisks tight: \startitemize-\item +\item asterisk 1-\item +\item asterisk 2-\item +\item asterisk 3 \stopitemize Asterisks loose: \startitemize-\item +\item asterisk 1-\item +\item asterisk 2-\item +\item asterisk 3 \stopitemize Pluses tight: \startitemize-\item +\item Plus 1-\item +\item Plus 2-\item +\item Plus 3 \stopitemize Pluses loose: \startitemize-\item +\item Plus 1-\item +\item Plus 2-\item +\item Plus 3 \stopitemize Minuses tight: \startitemize-\item +\item Minus 1-\item +\item Minus 2-\item +\item Minus 3 \stopitemize Minuses loose: \startitemize-\item +\item Minus 1-\item +\item Minus 2-\item +\item Minus 3 \stopitemize @@ -258,71 +261,71 @@ Tight: \startitemize[n][stopper=.]-\item +\item First-\item +\item Second-\item +\item Third \stopitemize and: \startitemize[n][stopper=.]-\item +\item One-\item +\item Two-\item +\item Three \stopitemize Loose using tabs: \startitemize[n][stopper=.]-\item +\item First-\item +\item Second-\item +\item Third \stopitemize and using spaces: \startitemize[n][stopper=.]-\item +\item One-\item +\item Two-\item +\item Three \stopitemize Multiple paragraphs: \startitemize[n][stopper=.]-\item +\item Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog's back.-\item +\item Item 2.-\item +\item Item 3. \stopitemize \subsubject{Nested} \startitemize-\item +\item Tab \startitemize- \item + \item Tab \startitemize- \item + \item Tab \stopitemize \stopitemize@@ -331,54 +334,54 @@ Here's another: \startitemize[n][stopper=.]-\item +\item First-\item +\item Second: \startitemize- \item + \item Fee- \item + \item Fie- \item + \item Foe \stopitemize-\item +\item Third \stopitemize Same thing but with paragraphs: \startitemize[n][stopper=.]-\item +\item First-\item +\item Second: \startitemize- \item + \item Fee- \item + \item Fie- \item + \item Foe \stopitemize-\item +\item Third \stopitemize \subsubject{Tabs and spaces} \startitemize-\item +\item this is a list item indented with tabs-\item +\item this is a list item indented with spaces \startitemize- \item + \item this is an example list item indented with tabs- \item + \item this is an example list item indented with spaces \stopitemize \stopitemize@@ -386,22 +389,22 @@ \subsubject{Fancy list markers} \startitemize[n][start=2,left=(,stopper=),width=2.0em]-\item +\item begins with 2-\item +\item and now 3 with a continuation \startitemize[r][start=4,stopper=.,width=2.0em]- \item + \item sublist with roman numerals, starting with 4- \item + \item more items \startitemize[A][left=(,stopper=),width=2.0em]- \item + \item a subsublist- \item + \item a subsublist \stopitemize \stopitemize@@ -410,16 +413,16 @@ Nesting: \startitemize[A][stopper=.]-\item +\item Upper Alpha \startitemize[R][stopper=.]- \item + \item Upper Roman. \startitemize[n][start=6,left=(,stopper=),width=2.0em]- \item + \item Decimal start with 6 \startitemize[a][start=3,stopper=)]- \item + \item Lower alpha with paren \stopitemize \stopitemize@@ -429,19 +432,19 @@ Autonumbering: \startitemize[n]-\item +\item Autonumber.-\item +\item More. \startitemize[a]- \item + \item Nested. \stopitemize \stopitemize Should not be a list item: -M.A. 2007+M.A.~2007 B. Williams @@ -587,9 +590,9 @@ \overstrikes{This is {\em strikeout}.} -Superscripts: a\high{bc}d a\high{{\em hello}} a\high{hello there}.+Superscripts: a\high{bc}d a\high{{\em hello}} a\high{hello~there}. -Subscripts: H\low{2}O, H\low{23}O, H\low{many of them}O.+Subscripts: H\low{2}O, H\low{23}O, H\low{many~of~them}O. These should not be superscripts or subscripts, because of the unescaped spaces: a\letterhat{}b c\letterhat{}d, a\lettertilde{}b@@ -613,7 +616,7 @@ Here is some quoted \quote{\type{code}} and a \quotation{\useURL[3][http://example.com/?foo=1&bar=2][][quoted link]\from[3]}. -Some dashes: one---two---three---four---five.+Some dashes: one---two --- three---four --- five. Dashes between numbers: 5--7, 255--66, 1987--1999. @@ -621,20 +624,67 @@ \thinrule +\subject{LaTeX}++\startitemize+\item+ \cite[22-23]{smith.1899}+\item+ $2+2=4$+\item+ $x \in y$+\item+ $\alpha \wedge \omega$+\item+ $223$+\item+ $p$-Tree+\item+ Here's some display math:+ \startformula \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h} \stopformula+\item+ Here's one that has a line break in it:+ $\alpha + \omega \times x^2$.+\stopitemize++These shouldn't be math:++\startitemize+\item+ To get the famous equation, write \type{$e = mc^2$}.+\item+ \$22,000 is a {\em lot} of money. So is \$34,000. (It worked if+ \quotation{lot} is emphasized.)+\item+ Shoes (\$20) and socks (\$5).+\item+ Escaped \type{$}: \$73 {\em this should be emphasized} 23\$.+\stopitemize++Here's a LaTeX table:++\begin{tabular}{|l|l|}\hline+Animal & Number \\ \hline+Dog & 2 \\+Cat & 1 \\ \hline+\end{tabular}++\thinrule+ \subject{Special Characters} Here is some unicode: \startitemize-\item +\item I hat: Î-\item +\item o umlaut: ö-\item +\item section: §-\item +\item set membership: ∈-\item +\item copyright: © \stopitemize @@ -751,11 +801,11 @@ \useURL[27][http://example.com/?foo=1&bar=2][][http://example.com/?foo=1\&bar=2]\from[27] \startitemize-\item +\item In a list?-\item +\item \useURL[28][http://example.com/][][http://example.com/]\from[28]-\item +\item It should. \stopitemize @@ -823,7 +873,7 @@ \stopblockquote \startitemize[n][stopper=.]-\item +\item And in list items. \footnote{In list.} \stopitemize
tests/writer.docbook view
@@ -606,7 +606,7 @@ Should not be a list item: </para> <para>- M.A. 2007+ M.A. 2007 </para> <para> B. Williams@@ -758,6 +758,135 @@ </variablelist> </section> <section>+ <title>HTML Blocks</title>+ <para>+ Simple block on one line:+ </para>+ <div>+ foo+ </div>++ <para>+ And nested without indentation:+ </para>+ <div>+<div>+<div>+ foo+ </div>+</div>+<div>+ bar+ </div>+</div>++ <para>+ Interpreted markdown in a table:+ </para>+ <table>+<tr>+<td>+ This is <emphasis>emphasized</emphasis>+ </td>+<td>+ And this is <emphasis role="strong">strong</emphasis>+ </td>+</tr>+</table>++<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>++ <para>+ Here's a simple block:+ </para>+ <div>+ + foo+ </div>++ <para>+ This should be a code block, though:+ </para>+ <screen>+<div>+ foo+</div>+</screen>+ <para>+ As should this:+ </para>+ <screen>+<div>foo</div>+</screen>+ <para>+ Now, nested:+ </para>+ <div>+ <div>+ <div>+ + foo+ </div>+ </div>+</div>++ <para>+ This should just be an HTML comment:+ </para>+ <!-- Comment -->++ <para>+ Multiline:+ </para>+ <!--+Blah+Blah+-->++<!--+ This is another comment.+-->++ <para>+ Code block:+ </para>+ <screen>+<!-- Comment -->+</screen>+ <para>+ Just plain comment, with trailing spaces on the line:+ </para>+ <!-- foo --> ++ <para>+ Code:+ </para>+ <screen>+<hr />+</screen>+ <para>+ Hr's:+ </para>+ <hr>++<hr />++<hr />++<hr> ++<hr /> ++<hr /> ++<hr class="foo" id="bar" />++<hr class="foo" id="bar" />++<hr class="foo" id="bar">++ </section>+ <section> <title>Inline Markup</title> <para> This is <emphasis>emphasized</emphasis>, and so@@ -795,11 +924,12 @@ <para> Superscripts: a<superscript>bc</superscript>d a<superscript><emphasis>hello</emphasis></superscript>- a<superscript>hello there</superscript>.+ a<superscript>hello there</superscript>. </para> <para> Subscripts: H<subscript>2</subscript>O,- H<subscript>23</subscript>O, H<subscript>many of them</subscript>O.+ H<subscript>23</subscript>O,+ H<subscript>many of them</subscript>O. </para> <para> These should not be superscripts or subscripts, because of the@@ -829,7 +959,7 @@ <quote><ulink url="http://example.com/?foo=1&bar=2">quoted link</ulink></quote>. </para> <para>- Some dashes: one—two—three—four—five.+ Some dashes: one—two — three—four — five. </para> <para> Dashes between numbers: 5–7, 255–66, 1987–1999.@@ -847,10 +977,6 @@ </listitem> <listitem> <para>- </para>- </listitem>- <listitem>- <para> 2+2=4 </para> </listitem>@@ -876,6 +1002,7 @@ </listitem> <listitem> <para>+ Here's some display math: \frac{<emphasis>d</emphasis>}{<emphasis>dx</emphasis>}<emphasis>f</emphasis>(<emphasis>x</emphasis>)=\lim<subscript><emphasis>h</emphasis> → 0</subscript>\frac{<emphasis>f</emphasis>(<emphasis>x</emphasis>+<emphasis>h</emphasis>)-<emphasis>f</emphasis>(<emphasis>x</emphasis>)}{<emphasis>h</emphasis>} </para> </listitem>@@ -899,6 +1026,11 @@ <para> $22,000 is a <emphasis>lot</emphasis> of money. So is $34,000. (It worked if <quote>lot</quote> is emphasized.)+ </para>+ </listitem>+ <listitem>+ <para>+ Shoes ($20) and socks ($5). </para> </listitem> <listitem>
tests/writer.html view
@@ -8,16 +8,7 @@ /><meta name="author" content="John MacFarlane" /><meta name="author" content="Anonymous" /><meta name="date" content="July 17, 2006"- /><style type="text/css"- >-.strikeout { text-decoration: line-through; }-ol.decimal { list-style-type: decimal; }-ol.lower-alpha { list-style-type: lower-alpha; }-ol.lower-roman { list-style-type: lower-roman; }-ol.upper-alpha { list-style-type: upper-alpha; }-ol.upper-roman { list-style-type: upper-roman; }-</style- ></head+ /></head ><body ><h1 class="title" >Pandoc Test Suite</h1@@ -85,7 +76,7 @@ ></pre ><p >A list:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li >item one</li ><li@@ -218,7 +209,7 @@ >Ordered</h2 ><p >Tight:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li >First</li ><li@@ -228,7 +219,7 @@ ></ol ><p >and:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li >One</li ><li@@ -238,7 +229,7 @@ ></ol ><p >Loose using tabs:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li ><p >First</p@@ -254,7 +245,7 @@ ></ol ><p >and using spaces:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li ><p >One</p@@ -270,7 +261,7 @@ ></ol ><p >Multiple paragraphs:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li ><p >Item 1, graf one.</p@@ -302,7 +293,7 @@ ></ul ><p >Here’s another:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li >First</li ><li@@ -320,7 +311,7 @@ ></ol ><p >Same thing but with paragraphs:</p- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li ><p >First</p@@ -366,7 +357,7 @@ ></ul ><h2 id="fancy-list-markers" >Fancy list markers</h2- ><ol start="2" class="decimal"+ ><ol start="2" style="list-style-type: decimal;" ><li >begins with 2</li ><li@@ -374,11 +365,11 @@ >and now 3</p ><p >with a continuation</p- ><ol start="4" class="lower-roman"+ ><ol start="4" style="list-style-type: lower-roman;" ><li >sublist with roman numerals, starting with 4</li ><li- >more items<ol class="upper-alpha"+ >more items<ol style="list-style-type: upper-alpha;" ><li >a subsublist</li ><li@@ -390,13 +381,13 @@ ></ol ><p >Nesting:</p- ><ol class="upper-alpha"+ ><ol style="list-style-type: upper-alpha;" ><li- >Upper Alpha<ol class="upper-roman"+ >Upper Alpha<ol style="list-style-type: upper-roman;" ><li- >Upper Roman.<ol start="6" class="decimal"+ >Upper Roman.<ol start="6" style="list-style-type: decimal;" ><li- >Decimal start with 6<ol start="3" class="lower-alpha"+ >Decimal start with 6<ol start="3" style="list-style-type: lower-alpha;" ><li >Lower alpha with paren</li ></ol@@ -421,7 +412,7 @@ ><p >Should not be a list item:</p ><p- >M.A. 2007</p+ >M.A. 2007</p ><p >B. Williams</p ><hr@@ -674,7 +665,7 @@ ><html></code >.</p ><p- ><span class="strikeout"+ ><span style="text-decoration: line-through;" >This is <em >strikeout</em >.</span@@ -687,7 +678,7 @@ >hello</em ></sup > a<sup- >hello there</sup+ >hello there</sup >.</p ><p >Subscripts: H<sub@@ -695,7 +686,7 @@ >O, H<sub >23</sub >O, H<sub- >many of them</sub+ >many of them</sub >O.</p ><p >These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</p@@ -717,7 +708,7 @@ >quoted link</a >”.</p ><p- >Some dashes: one—two—three—four—five.</p+ >Some dashes: one—two — three—four — five.</p ><p >Dashes between numbers: 5–7, 255–66, 1987–1999.</p ><p@@ -729,8 +720,6 @@ ><li ></li ><li- ></li- ><li ><span class="math" >2+2=4</span ></li@@ -757,7 +746,7 @@ ></span >-Tree</li ><li- ><span class="math"+ >Here’s some display math: <span class="math" >\frac{<em >d</em >}{<em@@ -805,6 +794,8 @@ >lot</em > of money. So is $34,000. (It worked if “lot” is emphasized.)</li ><li+ >Shoes ($20) and socks ($5).</li+ ><li >Escaped <code >$</code >: $73 <em@@ -1075,7 +1066,7 @@ ></a ></p ></blockquote- ><ol class="decimal"+ ><ol style="list-style-type: decimal;" ><li >And in list items.<a href="#fn5" class="footnoteRef" id="fnref5" ><sup
tests/writer.latex view
@@ -1,10 +1,11 @@ \documentclass{article}+\usepackage{amsmath} \usepackage[mathletters]{ucs} \usepackage[utf8x]{inputenc} \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt} -\newcommand{\textsubscript}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}+\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}} \usepackage[breaklinks=true]{hyperref} \usepackage[normalem]{ulem} \usepackage{enumerate}@@ -82,9 +83,9 @@ A list: \begin{enumerate}[1.]-\item +\item item one-\item +\item item two \end{enumerate} Nested block quotes:@@ -133,69 +134,69 @@ Asterisks tight: \begin{itemize}-\item +\item asterisk 1-\item +\item asterisk 2-\item +\item asterisk 3 \end{itemize} Asterisks loose: \begin{itemize}-\item +\item asterisk 1 -\item +\item asterisk 2 -\item +\item asterisk 3 \end{itemize} Pluses tight: \begin{itemize}-\item +\item Plus 1-\item +\item Plus 2-\item +\item Plus 3 \end{itemize} Pluses loose: \begin{itemize}-\item +\item Plus 1 -\item +\item Plus 2 -\item +\item Plus 3 \end{itemize} Minuses tight: \begin{itemize}-\item +\item Minus 1-\item +\item Minus 2-\item +\item Minus 3 \end{itemize} Minuses loose: \begin{itemize}-\item +\item Minus 1 -\item +\item Minus 2 -\item +\item Minus 3 \end{itemize}@@ -204,75 +205,75 @@ Tight: \begin{enumerate}[1.]-\item +\item First-\item +\item Second-\item +\item Third \end{enumerate} and: \begin{enumerate}[1.]-\item +\item One-\item +\item Two-\item +\item Three \end{enumerate} Loose using tabs: \begin{enumerate}[1.]-\item +\item First -\item +\item Second -\item +\item Third \end{enumerate} and using spaces: \begin{enumerate}[1.]-\item +\item One -\item +\item Two -\item +\item Three \end{enumerate} Multiple paragraphs: \begin{enumerate}[1.]-\item +\item Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog's back. -\item +\item Item 2. -\item +\item Item 3. \end{enumerate} \subsection{Nested} \begin{itemize}-\item +\item Tab \begin{itemize}- \item + \item Tab \begin{itemize}- \item + \item Tab \end{itemize} \end{itemize}@@ -280,56 +281,56 @@ Here's another: \begin{enumerate}[1.]-\item +\item First-\item +\item Second: \begin{itemize}- \item + \item Fee- \item + \item Fie- \item + \item Foe \end{itemize}-\item +\item Third \end{enumerate} Same thing but with paragraphs: \begin{enumerate}[1.]-\item +\item First -\item +\item Second: \begin{itemize}- \item + \item Fee- \item + \item Fie- \item + \item Foe \end{itemize}-\item +\item Third \end{enumerate} \subsection{Tabs and spaces} \begin{itemize}-\item +\item this is a list item indented with tabs -\item +\item this is a list item indented with spaces \begin{itemize}- \item + \item this is an example list item indented with tabs - \item + \item this is an example list item indented with spaces \end{itemize}@@ -338,23 +339,23 @@ \begin{enumerate}[(1)] \setcounter{enumi}{1}-\item +\item begins with 2-\item +\item and now 3 with a continuation \begin{enumerate}[i.] \setcounter{enumii}{3}- \item + \item sublist with roman numerals, starting with 4- \item + \item more items \begin{enumerate}[(A)]- \item + \item a subsublist- \item + \item a subsublist \end{enumerate} \end{enumerate}@@ -362,18 +363,18 @@ Nesting: \begin{enumerate}[A.]-\item +\item Upper Alpha \begin{enumerate}[I.]- \item + \item Upper Roman. \begin{enumerate}[(1)] \setcounter{enumiii}{5}- \item + \item Decimal start with 6 \begin{enumerate}[a)] \setcounter{enumiv}{2}- \item + \item Lower alpha with paren \end{enumerate} \end{enumerate}@@ -382,18 +383,18 @@ Autonumbering: \begin{enumerate}-\item +\item Autonumber.-\item +\item More. \begin{enumerate}- \item + \item Nested. \end{enumerate} \end{enumerate} Should not be a list item: -M.A. 2007+M.A.~2007 B. Williams @@ -526,10 +527,10 @@ \sout{This is \emph{strikeout}.} Superscripts: a\textsuperscript{bc}d-a\textsuperscript{\emph{hello}} a\textsuperscript{hello there}.+a\textsuperscript{\emph{hello}} a\textsuperscript{hello~there}. -Subscripts: H\textsubscript{2}O, H\textsubscript{23}O,-H\textsubscript{many of them}O.+Subscripts: H\textsubscr{2}O, H\textsubscr{23}O,+H\textsubscr{many~of~them}O. These should not be superscripts or subscripts, because of the unescaped spaces: a\^{}b c\^{}d, a\ensuremath{\sim}b@@ -550,7 +551,7 @@ Here is some quoted `\verb!code!' and a ``\href{http://example.com/?foo=1&bar=2}{quoted link}''. -Some dashes: one---two---three---four---five.+Some dashes: one---two --- three---four --- five. Dashes between numbers: 5--7, 255--66, 1987--1999. @@ -561,35 +562,36 @@ \section{LaTeX} \begin{itemize}-\item +\item \cite[22-23]{smith.1899}-\item - \doublespacing-\item +\item $2+2=4$-\item +\item $x \in y$-\item +\item $\alpha \wedge \omega$-\item +\item $223$-\item +\item $p$-Tree-\item - $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$-\item +\item+ Here's some display math:+ \[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}\]+\item Here's one that has a line break in it: $\alpha + \omega \times x^2$. \end{itemize} These shouldn't be math: \begin{itemize}-\item +\item To get the famous equation, write \verb!$e = mc^2$!.-\item +\item \$22,000 is a \emph{lot} of money. So is \$34,000. (It worked if ``lot'' is emphasized.)-\item +\item+ Shoes (\$20) and socks (\$5).+\item Escaped \verb!$!: \$73 \emph{this should be emphasized} 23\$. \end{itemize} Here's a LaTeX table:@@ -607,15 +609,15 @@ Here is some unicode: \begin{itemize}-\item +\item I hat: Î-\item +\item o umlaut: ö-\item +\item section: §-\item +\item set membership: ∈-\item +\item copyright: © \end{itemize} AT\&T has an ampersand in their name.@@ -729,11 +731,11 @@ With an ampersand: \url{http://example.com/?foo=1&bar=2} \begin{itemize}-\item +\item In a list?-\item +\item \url{http://example.com/}-\item +\item It should. \end{itemize} An e-mail address:@@ -788,7 +790,7 @@ \end{quote} \begin{enumerate}[1.]-\item +\item And in list items.% \footnote{In list.} \end{enumerate}
tests/writer.man view
@@ -49,7 +49,7 @@ .PP \f[CR] sub\ status\ {- \ \ \ \ print\ \"working\";+ \ \ \ \ print\ "working"; } \f[] .PP@@ -83,7 +83,7 @@ ----\ (should\ be\ four\ hyphens) sub\ status\ {- \ \ \ \ print\ \"working\";+ \ \ \ \ print\ "working"; } this\ code\ block\ is\ indented\ by\ one\ tab@@ -296,7 +296,7 @@ .PP Should not be a list item: .PP-M\.A\. 2007+M\.A\.\ 2007 .PP B\. Williams .PP@@ -516,9 +516,9 @@ .PP [STRIKEOUT:This is \f[I]strikeout\f[]\.] .PP-Superscripts: a^bc^d a^\f[I]hello\f[]^ a^hello there^\.+Superscripts: a^bc^d a^\f[I]hello\f[]^ a^hello\ there^\. .PP-Subscripts: H~2~O, H~23~O, H~many of them~O\.+Subscripts: H~2~O, H~23~O, H~many\ of\ them~O\. .PP These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d\.@@ -537,7 +537,7 @@ Here is some quoted `\f[B]code\f[]' and a \[lq]quoted link (http://example.com/?foo=1&bar=2)\[rq]\. .PP-Some dashes: one\[em]two\[em]three\[em]four\[em]five\.+Some dashes: one\[em]two \[em] three\[em]four \[em] five\. .PP Dashes between numbers: 5\[en]7, 255\[en]66, 1987\[en]1999\. .PP@@ -547,7 +547,6 @@ .SH LaTeX .IP \[bu] 2 .IP \[bu] 2-.IP \[bu] 2 \f[B]2+2=4\f[] .IP \[bu] 2 \f[B]x\ \\in\ y\f[]@@ -558,7 +557,10 @@ .IP \[bu] 2 \f[B]p\f[]-Tree .IP \[bu] 2+Here's some display math:+.RS \f[B]\\frac{d}{dx}f(x)=\\lim_{h\\to\ 0}\\frac{f(x+h)-f(x)}{h}\f[]+.RE .IP \[bu] 2 Here's one that has a line break in it: \f[B]\\alpha\ +\ \\omega\ \\times\ x^2\f[]\.@@ -569,6 +571,8 @@ .IP \[bu] 2 $22,000 is a \f[I]lot\f[] of money\. So is $34,000\. (It worked if \[lq]lot\[rq] is emphasized\.)+.IP \[bu] 2+Shoes ($20) and socks ($5)\. .IP \[bu] 2 Escaped \f[B]$\f[]: $73 \f[I]this should be emphasized\f[] 23$\. .PP
tests/writer.markdown view
@@ -269,7 +269,7 @@ Should not be a list item: -M.A. 2007+M.A. 2007 B. Williams @@ -457,9 +457,9 @@ ~~This is *strikeout*.~~ -Superscripts: a^bc^d a^*hello*^ a^hello\ there^.+Superscripts: a^bc^d a^*hello*^ a^hello there^. -Subscripts: H~2~O, H~23~O, H~many\ of\ them~O.+Subscripts: H~2~O, H~23~O, H~many of them~O. These should not be superscripts or subscripts, because of the unescaped spaces: a\^b c\^d, a\~b c\~d.@@ -480,7 +480,7 @@ Here is some quoted '`code`' and a "[quoted link](http://example.com/?foo=1&bar=2)". -Some dashes: one--two--three--four--five.+Some dashes: one--two -- three--four -- five. Dashes between numbers: 5-7, 255-66, 1987-1999. @@ -492,13 +492,13 @@ # LaTeX - \cite[22-23]{smith.1899}-- \doublespacing - $2+2=4$ - $x \in y$ - $\alpha \wedge \omega$ - $223$ - $p$-Tree-- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$+- Here's some display math:+ $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ - Here's one that has a line break in it: $\alpha + \omega \times x^2$. @@ -507,6 +507,7 @@ - To get the famous equation, write `$e = mc^2$`. - $22,000 is a *lot* of money. So is $34,000. (It worked if "lot" is emphasized.)+- Shoes ($20) and socks ($5). - Escaped `$`: $73 *this should be emphasized* 23$. Here's a LaTeX table:
+ tests/writer.mediawiki view
@@ -0,0 +1,604 @@+This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite.+++-----++== Headers ==++=== Level 2 with an [http://{{SERVERNAME}}/url embedded link] ===++==== Level 3 with ''emphasis'' ====++===== Level 4 =====++====== Level 5 ======++== Level 1 ==++=== Level 2 with ''emphasis'' ===++==== Level 3 ====++with no blank line++=== Level 2 ===++with no blank line+++-----++== Paragraphs ==++Here’s a regular paragraph.++In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.++Here’s one with a bullet. * criminey.++There should be a hard line break<br />+here.+++-----++== Block Quotes ==++E-mail style:++<blockquote>This is a block quote. It is pretty short.+</blockquote>+<blockquote>Code in a block quote:++<pre>sub status {+ print "working";+}</pre>+A list:++# item one+# item two+Nested block quotes:++<blockquote>nested+</blockquote>+<blockquote>nested+</blockquote></blockquote>+This should not be a block quote: 2 > 1.++And a following paragraph.+++-----++== Code Blocks ==++Code:++<pre>---- (should be four hyphens)++sub status {+ print "working";+}++this code block is indented by one tab</pre>+And:++<pre> this code block is indented by two tabs++These should not be escaped: \$ \\ \> \[ \{</pre>++-----++== Lists ==++=== Unordered ===++Asterisks tight:++* asterisk 1+* asterisk 2+* asterisk 3+Asterisks loose:++* asterisk 1+* asterisk 2+* asterisk 3+Pluses tight:++* Plus 1+* Plus 2+* Plus 3+Pluses loose:++* Plus 1+* Plus 2+* Plus 3+Minuses tight:++* Minus 1+* Minus 2+* Minus 3+Minuses loose:++* Minus 1+* Minus 2+* Minus 3+=== Ordered ===++Tight:++# First+# Second+# Third+and:++# One+# Two+# Three+Loose using tabs:++# First+# Second+# Third+and using spaces:++# One+# Two+# Three+Multiple paragraphs:++<ol style="list-style-type: decimal;">+<li><p>Item 1, graf one.</p>+<p>Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.</p></li>+<li><p>Item 2.</p></li>+<li><p>Item 3.</p></li></ol>++=== Nested ===++* Tab+** Tab+*** Tab+Here’s another:++# First+# Second:+#* Fee+#* Fie+#* Foe+# Third+Same thing but with paragraphs:++# First+# Second:+#* Fee+#* Fie+#* Foe+# Third+=== Tabs and spaces ===++* this is a list item indented with tabs+* this is a list item indented with spaces+** this is an example list item indented with tabs+** this is an example list item indented with spaces+=== Fancy list markers ===++<ol start="2" style="list-style-type: decimal;">+<li>begins with 2</li>+<li><p>and now 3</p>+<p>with a continuation</p>+<ol start="4" style="list-style-type: lower-roman;">+<li>sublist with roman numerals, starting with 4</li>+<li>more items+<ol style="list-style-type: upper-alpha;">+<li>a subsublist</li>+<li>a subsublist</li></ol>+</li></ol>+</li></ol>++Nesting:++<ol style="list-style-type: upper-alpha;">+<li>Upper Alpha+<ol style="list-style-type: upper-roman;">+<li>Upper Roman.+<ol start="6" style="list-style-type: decimal;">+<li>Decimal start with 6+<ol start="3" style="list-style-type: lower-alpha;">+<li>Lower alpha with paren</li></ol>+</li></ol>+</li></ol>+</li></ol>++Autonumbering:++# Autonumber.+# More.+## Nested.+Should not be a list item:++M.A. 2007++B. Williams+++-----++== Definition Lists ==++Tight using spaces:++; apple+: red fruit+; orange+: orange fruit+; banana+: yellow fruit+Tight using tabs:++; apple+: red fruit+; orange+: orange fruit+; banana+: yellow fruit+Loose:++; apple+: red fruit+; orange+: orange fruit+; banana+: yellow fruit+Multiple blocks with italics:++<dl>+<dt>''apple''</dt>+<dd><p>red fruit</p>+<p>contains seeds, crisp, pleasant to taste</p></dd>+<dt>''orange''</dt>+<dd><p>orange fruit</p>+<pre>{ orange code block }</pre>+<blockquote><p>orange block quote</p></blockquote></dd></dl>++== HTML Blocks ==++Simple block on one line:++<div>+foo+</div>++And nested without indentation:++<div>+<div>+<div>+foo+</div>+</div>+<div>+bar+</div>+</div>++Interpreted markdown in a table:++<table>+<tr>+<td>+This is ''emphasized''+</td>+<td>+And this is '''strong'''+</td>+</tr>+</table>++<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>++Here’s a simple block:++<div>+ +foo+</div>++This should be a code block, though:++<pre><div>+ foo+</div></pre>+As should this:++<pre><div>foo</div></pre>+Now, nested:++<div>+ <div>+ <div>+ +foo+</div>+ </div>+</div>++This should just be an HTML comment:++<!-- Comment -->++Multiline:++<!--+Blah+Blah+-->++<!--+ This is another comment.+-->++Code block:++<pre><!-- Comment --></pre>+Just plain comment, with trailing spaces on the line:++<!-- foo --> ++Code:++<pre><hr /></pre>+Hr’s:++<hr>++<hr />++<hr />++<hr> ++<hr /> ++<hr /> ++<hr class="foo" id="bar" />++<hr class="foo" id="bar" />++<hr class="foo" id="bar">+++-----++== Inline Markup ==++This is ''emphasized'', and so ''is this''.++This is '''strong''', and so '''is this'''.++An ''[http://{{SERVERNAME}}/url emphasized link]''.++'''''This is strong and em.'''''++So is '''''this''''' word.++'''''This is strong and em.'''''++So is '''''this''''' word.++This is code: <tt>></tt>, <tt>$</tt>, <tt>\</tt>, <tt>\$</tt>, <tt><html></tt>.++<s>This is ''strikeout''.</s>++Superscripts: a<sup>bc</sup>d a<sup>''hello''</sup> a<sup>hello there</sup>.++Subscripts: H<sub>2</sub>O, H<sub>23</sub>O, H<sub>many of them</sub>O.++These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.+++-----++== Smart quotes, ellipses, dashes ==++“Hello,” said the spider. “‘Shelob’ is my name.”++‘A’, ‘B’, and ‘C’ are letters.++‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’++‘He said, “I want to go.”’ Were you alive in the 70’s?++Here is some quoted ‘<tt>code</tt>’ and a “[http://example.com/?foo=1&bar=2 quoted link]”.++Some dashes: one—two — three—four — five.++Dashes between numbers: 5–7, 255–66, 1987–1999.++Ellipses…and…and….+++-----++== LaTeX ==++* +* <math>2+2=4</math>+* <math>x \in y</math>+* <math>\alpha \wedge \omega</math>+* <math>223</math>+* <math>p</math>-Tree+* Here’s some display math: <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>+* Here’s one that has a line break in it: <math>\alpha + \omega \times x^2</math>.+These shouldn’t be math:++* To get the famous equation, write <tt>$e = mc^2$</tt>.+* $22,000 is a ''lot'' of money. So is $34,000. (It worked if “lot” is emphasized.)+* Shoes ($20) and socks ($5).+* Escaped <tt>$</tt>: $73 ''this should be emphasized'' 23$.+Here’s a LaTeX table:+++++-----++== Special Characters ==++Here is some unicode:++* I hat: Î+* o umlaut: ö+* section: §+* set membership: ∈+* copyright: ©+AT&T has an ampersand in their name.++AT&T is another way to write it.++This & that.++4 < 5.++6 > 5.++Backslash: \++Backtick: `++Asterisk: *++Underscore: _++Left brace: {++Right brace: }++Left bracket: [++Right bracket: ]++Left paren: (++Right paren: )++Greater-than: >++Hash: #++Period: .++Bang: !++Plus: +++Minus: -+++-----++== Links ==++=== Explicit ===++Just a [http://{{SERVERNAME}}/url/ URL].++[http://{{SERVERNAME}}/url/ URL and title].++[http://{{SERVERNAME}}/url/ URL and title].++[http://{{SERVERNAME}}/url/ URL and title].++[http://{{SERVERNAME}}/url/ URL and title]++[http://{{SERVERNAME}}/url/ URL and title]++[http://{{SERVERNAME}}/url/with_underscore with_underscore]++[mailto:nobody@nowhere.net Email link]++[http://{{SERVERNAME}}/ Empty].++=== Reference ===++Foo [http://{{SERVERNAME}}/url/ bar].++Foo [http://{{SERVERNAME}}/url/ bar].++Foo [http://{{SERVERNAME}}/url/ bar].++With [http://{{SERVERNAME}}/url/ embedded [brackets]].++[http://{{SERVERNAME}}/url/ b] by itself should be a link.++Indented [http://{{SERVERNAME}}/url once].++Indented [http://{{SERVERNAME}}/url twice].++Indented [http://{{SERVERNAME}}/url thrice].++This should [not][] be a link.++<pre>[not]: /url</pre>+Foo [http://{{SERVERNAME}}/url/ bar].++Foo [http://{{SERVERNAME}}/url/ biz].++=== With ampersands ===++Here’s a [http://example.com/?foo=1&bar=2 link with an ampersand in the URL].++Here’s a link with an amersand in the link text: [http://att.com/ AT&T].++Here’s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link].++Here’s an [http://{{SERVERNAME}}/script?foo=1&bar=2 inline link in pointy braces].++=== Autolinks ===++With an ampersand: http://example.com/?foo=1&bar=2++* In a list?+* http://example.com/+* It should.+An e-mail address: [mailto:nobody@nowhere.net <tt>nobody@nowhere.net</tt>]++<blockquote>Blockquoted: http://example.com/+</blockquote>+Auto-links should not occur here: <tt><http://example.com/></tt>++<pre>or here: <http://example.com/></pre>++-----++== Images ==++From “Voyage dans la Lune” by Georges Melies (1902):++[[Image:lalune.jpg|Voyage dans la Lune]]++Here is a movie [[Image:movie.jpg|movie]] icon.+++-----++== Footnotes ==++Here is a footnote reference,<ref>Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.+</ref> and another.<ref>Here’s the long note. This one contains multiple blocks.++Subsequent blocks are indented to show that they belong to the footnote (as with list items).++<pre> { <code> }</pre>+If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.+</ref> This should ''not'' be a footnote reference, because it contains a space.[^my note] Here is an inline note.<ref>This is ''easier'' to type. Inline notes may contain [http://google.com links] and <tt>]</tt> verbatim characters, as well as [bracketed text].+</ref>++<blockquote>Notes can go in quotes.<ref>In quote.+</ref>+</blockquote>+# And in list items.<ref>In list.</ref>+This paragraph should not be part of the note, as it is not indented.++== Notes ==+<references />
tests/writer.native view
@@ -26,7 +26,7 @@ , BlockQuote [ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]- , CodeBlock "sub status {\n print \"working\";\n}"+ , CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}" , Para [Str "A",Space,Str "list:"] , OrderedList (1,Decimal,Period) [ [ Plain [Str "item",Space,Str "one"] ]@@ -43,9 +43,9 @@ , HorizontalRule , Header 1 [Str "Code",Space,Str "Blocks"] , Para [Str "Code:"]-, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"+, CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab" , Para [Str "And:"]-, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"+, CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" , HorizontalRule , Header 1 [Str "Lists"] , Header 2 [Str "Unordered"]@@ -165,7 +165,7 @@ [ [ Plain [Str "Nested",Str "."] ] ] ] ] , Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]-, Para [Str "M",Str ".",Str "A",Str ".",Space,Str "2007"]+, Para [Str "M",Str ".",Str "A.\160",Str "2007"] , Para [Str "B",Str ".",Space,Str "Williams"] , HorizontalRule , Header 1 [Str "Definition",Space,Str "Lists"]@@ -209,7 +209,7 @@ , Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"] ] ), ([Emph [Str "orange"]], [ Para [Str "orange",Space,Str "fruit"]- , CodeBlock "{ orange code block }"+ , CodeBlock ("",[],[]) "{ orange code block }" , BlockQuote [ Para [Str "orange",Space,Str "block",Space,Str "quote"] ] ] ) ]@@ -235,9 +235,9 @@ , Plain [Str "foo"] , RawHtml "</div>\n" , Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]-, CodeBlock "<div>\n foo\n</div>"+, CodeBlock ("",[],[]) "<div>\n foo\n</div>" , Para [Str "As",Space,Str "should",Space,Str "this:"]-, CodeBlock "<div>foo</div>"+, CodeBlock ("",[],[]) "<div>foo</div>" , Para [Str "Now,",Space,Str "nested:"] , RawHtml "<div>\n <div>\n <div>\n " , Plain [Str "foo"]@@ -247,11 +247,11 @@ , Para [Str "Multiline:"] , RawHtml "<!--\nBlah\nBlah\n-->\n\n<!--\n This is another comment.\n-->\n" , Para [Str "Code",Space,Str "block:"]-, CodeBlock "<!-- Comment -->"+, CodeBlock ("",[],[]) "<!-- Comment -->" , Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"] , RawHtml "<!-- foo --> \n" , Para [Str "Code:"]-, CodeBlock "<hr />"+, CodeBlock ("",[],[]) "<hr />" , Para [Str "Hr",Apostrophe,Str "s:"] , RawHtml "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n" , HorizontalRule@@ -265,8 +265,8 @@ , Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."] , Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ">",Str ",",Space,Code "$",Str ",",Space,Code "\\",Str ",",Space,Code "\\$",Str ",",Space,Code "<html>",Str "."] , Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]-, Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello",Str " ",Str "there"],Str "."]-, Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many",Str " ",Str "of",Str " ",Str "them"],Str "O",Str "."]+, Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello",Str "\160",Str "there"],Str "."]+, Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many",Str "\160",Str "of",Str "\160",Str "them"],Str "O",Str "."] , Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",Space,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces:",Space,Str "a",Str "^",Str "b",Space,Str "c",Str "^",Str "d,",Space,Str "a",Str "~",Str "b",Space,Str "c",Str "~",Str "d",Str "."] , HorizontalRule , Header 1 [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]@@ -275,25 +275,25 @@ , Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees",Str ".",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine",Str "."]] , Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70",Apostrophe,Str "s?"] , Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]-, Para [Str "Some",Space,Str "dashes:",Space,Str "one",EmDash,Str "two",EmDash,Str "three",EmDash,Str "four",EmDash,Str "five",Str "."]+, Para [Str "Some",Space,Str "dashes:",Space,Str "one",EmDash,Str "two",Space,EmDash,Space,Str "three",EmDash,Str "four",Space,EmDash,Space,Str "five",Str "."] , Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5",EnDash,Str "7,",Space,Str "255",EnDash,Str "66,",Space,Str "1987",EnDash,Str "1999",Str "."] , Para [Str "Ellipses",Ellipses,Str "and",Ellipses,Str "and",Ellipses,Str "."] , HorizontalRule , Header 1 [Str "LaTeX"] , BulletList [ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]- , [ Plain [TeX "\\doublespacing"] ]- , [ Plain [Math "2+2=4"] ]- , [ Plain [Math "x \\in y"] ]- , [ Plain [Math "\\alpha \\wedge \\omega"] ]- , [ Plain [Math "223"] ]- , [ Plain [Math "p",Str "-",Str "Tree"] ]- , [ Plain [Math "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]- , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math "\\alpha + \\omega \\times x^2",Str "."] ] ]+ , [ Plain [Math InlineMath "2+2=4"] ]+ , [ Plain [Math InlineMath "x \\in y"] ]+ , [ Plain [Math InlineMath "\\alpha \\wedge \\omega"] ]+ , [ Plain [Math InlineMath "223"] ]+ , [ Plain [Math InlineMath "p",Str "-",Str "Tree"] ]+ , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "some",Space,Str "display",Space,Str "math:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"] ]+ , [ Plain [Str "Here",Apostrophe,Str "s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."] ] ] , Para [Str "These",Space,Str "shouldn",Apostrophe,Str "t",Space,Str "be",Space,Str "math:"] , BulletList [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ] , [ Plain [Str "$",Str "22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money",Str ".",Space,Str "So",Space,Str "is",Space,Str "$",Str "34,000",Str ".",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized",Str ".",Str ")"] ]+ , [ Plain [Str "Shoes",Space,Str "(",Str "$",Str "20)",Space,Str "and",Space,Str "socks",Space,Str "(",Str "$",Str "5)",Str "."] ] , [ Plain [Str "Escaped",Space,Code "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."] ] ] , Para [Str "Here",Apostrophe,Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"] , Para [TeX "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"]@@ -349,7 +349,7 @@ , Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."] , Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."] , Para [Str "This",Space,Str "should",Space,Str "[",Str "not",Str "]",Str "[",Str "]",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]-, CodeBlock "[not]: /url"+, CodeBlock ("",[],[]) "[not]: /url" , Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."] , Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."] , Header 2 [Str "With",Space,Str "ampersands"]@@ -368,7 +368,7 @@ [ Para [Str "Blockquoted:",Space,Link [Code "http://example.com/"] ("http://example.com/","")] ] , Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code "<http://example.com/>"]-, CodeBlock "or here: <http://example.com/>"+, CodeBlock ("",[],[]) "or here: <http://example.com/>" , HorizontalRule , Header 1 [Str "Images"] , Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]@@ -376,7 +376,7 @@ , Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."] , HorizontalRule , Header 1 [Str "Footnotes"]-, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)",Str "."],CodeBlock " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]]+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here",Apostrophe,Str "s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]] , BlockQuote [ Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes",Str ".",Note [Para [Str "In",Space,Str "quote",Str "."]]] ]
+ tests/writer.opendocument view
@@ -0,0 +1,1563 @@+<?xml version="1.0" encoding="utf-8" ?>++<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">+ <office:scripts />+ <office:font-face-decls>+ <style:font-face style:name="&apos;Lucida Sans Unicode&apos;" svg:font-family="Lucida Sans Unicode" />+ <style:font-face style:name="&apos;Tahoma&apos;" svg:font-family="Tahoma" />+ <style:font-face style:name="&apos;Times New Roman&apos;" svg:font-family="Times New Roman" />+ </office:font-face-decls>+ <office:automatic-styles>+ <text:list-style style:name="L1">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L2">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L3">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L4">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L5">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L6">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L7">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L8">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L9">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L10">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L11">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L12">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L13">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L14">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L15">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L16">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L17">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L18">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L19">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L20">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L21">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L22">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="2" style:num-prefix="(" style:num-suffix=")">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ <text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-format="i" text:start-value="4" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ <text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-format="A" text:start-value="1" style:num-prefix="(" style:num-suffix=")">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L23">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="A" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ <text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-format="I" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ <text:list-level-style-number text:level="3" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="6" style:num-prefix="(" style:num-suffix=")">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ <text:list-level-style-number text:level="4" text:style-name="Numbering_20_Symbols" style:num-format="a" text:start-value="3" style:num-suffix=")">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L24">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ <text:list-level-style-number text:level="2" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <text:list-style style:name="L25">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L26">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L27">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L28">+ <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="0.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="0.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="1.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="1.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="1.75in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="‣">+ <style:list-level-properties text:space-before="2.0in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="⁃">+ <style:list-level-properties text:space-before="2.25in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ <text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•">+ <style:list-level-properties text:space-before="2.5in" text:min-label-width="0.25in" />+ </text:list-level-style-bullet>+ </text:list-style>+ <text:list-style style:name="L29">+ <text:list-level-style-number text:level="1" text:style-name="Numbering_20_Symbols" style:num-format="1" text:start-value="1" style:num-suffix=".">+ <style:list-level-properties text:space-before="0.25in" text:min-label-width="0.25in" />+ </text:list-level-style-number>+ </text:list-style>+ <style:style style:name="T1" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T2" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T3" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T4" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T5" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T6" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T7" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T8" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T9" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T10" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T11" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T12" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T13" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T14" style:family="text"><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T15" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T16" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T17" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T18" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T19" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T20" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T21" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T22" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T23" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T24" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T25" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T26" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T27" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T28" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T29" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T30" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T31" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T32" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T33" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T34" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T35" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T36" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T37" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T38" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T39" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>+ <style:style style:name="T40" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>+ <style:style style:name="T41" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>+ <style:style style:name="T42" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>+ <style:style style:name="T43" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>+ <style:style style:name="T44" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-line-through-style="solid" /></style:style>+ <style:style style:name="T45" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>+ <style:style style:name="T46" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>+ <style:style style:name="T47" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-position="super 58%" /></style:style>+ <style:style style:name="T48" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>+ <style:style style:name="T49" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>+ <style:style style:name="T50" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>+ <style:style style:name="T51" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T52" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T53" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T54" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T55" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T56" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T57" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T58" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T59" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T60" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T61" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T62" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T63" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T64" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T65" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-position="sub 58%" /></style:style>+ <style:style style:name="T66" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T67" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>+ <style:style style:name="T68" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T69" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T70" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T71" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T72" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T73" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T74" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T75" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>+ <style:style style:name="T76" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T77" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T78" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T79" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T80" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T81" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T82" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T83" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T84" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="T85" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Quotations">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Quotations">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P6" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L1">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P7" style:family="paragraph" style:parent-style-name="Quotations">+ <style:paragraph-properties fo:margin-left="1.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P8" style:family="paragraph" style:parent-style-name="Quotations">+ <style:paragraph-properties fo:margin-left="1.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P9" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P10" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P11" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P12" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P13" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P14" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P15" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P16" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P17" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P18" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P19" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L2">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P20" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L3">+ </style:style>+ <style:style style:name="P21" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L4">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P22" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L5">+ </style:style>+ <style:style style:name="P23" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L6">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P24" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L7">+ </style:style>+ <style:style style:name="P25" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L8">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P26" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L9">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P27" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L10">+ </style:style>+ <style:style style:name="P28" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L11">+ </style:style>+ <style:style style:name="P29" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L12">+ </style:style>+ <style:style style:name="P30" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L13">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P31" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L14">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P32" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L15">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P33" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L16">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P34" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L17">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P35" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L18">+ </style:style>+ <style:style style:name="P36" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L19">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P37" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L20">+ </style:style>+ <style:style style:name="P38" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L21">+ </style:style>+ <style:style style:name="P39" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L22">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P40" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L23">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P41" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L24">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P42" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P43" style:family="paragraph" style:parent-style-name="Quotations">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P44" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P45" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P46" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P47" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P48" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P49" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P50" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L25">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P51" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L26">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P52" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L27">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P53" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P54" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L28">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ <style:style style:name="P55" style:family="paragraph" style:parent-style-name="Quotations">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P56" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P57" style:family="paragraph" style:parent-style-name="Preformatted_20_Text">+ </style:style>+ <style:style style:name="P58" style:family="paragraph" style:parent-style-name="Quotations">+ <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />+ </style:style>+ <style:style style:name="P59" style:family="paragraph" style:parent-style-name="Text_20_body" style:list-style-name="L29">+ <style:paragraph-properties fo:margin-left="0.0in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:margin-top="0in" fo:margin-bottom="0in" />+ </style:style>+ </office:automatic-styles>+ <office:body>+ <office:text>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Pandoc+ Test Suite</text:h>+ <text:p text:style-name="Author">John MacFarlane</text:p>+ <text:p text:style-name="Author"> Anonymous</text:p>+ <text:p text:style-name="Date">July 17, 2006</text:p>+ <text:p text:style-name="Text_20_body">This is a set of tests for+ pandoc. Most of them are adapted from John+ Gruber’s markdown test suite.</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Headers</text:h>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Level+ 2 with an+ <text:a xlink:type="simple" xlink:href="/url" office:name=""><text:span text:style-name="Definition">embedded link</text:span></text:a></text:h>+ <text:h text:style-name="Heading_20_3" text:outline-level="3">Level+ 3 with+ <text:span text:style-name="T1">emphasis</text:span></text:h>+ <text:h text:style-name="Heading_20_4" text:outline-level="4">Level+ 4</text:h>+ <text:h text:style-name="Heading_20_5" text:outline-level="5">Level+ 5</text:h>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Level+ 1</text:h>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Level+ 2 with+ <text:span text:style-name="T2">emphasis</text:span></text:h>+ <text:h text:style-name="Heading_20_3" text:outline-level="3">Level+ 3</text:h>+ <text:p text:style-name="Text_20_body">with no blank line</text:p>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Level+ 2</text:h>+ <text:p text:style-name="Text_20_body">with no blank line</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Paragraphs</text:h>+ <text:p text:style-name="Text_20_body">Here’s a regular+ paragraph.</text:p>+ <text:p text:style-name="Text_20_body">In Markdown 1.0.0 and+ earlier. Version 8. This line turns into a list item.+ Because a hard-wrapped line in the middle of a+ paragraph looked like a list item.</text:p>+ <text:p text:style-name="Text_20_body">Here’s one with a+ bullet. * criminey.</text:p>+ <text:p text:style-name="Text_20_body">There should be a hard line+ break<text:line-break />here.</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Block+ Quotes</text:h>+ <text:p text:style-name="Text_20_body">E-mail style:</text:p>+ <text:p text:style-name="P1">This is a block quote. It is pretty short.</text:p>+ <text:p text:style-name="P2">Code in a block quote:</text:p>+ <text:p text:style-name="P3">sub status {</text:p>+ <text:p text:style-name="P4"><text:s text:c="4" />print "working";</text:p>+ <text:p text:style-name="P5">}</text:p>+ <text:p text:style-name="P2">A list:</text:p>+ <text:list text:style-name="L1">+ <text:list-item>+ <text:p text:style-name="P6">item one</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P6">item two</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="P2">Nested block quotes:</text:p>+ <text:p text:style-name="P7">nested</text:p>+ <text:p text:style-name="P8">nested</text:p>+ <text:p text:style-name="Text_20_body">This should not be a block+ quote: 2 > 1.</text:p>+ <text:p text:style-name="Text_20_body">And a following+ paragraph.</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Code+ Blocks</text:h>+ <text:p text:style-name="Text_20_body">Code:</text:p>+ <text:p text:style-name="P9">---- (should be four hyphens)</text:p>+ <text:p text:style-name="P10"></text:p>+ <text:p text:style-name="P11">sub status {</text:p>+ <text:p text:style-name="P12"><text:s text:c="4" />print "working";</text:p>+ <text:p text:style-name="P13">}</text:p>+ <text:p text:style-name="P14"></text:p>+ <text:p text:style-name="P15">this code block is indented by one tab</text:p>+ <text:p text:style-name="Text_20_body">And:</text:p>+ <text:p text:style-name="P16"><text:s text:c="4" />this code block is indented by two tabs</text:p>+ <text:p text:style-name="P17"></text:p>+ <text:p text:style-name="P18">These should not be escaped: <text:s text:c="1" />\$ \\ \> \[ \{</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Lists</text:h>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Unordered</text:h>+ <text:p text:style-name="Text_20_body">Asterisks tight:</text:p>+ <text:list text:style-name="L2">+ <text:list-item>+ <text:p text:style-name="P19">asterisk 1</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P19">asterisk 2</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P19">asterisk 3</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Asterisks loose:</text:p>+ <text:list text:style-name="L3">+ <text:list-item>+ <text:p text:style-name="P20">asterisk 1</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P20">asterisk 2</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P20">asterisk 3</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Pluses tight:</text:p>+ <text:list text:style-name="L4">+ <text:list-item>+ <text:p text:style-name="P21">Plus 1</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P21">Plus 2</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P21">Plus 3</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Pluses loose:</text:p>+ <text:list text:style-name="L5">+ <text:list-item>+ <text:p text:style-name="P22">Plus 1</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P22">Plus 2</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P22">Plus 3</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Minuses tight:</text:p>+ <text:list text:style-name="L6">+ <text:list-item>+ <text:p text:style-name="P23">Minus 1</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P23">Minus 2</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P23">Minus 3</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Minuses loose:</text:p>+ <text:list text:style-name="L7">+ <text:list-item>+ <text:p text:style-name="P24">Minus 1</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P24">Minus 2</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P24">Minus 3</text:p>+ </text:list-item>+ </text:list>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Ordered</text:h>+ <text:p text:style-name="Text_20_body">Tight:</text:p>+ <text:list text:style-name="L8">+ <text:list-item>+ <text:p text:style-name="P25">First</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P25">Second</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P25">Third</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">and:</text:p>+ <text:list text:style-name="L9">+ <text:list-item>+ <text:p text:style-name="P26">One</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P26">Two</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P26">Three</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Loose using tabs:</text:p>+ <text:list text:style-name="L10">+ <text:list-item>+ <text:p text:style-name="P27">First</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P27">Second</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P27">Third</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">and using spaces:</text:p>+ <text:list text:style-name="L11">+ <text:list-item>+ <text:p text:style-name="P28">One</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P28">Two</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P28">Three</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Multiple+ paragraphs:</text:p>+ <text:list text:style-name="L12">+ <text:list-item>+ <text:p text:style-name="P29">Item 1, graf one.</text:p>+ <text:p text:style-name="P29">Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P29">Item 2.</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P29">Item 3.</text:p>+ </text:list-item>+ </text:list>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Nested</text:h>+ <text:list text:style-name="L13">+ <text:list-item>+ <text:p text:style-name="P30">Tab</text:p>+ <text:list text:style-name="L14">+ <text:list-item>+ <text:p text:style-name="P31">Tab</text:p>+ <text:list text:style-name="L15">+ <text:list-item>+ <text:p text:style-name="P32">Tab</text:p>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Here’s+ another:</text:p>+ <text:list text:style-name="L16">+ <text:list-item>+ <text:p text:style-name="P33">First</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P33">Second:</text:p>+ <text:list text:style-name="L17">+ <text:list-item>+ <text:p text:style-name="P34">Fee</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P34">Fie</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P34">Foe</text:p>+ </text:list-item>+ </text:list>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P33">Third</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Same thing but with+ paragraphs:</text:p>+ <text:list text:style-name="L18">+ <text:list-item>+ <text:p text:style-name="P35">First</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P35">Second:</text:p>+ <text:list text:style-name="L19">+ <text:list-item>+ <text:p text:style-name="P36">Fee</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P36">Fie</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P36">Foe</text:p>+ </text:list-item>+ </text:list>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P35">Third</text:p>+ </text:list-item>+ </text:list>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Tabs+ and spaces</text:h>+ <text:list text:style-name="L20">+ <text:list-item>+ <text:p text:style-name="P37">this is a list item indented with tabs</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P37">this is a list item indented with spaces</text:p>+ <text:list text:style-name="L21">+ <text:list-item>+ <text:p text:style-name="P38">this is an example list item indented with tabs</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P38">this is an example list item indented with spaces</text:p>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Fancy+ list markers</text:h>+ <text:list text:style-name="L22">+ <text:list-item>+ <text:p text:style-name="P39">begins with 2</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P39">and now 3</text:p>+ <text:p text:style-name="P39">with a continuation</text:p>+ <text:list>+ <text:list-item>+ <text:p text:style-name="P39">sublist with roman numerals, starting with 4</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P39">more items</text:p>+ <text:list>+ <text:list-item>+ <text:p text:style-name="P39">a subsublist</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P39">a subsublist</text:p>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Nesting:</text:p>+ <text:list text:style-name="L23">+ <text:list-item>+ <text:p text:style-name="P40">Upper Alpha</text:p>+ <text:list>+ <text:list-item>+ <text:p text:style-name="P40">Upper Roman.</text:p>+ <text:list>+ <text:list-item>+ <text:p text:style-name="P40">Decimal start with 6</text:p>+ <text:list>+ <text:list-item>+ <text:p text:style-name="P40">Lower alpha with paren</text:p>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Autonumbering:</text:p>+ <text:list text:style-name="L24">+ <text:list-item>+ <text:p text:style-name="P41">Autonumber.</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P41">More.</text:p>+ <text:list>+ <text:list-item>+ <text:p text:style-name="P41">Nested.</text:p>+ </text:list-item>+ </text:list>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Should not be a list+ item:</text:p>+ <text:p text:style-name="Text_20_body">M.A. 2007</text:p>+ <text:p text:style-name="Text_20_body">B. Williams</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Definition+ Lists</text:h>+ <text:p text:style-name="Text_20_body">Tight using spaces:</text:p>+ <text:p text:style-name="Definition_20_Term_20_Tight">apple</text:p>+ <text:p text:style-name="Definition_20_Definition_20_Tight">red fruit</text:p>+ <text:p text:style-name="Definition_20_Term_20_Tight">orange</text:p>+ <text:p text:style-name="Definition_20_Definition_20_Tight">orange fruit</text:p>+ <text:p text:style-name="Definition_20_Term_20_Tight">banana</text:p>+ <text:p text:style-name="Definition_20_Definition_20_Tight">yellow fruit</text:p>+ <text:p text:style-name="Text_20_body">Tight using tabs:</text:p>+ <text:p text:style-name="Definition_20_Term_20_Tight">apple</text:p>+ <text:p text:style-name="Definition_20_Definition_20_Tight">red fruit</text:p>+ <text:p text:style-name="Definition_20_Term_20_Tight">orange</text:p>+ <text:p text:style-name="Definition_20_Definition_20_Tight">orange fruit</text:p>+ <text:p text:style-name="Definition_20_Term_20_Tight">banana</text:p>+ <text:p text:style-name="Definition_20_Definition_20_Tight">yellow fruit</text:p>+ <text:p text:style-name="Text_20_body">Loose:</text:p>+ <text:p text:style-name="Definition_20_Term">apple</text:p>+ <text:p text:style-name="Definition_20_Definition">red fruit</text:p>+ <text:p text:style-name="Definition_20_Term">orange</text:p>+ <text:p text:style-name="Definition_20_Definition">orange fruit</text:p>+ <text:p text:style-name="Definition_20_Term">banana</text:p>+ <text:p text:style-name="Definition_20_Definition">yellow fruit</text:p>+ <text:p text:style-name="Text_20_body">Multiple blocks with+ italics:</text:p>+ <text:p text:style-name="Definition_20_Term"><text:span text:style-name="T3">apple</text:span></text:p>+ <text:p text:style-name="Definition_20_Definition">red fruit</text:p>+ <text:p text:style-name="Definition_20_Definition">contains seeds, crisp, pleasant to taste</text:p>+ <text:p text:style-name="Definition_20_Term"><text:span text:style-name="T4">orange</text:span></text:p>+ <text:p text:style-name="Definition_20_Definition">orange fruit</text:p>+ <text:p text:style-name="P42">{ orange code block }</text:p>+ <text:p text:style-name="P43">orange block quote</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">HTML+ Blocks</text:h>+ <text:p text:style-name="Text_20_body">Simple block on one+ line:</text:p>+ <text:p text:style-name="Text_20_body">foo</text:p>+ <text:p text:style-name="Text_20_body">And nested without+ indentation:</text:p>+ <text:p text:style-name="Text_20_body">foo</text:p>+ <text:p text:style-name="Text_20_body">bar</text:p>+ <text:p text:style-name="Text_20_body">Interpreted markdown in a+ table:</text:p>+ <text:p text:style-name="Text_20_body">This is+ <text:span text:style-name="T5">emphasized</text:span></text:p>+ <text:p text:style-name="Text_20_body">And this is+ <text:span text:style-name="T6">strong</text:span></text:p>+ <text:p text:style-name="Text_20_body">Here’s a simple+ block:</text:p>+ <text:p text:style-name="Text_20_body">foo</text:p>+ <text:p text:style-name="Text_20_body">This should be a code block,+ though:</text:p>+ <text:p text:style-name="P44"><div></text:p>+ <text:p text:style-name="P45"><text:s text:c="4" />foo</text:p>+ <text:p text:style-name="P46"></div></text:p>+ <text:p text:style-name="Text_20_body">As should this:</text:p>+ <text:p text:style-name="P47"><div>foo</div></text:p>+ <text:p text:style-name="Text_20_body">Now, nested:</text:p>+ <text:p text:style-name="Text_20_body">foo</text:p>+ <text:p text:style-name="Text_20_body">This should just be an HTML+ comment:</text:p>+ <text:p text:style-name="Text_20_body">Multiline:</text:p>+ <text:p text:style-name="Text_20_body">Code block:</text:p>+ <text:p text:style-name="P48"><!-- Comment --></text:p>+ <text:p text:style-name="Text_20_body">Just plain comment, with+ trailing spaces on the line:</text:p>+ <text:p text:style-name="Text_20_body">Code:</text:p>+ <text:p text:style-name="P49"><hr /></text:p>+ <text:p text:style-name="Text_20_body">Hr’s:</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Inline+ Markup</text:h>+ <text:p text:style-name="Text_20_body">This is+ <text:span text:style-name="T7">emphasized</text:span>,+ and so+ <text:span text:style-name="T8">is</text:span><text:span text:style-name="T9"> </text:span><text:span text:style-name="T10">this</text:span>.</text:p>+ <text:p text:style-name="Text_20_body">This is+ <text:span text:style-name="T11">strong</text:span>,+ and so+ <text:span text:style-name="T12">is</text:span><text:span text:style-name="T13"> </text:span><text:span text:style-name="T14">this</text:span>.</text:p>+ <text:p text:style-name="Text_20_body">An+ <text:a xlink:type="simple" xlink:href="/url" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="T15">emphasized</text:span><text:span text:style-name="T16"> </text:span><text:span text:style-name="T17">link</text:span></text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body"><text:span text:style-name="T18">This</text:span><text:span text:style-name="T19"> </text:span><text:span text:style-name="T20">is</text:span><text:span text:style-name="T21"> </text:span><text:span text:style-name="T22">strong</text:span><text:span text:style-name="T23"> </text:span><text:span text:style-name="T24">and</text:span><text:span text:style-name="T25"> </text:span><text:span text:style-name="T26">em</text:span><text:span text:style-name="T27">.</text:span></text:p>+ <text:p text:style-name="Text_20_body">So is+ <text:span text:style-name="T28">this</text:span>+ word.</text:p>+ <text:p text:style-name="Text_20_body"><text:span text:style-name="T29">This</text:span><text:span text:style-name="T30"> </text:span><text:span text:style-name="T31">is</text:span><text:span text:style-name="T32"> </text:span><text:span text:style-name="T33">strong</text:span><text:span text:style-name="T34"> </text:span><text:span text:style-name="T35">and</text:span><text:span text:style-name="T36"> </text:span><text:span text:style-name="T37">em</text:span><text:span text:style-name="T38">.</text:span></text:p>+ <text:p text:style-name="Text_20_body">So is+ <text:span text:style-name="T39">this</text:span>+ word.</text:p>+ <text:p text:style-name="Text_20_body">This is code:+ <text:span text:style-name="Teletype">></text:span>,+ <text:span text:style-name="Teletype">$</text:span>,+ <text:span text:style-name="Teletype">\</text:span>,+ <text:span text:style-name="Teletype">\$</text:span>,+ <text:span text:style-name="Teletype"><html></text:span>.</text:p>+ <text:p text:style-name="Text_20_body"><text:span text:style-name="T40">This</text:span><text:span text:style-name="T41"> </text:span><text:span text:style-name="T42">is</text:span><text:span text:style-name="T43"> </text:span><text:span text:style-name="T44">strikeout</text:span><text:span text:style-name="T45">.</text:span></text:p>+ <text:p text:style-name="Text_20_body">Superscripts:+ a<text:span text:style-name="T46">bc</text:span>d+ a<text:span text:style-name="T47">hello</text:span>+ a<text:span text:style-name="T48">hello</text:span><text:span text:style-name="T49"> </text:span><text:span text:style-name="T50">there</text:span>.</text:p>+ <text:p text:style-name="Text_20_body">Subscripts:+ H<text:span text:style-name="T51">2</text:span>O,+ H<text:span text:style-name="T52">23</text:span>O,+ H<text:span text:style-name="T53">many</text:span><text:span text:style-name="T54"> </text:span><text:span text:style-name="T55">of</text:span><text:span text:style-name="T56"> </text:span><text:span text:style-name="T57">them</text:span>O.</text:p>+ <text:p text:style-name="Text_20_body">These should not be+ superscripts or subscripts, because of the unescaped+ spaces: a^b c^d, a~b c~d.</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Smart+ quotes, ellipses,+ dashes</text:h>+ <text:p text:style-name="Text_20_body">“Hello,” said+ the spider.+ “‘Shelob’ is my name.”</text:p>+ <text:p text:style-name="Text_20_body">‘A’,+ ‘B’, and ‘C’ are+ letters.</text:p>+ <text:p text:style-name="Text_20_body">‘Oak,’+ ‘elm,’ and ‘beech’ are names of+ trees. So is ‘pine.’</text:p>+ <text:p text:style-name="Text_20_body">‘He said, “I want to go.”’+ Were you alive in the 70’s?</text:p>+ <text:p text:style-name="Text_20_body">Here is some quoted+ ‘<text:span text:style-name="Teletype">code</text:span>’+ and a+ “<text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">quoted link</text:span></text:a>”.</text:p>+ <text:p text:style-name="Text_20_body">Some dashes: one—two+ — three—four — five.</text:p>+ <text:p text:style-name="Text_20_body">Dashes between numbers:+ 5–7, 255–66, 1987–1999.</text:p>+ <text:p text:style-name="Text_20_body">Ellipses…and…and….</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">LaTeX</text:h>+ <text:list text:style-name="L25">+ <text:list-item>+ <text:p text:style-name="P50"><text:span text:style-name="Teletype">\cite[22-23]{smith.1899}</text:span></text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P50">2+2=4</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P50"><text:span text:style-name="T58">x</text:span> ∈ <text:span text:style-name="T59">y</text:span></text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P50">α ∧ ω</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P50">223</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P50"><text:span text:style-name="T60">p</text:span>-Tree</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P50">Here’s some display math: \frac{<text:span text:style-name="T61">d</text:span>}{<text:span text:style-name="T62">dx</text:span>}<text:span text:style-name="T63">f</text:span>(<text:span text:style-name="T64">x</text:span>)=\lim<text:span text:style-name="T65">h</text:span><text:span text:style-name="T66"> → </text:span><text:span text:style-name="T67">0</text:span>\frac{<text:span text:style-name="T68">f</text:span>(<text:span text:style-name="T69">x</text:span>+<text:span text:style-name="T70">h</text:span>)-<text:span text:style-name="T71">f</text:span>(<text:span text:style-name="T72">x</text:span>)}{<text:span text:style-name="T73">h</text:span>}</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P50">Here’s one that has a line break in it: α+ω × <text:span text:style-name="T74">x</text:span><text:span text:style-name="T75">2</text:span>.</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">These shouldn’t be+ math:</text:p>+ <text:list text:style-name="L26">+ <text:list-item>+ <text:p text:style-name="P51">To get the famous equation, write <text:span text:style-name="Teletype">$e = mc^2$</text:span>.</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P51">$22,000 is a <text:span text:style-name="T76">lot</text:span> of money. So is $34,000. (It worked if “lot” is emphasized.)</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P51">Shoes ($20) and socks ($5).</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P51">Escaped <text:span text:style-name="Teletype">$</text:span>: $73 <text:span text:style-name="T77">this</text:span><text:span text:style-name="T78"> </text:span><text:span text:style-name="T79">should</text:span><text:span text:style-name="T80"> </text:span><text:span text:style-name="T81">be</text:span><text:span text:style-name="T82"> </text:span><text:span text:style-name="T83">emphasized</text:span> 23$.</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">Here’s a LaTeX+ table:</text:p>+ <text:p text:style-name="Text_20_body"><text:span text:style-name="Teletype">\begin{tabular}{|l|l|}\hline+Animal & Number \\ \hline+Dog <text:s text:c="3" />& 2 <text:s text:c="5" />\\+Cat <text:s text:c="3" />& 1 <text:s text:c="5" />\\ \hline+\end{tabular}</text:span></text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Special+ Characters</text:h>+ <text:p text:style-name="Text_20_body">Here is some+ unicode:</text:p>+ <text:list text:style-name="L27">+ <text:list-item>+ <text:p text:style-name="P52">I hat: Î</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P52">o umlaut: ö</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P52">section: §</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P52">set membership: ∈</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P52">copyright: ©</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">AT&T has an ampersand in+ their name.</text:p>+ <text:p text:style-name="Text_20_body">AT&T is another way to+ write it.</text:p>+ <text:p text:style-name="Text_20_body">This & that.</text:p>+ <text:p text:style-name="Text_20_body">4 < 5.</text:p>+ <text:p text:style-name="Text_20_body">6 > 5.</text:p>+ <text:p text:style-name="Text_20_body">Backslash: \</text:p>+ <text:p text:style-name="Text_20_body">Backtick: `</text:p>+ <text:p text:style-name="Text_20_body">Asterisk: *</text:p>+ <text:p text:style-name="Text_20_body">Underscore: _</text:p>+ <text:p text:style-name="Text_20_body">Left brace: {</text:p>+ <text:p text:style-name="Text_20_body">Right brace: }</text:p>+ <text:p text:style-name="Text_20_body">Left bracket: [</text:p>+ <text:p text:style-name="Text_20_body">Right bracket: ]</text:p>+ <text:p text:style-name="Text_20_body">Left paren: (</text:p>+ <text:p text:style-name="Text_20_body">Right paren: )</text:p>+ <text:p text:style-name="Text_20_body">Greater-than: ></text:p>+ <text:p text:style-name="Text_20_body">Hash: #</text:p>+ <text:p text:style-name="Text_20_body">Period: .</text:p>+ <text:p text:style-name="Text_20_body">Bang: !</text:p>+ <text:p text:style-name="Text_20_body">Plus: +</text:p>+ <text:p text:style-name="Text_20_body">Minus: -</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Links</text:h>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Explicit</text:h>+ <text:p text:style-name="Text_20_body">Just a+ <text:a xlink:type="simple" xlink:href="/url/" office:name=""><text:span text:style-name="Definition">URL</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="/url/" office:name="title"><text:span text:style-name="Definition">URL and title</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="/url/" office:name="title preceded by two spaces"><text:span text:style-name="Definition">URL and title</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="/url/" office:name="title preceded by a tab"><text:span text:style-name="Definition">URL and title</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="/url/" office:name="title with "quotes" in it"><text:span text:style-name="Definition">URL and title</text:span></text:a></text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="/url/" office:name="title with single quotes"><text:span text:style-name="Definition">URL and title</text:span></text:a></text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="/url/with_underscore" office:name=""><text:span text:style-name="Definition">with_underscore</text:span></text:a></text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="mailto:nobody@nowhere.net" office:name=""><text:span text:style-name="Definition">Email link</text:span></text:a></text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="" office:name=""><text:span text:style-name="Definition">Empty</text:span></text:a>.</text:p>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Reference</text:h>+ <text:p text:style-name="Text_20_body">Foo+ <text:a xlink:type="simple" xlink:href="/url/" office:name=""><text:span text:style-name="Definition">bar</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Foo+ <text:a xlink:type="simple" xlink:href="/url/" office:name=""><text:span text:style-name="Definition">bar</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Foo+ <text:a xlink:type="simple" xlink:href="/url/" office:name=""><text:span text:style-name="Definition">bar</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">With+ <text:a xlink:type="simple" xlink:href="/url/" office:name=""><text:span text:style-name="Definition">embedded [brackets]</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body"><text:a xlink:type="simple" xlink:href="/url/" office:name=""><text:span text:style-name="Definition">b</text:span></text:a>+ by itself should be a link.</text:p>+ <text:p text:style-name="Text_20_body">Indented+ <text:a xlink:type="simple" xlink:href="/url" office:name=""><text:span text:style-name="Definition">once</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Indented+ <text:a xlink:type="simple" xlink:href="/url" office:name=""><text:span text:style-name="Definition">twice</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Indented+ <text:a xlink:type="simple" xlink:href="/url" office:name=""><text:span text:style-name="Definition">thrice</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">This should [not][] be a+ link.</text:p>+ <text:p text:style-name="P53">[not]: /url</text:p>+ <text:p text:style-name="Text_20_body">Foo+ <text:a xlink:type="simple" xlink:href="/url/" office:name="Title with "quotes" inside"><text:span text:style-name="Definition">bar</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Foo+ <text:a xlink:type="simple" xlink:href="/url/" office:name="Title with "quote" inside"><text:span text:style-name="Definition">biz</text:span></text:a>.</text:p>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">With+ ampersands</text:h>+ <text:p text:style-name="Text_20_body">Here’s a+ <text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">link with an ampersand in the URL</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Here’s a link with an+ amersand in the link text:+ <text:a xlink:type="simple" xlink:href="http://att.com/" office:name="AT&T"><text:span text:style-name="Definition">AT&T</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Here’s an+ <text:a xlink:type="simple" xlink:href="/script?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">inline link</text:span></text:a>.</text:p>+ <text:p text:style-name="Text_20_body">Here’s an+ <text:a xlink:type="simple" xlink:href="/script?foo=1&bar=2" office:name=""><text:span text:style-name="Definition">inline link in pointy braces</text:span></text:a>.</text:p>+ <text:h text:style-name="Heading_20_2" text:outline-level="2">Autolinks</text:h>+ <text:p text:style-name="Text_20_body">With an ampersand:+ <text:a xlink:type="simple" xlink:href="http://example.com/?foo=1&bar=2" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/?foo=1&bar=2</text:span></text:span></text:a></text:p>+ <text:list text:style-name="L28">+ <text:list-item>+ <text:p text:style-name="P54">In a list?</text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P54"><text:a xlink:type="simple" xlink:href="http://example.com/" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/</text:span></text:span></text:a></text:p>+ </text:list-item>+ <text:list-item>+ <text:p text:style-name="P54">It should.</text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">An e-mail address:+ <text:a xlink:type="simple" xlink:href="mailto:nobody@nowhere.net" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">nobody@nowhere.net</text:span></text:span></text:a></text:p>+ <text:p text:style-name="P55">Blockquoted: <text:a xlink:type="simple" xlink:href="http://example.com/" office:name=""><text:span text:style-name="Definition"><text:span text:style-name="Teletype">http://example.com/</text:span></text:span></text:a></text:p>+ <text:p text:style-name="Text_20_body">Auto-links should not occur+ here:+ <text:span text:style-name="Teletype"><http://example.com/></text:span></text:p>+ <text:p text:style-name="P56">or here: <http://example.com/></text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Images</text:h>+ <text:p text:style-name="Text_20_body">From+ “Voyage dans la Lune” by Georges Melies+ (1902):</text:p>+ <text:p text:style-name="Text_20_body"><draw:frame><draw:image xlink:href="lalune.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame></text:p>+ <text:p text:style-name="Text_20_body">Here is a movie+ <draw:frame><draw:image xlink:href="movie.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" /></draw:frame>+ icon.</text:p>+ <text:h text:style-name="Heading_20_1" text:outline-level="1">Footnotes</text:h>+ <text:p text:style-name="Text_20_body">Here is a footnote+ reference,<text:note text:id="ftn0" text:note-class="footnote"><text:note-citation>1</text:note-citation>+ <text:note-body><text:p text:style-name="Footnote">Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.</text:p></text:note-body></text:note>+ and+ another.<text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation>+ <text:note-body><text:p text:style-name="Footnote">Here’s the long note. This one contains multiple blocks.</text:p>+ <text:p text:style-name="Footnote">Subsequent blocks are indented to show that they belong to the footnote (as with list items).</text:p>+ <text:p text:style-name="P57"><text:s text:c="2" />{ <code> }</text:p>+ <text:p text:style-name="Footnote">If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.</text:p></text:note-body></text:note>+ This should+ <text:span text:style-name="T84">not</text:span> be a+ footnote reference, because it contains a space.[^my+ note] Here is an inline+ note.<text:note text:id="ftn2" text:note-class="footnote"><text:note-citation>3</text:note-citation>+ <text:note-body><text:p text:style-name="Footnote">This is <text:span text:style-name="T85">easier</text:span> to type. Inline notes may contain <text:a xlink:type="simple" xlink:href="http://google.com" office:name=""><text:span text:style-name="Definition">links</text:span></text:a> and <text:span text:style-name="Teletype">]</text:span> verbatim characters, as well as [bracketed text].</text:p></text:note-body></text:note></text:p>+ <text:p text:style-name="P58">Notes can go in quotes.<text:note text:id="ftn3" text:note-class="footnote"><text:note-citation>4</text:note-citation>+ <text:note-body><text:p text:style-name="Footnote">In quote.</text:p></text:note-body></text:note></text:p>+ <text:list text:style-name="L29">+ <text:list-item>+ <text:p text:style-name="P59">And in list items.<text:note text:id="ftn4" text:note-class="footnote"><text:note-citation>5</text:note-citation>+ <text:note-body><text:p text:style-name="Footnote">In list.</text:p></text:note-body></text:note></text:p>+ </text:list-item>+ </text:list>+ <text:p text:style-name="Text_20_body">This paragraph should not be+ part of the note, as it is not indented.</text:p>+ </office:text>+ </office:body>+ +</office:document-content>
tests/writer.rst view
@@ -329,7 +329,7 @@ Should not be a list item: -M.A. 2007+M.A. 2007 B. Williams @@ -585,10 +585,10 @@ [STRIKEOUT:This is *strikeout*.] Superscripts: a\ :sup:`bc`\ d a\ :sup:`*hello*`\ -a\ :sup:`hello there`\ .+a\ :sup:`hello there`\ . Subscripts: H\ :sub:`2`\ O, H\ :sub:`23`\ O,-H\ :sub:`many of them`\ O.+H\ :sub:`many of them`\ O. These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.@@ -609,7 +609,7 @@ Here is some quoted '``code``' and a "`quoted link <http://example.com/?foo=1&bar=2>`_". -Some dashes: one--two--three--four--five.+Some dashes: one--two -- three--four -- five. Dashes between numbers: 5-7, 255-66, 1987-1999. @@ -622,13 +622,13 @@ - -- - :math:`$2+2=4$` - :math:`$x \in y$` - :math:`$\alpha \wedge \omega$` - :math:`$223$` - :math:`$p$`-Tree-- :math:`$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$`+- Here's some display math:+ :math:`$$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$` - Here's one that has a line break in it: :math:`$\alpha + \omega \times x^2$`. @@ -638,6 +638,7 @@ - To get the famous equation, write ``$e = mc^2$``. - $22,000 is a *lot* of money. So is $34,000. (It worked if "lot" is emphasized.)+- Shoes ($20) and socks ($5). - Escaped ``$``: $73 *this should be emphasized* 23$. Here's a LaTeX table:
tests/writer.rtf view
@@ -13,11 +13,11 @@ embedded link }}} \par}-{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Level 3 with {\i emphasis} \par}+{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Level 3 with {\i emphasis}\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs24 Level 4\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs20 Level 5\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Level 1\par}-{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Level 2 with {\i emphasis} \par}+{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Level 2 with {\i emphasis}\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs28 Level 3\par} {\pard \ql \f0 \sa180 \li0 \fi0 with no blank line\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Level 2\par}@@ -148,7 +148,7 @@ {\pard \ql \f0 \sa0 \li360 \fi-360 2.\tx360\tab More.\par} {\pard \ql \f0 \sa0 \li720 \fi-360 a.\tx360\tab Nested.\sa180\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 Should not be a list item:\par}-{\pard \ql \f0 \sa180 \li0 \fi0 M.A. 2007\par}+{\pard \ql \f0 \sa180 \li0 \fi0 M.A.\u160?2007\par} {\pard \ql \f0 \sa180 \li0 \fi0 B. Williams\par} {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Definition Lists\par}@@ -174,10 +174,10 @@ {\pard \ql \f0 \sa0 \li0 \fi0 banana\par} {\pard \ql \f0 \sa180 \li360 \fi0 yellow fruit\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 Multiple blocks with italics:\par}-{\pard \ql \f0 \sa0 \li0 \fi0 {\i apple} \par}+{\pard \ql \f0 \sa0 \li0 \fi0 {\i apple}\par} {\pard \ql \f0 \sa180 \li360 \fi0 red fruit\par} {\pard \ql \f0 \sa180 \li360 \fi0 contains seeds, crisp, pleasant to taste\par}-{\pard \ql \f0 \sa0 \li0 \fi0 {\i orange} \par}+{\pard \ql \f0 \sa0 \li0 \fi0 {\i orange}\par} {\pard \ql \f0 \sa180 \li360 \fi0 orange fruit\par} {\pard \ql \f0 \sa180 \li360 \fi0 \f1 \{ orange code block \}\par} {\pard \ql \f0 \sa180 \li1080 \fi0 orange block quote\sa180\par}@@ -188,8 +188,8 @@ {\pard \ql \f0 \sa0 \li0 \fi0 foo\par} {\pard \ql \f0 \sa0 \li0 \fi0 bar\par} {\pard \ql \f0 \sa180 \li0 \fi0 Interpreted markdown in a table:\par}-{\pard \ql \f0 \sa0 \li0 \fi0 This is {\i emphasized} \par}-{\pard \ql \f0 \sa0 \li0 \fi0 And this is {\b strong} \par}+{\pard \ql \f0 \sa0 \li0 \fi0 This is {\i emphasized}\par}+{\pard \ql \f0 \sa0 \li0 \fi0 And this is {\b strong}\par} {\pard \ql \f0 \sa180 \li0 \fi0 Here\u8217's a simple block:\par} {\pard \ql \f0 \sa0 \li0 \fi0 foo\par} {\pard \ql \f0 \sa180 \li0 \fi0 This should be a code block, though:\par}@@ -210,20 +210,20 @@ {\pard \ql \f0 \sa180 \li0 \fi0 Hr\u8217's:\par} {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Inline Markup\par}-{\pard \ql \f0 \sa180 \li0 \fi0 This is {\i emphasized} , and so {\i is this} .\par}-{\pard \ql \f0 \sa180 \li0 \fi0 This is {\b strong} , and so {\b is this} .\par}+{\pard \ql \f0 \sa180 \li0 \fi0 This is {\i emphasized}, and so {\i is this}.\par}+{\pard \ql \f0 \sa180 \li0 \fi0 This is {\b strong}, and so {\b is this}.\par} {\pard \ql \f0 \sa180 \li0 \fi0 An {\i {\field{\*\fldinst{HYPERLINK "/url"}}{\fldrslt{\ul emphasized link }}}-} .\par}-{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.} } \par}-{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this} } word.\par}-{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.} } \par}-{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this} } word.\par}-{\pard \ql \f0 \sa180 \li0 \fi0 This is code: {\f1 >} , {\f1 $} , {\f1 \\} , {\f1 \\$} , {\f1 <html>} .\par}-{\pard \ql \f0 \sa180 \li0 \fi0 {\strike This is {\i strikeout} .} \par}-{\pard \ql \f0 \sa180 \li0 \fi0 Superscripts: a{\super bc} d a{\super {\i hello} } a{\super hello there} .\par}-{\pard \ql \f0 \sa180 \li0 \fi0 Subscripts: H{\sub 2} O, H{\sub 23} O, H{\sub many of them} O.\par}+}.\par}+{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.}}\par}+{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this}} word.\par}+{\pard \ql \f0 \sa180 \li0 \fi0 {\b {\i This is strong and em.}}\par}+{\pard \ql \f0 \sa180 \li0 \fi0 So is {\b {\i this}} word.\par}+{\pard \ql \f0 \sa180 \li0 \fi0 This is code: {\f1 >}, {\f1 $}, {\f1 \\}, {\f1 \\$}, {\f1 <html>}.\par}+{\pard \ql \f0 \sa180 \li0 \fi0 {\strike This is {\i strikeout}.}\par}+{\pard \ql \f0 \sa180 \li0 \fi0 Superscripts: a{\super bc}d a{\super {\i hello}} a{\super hello\u160?there}.\par}+{\pard \ql \f0 \sa180 \li0 \fi0 Subscripts: H{\sub 2}O, H{\sub 23}O, H{\sub many\u160?of\u160?them}O.\par} {\pard \ql \f0 \sa180 \li0 \fi0 These should not be superscripts or subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.\par} {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Smart quotes, ellipses, dashes\par}@@ -231,28 +231,28 @@ {\pard \ql \f0 \sa180 \li0 \fi0 \u8216'A\u8217', \u8216'B\u8217', and \u8216'C\u8217' are letters.\par} {\pard \ql \f0 \sa180 \li0 \fi0 \u8216'Oak,\u8217' \u8216'elm,\u8217' and \u8216'beech\u8217' are names of trees. So is \u8216'pine.\u8217'\par} {\pard \ql \f0 \sa180 \li0 \fi0 \u8216'He said, \u8220"I want to go.\u8221"\u8217' Were you alive in the 70\u8217's?\par}-{\pard \ql \f0 \sa180 \li0 \fi0 Here is some quoted \u8216'{\f1 code} \u8217' and a \u8220"{\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul+{\pard \ql \f0 \sa180 \li0 \fi0 Here is some quoted \u8216'{\f1 code}\u8217' and a \u8220"{\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul quoted link }}} \u8221".\par}-{\pard \ql \f0 \sa180 \li0 \fi0 Some dashes: one\u8212-two\u8212-three\u8212-four\u8212-five.\par}+{\pard \ql \f0 \sa180 \li0 \fi0 Some dashes: one\u8212-two \u8212- three\u8212-four \u8212- five.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Dashes between numbers: 5\u8211-7, 255\u8211-66, 1987\u8211-1999.\par} {\pard \ql \f0 \sa180 \li0 \fi0 Ellipses\u8230?and\u8230?and\u8230?.\par} {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 LaTeX\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2+2=4\par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x} \u8201?\u8712?\u8201?{\i y} \par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8201?\u8712?\u8201?{\i y}\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8201?\u8743?\u8201?\u969?\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 223\par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p} -Tree\par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \\frac\{{\i d} \}\{{\i dx} \}{\i f} ({\i x} )=\\lim{\sub {\i h} \u8201?\u8594?\u8201?0} \\frac\{{\i f} ({\i x} +{\i h} )-{\i f} ({\i x} )\}\{{\i h} \}\par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?+\u969?\u8201?\u215?\u8201?{\i x} {\super 2} .\sa180\par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p}-Tree\par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's some display math: \\frac\{{\i d}\}\{{\i dx}\}{\i f}({\i x})=\\lim{\sub {\i h}\u8201?\u8594?\u8201?0}\\frac\{{\i f}({\i x}+{\i h})-{\i f}({\i x})\}\{{\i h}\}\par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?+\u969?\u8201?\u215?\u8201?{\i x}{\super 2}.\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 These shouldn\u8217't be math:\par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$} .\par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if \u8220"lot\u8221" is emphasized.)\par}-{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Escaped {\f1 $} : $73 {\i this should be emphasized} 23$.\sa180\par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$}.\par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if \u8220"lot\u8221" is emphasized.)\par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Shoes ($20) and socks ($5).\par}+{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Escaped {\f1 $}: $73 {\i this should be emphasized} 23$.\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 Here\u8217's a LaTeX table:\par} {\pard \ql \f0 \sa180 \li0 \fi0 \par} {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par}@@ -385,24 +385,24 @@ .\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Autolinks\par} {\pard \ql \f0 \sa180 \li0 \fi0 With an ampersand: {\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul-{\f1 http://example.com/?foo=1&bar=2} +{\f1 http://example.com/?foo=1&bar=2} }}} \par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab In a list?\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\field{\*\fldinst{HYPERLINK "http://example.com/"}}{\fldrslt{\ul-{\f1 http://example.com/} +{\f1 http://example.com/} }}} \par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab It should.\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 An e-mail address: {\field{\*\fldinst{HYPERLINK "mailto:nobody@nowhere.net"}}{\fldrslt{\ul-{\f1 nobody@nowhere.net} +{\f1 nobody@nowhere.net} }}} \par} {\pard \ql \f0 \sa180 \li720 \fi0 Blockquoted: {\field{\*\fldinst{HYPERLINK "http://example.com/"}}{\fldrslt{\ul-{\f1 http://example.com/} +{\f1 http://example.com/} }}} \par}-{\pard \ql \f0 \sa180 \li0 \fi0 Auto-links should not occur here: {\f1 <http://example.com/>} \par}+{\pard \ql \f0 \sa180 \li0 \fi0 Auto-links should not occur here: {\f1 <http://example.com/>}\par} {\pard \ql \f0 \sa180 \li0 \fi0 \f1 or here: <http://example.com/>\par} {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Images\par}@@ -416,10 +416,10 @@ {\pard \ql \f0 \sa180 \li0 \fi0 Subsequent blocks are indented to show that they belong to the footnote (as with list items).\par} {\pard \ql \f0 \sa180 \li0 \fi0 \f1 \{ <code> \}\par} {\pard \ql \f0 \sa180 \li0 \fi0 If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.\par}-} This should {\i not} be a footnote reference, because it contains a space.[^my note] Here is an inline note.{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \ql \f0 \sa180 \li0 \fi0 This is {\i easier} to type. Inline notes may contain {\field{\*\fldinst{HYPERLINK "http://google.com"}}{\fldrslt{\ul+} This should {\i not} be a footnote reference, because it contains a space.[^my note] Here is an inline note.{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \ql \f0 \sa180 \li0 \fi0 This is {\i easier} to type. Inline notes may contain {\field{\*\fldinst{HYPERLINK "http://google.com"}}{\fldrslt{\ul links }}}- and {\f1 ]} verbatim characters, as well as [bracketed text].\par}+ and {\f1 ]} verbatim characters, as well as [bracketed text].\par} }\par} {\pard \ql \f0 \sa180 \li720 \fi0 Notes can go in quotes.{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \ql \f0 \sa180 \li0 \fi0 In quote.\par} }\par}
+ tests/writer.texinfo view
@@ -0,0 +1,960 @@+\input texinfo++@macro textstrikeout{text}+~~\text\~~+@end macro++@macro textsubscript{text}+@iftex+@textsubscript{\text\}+@end iftex+@ifnottex+_@{\text\@}+@end ifnottex+@end macro++@macro textsuperscript{text}+@iftex+@textsuperscript{\text\}+@end iftex+@ifnottex+^@{\text\@}+@end ifnottex+@end macro+++@ifnottex+@paragraphindent 0+@end ifnottex+@titlepage+@title Pandoc Test Suite+@author John MacFarlane+@author Anonymous+July 17@comma{} 2006+@end titlepage+@node Top+@top Pandoc Test Suite++This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex+@menu+* Headers::+* Level 1::+* Paragraphs::+* Block Quotes::+* Code Blocks::+* Lists::+* Definition Lists::+* HTML Blocks::+* Inline Markup::+* Smart quotes ellipses dashes::+* LaTeX::+* Special Characters::+* Links::+* Images::+* Footnotes::+@end menu++@node Headers+@chapter Headers+@menu+* Level 2 with an embedded link::+@end menu++@node Level 2 with an embedded link+@section Level 2 with an @uref{/url,embedded link}+@menu+* Level 3 with emphasis::+@end menu++@node Level 3 with emphasis+@subsection Level 3 with @emph{emphasis}+@menu+* Level 4::+@end menu++@node Level 4+@subsubsection Level 4+Level 5++@node Level 1+@chapter Level 1+@menu+* Level 2 with emphasis::+* Level 2::+@end menu++@node Level 2 with emphasis+@section Level 2 with @emph{emphasis}+@menu+* Level 3::+@end menu++@node Level 3+@subsection Level 3+with no blank line+++@node Level 2+@section Level 2+with no blank line++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Paragraphs+@chapter Paragraphs+Here's a regular paragraph.++In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.++Here's one with a bullet. * criminey.++There should be a hard line break@*here.++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Block Quotes+@chapter Block Quotes+E-mail style:++@quotation+This is a block quote. It is pretty short.++@end quotation+@quotation+Code in a block quote:+@verbatim+sub status {+ print "working";+}+@end verbatim++A list:++@enumerate +@item+item one+@item+item two+@end enumerate++Nested block quotes:++@quotation+nested++@end quotation+@quotation+nested++@end quotation+@end quotation+This should not be a block quote: 2 > 1.++And a following paragraph.++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Code Blocks+@chapter Code Blocks+Code:+@verbatim+---- (should be four hyphens)++sub status {+ print "working";+}++this code block is indented by one tab+@end verbatim++And:+@verbatim+ this code block is indented by two tabs++These should not be escaped: \$ \\ \> \[ \{+@end verbatim++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Lists+@chapter Lists+@menu+* Unordered::+* Ordered::+* Nested::+* Tabs and spaces::+* Fancy list markers::+@end menu++@node Unordered+@section Unordered+Asterisks tight:++@itemize+@item+asterisk 1+@item+asterisk 2+@item+asterisk 3+@end itemize++Asterisks loose:++@itemize+@item+asterisk 1++@item+asterisk 2++@item+asterisk 3++@end itemize++Pluses tight:++@itemize+@item+Plus 1+@item+Plus 2+@item+Plus 3+@end itemize++Pluses loose:++@itemize+@item+Plus 1++@item+Plus 2++@item+Plus 3++@end itemize++Minuses tight:++@itemize+@item+Minus 1+@item+Minus 2+@item+Minus 3+@end itemize++Minuses loose:++@itemize+@item+Minus 1++@item+Minus 2++@item+Minus 3++@end itemize+++@node Ordered+@section Ordered+Tight:++@enumerate +@item+First+@item+Second+@item+Third+@end enumerate++and:++@enumerate +@item+One+@item+Two+@item+Three+@end enumerate++Loose using tabs:++@enumerate +@item+First++@item+Second++@item+Third++@end enumerate++and using spaces:++@enumerate +@item+One++@item+Two++@item+Three++@end enumerate++Multiple paragraphs:++@enumerate +@item+Item 1@comma{} graf one.++Item 1. graf two. The quick brown fox jumped over the lazy dog's back.++@item+Item 2.++@item+Item 3.++@end enumerate+++@node Nested+@section Nested+@itemize+@item+Tab+@itemize+@item+Tab+@itemize+@item+Tab+@end itemize++@end itemize++@end itemize++Here's another:++@enumerate +@item+First+@item+Second:+@itemize+@item+Fee+@item+Fie+@item+Foe+@end itemize++@item+Third+@end enumerate++Same thing but with paragraphs:++@enumerate +@item+First++@item+Second:++@itemize+@item+Fee+@item+Fie+@item+Foe+@end itemize++@item+Third++@end enumerate+++@node Tabs and spaces+@section Tabs and spaces+@itemize+@item+this is a list item indented with tabs++@item+this is a list item indented with spaces++@itemize+@item+this is an example list item indented with tabs++@item+this is an example list item indented with spaces++@end itemize++@end itemize+++@node Fancy list markers+@section Fancy list markers+@enumerate 2+@item+begins with 2+@item+and now 3++with a continuation++@enumerate 4+@item+sublist with roman numerals@comma{} starting with 4+@item+more items+@enumerate A+@item+a subsublist+@item+a subsublist+@end enumerate++@end enumerate++@end enumerate++Nesting:++@enumerate A+@item+Upper Alpha+@enumerate +@item+Upper Roman.+@enumerate 6+@item+Decimal start with 6+@enumerate c+@item+Lower alpha with paren+@end enumerate++@end enumerate++@end enumerate++@end enumerate++Autonumbering:++@enumerate +@item+Autonumber.+@item+More.+@enumerate +@item+Nested.+@end enumerate++@end enumerate++Should not be a list item:++M.A.@ 2007++B. Williams++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Definition Lists+@chapter Definition Lists+Tight using spaces:++@table @asis+@item apple++red fruit+@item orange++orange fruit+@item banana++yellow fruit+@end table++Tight using tabs:++@table @asis+@item apple++red fruit+@item orange++orange fruit+@item banana++yellow fruit+@end table++Loose:++@table @asis+@item apple++red fruit++@item orange++orange fruit++@item banana++yellow fruit++@end table++Multiple blocks with italics:++@table @asis+@item @emph{apple}++red fruit++contains seeds@comma{} crisp@comma{} pleasant to taste++@item @emph{orange}++orange fruit+@verbatim+{ orange code block }+@end verbatim++@quotation+orange block quote++@end quotation+@end table+++@node HTML Blocks+@chapter HTML Blocks+Simple block on one line:++foo+And nested without indentation:++foo+bar+Interpreted markdown in a table:++This is @emph{emphasized}+And this is @strong{strong}+Here's a simple block:++foo+This should be a code block@comma{} though:+@verbatim+<div>+ foo+</div>+@end verbatim++As should this:+@verbatim+<div>foo</div>+@end verbatim++Now@comma{} nested:++foo+This should just be an HTML comment:++Multiline:++Code block:+@verbatim+<!-- Comment -->+@end verbatim++Just plain comment@comma{} with trailing spaces on the line:++Code:+@verbatim+<hr />+@end verbatim++Hr's:++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Inline Markup+@chapter Inline Markup+This is @emph{emphasized}@comma{} and so @emph{is this}.++This is @strong{strong}@comma{} and so @strong{is this}.++An @emph{@uref{/url,emphasized link}}.++@strong{@emph{This is strong and em.}}++So is @strong{@emph{this}} word.++@strong{@emph{This is strong and em.}}++So is @strong{@emph{this}} word.++This is code: @code{>}@comma{} @code{$}@comma{} @code{\}@comma{} @code{\$}@comma{} @code{<html>}.++@textstrikeout{This is @emph{strikeout}.}++Superscripts: a@textsuperscript{bc}d a@textsuperscript{@emph{hello}} a@textsuperscript{hello@ there}.++Subscripts: H@textsubscript{2}O@comma{} H@textsubscript{23}O@comma{} H@textsubscript{many@ of@ them}O.++These should not be superscripts or subscripts@comma{} because of the unescaped spaces: a^b c^d@comma{} a~b c~d.++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Smart quotes ellipses dashes+@chapter Smart quotes@comma{} ellipses@comma{} dashes+``Hello@comma{}'' said the spider. ```Shelob' is my name.''++`A'@comma{} `B'@comma{} and `C' are letters.++`Oak@comma{}' `elm@comma{}' and `beech' are names of trees. So is `pine.'++`He said@comma{} ``I want to go.''' Were you alive in the 70's?++Here is some quoted `@code{code}' and a ``@uref{http://example.com/?foo=1&bar=2,quoted link}''.++Some dashes: one---two --- three---four --- five.++Dashes between numbers: 5--7@comma{} 255--66@comma{} 1987--1999.++Ellipses@dots{}and@dots{}and@dots{}.++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node LaTeX+@chapter LaTeX+@itemize+@item+@tex+\cite[22-23]{smith.1899}+@end tex+@item+@math{2+2=4}+@item+@math{x \in y}+@item+@math{\alpha \wedge \omega}+@item+@math{223}+@item+@math{p}-Tree+@item+Here's some display math: @math{\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}}+@item+Here's one that has a line break in it: @math{\alpha + \omega \times x^2}.+@end itemize++These shouldn't be math:++@itemize+@item+To get the famous equation@comma{} write @code{$e = mc^2$}.+@item+$22@comma{}000 is a @emph{lot} of money. So is $34@comma{}000. (It worked if ``lot'' is emphasized.)+@item+Shoes ($20) and socks ($5).+@item+Escaped @code{$}: $73 @emph{this should be emphasized} 23$.+@end itemize++Here's a LaTeX table:++@tex+\begin{tabular}{|l|l|}\hline+Animal & Number \\ \hline+Dog & 2 \\+Cat & 1 \\ \hline+\end{tabular}+@end tex++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Special Characters+@chapter Special Characters+Here is some unicode:++@itemize+@item+I hat: Î+@item+o umlaut: ö+@item+section: §+@item+set membership: ∈+@item+copyright: ©+@end itemize++AT&T has an ampersand in their name.++AT&T is another way to write it.++This & that.++4 < 5.++6 > 5.++Backslash: \++Backtick: `++Asterisk: *++Underscore: _++Left brace: @{++Right brace: @}++Left bracket: [++Right bracket: ]++Left paren: (++Right paren: )++Greater-than: >++Hash: #++Period: .++Bang: !++Plus: +++Minus: -++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Links+@chapter Links+@menu+* Explicit::+* Reference::+* With ampersands::+* Autolinks::+@end menu++@node Explicit+@section Explicit+Just a @uref{/url/,URL}.++@uref{/url/,URL and title}.++@uref{/url/,URL and title}.++@uref{/url/,URL and title}.++@uref{/url/,URL and title}++@uref{/url/,URL and title}++@uref{/url/with_underscore,with_underscore}++@uref{mailto:nobody@@nowhere.net,Email link}++@uref{,Empty}.+++@node Reference+@section Reference+Foo @uref{/url/,bar}.++Foo @uref{/url/,bar}.++Foo @uref{/url/,bar}.++With @uref{/url/,embedded [brackets]}.++@uref{/url/,b} by itself should be a link.++Indented @uref{/url,once}.++Indented @uref{/url,twice}.++Indented @uref{/url,thrice}.++This should [not][] be a link.+@verbatim+[not]: /url+@end verbatim++Foo @uref{/url/,bar}.++Foo @uref{/url/,biz}.+++@node With ampersands+@section With ampersands+Here's a @uref{http://example.com/?foo=1&bar=2,link with an ampersand in the URL}.++Here's a link with an amersand in the link text: @uref{http://att.com/,AT&T}.++Here's an @uref{/script?foo=1&bar=2,inline link}.++Here's an @uref{/script?foo=1&bar=2,inline link in pointy braces}.+++@node Autolinks+@section Autolinks+With an ampersand: @url{http://example.com/?foo=1&bar=2}++@itemize+@item+In a list?+@item+@url{http://example.com/}+@item+It should.+@end itemize++An e-mail address: @uref{mailto:nobody@@nowhere.net,@code{nobody@@nowhere.net}}++@quotation+Blockquoted: @url{http://example.com/}++@end quotation+Auto-links should not occur here: @code{<http://example.com/>}+@verbatim+or here: <http://example.com/>+@end verbatim++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Images+@chapter Images+From ``Voyage dans la Lune'' by Georges Melies (1902):++@image{lalune,,,lalune,jpg}++Here is a movie @image{movie,,,movie,jpg} icon.++@iftex+@bigskip@hrule@bigskip+@end iftex+@ifnottex+------------------------------------------------------------------------+@end ifnottex++@node Footnotes+@chapter Footnotes+Here is a footnote reference@comma{}@footnote{Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.} and another.@footnote{Here's the long note. This one contains multiple blocks.++Subsequent blocks are indented to show that they belong to the footnote (as with list items).+@verbatim+ { <code> }+@end verbatim++If you want@comma{} you can indent every line@comma{} but you can also be lazy and just indent the first line of each block.} This should @emph{not} be a footnote reference@comma{} because it contains a space.[^my note] Here is an inline note.@footnote{This is @emph{easier} to type. Inline notes may contain @uref{http://google.com,links} and @code{]} verbatim characters@comma{} as well as [bracketed text].}++@quotation+Notes can go in quotes.@footnote{In quote.}++@end quotation+@enumerate +@item+And in list items.@footnote{In list.}+@end enumerate++This paragraph should not be part of the note@comma{} as it is not indented.++@bye
− web/Makefile
@@ -1,37 +0,0 @@-ALL := index.html README.html INSTALL.html examples.html pandoc1.html markdown2pdf1.html html2markdown1.html hsmarkdown1.html html2x.html-PANDOC_PATH ?= $(dir $(shell which pandoc))-MAKEPAGE = $(PANDOC_PATH)/pandoc -s -S -H css -A footer.html-all : $(ALL) --.PHONY: clean-clean:- for file in $(ALL); do rm $$file; done; \- rm -r example*;--examples.txt : $(PANDOC_DEPS) mkdemos.pl config.xsl S5DEMO README demos- PATH=$(PANDOC_PATH):$$PATH ./mkdemos.pl demos $@- perl -pi -e 's!(href="(main|(my)?header|footer|example\d+)\.(html|tex|xml|css))"!\1.html"!g' $@- for file in $$(ls | egrep '(main|(my)?header|footer|example[0-9]+)\.(html|tex|xml|css)$$'); \- do highlight -k monospace -u utf-8 --style emacs $$file > $$file.html; \- done--index.html : index.txt css- $(MAKEPAGE) --toc $< > $@--README.html : README css- $(MAKEPAGE) --toc $< > $@--INSTALL.html : INSTALL css- $(MAKEPAGE) --toc $< > $@--%.html : %.txt css- $(MAKEPAGE) $< > $@--%1.html : %.1 - groff -man -T html $< > $@--%.html : % css- $(MAKEPAGE) $< > $@--upload : - make -C .. upload
− web/S5DEMO
@@ -1,19 +0,0 @@-% Eating Habits-% John Doe-% March 22, 2005--# In the morning--- Eat eggs-- Drink coffee--# In the evening--- Eat spaghetti-- Drink wine--# Conclusion--- And the answer is...-- $f(x)=\sum_{n=0}^\infty\frac{f^{(n)}(a)}{n!}(x-a)^n$ -
− web/config.xsl
@@ -1,9 +0,0 @@-<?xml version='1.0'?>-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"- xmlns:fo="http://www.w3.org/1999/XSL/Format"- version="1.0">- <xsl:param name="use.id.as.filename" select="'1'"/>- <xsl:param name="admon.graphics" select="'1'"/>- <xsl:param name="admon.graphics.path"></xsl:param>- <xsl:param name="html.stylesheet" select="'../docbook.css'"/>-</xsl:stylesheet>
− web/css
@@ -1,8 +0,0 @@-<link rel="stylesheet" type="text/css" href="pandoc.css" media="all" />-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">-</script>-<script type="text/javascript">-_uacct = "UA-2234613-4";-urchinTracker();-</script>-
− web/demos
@@ -1,85 +0,0 @@-% Pandoc examples--To see the output created by each of the commands below,-click on the name of the output file:--1. HTML fragment:--@ pandoc @@README@@ -o @@example1.html@@--2. Standalone HTML file:--@ pandoc -s @@README@@ -o @@example2.html@@--3. HTML with smart quotes, table of contents, CSS, and custom footer:--@ pandoc -s -S --toc -c @@pandoc.css@@ -A @@footer.html@@ @@README@@ -o @@example3.html@@--4. LaTeX:--@ pandoc -s @@README@@ -o @@example4.tex@@--5. From LaTeX to markdown:--@ pandoc -s @@example4.tex@@ -o @@example5.text@@--6. reStructuredText:--@ pandoc -s -w rst --toc @@README@@ -o @@example6.text@@--7. Rich text format (RTF):--@ pandoc -s @@README@@ -o @@example7.rtf@@--8. S5 HTML slide show (all in one file):--@ pandoc -s -m -i -w s5 @@S5DEMO@@ -o @@example8.html@@--9. DocBook XML:--@ pandoc -s -S -w docbook @@README@@ -o @@example9.db@@-- Chunked XHTML via DocBook and [xmlto]:--@ xmlto xhtml -m @@config.xsl@@ @@example9.db@@ -o @@example9/@@--10. Man page:--@ pandoc -s -w man @@pandoc.1.md@@ -o @@example10.1@@--11. ConTeXt:--@ pandoc -s -w context @@README@@ -o @@example11.tex@@-- PDF via pandoc and ConTeXt's `texexec`:--@ texexec --pdf @@example11.tex@@ # produces @@example11.pdf@@--12. Converting a web page to markdown:--@ html2markdown @@http://www.gnu.org/software/make/@@ -o @@example12.text@@--13. From markdown to PDF:--@ markdown2pdf @@README@@ -o @@example13.pdf@@--14. PDF with numbered sections and a custom LaTeX header:--@ markdown2pdf -N -C @@myheader.tex@@ @@README@@ -o @@example14.pdf@@--[xmlto]: http://cyberelk.net/tim/xmlto/--15. A simple wiki program using [HAppS](http://happs.org) and pandoc: - [pandocwiki](http://pandocwiki.googlecode.com/svn/trunk/)--16. A web application that converts web pages to any of eight different- formats: [html2x](html2x.html).--17. TeX math in HTML:--@ pandoc @@math.txt@@ -s -o @@mathDefault.html@@-@ pandoc @@math.txt@@ -s -m -o @@mathAsciimathml.html@@-@ pandoc @@math.txt@@ -s --mimetex=/cgi-bin/mimetex.cgi -o @@mathMimetex.html@@-@ pandoc @@math.txt@@ -s --gladtex -o mathGladtex.htex-@ gladtex @@mathGladtex.htex@@ # produces @@mathGladtex.html@@-
− web/docbook.css
@@ -1,29 +0,0 @@-body {- font-family: Verdana, sans-serif;-}--.screen {- font-family: monospace;- font-size: 1em;- display: block;- padding: 10px;- border: 1px solid #bbb;- background-color: #eee;- color: #000; - overflow: auto;- border-radius: 2.5px;- -moz-border-radius: 2.5px;- margin: 0.5em 2em;-}--a {- text-decoration: none;- border-bottom: 1px dotted #000;-}--a:hover {- background-color: #777;- color: #fff;-}--
@@ -1,4 +0,0 @@-<div id="footer">- © 2006-2007 <a href="http://johnmacfarlane.net/">John MacFarlane</a>-</div>-
− web/html2x.txt
@@ -1,55 +0,0 @@-% html2x--<form action="/cgi-bin/html2x.pl" method="get">-<p>-<label for="url">URL:</label>-<input type="text" size="60" name="url" value="http://johnmacfarlane.net/pandoc" /> -<input type="submit" value="Convert" />-</p>-<table>-<tr>-<th>Convert to:</th>-<th style="padding-left: 1em;">Bookmarklets<br/>(right-click, add bookmark)</th>-</tr>-<tr>-<td style="border-right: 1px solid gray; padding-right: 2em;">-<input type="radio" name="format" value="markdown" checked="checked" />Markdown<br/>-<input type="radio" name="format" value="markdown+" />Markdown with -<a href="/pandoc/README.html#pandocs-markdown-vs-standard-markdown">pandoc extensions</a><br/>-<input type="radio" name="format" value="rst" />reStructuredText<br/>-<input type="radio" name="format" value="docbook" />DocBook XML<br/>-<input type="radio" name="format" value="latex" />LaTeX<br/>-<input type="radio" name="format" value="context" />ConTeXt<br/>-<input type="radio" name="format" value="rtf" />Rich Text Format (RTF)<br/>-<input type="radio" name="format" value="man" />Groff man page-</td>-<td style="padding-left: 1em;">-- [2markdown]-- [2markdown+]-- [2rst]-- [2docbook]-- [2LaTeX]-- [2ConTeXt]-- [2RTF]-- [2man]-</td>-</table>-</form>--<center>-Powered by [pandoc]. Inspired by [the Asciinator].--</center>--[2markdown]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=markdown&url='+document.location.href;-[2markdown+]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=markdown+&url='+document.location.href;-[2rst]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=rst&url='+document.location.href;-[2docbook]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=docbook&url='+document.location.href;-[2LaTeX]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=latex&url='+document.location.href;-[2ConTeXt]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=context&url='+document.location.href;-[2RTF]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=rtf&url='+document.location.href;-[2man]: javascript:location.href='http://johnmacfarlane.net/cgi-bin/html2x.pl?format=man&url='+document.location.href;--[pandoc]: /pandoc/-[the Asciinator]: http://www.aaronsw.com/2002/html2text/-
− web/index.txt.in
@@ -1,169 +0,0 @@-% Pandoc--# Overview--Pandoc is a [Haskell] library for converting from one markup format-to another, and a command-line tool that uses this library. It can read-[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX],-and it can write [markdown], [reStructuredText], [HTML], [LaTeX], [ConTeXt],-[RTF], [DocBook XML], [groff man], and [S5] HTML slide shows. --Pandoc features--- Modular design, using separate writers and readers for each- supported format.-- A real markdown parser, not based on regex substitutions.- [More accurate] and [much faster] than `Markdown.pl`.-- Also parses (subsets of) reStructuredText, LaTeX, and HTML.-- Multiple output formats: HTML, Docbook XML, LaTeX, ConTeXt,- reStructuredText, Markdown, RTF, groff man pages, S5 slide shows.-- Unicode support.-- Optional "smart" quotes, dashes, and ellipses.-- Automatically generated tables of contents.-- Support for displaying math in HTML.-- Extensions to markdown syntax:- + Document metadata (title, author, date).- + Footnotes, tables, and definition lists.- + Superscripts, subscripts, and strikeout.- + Inline LaTeX math and LaTeX commands.- + Markdown inside HTML blocks.- + Enhanced ordered lists: start number and numbering style- are significant.- + Compatibility mode to turn off syntax entensions and emulate- `Markdown.pl`.-- Convenient wrapper scripts:- + `html2markdown` makes it easy to produce a markdown version- of any web page.- + `markdown2pdf` converts markdown to PDF in one step.- + `hsmarkdown` is a drop-in replacement for `Markdown.pl`.-- Multi-platform: runs on Windows, MacOS X, Linux, Unix.-- Free software, released under the [GPL].--To see what pandoc can do, see the [demonstration page](examples.html),-or [try pandoc on the web](/pandoc/try).--# Documentation--- [User's Guide](README.html)-- [Demonstrations](examples.html)-- Man pages- - [`pandoc(1)`](pandoc1.html)- - [`markdown2pdf(1)`](markdown2pdf1.html)- - [`html2markdown(1)`](html2markdown1.html)- - [`hsmarkdown(1)`](hsmarkdown1.html)-- [Library documentation](doc/index.html) (for Haskell programmers)-- [Installation instructions](INSTALL.html)-- [Changelog](changelog.txt)--# Downloads--For installation instructions for all architectures, see-[INSTALL](INSTALL.html). Note that pandoc is in the [MacPorts],-[Debian unstable], and [FreeBSD ports] repositories.-Abhishek Dasgupta has also contributed an [Arch linux PKGBUILD script].-Starting with release 8.04 ("Hardy Heron"), pandoc will be included-in [Ubuntu linux].--- [Source tarball]-- [Windows binary package]--# Code repository--Pandoc has a publicly accesible subversion repository at Google-Code (<http://code.google.com/p/pandoc>). To check out the latest,-bleeding-edge source code:-- svn checkout http://pandoc.googlecode.com/svn/trunk/ pandoc--# Reporting bugs--You may view existing bug reports and submit new ones at -<http://code.google.com/p/pandoc/issues/list>.--# Mailing lists--- [pandoc-announce]: Announcements of new releases only.-- [pandoc-discuss]: General discussion of pandoc.--# News--- Version 0.45 released (December 9, 2007).-- + Many bug fixes and structural improvements. See [changelog] for- full details.- + Improved treatment of math. Math is now rendered using unicode- by default in HTML, RTF, and DocBook output. For more accurate- display of math in HTML, `--gladtex`, `--mimetex`, and `--asciimathml`- options are provided. See the [User's Guide](README.html#math) for- details.- + Removed support for box-style block quotes in markdown.- + More idiomatic ConTeXt output.- + Text wrapping in ConTeXt and LaTeX output.- + Pandoc now correctly handles all standard line endings- (CR, LF, CRLF).- + New `--no-wrap` option that disables line wrapping and minimizes- whitespace in HTML output.- + Build process is now compatible with both GHC 6.8 and GHC 6.6.- GHC and GHC_PKG environment variables may be used to specify- which version of the compiler to use, when multiple versions are- installed.--- Version 0.44 released (September 3, 2007).-- + Fixed bug in HTML writer: when `--toc` was used, anchors were put around- headers, which is invalid XHTML (block content within inline element).- Now the anchors are put inside the header tags. Resolves Issue #23.- + Changed build process to compile `Setup.hs` instead of using- `runhaskell`, which throws an error on platforms where GHC is- "not built for interactive use". Closes Debian #440668.--- Version 0.43 released (September 2, 2007).-- + HUGE increase in performance: markdown is parsed five times- faster than with 0.42 on large benchmark files.- + Prettyprinting library used in LaTeX writer, so that LaTeX output- is wrapped and intelligently indented.- + Fixed bugs in LaTeX ordered lists and LaTeX command and environment- parsers.- + Blank lines are no longer required after code blocks.- + Fixed inline code parsing so that it uses the method of Markdown.pl:- the delimiters are blocks of N `` ` `` characters not followed by another- `` ` `` character. For example:- ```` ` h ``` i ` ```` -> `<code>h ``` i</code>`.- + Markdown writer escapes paragraphs that begin like list items.- + MacPorts Portfile now installs library as well as executable.- + Added pandocwiki demonstration to the website.--# Disclaimer--This is an early, "alpha" release. It carries no warranties of any-kind.--[More accurate]: http://code.google.com/p/pandoc/wiki/PandocVsMarkdownPl-[much faster]: http://code.google.com/p/pandoc/wiki/Benchmarks-[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html- -[John MacFarlane]: http://johnmacfarlane.net/-[markdown]: http://daringfireball.net/projects/markdown/-[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html-[S5]: http://meyerweb.com/eric/tools/s5/-[HTML]: http://www.w3.org/TR/html40/-[LaTeX]: http://www.latex-project.org/-[ConTeXt]: http://www.pragma-ade.nl/ -[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format-[DocBook XML]: http://www.docbook.org/-[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html-[Haskell]: http://www.haskell.org/-[GHC]: http://www.haskell.org/ghc/-[GPL]: http://www.gnu.org/copyleft/gpl.html-[Source tarball]: http://code.google.com/p/pandoc/downloads/detail?name=pandoc-@VERSION@.tar.gz "Download source tarball from Pandoc's Google Code site"-[Windows binary package]: http://code.google.com/p/pandoc/downloads/detail?name=pandoc-@VERSION@.zip "Download Windows zip file from Pandoc's Google Code site"-[Debian unstable]: http://packages.debian.org/unstable/text/pandoc-[FreeBSD ports]: http://www.freshports.org/textproc/pandoc/-[Arch linux PKGBUILD script]: http://aur.archlinux.org/packages.php?do_Details=1&ID=12751&O=0&L=0&C=0&K=pandoc&SB=n&SO=a&PP=25&do_MyPackages=0&do_Orphans=0&SeB=nd-[Ubuntu linux]: http://www.ubuntu.com-[MacPorts]: http://db.macports.org/port/show/4218-[pandoc-announce]: http://groups.google.com/group/pandoc-announce-[pandoc-discuss]: http://groups.google.com/group/pandoc-discuss-[changelog]: changelog.txt-
− web/math.txt
@@ -1,17 +0,0 @@-% Pandoc math demos--$a^2 + b^2 = c^2$--$v(t) = v_0 + \frac{1}{2}at^2$--$\gamma = \frac{1}{\sqrt{1 - v^2/c^2}}$ --$\exists x \forall y (Rxy \equiv Ryx)$--$p \wedge q \models p$--$\Box\diamond p\equiv\diamond p$--$\int_{0}^{1} x dx = \left[ \frac{1}{2}x^2 \right]_{0}^{1} = \frac{1}{2}$--$e^x = \sum_{n=0}^\infty \frac{x^n}{n!} = \lim_{n\rightarrow\infty} (1+x/n)^n$
− web/mkdemos.pl
@@ -1,34 +0,0 @@-#!/usr/bin/perl -w-# first argument is input filename - a demo template.-# second argument is output filename.--my $infile=$ARGV[0];-my $outfile=$ARGV[1];--open( IN, "< $infile" );-open( OUT, "> $outfile" );--while (<IN>) {-- my $line = $_;- my $firstchar = substr ($line,0,1);- if ( $firstchar eq '@' ) {- my $command = substr ($line,4);- my $commandExec = $command;- $commandExec =~ s/[#].*$//g; # strip off comments- $commandExec =~ s/@@//g; # strip off hotlink markers- print STDERR "$commandExec";- system "$commandExec";- $line = $command;- $line =~ s/-/\-/;- $line =~ s/@@([^@]*)@@/<a href="$1">$1<\/a>/g;- $line =~ s/-/\\-/g; # to prevent smart dashes!- $line =~ s/^(.*)$/ <pre><code>$1<\/code><\/pre>/g; - if ( $line =~ /(example\d+\.html)<\/a><\/code>/m ) {- $line .= "\n (View [`$1` as a web page]($1).)\n";- }- }- print OUT $line;--}-
− web/myheader.tex
@@ -1,5 +0,0 @@-\documentclass[11pt]{article}-\usepackage{pxfonts}-\usepackage[margin=1.5in]{geometry}-\usepackage{ucs}-\usepackage[utf8x]{inputenc}
− web/pandoc.css
@@ -1,75 +0,0 @@-body {- margin: auto;- padding-right: 1em;- padding-left: 1em;- max-width: 44em; - border-left: 1px solid black;- border-right: 1px solid black;- color: black;- font-family: Verdana, sans-serif;- font-size: 100%;- line-height: 140%;- color: #333; -}-pre {- border: 1px dotted gray;- background-color: #ececec;- color: #1111111;- padding: 0.5em;-}-code {- font-family: monospace;- font-size: 110%;-}-h1 a, h2 a, h3 a, h4 a, h5 a { - text-decoration: none;- color: #7a5ada; -}-h1, h2, h3, h4, h5 { font-family: verdana;- font-weight: bold;- border-bottom: 1px dotted black;- color: #7a5ada; }-h1 {- font-size: 130%;-}--h2 {- font-size: 110%;-}--h3 {- font-size: 95%;-}--h4 {- font-size: 90%;- font-style: italic;-}--h5 {- font-size: 90%;- font-style: italic;-}--h1.title {- font-size: 200%;- font-weight: bold;- padding-top: 0.2em;- padding-bottom: 0.2em;- text-align: left;- border: none;-}--dt code {- font-weight: bold;-}-dd p {- margin-top: 0;-}--#footer {- padding-top: 1em;- font-size: 70%;- color: gray;- text-align: center;-}
− wrappers/common.sh
@@ -1,43 +0,0 @@-THIS=${0##*/}--NEWLINE='-'--err () { echo "$*" | fold -s -w ${COLUMNS:-110} >&2; }-errn () { printf "$*" | fold -s -w ${COLUMNS:-110} >&2; }--usage () {- err "$1 - $2" # short description- err "See the $1(1) man page for usage."-}--# Portable which(1).-pathfind () {- oldifs="$IFS"; IFS=':'- for _p in $PATH; do- if [ -x "$_p/$*" ] && [ -f "$_p/$*" ]; then- IFS="$oldifs"- return 0- fi- done- IFS="$oldifs"- return 1-}--for p in pandoc $REQUIRED; do- pathfind $p || {- err "You need '$p' to use this program!"- exit 1- }-done--CONF=$(pandoc --dump-args "$@" 2>&1) || {- errcode=$?- echo "$CONF" | sed -e '/^pandoc \[OPTIONS\] \[FILES\]/,$d' >&2- [ $errcode -eq 2 ] && usage "$THIS" "$SYNOPSIS"- exit $errcode-}--OUTPUT=$(echo "$CONF" | sed -ne '1p')-ARGS=$(echo "$CONF" | sed -e '1d')-
− wrappers/hsmarkdown.in
@@ -1,5 +0,0 @@-#!/bin/sh-# hsmarkdown - intended as a drop-in replacement for Markdown.pl.-# Uses pandoc to convert from markdown to HTML, using --strict mode-# for maximum compatibility with official markdown syntax.-exec pandoc --from markdown --to html --strict -- "$@"
− wrappers/html2markdown.in
@@ -1,162 +0,0 @@-#!/bin/sh -e-# converts HTML from a URL, file, or stdin to markdown-# uses an available program to fetch URL and tidy to normalize it first--REQUIRED="tidy"-SYNOPSIS="converts HTML from a URL, file, or STDIN to markdown-formatted text."--### common.sh--grab_url_with () {- url="${1:?internal error: grab_url_with: url required}"-- shift- cmdline="$@"-- prog=- prog_opts=- if [ -n "$cmdline" ]; then- eval "set -- $cmdline"- prog=$1- shift- prog_opts="$@"- fi-- if [ -z "$prog" ]; then- # Locate a sensible web grabber (note the order).- for p in wget lynx w3m curl links w3c; do- if pathfind $p; then- prog=$p- break- fi- done-- [ -n "$prog" ] || {- errn "$THIS: Couldn't find a program to fetch the file from URL "- err "(e.g. wget, w3m, lynx, w3c, or curl)."- return 1- }- else- pathfind "$prog" || {- err "$THIS: No such web grabber '$prog' found; aborting."- return 1- }- fi-- # Setup proper base options for known grabbers.- base_opts=- case "$prog" in- wget) base_opts="-O-" ;;- lynx) base_opts="-source" ;;- w3m) base_opts="-dump_source" ;;- curl) base_opts="" ;;- links) base_opts="-source" ;;- w3c) base_opts="-n -get" ;;- *) err "$THIS: unhandled web grabber '$prog'; hope it succeeds."- esac-- err "$THIS: invoking '$prog $base_opts $prog_opts $url'..."- eval "set -- $base_opts $prog_opts"- $prog "$@" "$url"-}--# Parse command-line arguments-parse_arguments () {- while [ $# -gt 0 ]; do- case "$1" in- --encoding=*)- wholeopt="$1"- # extract encoding from after =- encoding="${wholeopt#*=}" ;;- -e|--encoding|-encoding)- shift- encoding="$1" ;; - --grabber=*)- wholeopt="$1"- # extract encoding from after =- grabber="\"${wholeopt#*=}\"" ;;- -g|--grabber|-grabber)- shift- grabber="$1" ;; - *)- if [ -z "$argument" ]; then- argument="$1"- else- err "Warning: extra argument '$1' will be ignored."- fi ;;- esac- shift- done-}--argument=-encoding=-grabber=--oldifs="$IFS"-IFS=$NEWLINE-parse_arguments $ARGS-IFS="$oldifs"--inurl=-if [ -n "$argument" ] && ! [ -f "$argument" ]; then- # Treat given argument as an URL.- inurl="$argument"-fi--### tempdir.sh--if [ -n "$inurl" ]; then- err "Attempting to fetch file from '$inurl'..."-- grabber_out=$THIS_TEMPDIR/grabber.out- grabber_log=$THIS_TEMPDIR/grabber.log- if ! grab_url_with "$inurl" "$grabber" 1>$grabber_out 2>$grabber_log; then- errn "grab_url_with failed"- if [ -f $grabber_log ]; then- err " with the following error log."- err- cat >&2 $grabber_log- else- err .- fi- exit 1- fi-- argument="$grabber_out"-fi--if [ -z "$encoding" ] && [ "x$argument" != "x" ]; then- # Try to determine character encoding if not specified- # and input is not STDIN.- encoding=$(- head "$argument" |- LC_ALL=C tr 'A-Z' 'a-z' |- sed -ne '/<meta .*content-type.*charset=/ {- s/.*charset=["'\'']*\([-a-zA-Z0-9]*\).*["'\'']*/\1/p- }'- )-fi--if [ -n "$encoding" ] && pathfind iconv; then- alias to_utf8='iconv -f "$encoding" -t utf-8'-else # assume UTF-8- alias to_utf8='cat'-fi --htmlinput=$THIS_TEMPDIR/htmlinput--if [ -z "$argument" ]; then- to_utf8 > $htmlinput # read from STDIN-elif [ -f "$argument" ]; then- to_utf8 "$argument" > $htmlinput # read from file-else- err "File '$argument' not found."- exit 1-fi--if ! cat $htmlinput | pandoc --ignore-args -r html -w markdown "$@" ; then- err "Failed to parse HTML. Trying again with tidy..."- tidy -q -asxhtml -utf8 $htmlinput | \- pandoc --ignore-args -r html -w markdown "$@"-fi
− wrappers/markdown2pdf.in
@@ -1,81 +0,0 @@-#!/bin/sh -e--REQUIRED="pdflatex"-SYNOPSIS="converts markdown-formatted text to PDF, using pdflatex."--### common.sh--### tempdir.sh--texname=output-logfile=$THIS_TEMPDIR/log--pandoc -s -r markdown -w latex "$@" -o $THIS_TEMPDIR/$texname.tex--if [ "$OUTPUT" = "-" ]; then- firstinfile="$(echo $ARGS | sed -ne '1p')"- firstinfilebase="${firstinfile%.*}"- destname="${firstinfilebase:-stdin}.pdf"-else- destname="$OUTPUT"-fi--(- origdir=$(pwd)- cd $THIS_TEMPDIR- TEXINPUTS=$origdir:$TEXINPUTS:- export TEXINPUTS- finished=no- runs=0- while [ $finished = "no" ]; do- pdflatex -interaction=batchmode $texname.tex >/dev/null || {- errcode=$?- err "${THIS}: pdfLaTeX failed with error code $errcode"- [ -f $texname.log ] && {- err "${THIS}: error context:"- sed -ne '/^!/,/^[[:space:]]*$/p' \- -ne '/^[Ll]a[Tt]e[Xx] [Ww]arning/,/^[[:space:]]*$/p' \- -ne '/^[Ee]rror/,/^[[:space:]]*$/p' $texname.log >&2- if grep -q "File \`ucs.sty' not found" $texname.log; then- err "${THIS}: Please install the 'unicode' package from CTAN:"- err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"- fi- if grep -q "File \`ulem.sty' not found" $texname.log; then- err "${THIS}: Please install the 'ulem' package from CTAN:"- err " http://www.ctan.org/tex-archive/macros/latex/contrib/misc/ulem.sty"- fi- }- exit $errcode- }- if [ $runs -lt 3 ] && - ((grep -q "LaTeX Warning: There were undefined references." $texname.log) ||- (echo "$@" | grep -q -- "--toc\|--table-of-contents")); then- runs=$(($runs + 1))- if grep -q "LaTeX Warning:.*[Cc]itation" $texname.log; then- bibtex $texname 2>&1 >bibtex.err- if [ $runs -gt 2 ]; then- if grep -q "error message" bibtex.err ||- grep -q "Warning" bibtex.err; then- cat bibtex.err >&2- fi- fi- fi- else- finished=yes- fi- done-) || exit $?--is_target_exists=-if [ -f "$destname" ]; then- is_target_exists=1- mv "$destname" "$destname~" -fi--mv -f $THIS_TEMPDIR/$texname.pdf "$destname"--errn "Created $destname"-[ -z "$is_target_exists" ] || {- errn " (previous file has been backed up as $destname~)"-}-err .
− wrappers/tempdir.sh
@@ -1,18 +0,0 @@-# As a security measure refuse to proceed if mktemp is not available.-pathfind mktemp || { err "Couldn't find 'mktemp'; aborting."; exit 1; }--# Avoid issues with /tmp directory on Windows/Cygwin -cygwin=-cygwin=$(uname | sed -ne '/^CYGWIN/p')-if [ -n "$cygwin" ]; then- TMPDIR=.- export TMPDIR-fi--THIS_TEMPDIR=-THIS_TEMPDIR="$(mktemp -d -t $THIS.XXXXXXXX)" || exit 1-readonly THIS_TEMPDIR--trap 'exitcode=$?- [ -z "$THIS_TEMPDIR" ] || rm -rf "$THIS_TEMPDIR"- exit $exitcode' 0 1 2 3 13 15