diff options
48 files changed, 0 insertions, 5807 deletions
diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 4eaaa8c44..000000000 --- a/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_style = space -indent_size = 2 -insert_final_newline = true -trim_trailing_whitespace = true - -[*.{markdown,md}] -trim_trailing_whitespace = false - -[test/*] -insert_final_newline = false -trim_trailing_whitespace = false diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE deleted file mode 100644 index 83336e684..000000000 --- a/.github/ISSUE_TEMPLATE +++ /dev/null @@ -1,11 +0,0 @@ -Asking a question? -Please use the pandoc-discuss mailing list instead: -https://groups.google.com/forum/#!forum/pandoc-discuss -This tracker is for bug reports and enhancement requests. - -Reporting a bug? -Please include your pandoc version and an example that allows us -to reproduce the problem (complete input, exact command line -used, expected and actual output). The smaller the example, the -better. - diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 32ef66e8b..000000000 --- a/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*~ -deb/.vagrant -dist/* -MANUAL.* -!MANUAL.txt -.configure-stamp -.cabal-sandbox -cabal.sandbox.config -pandoc.cabal.orig -man/man?/*.1 -man/man?/*.5 -man/man?/*.html -*.diff -*.o -*.hi -*.pyc -/COPYING.rtf -/COPYRIGHT.txt -/cabal-dev/ -/windows/*.msi -/windows/*.wixpdb -windows/*.wixobj -data/reference.docx -data/reference.odt -.stack-work diff --git a/.hlint.yaml b/.hlint.yaml deleted file mode 100644 index def675e77..000000000 --- a/.hlint.yaml +++ /dev/null @@ -1,72 +0,0 @@ -# HLint configuration file -# https://github.com/ndmitchell/hlint -########################## - -# This file contains a template configuration file, which is typically -# placed as .hlint.yaml in the root of your project - - -# Specify additional command line arguments -# -- arguments: [--color, --cpp-ansi] - - -# Control which extensions/flags/modules/functions can be used -# -# - extensions: -# - default: false # all extension are banned by default -# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used -# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module -# -# - flags: -# - {name: -w, within: []} # -w is allowed nowhere -# -# - modules: -# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set' -# - {name: Control.Arrow, within: []} # Certain modules are banned entirely -# -# - functions: -# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules - - -# Add custom hints for this project -# -# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar" -# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x} - - -# Turn on hints that are off by default -# -# Ban "module X(module X) where", to require a real export list -# - warn: {name: Use explicit module export list} -# -# Replace a $ b $ c with a . b $ c -# - group: {name: dollar, enabled: true} -# -# Generalise map to fmap, ++ to <> -# - group: {name: generalise, enabled: true} - - -# Ignore some builtin hints -# - ignore: {name: Use let} -# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules -# - ignore: {name: "Use section"} -# - ignore: {name: "Use camelCase"} -# - ignore: {name: "Use list comprehension"} -# - ignore: {name: "Redundant if"} -- ignore: {name: "Avoid lambda"} -- ignore: {name: "Use String"} -- ignore: {name: "Use isDigit"} -- ignore: {name: "Eta reduce"} -- ignore: {name: "Use fmap"} # specific for GHC 7.8 compat -- ignore: {name: "Parse error"} # we trust the compiler over HLint -- ignore: {name: "Use =="} # Creates infinite loops in `EQ` using expressions -- ignore: {name: "Evaluate"} -- ignore: {name: "Use &&&"} -# - ignore: {name: "Redundant compare"} - -# Define some custom infix operators -# - fixity: infixr 3 ~^#^~ - - - diff --git a/.stylish-haskell.yaml b/.stylish-haskell.yaml deleted file mode 100644 index 496e72802..000000000 --- a/.stylish-haskell.yaml +++ /dev/null @@ -1,171 +0,0 @@ -# stylish-haskell configuration file -# ================================== - -# The stylish-haskell tool is mainly configured by specifying steps. These steps -# are a list, so they have an order, and one specific step may appear more than -# once (if needed). Each file is processed by these steps in the given order. -steps: - # Convert some ASCII sequences to their Unicode equivalents. This is disabled - # by default. - # - unicode_syntax: - # # In order to make this work, we also need to insert the UnicodeSyntax - # # language pragma. If this flag is set to true, we insert it when it's - # # not already present. You may want to disable it if you configure - # # language extensions using some other method than pragmas. Default: - # # true. - # add_language_pragma: true - - # Align the right hand side of some elements. This is quite conservative - # and only applies to statements where each element occupies a single - # line. - - simple_align: - cases: true - top_level_patterns: true - records: true - - # Import cleanup - - imports: - # There are different ways we can align names and lists. - # - # - global: Align the import names and import list throughout the entire - # file. - # - # - file: Like global, but don't add padding when there are no qualified - # imports in the file. - # - # - group: Only align the imports per group (a group is formed by adjacent - # import lines). - # - # - none: Do not perform any alignment. - # - # Default: global. - align: none - - # Folowing options affect only import list alignment. - # - # List align has following options: - # - # - after_alias: Import list is aligned with end of import including - # 'as' and 'hiding' keywords. - # - # > import qualified Data.List as List (concat, foldl, foldr, head, - # > init, last, length) - # - # - with_alias: Import list is aligned with start of alias or hiding. - # - # > import qualified Data.List as List (concat, foldl, foldr, head, - # > init, last, length) - # - # - new_line: Import list starts always on new line. - # - # > import qualified Data.List as List - # > (concat, foldl, foldr, head, init, last, length) - # - # Default: after_alias - list_align: after_alias - - # Long list align style takes effect when import is too long. This is - # determined by 'columns' setting. - # - # - inline: This option will put as much specs on same line as possible. - # - # - new_line: Import list will start on new line. - # - # - new_line_multiline: Import list will start on new line when it's - # short enough to fit to single line. Otherwise it'll be multiline. - # - # - multiline: One line per import list entry. - # Type with contructor list acts like single import. - # - # > import qualified Data.Map as M - # > ( empty - # > , singleton - # > , ... - # > , delete - # > ) - # - # Default: inline - long_list_align: inline - - # List padding determines indentation of import list on lines after import. - # This option affects 'list_align' and 'long_list_align'. - list_padding: 4 - - # Separate lists option affects formating of import list for type - # or class. The only difference is single space between type and list - # of constructors, selectors and class functions. - # - # - true: There is single space between Foldable type and list of it's - # functions. - # - # > import Data.Foldable (Foldable (fold, foldl, foldMap)) - # - # - false: There is no space between Foldable type and list of it's - # functions. - # - # > import Data.Foldable (Foldable(fold, foldl, foldMap)) - # - # Default: true - separate_lists: true - - # Language pragmas - - language_pragmas: - # We can generate different styles of language pragma lists. - # - # - vertical: Vertical-spaced language pragmas, one per line. - # - # - compact: A more compact style. - # - # - compact_line: Similar to compact, but wrap each line with - # `{-#LANGUAGE #-}'. - # - # Default: vertical. - style: vertical - - # Align affects alignment of closing pragma brackets. - # - # - true: Brackets are aligned in same collumn. - # - # - false: Brackets are not aligned together. There is only one space - # between actual import and closing bracket. - # - # Default: true - align: true - - # stylish-haskell can detect redundancy of some language pragmas. If this - # is set to true, it will remove those redundant pragmas. Default: true. - remove_redundant: true - - # Replace tabs by spaces. This is disabled by default. - # - tabs: - # # Number of spaces to use for each tab. Default: 8, as specified by the - # # Haskell report. - # spaces: 8 - - # Remove trailing whitespace - - trailing_whitespace: {} - -# A common setting is the number of columns (parts of) code will be wrapped -# to. Different steps take this into account. Default: 80. -columns: 80 - -# By default, line endings are converted according to the OS. You can override -# preferred format here. -# -# - native: Native newline format. CRLF on Windows, LF on other OSes. -# -# - lf: Convert to LF ("\n"). -# -# - crlf: Convert to CRLF ("\r\n"). -# -# Default: native. -newline: native - -# Sometimes, language extensions are specified in a cabal file or from the -# command line instead of using language pragmas in the file. stylish-haskell -# needs to be aware of these, so it can parse the file correctly. -# -# No language extensions are enabled by default. -# language_extensions: - # - TemplateHaskell - # - QuasiQuotes diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f20042da7..000000000 --- a/.travis.yml +++ /dev/null @@ -1,135 +0,0 @@ -# This .travis.yml is modified from the sample at -# https://docs.haskellstack.org/en/stable/GUIDE/#travis-with-caching - -# Use new container infrastructure to enable caching -sudo: false - -# Do not choose a language; we provide our own build tools. -language: generic - -# Caching so the next build will be fast too. -cache: - directories: - - $HOME/.ghc - - $HOME/.cabal - - $HOME/.stack - -# The different configurations we want to test. We have BUILD=cabal which uses -# cabal-install, and BUILD=stack which uses Stack. More documentation on each -# of those below. -# -# We set the compiler values here to tell Travis to use a different -# cache file per set of arguments. -# -# If you need to have different apt packages for each combination in the -# matrix, you can use a line such as: -# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}} -# -# fast_finish: build successful when every builds not in allow_failure are finished -# i.e. not waiting any of the allow_failure to finish -matrix: - include: - # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See: - # https://github.com/hvr/multi-ghc-travis - # don't build benchmarks for ghc 7.10.3, because build takes too long... - - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 OPTS="-O0 -Wall -fno-warn-unused-do-bind -Werror" FLAGS="fast embed_data_files" CABALARGS="" - compiler: ": #GHC 7.10.3" - addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5], sources: [hvr-ghc]}} - - # don't build benchmarks for ghc 8.0.2, because build takes too long... - - env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 OPTS="-O0 -Wall -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-unused-do-bind -Werror" FLAGS="fast" CABALARGS="" - compiler: ": #GHC 8.0.2" - addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,happy-1.19.5], sources: [hvr-ghc]}} - - - env: BUILD=cabal GHCVER=8.2.2 CABALVER=1.24 OPTS="-O0 -Wall -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-unused-do-bind -Werror" FLAGS="fast embed_data_files" CABALARGS="--enable-benchmarks" - compiler: ": #GHC 8.2.2" - addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.2,happy-1.19.5], sources: [hvr-ghc]}} - - - env: BUILD=cabal GHCVER=8.2.2 CABALVER=2.0 OPTS="-O0 -Wall -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-unused-do-bind -Werror" FLAGS="fast embed_data_files" CABALARGS="--enable-benchmarks" - compiler: ": #GHC 8.2.2" - addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,happy-1.19.5], sources: [hvr-ghc]}} - - # Build with the newest GHC and cabal-install. This is an accepted failure, - # see below. - # - env: BUILD=cabal GHCVER=head CABALVER=head CABALAGS="--allow-newer" - # compiler: ": #GHC HEAD" - # addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} - - # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS - # variable, such as using --stack-yaml to point to a different file. - # - env: BUILD=stack ARGS="--stack-yaml stack.lts9.yaml" OPTS="-Wall -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-unused-do-bind -Werror" - # compiler: ": #stack 8.0.2" - # addons: {apt: {packages: [ghc-8.0.2], sources: [hvr-ghc]}} - - - env: BUILD=stack ARGS="--resolver lts-10" OPTS="-Wall -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-unused-do-bind -Werror" - compiler: ": #stack 8.2.2" - addons: {apt: {packages: [ghc-8.2.2], sources: [hvr-ghc]}} - - # Nightly builds are allowed to fail - - env: BUILD=stack ARGS="--resolver nightly" OPTS="-Wall -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-unused-do-bind -Werror" - compiler: ": #stack nightly" - addons: {apt: {packages: [ghc-8.2.2], sources: [hvr-ghc]}} - - # - env: BUILD=stack ARGS="--resolver lts-8" - # compiler: ": #stack 8.0.2 osx" - # os: osx - - # - env: BUILD=stack ARGS="--resolver nightly" - # compiler: ": #stack nightly osx" - # os: osx - - allow_failures: - - env: BUILD=cabal GHCVER=head CABALVER=head - - env: BUILD=stack ARGS="--resolver nightly" OPTS="-Wall -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -fno-warn-unused-do-bind -Werror" - - fast_finish: true - -before_install: -# Using compiler above sets CC to an invalid value, so unset it -- unset CC -- export PATH=/opt/happy/1.19.5/bin/:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$HOME/.cabal/bin:$PATH -# Download and unpack the stack executable -- | - if [[ $BUILD == "stack" ]]; then - mkdir -p ~/.local/bin - if [ `uname` = "Darwin" ] - then - curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin - else - curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' - fi - fi - -install: -- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" -- if [ -f configure.ac ]; then autoreconf -i; fi -- | - case "$BUILD" in - stack) - ulimit -n 4096 - stack config set system-ghc --global true - stack --no-terminal --install-ghc $ARGS build --only-dependencies --fast --flag 'pandoc:embed_data_files' --flag 'aeson:fast' --jobs 2 - ;; - cabal) - cabal --version - travis_retry cabal update - cabal install --disable-optimization --only-dependencies --flags="$FLAGS" --enable-tests --force-reinstalls --reorder-goals --max-backjumps=-1 $CABALARGS - ;; - esac - -script: -- | - case "$BUILD" in - stack) - ulimit -n 4096 - stack config set system-ghc --global true - stack --no-terminal $ARGS test --fast --flag 'aeson:fast' --flag pandoc:embed_data_files --haddock --no-haddock-deps --ghc-options="$OPTS" - ;; - cabal) - cabal sdist --output-directory=sourcedist && \ - cd sourcedist && \ - cabal configure --disable-optimization --enable-tests -v2 --flags="$FLAGS" --ghc-options="$OPTS" $CABALARGS && \ - cabal build -v2 -j2 && \ - cabal test - ;; - esac diff --git a/Makefile b/Makefile deleted file mode 100644 index 330f83e87..000000000 --- a/Makefile +++ /dev/null @@ -1,115 +0,0 @@ -version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}') -pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) -SOURCEFILES?=$(shell find pandoc.hs src test -name '*.hs') -BRANCH?=master -RESOLVER=lts-10 -GHCOPTS=-fdiagnostics-color=always -Wall -fno-warn-unused-do-bind -Wincomplete-record-updates -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances -WEBSITE=../../web/pandoc.org - -quick: - stack install --resolver=$(RESOLVER) --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --test-arguments='-j4 --hide-successes $(TESTARGS)' - -full: - stack install --resolver=$(RESOLVER) --flag 'pandoc:embed_data_files' --flag 'pandoc:weigh-pandoc' --flag 'pandoc:trypandoc' --bench --no-run-benchmarks --test --test-arguments='-j4 --hide-successes' --ghc-options '-Wall -Werror -fno-warn-unused-do-bind -O0 -j4 $(GHCOPTS)' - -haddock: - stack haddock --resolver=$(RESOLVER) - -# Note: to accept current results of golden tests, -# make test TESTARGS='--accept' -test: - stack test --resolver=$(RESOLVER) --flag 'pandoc:embed_data_files' --fast --test-arguments='-j4 --hide-successes $(TESTARGS)' --ghc-options '$(GHCOPTS)' - -bench: - stack bench --benchmark-arguments='$(BENCHARGS)' --resolver=$(RESOLVER) --ghc-options '$(GHCOPTS)' - -weigh: - stack build --resolver=$(RESOLVER) --ghc-options '$(GHCOPTS)' --flag 'pandoc:weigh-pandoc' && stack exec weigh-pandoc - -reformat: - for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done - -lint: - for f in $(SOURCEFILES); do echo $$f; hlint --verbose --refactor --refactor-options='-i -s' $$f; done - -changes_github: - pandoc --filter tools/extract-changes.hs changelog -t gfm --wrap=none | sed -e 's/\\#/#/g' | pbcopy - -dist: man/pandoc.1 - cabal sdist - rm -rf "pandoc-${version}" - tar xvzf dist/pandoc-${version}.tar.gz - cd pandoc-${version} - stack setup && stack test && cd .. && rm -rf "pandoc-${version}" - -packages: checkdocs winpkg debpkg macospkg - -checkdocs: README.md - ! grep -n -e "\t" MANUAL.txt changelog - -debpkg: man/pandoc.1 - make -C linux && \ - cp linux/artifacts/pandoc-$(version)-*.* . - -macospkg: man/pandoc.1 - ./macos/make_macos_package.sh - -winpkg: pandoc-$(version)-windows.msi pandoc-$(version)-windows.zip - -pandoc-$(version)-windows.zip: pandoc-$(version)-windows.msi - -rm -rf wintmp && \ - msiextract -C wintmp $< && \ - cd wintmp/"Program Files" && \ - mv Pandoc pandoc-$(version) && \ - zip -r $@ pandoc-$(version) && \ - mv $@ ../../ && \ - cd ../.. && \ - rm -rf wintmp - -pandoc-$(version)-windows.msi: - wget 'https://ci.appveyor.com/api/projects/jgm/pandoc/artifacts/windows/pandoc-windows-i386.msi?branch=$(BRANCH)' -O pandoc.msi && \ - osslsigncode sign -pkcs12 ~/Private/ComodoCodeSigning.exp2019.p12 -in pandoc.msi -i http://johnmacfarlane.net/ -t http://timestamp.comodoca.com/ -out $@ -askpass - rm pandoc.msi - -man/pandoc.1: MANUAL.txt man/pandoc.1.template - pandoc $< -f markdown-smart -t man -s --template man/pandoc.1.template \ - --lua-filter man/manfilter.lua \ - --variable version="pandoc $(version)" \ - -o $@ - -doc/lua-filters.md: tools/ldoc.ltp data/pandoc.lua tools/update-lua-docs.lua - cp $@ $@.tmp - pandoc -t markdown --columns=64 --atx-headers \ - -f markdown -t markdown --standalone\ - --lua-filter tools/update-lua-docs.lua \ - -o $@ $@.tmp - rm $@.tmp - -README.md: README.template MANUAL.txt tools/update-readme.lua - pandoc --lua-filter tools/update-readme.lua --reference-links \ - --reference-location=section -t gfm $< -o $@ - -download_stats: - curl https://api.github.com/repos/jgm/pandoc/releases | \ - jq -r '.[] | .assets | .[] | "\(.download_count)\t\(.name)"' - -pandoc-templates: - rm ../pandoc-templates/default.* ; \ - cp data/templates/default.* ../pandoc-templates/ ; \ - pushd ../pandoc-templates/ && \ - git add default.* && \ - git commit -m "Updated templates for pandoc $(version)" && \ - popd - -trypandoc: - ssh -t macfarlane 'cd src/pandoc && git pull && ~/.local/bin/stack install --flag pandoc:trypandoc --flag pandoc:embed_data_files && cd trypandoc && sudo make install' - -update-website: - make -C $(WEBSITE) update - make -C $(WEBSITE) - make -C $(WEBSITE) upload - -clean: - stack clean - -.PHONY: deps quick full haddock install clean test bench changes_github macospkg dist prof download_stats reformat lint weigh doc/lua-filters.md packages pandoc-templates trypandoc update-website debpkg macospkg winpkg checkdocs diff --git a/README.template b/README.template deleted file mode 100644 index cf664647a..000000000 --- a/README.template +++ /dev/null @@ -1,54 +0,0 @@ -<!-- Do not edit this file. It is generated automatically from -README.template and MANUAL.txt via the command: -pandoc --lua-filter tools/update-readme.lua README.template -o README.md ---> - -Pandoc -====== - -[![github release](https://img.shields.io/github/release/jgm/pandoc.svg?label=current+release)](https://github.com/jgm/pandoc/releases) -[![hackage release](https://img.shields.io/hackage/v/pandoc.svg?label=hackage)](http://hackage.haskell.org/package/pandoc) -[![homebrew](https://img.shields.io/homebrew/v/pandoc.svg)](http://brewformulas.org/Pandoc) -[![stackage LTS package](http://stackage.org/package/pandoc/badge/lts)](http://stackage.org/lts/package/pandoc) -[![travis build status](https://img.shields.io/travis/jgm/pandoc/master.svg?label=travis+build)](https://travis-ci.org/jgm/pandoc) -[![appveyor build status](https://ci.appveyor.com/api/projects/status/nvqs4ct090igjiqc?svg=true)](https://ci.appveyor.com/project/jgm/pandoc) -[![license](https://img.shields.io/badge/license-GPLv2+-lightgray.svg)](https://www.gnu.org/licenses/gpl.html) -[![pandoc-discuss on google groups](https://img.shields.io/badge/pandoc-discuss-red.svg?style=social)](https://groups.google.com/forum/#!forum/pandoc-discuss) - - -The universal markup converter ------------------------------- - -::: description -::: - -Installing ----------- - -Here's [how to install pandoc](INSTALL.md). - -Documentation -------------- - -Pandoc's website contains a full [User's Guide](https://pandoc.org/MANUAL.html). -It is also available [here](MANUAL.txt) as pandoc-flavored Markdown. -The website also contains some [examples of the use of -pandoc](https://pandoc.org/demos.html) and a limited [online -demo](https://pandoc.org/try). - -Contributing ------------- - -Pull requests, bug reports, and feature requests are welcome. Please make -sure to read [the contributor guidelines](CONTRIBUTING.md) before opening a -new issue. - - -License -------- - -© 2006-2018 John MacFarlane (jgm@berkeley.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.) - -[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License" diff --git a/RELEASE-CHECKLIST b/RELEASE-CHECKLIST deleted file mode 100644 index 1fbf396d7..000000000 --- a/RELEASE-CHECKLIST +++ /dev/null @@ -1,18 +0,0 @@ -[ ] make README.md and commit if needed -[ ] make man/pandoc.1 and commit if needed -[ ] Finalize changelog - git log --pretty='format:%n%n* %s (%an)%n%b%n%h%n' \ - --reverse --name-only LASTRELEASE..HEAD > LOG -[ ] make packages -[ ] make update-website -[ ] make trypandoc -[ ] Tag release in git -[ ] make pandoc-templates - cd ../pandoc-templates - git tag REL - git push - git push --tags -[ ] Add release on github (use 'make changes_github' and upload files) -[ ] stack upload . -[ ] Announce on pandoc-announce, pandoc-discuss - diff --git a/RELEASE-CHECKLIST.md b/RELEASE-CHECKLIST.md deleted file mode 100644 index 07fbcb8bb..000000000 --- a/RELEASE-CHECKLIST.md +++ /dev/null @@ -1,27 +0,0 @@ -- [ ] Test, on Linux, Windows, macOS (inc. website demos) - -- [ ] Finalize changelog: - `git log --pretty='format:%n%n* %s (%an)%n%b%n%h%n' --reverse --name-only 1.17.0.3..HEAD > LOG` - -- [ ] `make man/pandoc.1` and commit if needed - -- [ ] Tag release in git - -- [ ] Tag templates - -- [ ] Generate Windows package (`make winpkg`) - -- [ ] Generate macOS package (`make macospkg`) - -- [ ] Generate Ubuntu/Debian deb package (`make debpkg`) - -- [ ] Add release on github (use `make changes_github` and upload files) - -- [ ] Upload to HackageDB - -- [ ] Update website (`make update`), including short description of changes (`make changes`) - -- [ ] on server, `cabal install --enable-tests -ftrypandoc` - and then `cd trypandoc; sudo make install` - -- [ ] Announce on pandoc-announce, pandoc-discuss diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 0df7abf32..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,78 +0,0 @@ -clone_folder: "c:\\pandoc" -environment: - global: - WIXBIN: "c:\\Program Files (x86)\\WiX Toolset v3.11\\bin" - STACK_YAML: "c:\\pandoc\\stack.yaml" - STACK_BUILD_OPTS: "-j1 --no-terminal --test --local-bin-path=.\\windows" - # see #4201, https://github.com/haskell-tools/haskell-tools/issues/277 - matrix: - - STACK_VERSION: "windows-i386" - STACK_ROOT: "c:\\sr32" - STACK: "%STACK_ROOT%\\stack.exe" - STACK_FLAGS: "--flag=hslua:lua_32bits" -# - STACK_VERSION: "windows-x86_64" -# STACK_ROOT: "c:\\sr64" -# STACK: "%STACK_ROOT%\\stack.exe" -# STACK_FLAGS: "" - -skip_commits: - files: - - '*.md' - - '*.txt' - - '.travis.yml' - - 'Makefile' - - 'man/pandoc.1' - - 'linux/*' - - 'macos/*' - -matrix: - fast_finish: true - -cache: - - "%STACK_ROOT%" - - "%WIXBIN%" - # This is where stack install ghc by default, but we don't - # cache it because it's too large: - # - "c:\\Users\\appveyor\\AppData\\Local\\Programs\\stack" - -# Note: to reset build cache, do the following in JavaScript -# console on appveyor: -# $.ajax({ url: 'https://ci.appveyor.com/api/projects/jgm/pandoc/buildcache', type: 'DELETE'}) -# We don't do a normal C build, but build in test_script via stack -build: off - -install: - - '"%WIXBIN%"\candle -? || choco install wixtoolset' - - | - %STACK% --version || curl -ostack.zip -L --insecure http://www.stackage.org/stack/%STACK_VERSION% && 7z e stack.zip -o"%STACK_ROOT%" stack.exe - -# before_test: - -test_script: - # The ugly echo "" hack is to avoid complaints about 0 being an invalid file - # descriptor - - | - %STACK% setup > nul - %STACK% path - echo "" | %STACK% clean - echo "" | %STACK% install %STACK_BUILD_OPTS% pandoc pandoc-citeproc %STACK_FLAGS% - -after_test: - # .\ in the stack commandline seems to be .\windows\ (where the stack-appveyor.yaml is) - - cd windows - - .\pandoc.exe -s --toc ..\MANUAL.txt -o MANUAL.html - - .\pandoc.exe -s ..\COPYING.md -o COPYING.rtf - - copy ..\COPYRIGHT COPYRIGHT.txt - - 7z a "pandoc-%STACK_VERSION%.zip" pandoc.exe pandoc-citeproc.exe MANUAL.html COPYING.rtf - - | - set VERSION= - for /f "tokens=1-2 delims= " %%a in ('.\pandoc.exe --version') do ( if not defined VERSION set "VERSION=%%b" ) - echo %VERSION% - "%WIXBIN%\\candle" -dVERSION=%VERSION% -dBINPATH=. *.wxs -out wixobj\ - "%WIXBIN%\\light" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us -loc Pandoc-en-us.wxl -out "pandoc-%STACK_VERSION%.msi" wixobj\*.wixobj - -artifacts: - - path: 'windows\pandoc-%STACK_VERSION%.zip' - name: exe - - path: 'windows\pandoc-%STACK_VERSION%.msi' - name: msi diff --git a/data/LaTeXMathML.js b/data/LaTeXMathML.js deleted file mode 100644 index 4957624de..000000000 --- a/data/LaTeXMathML.js +++ /dev/null @@ -1,198 +0,0 @@ -/* -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. -Released under the GNU General Public License version 2 or later. -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;}} diff --git a/data/make-reference-files.hs b/data/make-reference-files.hs deleted file mode 100644 index 77e518496..000000000 --- a/data/make-reference-files.hs +++ /dev/null @@ -1,27 +0,0 @@ -import System.Environment -import System.Directory -import Codec.Archive.Zip -import qualified Data.ByteString.Lazy as BS -import qualified Control.Exception as E -import System.IO.Error (isDoesNotExistError) -import System.FilePath - -mkzip :: String -> IO () -mkzip fmt = do - let dir = "data" </> fmt - output = "data" </> "reference" <.> fmt - cd <- getCurrentDirectory - setCurrentDirectory dir - archive <- addFilesToArchive [OptRecursive] emptyArchive ["."] - setCurrentDirectory cd - removeIfExists output - BS.writeFile output $ fromArchive archive - -removeIfExists :: FilePath -> IO () -removeIfExists fileName = removeFile fileName `E.catch` handleExists - where handleExists e - | isDoesNotExistError e = return () - | otherwise = E.throwIO e - -main :: IO () -main = getArgs >>= mkzip . (!!0) diff --git a/data/templates/.github/ISSUE_TEMPLATE.md b/data/templates/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index ead4f6811..000000000 --- a/data/templates/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,3 +0,0 @@ -This repository is now maintained as a subtree of -[jgm/pandoc](https://github.com/jgm/pandoc). Please open -your issue there, not here. diff --git a/data/templates/.github/PULL_REQUEST_TEMPLATE.md b/data/templates/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 7328f66a4..000000000 --- a/data/templates/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,4 +0,0 @@ -This repository is now maintained as a subtree of -[jgm/pandoc](https://github.com/jgm/pandoc). Please open -your pull request there, not here. - diff --git a/data/templates/README.markdown b/data/templates/README.markdown deleted file mode 100644 index f84cbb6fe..000000000 --- a/data/templates/README.markdown +++ /dev/null @@ -1,49 +0,0 @@ -The [pandoc-templates] repository contains default templates for [pandoc]. - -If you use custom templates, we recommend forking this -repository, so that you can integrate changes to the default -templates in future pandoc releases. - -This repository is a subtree of [pandoc]; it will be updated -each time there is a new pandoc release. However, changes to -templates are made first in [pandoc]; thus, issues and pull -requests should be made [pandoc]'s issue tracker rather than -here. - -[pandoc]: https://github.com/jgm/pandoc -[pandoc-templates]: https://github.com/jgm/pandoc-templates - -All of the templates in this repository are dual licensed, under both -the GPL (v2 or higher, same as pandoc) and the BSD 3-clause license -(included below). - -Copyright (c) 2014--2018, John MacFarlane - -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 John MacFarlane nor the names of other - 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. diff --git a/data/vimwiki.css b/data/vimwiki.css deleted file mode 100644 index 0a8841a32..000000000 --- a/data/vimwiki.css +++ /dev/null @@ -1,82 +0,0 @@ -pre{ - font-size: 1.5em -} - -img {vertical-align: middle} - -body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 120%; line-height: 130%;} -h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;} -h1 {font-size: 2.6em; color: #000000;} -h2 {font-size: 2.2em; color: #404040;} -h3 {font-size: 1.8em; color: #707070;} -h4 {font-size: 1.4em; color: #909090;} -h5 {font-size: 1.3em; color: #989898;} -h6 {font-size: 1.2em; color: #9c9c9c;} -p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;} -ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;} -li {margin: 0.3em auto;} -ul {margin-left: 2em; padding-left: 0.5em;} -dt {font-weight: bold;} -img {border: none;} -pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;} -blockquote {padding: 0.4em; background-color: #f6f5eb;} -th, td {border: 1px solid #ccc; padding: 0.3em;} -th {background-color: #f0f0f0;} -hr {border: none; border-top: 1px solid #ccc; width: 100%;} -del {text-decoration: line-through; color: #777777;} -.toc li {list-style-type: none;} -.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;} -.justleft {text-align: left;} -.justright {text-align: right;} -.justcenter {text-align: center;} -.center {margin-left: auto; margin-right: auto;} -div.center > table {margin-left: auto; margin-right: auto;} -.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;} - -/* classes for items of todo lists */ -.done0 { - /* list-style: none; */ - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==); - background-repeat: no-repeat; - background-position: 0 .2em; - padding-left: 1.5em; -} -.done1 { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC); - background-repeat: no-repeat; - background-position: 0 .15em; - padding-left: 1.5em; -} -.done2 { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=); - background-repeat: no-repeat; - background-position: 0 .15em; - padding-left: 1.5em; -} -.done3 { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==); - background-repeat: no-repeat; - background-position: 0 .15em; - padding-left: 1.5em; -} -.done4 { - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC); - background-repeat: no-repeat; - background-position: 0 .15em; - padding-left: 1.5em; -} - -*:not(pre) > code { - font-family: Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace; - -webkit-border-radius: 1px; - -moz-border-radius: 1px; - border-radius: 1px; - -moz-background-clip: padding; - -webkit-background-clip: padding-box; - background-clip: padding-box; - padding: 0px 3px; - display: inline-block; - color: #52595d; - border: 1px solid #ccc; - background-color: #f9f9f9; -} diff --git a/default.nix b/default.nix deleted file mode 100644 index b34400204..000000000 --- a/default.nix +++ /dev/null @@ -1,96 +0,0 @@ -# This Nix file can be handy when working on the github version of pandoc. -# -# To build pandoc run: -# nix-build -# To run a nix shell with everthing needed to build pandoc with cabal: -# nix-shell -# To build pandoc for use on Linux and macOS systems without Nix: -# nix-build -A patched -{ pkgs ? - import ((import <nixpkgs> {}).pkgs.fetchFromGitHub { - owner = "NixOS"; repo = "nixpkgs"; - rev = "42b9b8f7c8687cb26e69c3559e0e1346fb0e680f"; - sha256 = "01zcd0dh9x3qf5yflclbrcvff9yh8k9pmccc7vjlq3phc440qsyb"; - }) {} }: -let haskellPackages = pkgs.haskellPackages; - overrides = self: super: { }; - source-overrides = { - doctemplates = "0.2.1"; - texmath = "0.10"; - pandoc-types = pkgs.fetchFromGitHub { - owner = "jgm"; - repo = "pandoc-types"; - rev = "f1278603a4766f32b8375de84b8581f4bb1e665a"; - sha256 = "05ykcs8qdjrxly9b6chjr939mv6r42mh51bl58k7jxsr1crxrrf9"; - }; - }; - filterHaskellSource = src: - builtins.filterSource (path: type: - pkgs.lib.all (i: i != baseNameOf path) [ ".git" "dist-newstyle" "cabal.project.local" "dist" ".stack-work" ".DS_Store" "default.nix" "result" ] - && pkgs.lib.all (i: !(pkgs.lib.hasSuffix i path)) [ ".lkshf" ] - && pkgs.lib.all (i: !(pkgs.lib.hasPrefix i path)) [ ".ghc.environment." ] - ) src; - - # Normal nix derivation - drv = ( - haskellPackages.extend ( - pkgs.lib.composeExtensions ( - haskellPackages.packageSourceOverrides source-overrides - ) overrides - ) - ).callCabal2nix "pandoc" (filterHaskellSource ./.) {}; - - # Like drv but with static linking for haskell libraries - static = pkgs.haskell.lib.justStaticExecutables (drv.overrideAttrs (old: { - buildInputs = old.buildInputs ++ [ - pkgs.zlib.static - haskellPackages.file-embed - ]; - configureFlags = [ - "-fembed_data_files" - "--disable-executable-dynamic" - ]; - })); - - # Patch binaries for use on macOS and linux systems without nix - # and bundle the required gmp and lua libraries - patched = pkgs.stdenv.mkDerivation { - name = "pandoc-patched"; - buildInputs = [ - static - pkgs.zip - pkgs.gnutar - ]; - unpackPhase = "true"; - buildPhase = "true"; - installPhase = if pkgs.stdenv.isDarwin - then '' - mkdir -p $out/bin - cp ${static}/bin/pandoc $out/bin - cp ${pkgs.gmp}/lib/libgmp.10.dylib $out/bin - cp ${pkgs.lua5_3}/lib/liblua.5.3.4.dylib $out/bin - chmod +w $out/bin/* - echo patching libgmp and liblua - install_name_tool -id "@executable_path/libgmp.10.dylib" "$out/bin/libgmp.10.dylib" - install_name_tool -id "@executable_path/liblua.5.3.4.dylib" "$out/bin/liblua.5.3.4.dylib" - for fn in $out/bin/*; do - echo patching $fn - install_name_tool -change "${pkgs.libiconv}/lib/libiconv.dylib" /usr/lib/libiconv.dylib "$fn" - install_name_tool -change "${pkgs.stdenv.libc}/lib/libSystem.B.dylib" /usr/lib/libSystem.B.dylib "$fn" - install_name_tool -change "${pkgs.gmp}/lib/libgmp.10.dylib" "@executable_path/libgmp.10.dylib" "$fn" - install_name_tool -change "${pkgs.lua5_3}/lib/liblua.5.3.4.dylib" "@executable_path/liblua.5.3.4.dylib" "$fn" - done - (cd $out/.. && zip -r $out/pandoc-macOS.zip `basename $out`/bin) - '' - else '' - mkdir -p $out/bin - cp ${static}/bin/pandoc $out/bin - cp ${pkgs.gmp}/lib/libgmp.so* $out/bin - cp ${pkgs.lua5_3}/lib/liblua.so* $out/bin - chmod +w $out/bin/pandoc - patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 $out/bin/pandoc - patchelf --set-rpath '$ORIGIN' $out/bin/pandoc - (cd $out/.. && tar -czf $out/pandoc-linux.tar.gz `basename $out`/bin) - ''; - }; -in if pkgs.lib.inNixShell then drv.env else drv // { inherit static patched; } diff --git a/doc/epub.md b/doc/epub.md deleted file mode 100644 index 1d9480bd1..000000000 --- a/doc/epub.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -title: Creating an ebook with pandoc -author: John MacFarlane ---- - -Starting with version 1.6, pandoc can produce output in the [EPUB] -electronic book format. EPUB books can be viewed on iPads, Nooks, and -other electronic book readers, including many smart phones. (They can -also be converted to Kindle books using [KindleGen].) - -This means that it's now very easy to produce an electronic book! -Let's try it. - -# A toy example - -Use your text editor to create a file `mybook.txt`, with the following -contents: - - % My Book - % Sam Smith - - This is my book! - - # Chapter One - - Chapter one is over. - - # Chapter Two - - Chapter two has just begun. - -To make this into an ebook takes only one command: - - pandoc mybook.txt -o mybook.epub - -You can upload `mybook.epub` to your ebook reader and try it out. - -Note that if your markdown file contains links to local images, for -example - - ![Juliet](images/sun.jpg) - -pandoc will automatically include the images in the generated -epub. - -# A real book - -To see what this would look like for a real book, let's convert Scott -Chacon's book [Pro Git], which he wrote using pandoc's markdown variant -and released under a [Creative Commons] license. (If you use the book, -please consider [buying a copy] to help support his excellent work.) - -You can find the markdown source for the book on its -[github site]. Let's get a copy of the whole repository:[^1] - - git clone http://github.com/progit/progit.git - -[^1]: If you don't have [git], you can browse to the [github site] and -click "Download Source" to get the same files in a zip or tar archive. - -This command will create a working directory called `progit` on -your machine. The actual markdown sources for the English version -of the book are in the `en` subdirectory, so start by changing -to that directory: - - cd progit/en - -As you can see, each chapter is a single text file in its own directory. -Chacon does some postprocessing on these files, for example, to insert images. -This is a placeholder for Figure 1-1, for example: - - Insert 18333fig0101.png - Figure 1-1. Local version control diagram. - -The actual image file is called `18333fig0101-tn.png` and lives in -the `figures` subdirectory of the repository, as you can verify. - -For demonstration purposes, we want pure markdown files, so let's -change this placeholder into a markdown image link. Pandoc will -treat a paragraph containing a single image as a figure with -a caption, which is what we want: - - ![Figure 1-1. Local version control diagram.](../figures/18333fig0101-tn.png) - -We can make this change in all the files with a perl one-liner: - - perl -i -0pe \ - 's/^Insert\s*(.*)\.png\s*\n([^\n]*)$/!\[\2](..\/figures\/\1-tn.png)/mg' \ - */*.markdown - -This will modify the files in place. (We won't worry about backing -them up; if we mess up, we can get the original files back with -`git reset --hard`.) - -OK! Now we're almost ready to make an ebook. We have the chapters, -each in its own file, but we still need a title. Create a file, -`title.txt`, with a pandoc YAML metadata block: - -``` ---- -title: Pro Git -author: Scott Chacon -rights: Creative Commons Non-Commercial Share Alike 3.0 -language: en-US -... -``` - -See the [User's Guide](MANUAL.html#epub-metadata) for more information -above these fields. - -Now run pandoc to make the ebook, using our title page and modified -chapter files as sources: - - pandoc -o progit.epub title.txt \ - 01-introduction/01-chapter1.markdown \ - 02-git-basics/01-chapter2.markdown \ - 03-git-branching/01-chapter3.markdown \ - 04-git-server/01-chapter4.markdown \ - 05-distributed-git/01-chapter5.markdown \ - 06-git-tools/01-chapter6.markdown \ - 07-customizing-git/01-chapter7.markdown \ - 08-git-and-other-scms/01-chapter8.markdown \ - 09-git-internals/01-chapter9.markdown - -That's it! The ebook, `progit.epub`, is ready to be uploaded to your reader. - -## Changing the format - -You can use the `--css` option to specify a CSS file -for the book. The default CSS is minimal and can be found -[on GitHub](https://github.com/jgm/pandoc/blob/master/data/epub.css) -or in the `epub.css` file in your data directory -(see `--data-dir` in the [User's Guide]). - -You can even embed fonts in the EPUB if you want; see the [User's Guide] -under `--epub-embed-font` for instructions. - -## Math - -Pandoc has an EPUB3 writer. It renders LaTeX math into MathML, which -EPUB3 readers are supposed to support (but unfortunately few do). - -Of course, this isn't much help if you want EPUB2 output (`pandoc -t epub2`) -or target readers that don't support MathML. Then you should try using the -`--webtex` option, which will use a web service to convert the TeX to an image. - -[KindleGen]: http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000234621 -[EPUB]: http://en.wikipedia.org/wiki/EPUB -[Pro Git]: http://progit.org/ -[Creative Commons]: http://creativecommons.org/ -[buying a copy]: http://progit.org/ -[github site]: http://github.com/progit/progit -[git]: http://git-scm.com -[Dublin Core metadata elements]: http://dublincore.org/documents/dces/ -[User's Guide]: MANUAL.html - diff --git a/doc/filters.md b/doc/filters.md deleted file mode 100644 index a27d657fb..000000000 --- a/doc/filters.md +++ /dev/null @@ -1,471 +0,0 @@ -% Pandoc filters -% John MacFarlane - -# Summary - -Pandoc provides an interface for users to write programs (known -as filters) which act on pandoc’s AST. - -Pandoc consists of a set of readers and writers. When converting -a document from one format to another, text is parsed by a -reader into pandoc’s intermediate representation of the -document---an "abstract syntax tree" or AST---which is then -converted by the writer into the target format. -The pandoc AST format is defined in the module -`Text.Pandoc.Definition` in -[pandoc-types](https://hackage.haskell.org/package/pandoc-types). - -A "filter" is a program that modifies the AST, between the -reader and the writer: - - INPUT --reader--> AST --filter--> AST --writer--> OUTPUT - -Filters are "pipes" that read from standard input and write to -standard output. They consume and produce a JSON representation -of the pandoc AST. (In recent versions, this representation -includes a `pandoc-api-version` field which refers to a -version of `pandoc-types`.) Filters may be written in any programming -language. To use a filter, you need only specify it on the -command line using `--filter`, e.g. - - pandoc -s input.txt --filter pandoc-citeproc -o output.htl - -For a gentle introduction into writing your own filters, -continue this guide. There’s also a [list of third party filters -on the wiki](https://github.com/jgm/pandoc/wiki/Pandoc-Filters). - - -# A simple example - -Suppose you wanted to replace all level 2+ headers in a markdown -document with regular paragraphs, with text in italics. How would you go -about doing this? - -A first thought would be to use regular expressions. Something -like this: - - perl -pe 's/^##+ (.*)$/\*\1\*/' source.txt - -This should work most of the time. But don't forget -that ATX style headers can end with a sequence of `#`s -that is not part of the header text: - - ## My header ## - -And what if your document contains a line starting with `##` in an HTML -comment or delimited code block? - - <!-- - ## This is just a comment - --> - - ~~~~ - ### A third level header in standard markdown - ~~~~ - -We don't want to touch *these* lines. Moreover, what about setext -style second-level headers? - - A header - -------- - -We need to handle those too. Finally, can we be sure that adding -asterisks to each side of our string will put it in italics? -What if the string already contains asterisks around it? Then we'll -end up with bold text, which is not what we want. And what if it contains -a regular unescaped asterisk? - -How would you modify your regular expression to handle these cases? It -would be hairy, to say the least. What we need is a real parser. - -Well, pandoc has a real markdown parser, the library function -`readMarkdown`. This transforms markdown text to an abstract syntax tree -(AST) that represents the document structure. Why not manipulate the -AST directly in a short Haskell script, then convert the result back to -markdown using `writeMarkdown`? - -First, let's see what this AST looks like. We can use pandoc's `native` -output format: - -~~~~ -% cat test.txt -## my header - -text with *italics* -% pandoc -s -t native test.txt -Pandoc (Meta {unMeta = fromList []}) -[Header 3 ("my-header",[],[]) [Str "My",Space,Str "header"] -, Para [Str "text",Space,Str "with",Space,Emph [Str "italics"]] ] -~~~~ - -A `Pandoc` document consists of a `Meta` block (containing -metadata like title, authors, and date) and a list of `Block` - elements. In this case, we have two `Block`s, a `Header` and a `Para`. -Each has as its content a list of `Inline` elements. For more details on -the pandoc AST, see the [haddock documentation for `Text.Pandoc.Definition`]. - -[haddock documentation for `Text.Pandoc.Definition`]: http://hackage.haskell.org/package/pandoc-types - -Here's a short Haskell script that reads markdown, changes level -2+ headers to regular paragraphs, and writes the result as markdown. -If you save it as `behead.hs`, you can run it using `runhaskell behead.hs`. -It will act like a unix pipe, reading from `stdin` and writing to `stdout`. -Or, if you want, you can compile it, using `ghc --make behead`, then run -the resulting executable `behead`. - -~~~~ {.haskell} --- behead.hs -import Text.Pandoc -import Text.Pandoc.Walk (walk) - -behead :: Block -> Block -behead (Header n _ xs) | n >= 2 = Para [Emph xs] -behead x = x - -readDoc :: String -> Pandoc -readDoc s = readMarkdown def s --- or, for pandoc 1.14 and greater, use: --- readDoc s = case readMarkdown def s of --- Right doc -> doc --- Left err -> error (show err) - -writeDoc :: Pandoc -> String -writeDoc doc = writeMarkdown def doc - -main :: IO () -main = interact (writeDoc . walk behead . readDoc) -~~~~ - -The magic here is the `walk` function, which converts -our `behead` function (a function from `Block` to `Block`) to -a transformation on whole `Pandoc` documents. -(See the [haddock documentation for `Text.Pandoc.Walk`].) - -[haddock documentation for `Text.Pandoc.Walk`]: http://hackage.haskell.org/package/pandoc-types - -# Queries: listing URLs - -We can use this same technique to do much more complex transformations -and queries. Here's how we could extract all the URLs linked to in -a markdown document (again, not an easy task with regular expressions): - -~~~~ {.haskell} --- extracturls.hs -import Text.Pandoc - -extractURL :: Inline -> [String] -extractURL (Link _ _ (u,_)) = [u] -extractURL (Image _ _ (u,_)) = [u] -extractURL _ = [] - -extractURLs :: Pandoc -> [String] -extractURLs = query extractURL - -readDoc :: String -> Pandoc -readDoc = readMarkdown def --- or, for pandoc 1.14, use: --- readDoc s = case readMarkdown def s of --- Right doc -> doc --- Left err -> error (show err) - -main :: IO () -main = interact (unlines . extractURLs . readDoc) -~~~~ - -`query` is the query counterpart of `walk`: it lifts -a function that operates on `Inline` elements to one that operates -on the whole `Pandoc` AST. The results returned by applying -`extractURL` to each `Inline` element are concatenated in the -result. - -# JSON filters - -`behead.hs` is a very special-purpose program. It reads a -specific input format (markdown) and writes a specific output format -(HTML), with a specific set of options (here, the defaults). -But the basic operation it performs is one that would be useful -in many document transformations. It would be nice to isolate the -part of the program that transforms the pandoc AST, leaving the rest -to pandoc itself. What we want is a *filter* that *just* operates -on the AST---or rather, on a JSON representation of the AST that -pandoc can produce and consume: - - source format - ↓ - (pandoc) - ↓ - JSON-formatted AST - ↓ - (filter) - ↓ - JSON-formatted AST - ↓ - (pandoc) - ↓ - target format - -The module `Text.Pandoc.JSON` (from `pandoc-types`) contains a -function `toJSONFilter` that makes it easy to write such -filters. Here is a filter version of `behead.hs`: - -~~~~ {.haskell} -#!/usr/bin/env runhaskell --- behead2.hs -import Text.Pandoc.JSON - -main :: IO () -main = toJSONFilter behead - where behead (Header n _ xs) | n >= 2 = Para [Emph xs] - behead x = x -~~~~ - -It can be used this way: - - pandoc -f SOURCEFORMAT -t json | runhaskell behead2.hs | \ - pandoc -f json -t TARGETFORMAT - -But it is easier to use the `--filter` option with pandoc: - - pandoc -f SOURCEFORMAT -t TARGETFORMAT --filter ./behead2.hs - -Note that this approach requires that `behead2.hs` be executable, -so we must - - chmod +x behead2.hs - -Alternatively, we could compile the filter: - - ghc --make behead2.hs - pandoc -f SOURCEFORMAT -t TARGETFORMAT --filter ./behead - -Note that if the filter is placed in the system PATH, then the initial -`./` is not needed. Note also that the command line can include -multiple instances of `--filter`: the filters will be applied in -sequence. - -# LaTeX for WordPress - -Another easy example. WordPress blogs require a special format for -LaTeX math. Instead of `$e=mc^2$`, you need: `$LaTeX e=mc^2$`. -How can we convert a markdown document accordingly? - -Again, it's difficult to do the job reliably with regexes. -A `$` might be a regular currency indicator, or it might occur in -a comment or code block or inline code span. We just want to find -the `$`s that begin LaTeX math. If only we had a parser... - -We do. Pandoc already extracts LaTeX math, so: - -~~~~ {.haskell} -#!/usr/bin/env runhaskell --- wordpressify.hs -import Text.Pandoc.JSON - -main = toJSONFilter wordpressify - where wordpressify (Math x y) = Math x ("LaTeX " ++ y) - wordpressify x = x -~~~~ - -Mission accomplished. (I've omitted type signatures here, -just to show it can be done.) - - -# But I don't want to learn Haskell! - -While it's easiest to write pandoc filters in Haskell, it is fairly -easy to write them in python using the `pandocfilters` package. -The package is in PyPI and can be installed using `pip install -pandocfilters` or `easy_install pandocfilters`. - -Here's our "beheading" filter in python: - -~~~ {.python} -#!/usr/bin/env python - -""" -Pandoc filter to convert all level 2+ headers to paragraphs with -emphasized text. -""" - -from pandocfilters import toJSONFilter, Emph, Para - -def behead(key, value, format, meta): - if key == 'Header' and value[0] >= 2: - return Para([Emph(value[2])]) - -if __name__ == "__main__": - toJSONFilter(behead) -~~~ - -`toJSONFilter(behead)` walks the AST and applies the `behead` action -to each element. If `behead` returns nothing, the node is unchanged; -if it returns an object, the node is replaced; if it returns a list, -the new list is spliced in. - -Note that, although these parameters are not used in this example, -`format` provides access to the target format, and `meta` provides access to -the document's metadata. - -There are many examples of python filters in [the pandocfilters -repository](http://github.com/jgm/pandocfilters). - -For a more Pythonic alternative to pandocfilters, see -the [panflute](http://scorreia.com/software/panflute/) library. -Don't like Python? There are also ports of pandocfilters in -[PHP](https://github.com/vinai/pandocfilters-php), -[perl](https://metacpan.org/pod/Pandoc::Filter), -[javascript/node.js](https://github.com/mvhenderson/pandoc-filter-node), -[Groovy](https://github.com/dfrommi/groovy-pandoc), and -[Ruby](https://heerdebeer.org/Software/markdown/paru/). - -Starting with pandoc 2.0, pandoc includes built-in support for -writing filters in lua. The lua interpreter is built in to -pandoc, so a lua filter does not require any additional software -to run. See the [documentation on lua -filters](lua-filters.html). - -# Include files - -So none of our transforms have involved IO. How about a script that -reads a markdown document, finds all the inline code blocks with -attribute `include`, and replaces their contents with the contents of -the file given? - -~~~~ {.haskell} -#!/usr/bin/env runhaskell --- includes.hs -import Text.Pandoc.JSON - -doInclude :: Block -> IO Block -doInclude cb@(CodeBlock (id, classes, namevals) contents) = - case lookup "include" namevals of - Just f -> return . (CodeBlock (id, classes, namevals)) =<< readFile f - Nothing -> return cb -doInclude x = return x - -main :: IO () -main = toJSONFilter doInclude -~~~~ - -Try this on the following: - - Here's the pandoc README: - - ~~~~ {include="README"} - this will be replaced by contents of README - ~~~~ - -# Removing links - -What if we want to remove every link from a document, retaining -the link's text? - -~~~~ {.haskell} -#!/usr/bin/env runhaskell --- delink.hs -import Text.Pandoc.JSON - -main = toJSONFilter delink - -delink :: Inline -> [Inline] -delink (Link _ txt _) = txt -delink x = [x] -~~~~ - -Note that `delink` can't be a function of type `Inline -> Inline`, -because the thing we want to replace the link with is not a single -`Inline` element, but a list of them. So we make `delink` a function -from an `Inline` element to a list of `Inline` elements. -`toJSONFilter` can still lift this function to a transformation of type -`Pandoc -> Pandoc`. - -# A filter for ruby text - -Finally, here's a nice real-world example, developed on the -[pandoc-discuss](http://groups.google.com/group/pandoc-discuss/browse_thread/thread/7baea325565878c8) list. Qubyte wrote: - -> I'm interested in using pandoc to turn my markdown notes on Japanese -> into nicely set HTML and (Xe)LaTeX. With HTML5, ruby (typically used to -> phonetically read chinese characters by placing text above or to the -> side) is standard, and support from browsers is emerging (Webkit based -> browsers appear to fully support it). For those browsers that don't -> support it yet (notably Firefox) the feature falls back in a nice way -> by placing the phonetic reading inside brackets to the side of each -> Chinese character, which is suitable for other output formats too. As -> for (Xe)LaTeX, ruby is not an issue. -> -> At the moment, I use inline HTML to achieve the result when the -> conversion is to HTML, but it's ugly and uses a lot of keystrokes, for -> example -> -> ~~~ {.xml} -> <ruby>ご<rt></rt>飯<rp>(</rp><rt>はん</rt><rp>)</rp></ruby> -> ~~~ -> -> sets ご飯 "gohan" with "han" spelt phonetically above the second -> character, or to the right of it in brackets if the browser does not -> support ruby. I'd like to have something more like -> -> r[はん](飯) -> -> or any keystroke saving convention would be welcome. - -We came up with the following script, which uses the convention that a -markdown link with a URL beginning with a hyphen is interpreted as ruby: - - [はん](-飯) - -~~~ {.haskell} --- handleruby.hs -import Text.Pandoc.JSON -import System.Environment (getArgs) - -handleRuby :: Maybe Format -> Inline -> Inline -handleRuby (Just format) (Link _ [Str ruby] ('-':kanji,_)) - | format == Format "html" = RawInline format - $ "<ruby>" ++ kanji ++ "<rp>(</rp><rt>" ++ ruby ++ "</rt><rp>)</rp></ruby>" - | format == Format "latex" = RawInline format - $ "\\ruby{" ++ kanji ++ "}{" ++ ruby ++ "}" - | otherwise = Str ruby -handleRuby _ x = x - -main :: IO () -main = toJSONFilter handleRuby -~~~ - -Note that, when a script is called using `--filter`, pandoc passes -it the target format as the first argument. When a function's -first argument is of type `Maybe Format`, `toJSONFilter` will -automatically assign it `Just` the target format or `Nothing`. - -We compile our script: - - ghc --make handleRuby - -Then run it: - - % pandoc -F ./handleRuby -t html - [はん](-飯) - ^D - <p><ruby>飯<rp>(</rp><rt>はん</rt><rp>)</rp></ruby></p> - % pandoc -F ./handleRuby -t latex - [はん](-飯) - ^D - \ruby{飯}{はん} - -# Exercises - -1. Put all the regular text in a markdown document in ALL CAPS - (without touching text in URLs or link titles). - -2. Remove all horizontal rules from a document. - -3. Renumber all enumerated lists with roman numerals. - -4. Replace each delimited code block with class `dot` with an - image generated by running `dot -Tpng` (from graphviz) on the - contents of the code block. - -5. Find all code blocks with class `python` and run them - using the python interpreter, printing the results to the console. - diff --git a/doc/getting-started.md b/doc/getting-started.md deleted file mode 100644 index 4134a61a2..000000000 --- a/doc/getting-started.md +++ /dev/null @@ -1,314 +0,0 @@ ---- -title: Getting started with pandoc -author: John MacFarlane ---- - -This document is for people who are unfamiliar with command line -tools. Command-line experts can go straight to the [User's -Guide](README.html) or the pandoc man page. - -# Step 1: Install pandoc - -First, install pandoc, following the [instructions for -your platform](installing.html). - -# Step 2: Open a terminal - -Pandoc is a command-line tool. There is no graphic user interface. -So, to use it, you'll need to open a terminal window: - -- On OS X, the Terminal application can be found in - `/Applications/Utilities`. Open a Finder window and go to - `Applications`, then `Utilities`. Then double click on - `Terminal`. (Or, click the spotlight icon in the upper right - hand corner of your screen and type `Terminal` -- you should - see `Terminal` under `Applications`.) - -- On Windows, you can use either the classic command prompt or the - more modern PowerShell terminal. If you use Windows in desktop - mode, run the `cmd` or `powershell` command from the Start menu. - If you use the Windows 8 start screen instead, simply type - `cmd` or `powershell`, and then run either the "Command - Prompt" or "Windows Powershell" application. If you are using - `cmd`, type `chcp 65001` before using pandoc, to set the - encoding to UTF-8. - -- On Linux, there are many possible configurations, depending on - what desktop environment you're using: - - * In Unity, use the search function on the `Dash`, and search - for `Terminal`. Or, use the keyboard shortcut `Ctrl-Alt-T`. - * In Gnome, go to `Applications`, then `Accessories`, and - select `Terminal`, or use `Ctrl-Alt-T`. - * In XFCE, go to `Applications`, then `System`, then `Terminal`, - or use `Super-T`. - * In KDE, go to `KMenu`, then `System`, then `Terminal Program (Konsole)`. - -You should now see a rectangle with a "prompt" (possibly just a symbol -like `%`, but probably including more information, such as your -username and directory), and a blinking cursor. - -Let's verify that pandoc is installed. Type - - pandoc --version - -and hit enter. You should see a message telling you which version -of pandoc is installed, and giving you some additional information. - -# Step 3: Changing directories - -First, let's see where we are. Type - - pwd - -on linux or OSX, or - - echo %cd% - -on Windows, and hit enter. Your terminal should print your current -working directory. (Guess what `pwd` stands for?) This should be your -home directory. - -Let's navigate now to our `Documents` directory: type - - cd Documents - -and hit enter. Now type - - pwd - -(or `echo %cd%` on Windows) -again. You should be in the `Documents` subdirectory of your home -directory. To go back to your home directory, you could type - - cd .. - -The `..` means "one level up." - -Go back to your `Documents` directory if you're not there already. -Let's try creating a subdirectory called `pandoc-test`: - - mkdir pandoc-test - -Now change to the `pandoc-test` directory: - - cd pandoc-test - -If the prompt doesn't tell you what directory you're in, you can -confirm that you're there by doing - - pwd - -(or `echo %cd%`) again. - -OK, that's all you need to know for now about using the terminal. -But here's a secret that will save you a lot of typing. You can -always type the up-arrow key to go back through your history -of commands. So if you want to use a command you typed earlier, -you don't need to type it again: just use up-arrow until it comes -up. Try this. (You can use down-arrow as well, to go the other -direction.) Once you have the command, you can also use the -left and right arrows and the backspace/delete key to edit it. - -Most terminals also support tab completion of directories and -filenames. To try this, let's first go back up to our `Documents` -directory: - - cd .. - -Now, type - - cd pandoc- - -and hit the tab key instead of enter. Your terminal should fill -in the rest (`test`), and then you can hit enter. - -To review: - - - `pwd` (or `echo %cd%` on Windows) - to see what the current working directory is. - - `cd foo` to change to the `foo` subdirectory of your working - directory. - - `cd ..` to move up to the parent of the working directory. - - `mkdir foo` to create a subdirectory called `foo` in the - working directory. - - up-arrow to go back through your command history. - - tab to complete directories and file names. - -# Step 4: Using pandoc as a filter - -Type - - pandoc - -and hit enter. You should see the cursor just sitting there, waiting -for you to type something. Type this: - - Hello *pandoc*! - - - one - - two - -When you're finished (the cursor should be at the beginning of the line), -type `Ctrl-D` on OS X or Linux, or `Ctrl-Z` followed -by `Enter` on Windows. You should now see your text converted to HTML! - - <p>Hello <em>pandoc</em>!</p> - <ul> - <li>one</li> - <li>two</li> - </ul> - -What just happened? When pandoc is invoked without specifying any -input files, it operates as a "filter," taking input from the -terminal and sending its output back to the terminal. You can use -this feature to play around with pandoc. - -By default, input is interpreted as pandoc markdown, and output is -HTML. But we can change that. Let's try converting *from* HTML -*to* markdown: - - pandoc -f html -t markdown - -Now type: - - <p>Hello <em>pandoc</em>!</p> - -and hit `Ctrl-D` (or `Ctrl-Z` followed by `Enter` on Windows). -You should see: - - Hello *pandoc*! - -Now try converting something from markdown to LaTeX. What command -do you think you should use? - -# Step 5: Text editor basics - -You'll probably want to use pandoc to convert a file, not to read -text from the terminal. That's easy, but first we need to create -a text file in our `pandoc-test` subdirectory. - -**Important:** To create a text file, you'll need to use a text -editor, *not* a word processor like Microsoft Word. On Windows, you -can use Notepad (in `Accessories`). On OS X, you can use -`TextEdit` (in `Applications`). On Linux, different platforms come -with different text editors: Gnome has `GEdit`, and KDE has `Kate`. - -Start up your text editor. Type the following: - - # Test! - - This is a test of *pandoc*. - - - list one - - list two - -Now save your file as `test1.md` in the directory -`Documents/pandoc-test`. - -Note: If you use plain text a lot, you'll want a better editor than -`Notepad` or `TextEdit`. You might want to look at -[Sublime Text](http://www.sublimetext.com/) or (if you're willing -to put in some time learning an unfamiliar interface) -[Vim](http://www.vim.org) or [Emacs](http://www.gnu.org/software/emacs). - -# Step 6: Converting a file - -Go back to your terminal. We should still be in the -`Documents/pandoc-test` directory. Verify that with `pwd`. - -Now type - - ls - -(or `dir` if you're on Windows). -This will list the files in the current directory. You should see -the file you created, `test1.md`. - -To convert it to HTML, use this command: - - pandoc test1.md -f markdown -t html -s -o test1.html - -The filename `test1.md` tells pandoc which file to convert. -The `-s` option says to create a "standalone" file, with a header -and footer, not just a fragment. And the `-o test1.html` says -to put the output in the file `test1.html`. Note that we could -have omitted `-f markdown` and `-t html`, since the default -is to convert from markdown to HTML, but it doesn't hurt to -include them. - -Check that the file was created by typing `ls` again. You -should see `test1.html`. Now open this in a browser. On OS X, -you can type - - open test1.html - -On Windows, type - - .\test1.html - -You should see a browser window with your document. - -To create a LaTeX document, you just need to change the command -slightly: - - pandoc test1.md -f markdown -t latex -s -o test1.tex - -Try opening `test1.tex` in your text editor. - -Pandoc can often figure out the input and output formats from -the filename extensions. So, you could have just used: - - pandoc test1.md -s -o test1.tex - -Pandoc knows you're trying to create a LaTeX document, because of the -`.tex` extension. - -Now try creating a Word document (with extension `docx`). - -If you want to create a PDF, you'll need to have LaTeX installed. -(See [MacTeX](http://tug.org/mactex/) on OS X, -[MiKTeX](http://miktex.org) on Windows, or install the texlive -package in linux.) Then do - - pandoc test1.md -s -o test1.pdf - -# Step 7: Command-line options - -You now know the basics. Pandoc has a lot of options. At this point -you can start to learn more about them by reading the -[User's Guide](README.html). - -Here's an example. The `--mathml` option causes pandoc to -convert TeX math into MathML. Type - - pandoc --mathml - -then enter this text, followed by `Ctrl-D` (`Ctrl-Z` followed by -`Enter` on Windows): - - $x = y^2$ - -Now try the same thing without `--mathml`. See the difference -in output? - -If you forget an option, or forget which formats are supported, you -can always do - - pandoc --help - -to get a list of all the supported options. - -On OS X or Linux systems, you can also do - - man pandoc - -to get the pandoc manual page. All of this information is also -in the User's Guide. - -If you get stuck, you can always ask questions on the -[pandoc-discuss](http://groups.google.com/group/pandoc-discuss) -mailing list. But be sure to check the [FAQs](faqs.html) first, -and search through the mailing list to see if your question has -been answered before. - diff --git a/doc/lua-filters.md b/doc/lua-filters.md deleted file mode 100644 index 0e07ee73a..000000000 --- a/doc/lua-filters.md +++ /dev/null @@ -1,1736 +0,0 @@ ---- -author: -- Albert Krewinkel -- John MacFarlane -date: 'December 6, 2017' -title: Pandoc Lua Filters ---- - -# Introduction - -Pandoc has long supported filters, which allow the pandoc -abstract syntax tree (AST) to be manipulated between the parsing -and the writing phase. Traditional pandoc filters accept a JSON -representation of the pandoc AST and produce an altered JSON -representation of the AST. They may be written in any -programming language, and invoked from pandoc using the -`--filter` option. - -Although traditional filters are very flexible, they have a -couple of disadvantages. First, there is some overhead in -writing JSON to stdout and reading it from stdin (twice, once on -each side of the filter). Second, whether a filter will work -will depend on details of the user's environment. A filter may -require an interpreter for a certain programming language to be -available, as well as a library for manipulating the pandoc AST -in JSON form. One cannot simply provide a filter that can be -used by anyone who has a certain version of the pandoc -executable. - -Starting with pandoc 2.0, we have made it possible to write -filters in lua without any external dependencies at all. A lua -interpreter and a lua library for creating pandoc filters is -built into the pandoc executable. Pandoc data types are -marshalled to lua directly, avoiding the overhead of writing -JSON to stdout and reading it from stdin. - -Here is an example of a lua filter that converts strong emphasis -to small caps: - -``` {.lua} -return { - { - Strong = function (elem) - return pandoc.SmallCaps(elem.c) - end, - } -} -``` - -or equivalently, - -``` {.lua} -function Strong(elem) - return pandoc.SmallCaps(elem.c) -end -``` - -This says: walk the AST, and when you find a Strong element, -replace it with a SmallCaps element with the same content. - -To run it, save it in a file, say `smallcaps.lua`, and invoke -pandoc with `--lua-filter=smallcaps.lua`. - -Here's a quick performance comparison, using a version of the -pandoc manual, MANUAL.txt, and versions of the same filter -written in compiled Haskell (`smallcaps`) and interpreted Python -(`smallcaps.py`): - - Command Time - -------------------------------------------------- ------- - `pandoc MANUAL.txt` 1.01s - `pandoc MANUAL.txt --filter ./smallcaps` 1.36s - `pandoc MANUAL.txt --filter ./smallcaps.py` 1.40s - `pandoc MANUAL.txt --lua-filter ./smallcaps.lua` 1.03s - -As you can see, the lua filter avoids the substantial overhead -associated with marshalling to and from JSON over a pipe. - -# Lua filter structure - -Lua filters are tables with element names as keys and values -consisting of functions acting on those elements. - -Filters are expected to be put into separate files and are -passed via the `--lua-filter` command-line argument. For -example, if a filter is defined in a file `current-date.lua`, -then it would be applied like this: - - pandoc --lua-filter=current-date.lua -f markdown MANUAL.txt - -The `--lua-filter` option may be supplied multiple times. Pandoc -applies all filters (including JSON filters specified via -`--filter` and lua filters specified via `--lua-filter`) in the -order they appear on the command line. - -Pandoc expects each lua file to return a list of filters. The -filters in that list are called sequentially, each on the result -of the previous filter. If there is no value returned by the -filter script, then pandoc will try to generate a single filter -by collecting all top-level functions whose names correspond to -those of pandoc elements (e.g., `Str`, `Para`, `Meta`, or -`Pandoc`). (That is why the two examples above are equivalent.) - -For each filter, the document is traversed and each element -subjected to the filter. Elements for which the filter contains -an entry (i.e. a function of the same name) are passed to lua -element filtering function. In other words, filter entries will -be called for each corresponding element in the document, -getting the respective element as input. - -The return of a filter function must one of the following: - -- nil: this means that the object should remain unchanged. -- a pandoc object: this must be of the same type as the input - and will replace the original object. -- a list of pandoc objects: these will replace the original - object; the list is merged with the neighbors of the orignal - objects (spliced into the list the original object belongs - to); returning an empty list deletes the object. - -The function's output must result in an element of the same type -as the input. This means a filter function acting on an inline -element must return either nil, an inline, or a list of inlines, -and a function filtering a block element must return one of nil, -a block, or a list of block elements. Pandoc will throw an error -if this condition is violated. - -If there is no function matching the element's node type, then -the filtering system will look for a more general fallback -function. Two fallback functions are supported, `Inline` and -`Block`. Each matches elements of the respective type. - -Elements without matching functions are left untouched. - -See [module documentation](#module-pandoc) for a list of pandoc -elements. - - -## Global variables - -Pandoc passes additional data to Lua filters by setting global -variables. - -`FORMAT` -: The global `FORMAT` is set to the format of the pandoc - writer being used (`html5`, `latex`, etc.), so the behavior - of a filter can be made conditional on the eventual output - format. - -`PANDOC_READER_OPTIONS` -: Table of the options which were provided to the parser. - -`PANDOC_VERSION` -: Contains the pandoc version as a numerically indexed table, - most significant number first. E.g., for pandoc 2.1.1, the - value of the variable is a table `{2, 1, 1}`. Use - `table.concat(PANDOC_VERSION, '.')` to produce a version - string. This variable is also set in custom writers. - -`PANDOC_API_VERSION` -: Contains the version of the pandoc-types API against which - pandoc was compiled. It is given as a numerically indexed - table, most significant number first. E.g., if pandoc was - compiled against pandoc-types 1.17.3, then the value of the - variable will be a table `{1, 17, 3}`. Use - `table.concat(PANDOC_API_VERSION, '.')` to produce a version - string from this table. This variable is also set in custom - writers. - -`PANDOC_SCRIPT_FILE` -: The name used to involve the filter. This value can be used - to find files relative to the script file. This variable is - also set in custom writers. - -# Pandoc Module - -The `pandoc` lua module is loaded into the filter's lua -environment and provides a set of functions and constants to -make creation and manipulation of elements easier. The global -variable `pandoc` is bound to the module and should generally -not be overwritten for this reason. - -Two major functionalities are provided by the module: element -creator functions and access to some of pandoc's main -functionalities. - -## Element creation - -Element creator functions like `Str`, `Para`, and `Pandoc` are -designed to allow easy creation of new elements that are simple -to use and can be read back from the lua environment. -Internally, pandoc uses these functions to create the lua -objects which are passed to element filter functions. This means -that elements created via this module will behave exactly as -those elements accessible through the filter function parameter. - -## Exposed pandoc functionality - -Some pandoc functions have been made available in lua: - -- [`walk_block`](#walk_block) and - [`walk_inline`](#walk_inline) allow filters to be applied - inside specific block or inline elements; -- [`read`](#read) allows filters to parse strings into pandoc - documents; -- [`pipe`](#pipe) runs an external command with input from and - output to strings; -- the [`pandoc.mediabag`](#module-pandoc.mediabag) module - allows access to the "mediabag," which stores binary content - such as images that may be included in the final document; -- the [`pandoc.utils`](#module-pandoc.utils) module contains - various utility functions. - -# Lua interpreter initialization - -The way the Lua interpreter is set-up can be controlled by -placing a file `init.lua` in pandoc's data directory. The -default init file loads the `pandoc` and `pandoc.mediabag` -modules: - -``` {.lua} -pandoc = require 'pandoc' -pandoc.mediabag = require 'pandoc.mediabag' -``` - -A common use-case would be to add code to load additional -modules or to alter default modules. E.g., the following snippet -adds all unicode-aware functions defined in the [`text` -module](#module-text) to the default `string` module, prefixed -with the string `uc_`. - -``` {.lua} -for name, fn in pairs(require 'text') do - string['uc_' .. name] = fn -end -``` - -This makes it possible to apply these functions on strings using -colon syntax (`mystring:uc_upper()`). - -# Examples - -## Macro substitution. - -The following filter converts the string `{{helloworld}}` into -emphasized text "Hello, World". - -``` {.lua} -return { - { - Str = function (elem) - if elem.text == "{{helloworld}}" then - return pandoc.Emph {pandoc.Str "Hello, World"} - else - return elem - end - end, - } -} -``` - -## Default metadata file - -This filter causes metadata defined in an external file -(`metadata-file.yaml`) to be used as default values in a -document's metadata: - -``` {.lua} --- read metadata file into string -local metafile = io.open('metadata-file.yaml', 'r') -local content = metafile:read("*a") -metafile:close() --- get metadata -local default_meta = pandoc.read(content, "markdown").meta - -return { - { - Meta = function(meta) - -- use default metadata field if it hasn't been defined yet. - for k, v in pairs(default_meta) do - if meta[k] == nil then - meta[k] = v - end - end - return meta - end, - } -``` - -## Setting the date in the metadata - -This filter sets the date in the document's metadata to the -current date: - -``` {.lua} -function Meta(m) - m.date = os.date("%B %e, %Y") - return m -end -``` - -## Extracting information about links - -This filter prints a table of all the URLs linked to in the -document, together with the number of links to that URL. - -``` {.lua} -links = {} - -function Link (el) - if links[el.target] then - links[el.target] = links[el.target] + 1 - else - links[el.target] = 1 - end - return el -end - -function Doc (blocks, meta) - function strCell(str) - return {pandoc.Plain{pandoc.Str(str)}} - end - local caption = {pandoc.Str "Link", pandoc.Space(), pandoc.Str "count"} - local aligns = {pandoc.AlignDefault, pandoc.AlignLeft} - local widths = {0.8, 0.2} - local headers = {strCell "Target", strCell "Count"} - local rows = {} - for link, count in pairs(links) do - rows[#rows + 1] = {strCell(link), strCell(count)} - end - return pandoc.Doc( - {pandoc.Table(caption, aligns, widths, headers, rows)}, - meta - ) -end -``` - -## Replacing placeholders with their metadata value - -Lua filter functions are run in the order - -> *Inlines → Blocks → Meta → Pandoc*. - -Passing information from a higher level (e.g., metadata) to a -lower level (e.g., inlines) is still possible by using two -filters living in the same file: - -``` {.lua} -local vars = {} - -function get_vars (meta) - for k, v in pairs(meta) do - if v.t == 'MetaInlines' then - vars["$" .. k .. "$"] = v - end - end -end - -function replace (el) - if vars[el.text] then - return pandoc.Span(vars[el.text]) - else - return el - end -end - -return {{Meta = get_vars}, {Str = replace}} -``` - -If the contents of file `occupations.md` is - -``` {.markdown} ---- -name: Samuel Q. Smith -occupation: Professor of Phrenology ---- - -Name - -: \$name\$ - -Occupation - -: \$occupation\$ -``` - -then running `pandoc --lua-filter=meta-vars.lua occupations.md` -will output: - -``` {.html} -<dl> -<dt>Name</dt> -<dd><p><span>Samuel Q. Smith</span></p> -</dd> -<dt>Occupation</dt> -<dd><p><span>Professor of Phrenology</span></p> -</dd> -</dl> -``` - -## Modifying pandoc's `MANUAL.txt` for man pages - -This is the filter we use when converting `MANUAL.txt` to man -pages. It converts level-1 headers to uppercase (using -`walk_block` to transform inline elements inside headers), -removes footnotes, and replaces links with regular text. - -``` {.lua} --- we use preloaded text to get a UTF-8 aware 'upper' function -local text = require('text') - -function Header(el) - if el.level == 1 then - return pandoc.walk_block(el, { - Str = function(el) - return pandoc.Str(text.upper(el.text)) - end }) - end -end - -function Link(el) - return el.content -end - -function Note(el) - return {} -end -``` - -## Creating a handout from a paper - -This filter extracts all the numbered examples, section headers, -block quotes, and figures from a document, in addition to any -divs with class `handout`. (Note that only blocks at the "outer -level" are included; this ignores blocks inside nested -constructs, like list items.) - -``` {.lua} --- creates a handout from an article, using its headings, --- blockquotes, numbered examples, figures, and any --- Divs with class "handout" - -function Pandoc(doc) - local hblocks = {} - for i,el in pairs(doc.blocks) do - if (el.t == "Div" and el.classes[1] == "handout") or - (el.t == "BlockQuote") or - (el.t == "OrderedList" and el.style == "Example") or - (el.t == "Para" and #el.c == 1 and el.c[1].t == "Image") or - (el.t == "Header") then - table.insert(hblocks, el) - end - end - return pandoc.Pandoc(hblocks, doc.meta) -end -``` - -## Counting words in a document - -This filter counts the words in the body of a document (omitting -metadata like titles and abstracts), including words in code. It -should be more accurate than `wc -w` run directly on a Markdown -document, since the latter will count markup characters, like -the `#` in front of an ATX header, or tags in HTML documents, as -words. To run it, `pandoc --lua-filter wordcount.lua myfile.md`. - -``` {.lua} --- counts words in a document - -words = 0 - -wordcount = { - Str = function(el) - -- we don't count a word if it's entirely punctuation: - if el.text:match("%P") then - words = words + 1 - end - end, - - Code = function(el) - _,n = el.text:gsub("%S+","") - words = words + n - end, - - CodeBlock = function(el) - _,n = el.text:gsub("%S+","") - words = words + n - end -} - -function Pandoc(el) - -- skip metadata, just count body: - pandoc.walk_block(pandoc.Div(el.blocks), wordcount) - print(words .. " words in body") - os.exit(0) -end -``` - -## Converting ABC code to music notation - -This filter replaces code blocks with class `abc` with images -created by running their contents through `abcm2ps` and -ImageMagick's `convert`. (For more on ABC notation, see -<http://abcnotation.com>.) - -Images are added to the mediabag. For output to binary formats, -pandoc will use images in the mediabag. For textual formats, use -`--extract-media` to specify a directory where the files in the -mediabag will be written, or (for HTML only) use -`--self-contained`. - -``` {.lua} --- Pandoc filter to process code blocks with class "abc" containing --- ABC notation into images. --- --- * Assumes that abcm2ps and ImageMagick's convert are in the path. --- * For textual output formats, use --extract-media=abc-images --- * For HTML formats, you may alternatively use --self-contained - -local filetypes = { html = {"png", "image/png"} - , latex = {"pdf", "application/pdf"} - } -local filetype = filetypes[FORMAT][1] or "png" -local mimetype = filetypes[FORMAT][2] or "image/png" - -local function abc2eps(abc, filetype) - local eps = pandoc.pipe("abcm2ps", {"-q", "-O", "-", "-"}, abc) - local final = pandoc.pipe("convert", {"-", filetype .. ":-"}, eps) - return final -end - -function CodeBlock(block) - if block.classes[1] == "abc" then - local img = abc2eps(block.text, filetype) - local fname = pandoc.sha1(img) .. "." .. filetype - pandoc.mediabag.insert(fname, mimetype, img) - return pandoc.Para{ pandoc.Image({pandoc.Str("abc tune")}, fname) } - end -end -``` - -## Building images with tikz - -This filter converts raw LaTeX tikz environments into images. It -works with both PDF and HTML output. The tikz code is compiled -to an image using `pdflatex`, and the image is converted (if -necessary) from pdf to png format using ImageMagick's `convert`, -so both of these must be in the system path. Converted images -are cached in the working directory and given filenames based on -a hash of the source, so that they need not be regenerated each -time the document is built. (A more sophisticated version of -this might put these in a special cache directory.) - -``` {.lua} -local function tikz2image(src, filetype, outfile) - local tmp = os.tmpname() - local tmpdir = string.match(tmp, "^(.*[\\/])") or "." - local f = io.open(tmp .. ".tex", 'w') - f:write("\\documentclass{standalone}\n\\usepackage{tikz}\n\\begin{document}\n") - f:write(src) - f:write("\n\\end{document}\n") - f:close() - os.execute("pdflatex -output-directory " .. tmpdir .. " " .. tmp) - if filetype == 'pdf' then - os.rename(tmp .. ".pdf", outfile) - else - os.execute("convert " .. tmp .. ".pdf " .. outfile) - end - os.remove(tmp .. ".tex") - os.remove(tmp .. ".pdf") - os.remove(tmp .. ".log") - os.remove(tmp .. ".aux") -end - -extension_for = { - html = 'png', - html4 = 'png', - html5 = 'png', - latex = 'pdf', - beamer = 'pdf' } - -local function file_exists(name) - local f = io.open(name, 'r') - if f ~= nil then - io.close(f) - return true - else - return false - end -end - -function RawBlock(el) - local filetype = extension_for[FORMAT] or "png" - local fname = pandoc.sha1(el.text) .. "." .. filetype - if not file_exists(fname) then - tikz2image(el.text, filetype, fname) - end - return pandoc.Para({pandoc.Image({}, fname)}) -end -``` - -Example of use: - - pandoc --lua-filter tikz.lua -s -o cycle.html <<EOF - Here is a diagram of the cycle: - - \begin{tikzpicture} - - \def \n {5} - \def \radius {3cm} - \def \margin {8} % margin in angles, depends on the radius - - \foreach \s in {1,...,\n} - { - \node[draw, circle] at ({360/\n * (\s - 1)}:\radius) {$\s$}; - \draw[->, >=latex] ({360/\n * (\s - 1)+\margin}:\radius) - arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius); - } - \end{tikzpicture} - EOF - -# Module text - -UTF-8 aware text manipulation functions, implemented in Haskell. -These are available to any lua filter. However, the module must -be explicitly loaded: - -``` {.lua} --- uppercase all regular text in a document: -text = require 'text' -function Str (s) - s.text = text.upper(s.text) - return s -end -``` - -[`lower (s)`]{#text-lower} - -: Returns a copy of a UTF-8 string, converted to lowercase. - -[`upper (s)`]{#text-upper} - -: Returns a copy of a UTF-8 string, converted to uppercase. - -[`reverse (s)`]{#text-reverse} - -: Returns a copy of a UTF-8 string, with characters reversed. - -[`len (s)`]{#text-len} - -: Returns the length of a UTF-8 string. - -[`sub (s)`]{#text-sub} - -: Returns a substring of a UTF-8 string, using lua's string - indexing rules. - -# Module pandoc - -Lua functions for pandoc scripts. - -## Pandoc Document - -[`Pandoc (blocks[, meta])`]{#Pandoc} - -: A complete pandoc document - - Parameters: - - `blocks`: - : document content - - `meta`: - : document meta data - -## Meta - -[`Meta (table)`]{#Meta} - -: Create a new Meta object. - - Parameters: - - `table`: - : table containing document meta information - -## MetaValue - -[`MetaBlocks (blocks)`]{#MetaBlocks} - -: Meta blocks - - Parameters: - - `blocks`: - : blocks - -[`MetaInlines (inlines)`]{#MetaInlines} - -: Meta inlines - - Parameters: - - `inlines`: - : inlines - -[`MetaList (meta_values)`]{#MetaList} - -: Meta list - - Parameters: - - `meta_values`: - : list of meta values - -[`MetaMap (key_value_map)`]{#MetaMap} - -: Meta map - - Parameters: - - `key_value_map`: - : a string-indexed map of meta values - -[`MetaString (str)`]{#MetaString} - -: Creates string to be used in meta data. - - Parameters: - - `str`: - : string value - -[`MetaBool (bool)`]{#MetaBool} - -: Creates boolean to be used in meta data. - - Parameters: - - `bool`: - : boolean value - -## Blocks - -[`Block`]{#Block} - -: Block elements - -[`BlockQuote (content)`]{#BlockQuote} - -: Creates a block quote element - - Parameters: - - `content`: - : block content - - Returns: block quote element - -[`BulletList (content)`]{#BulletList} - -: Creates a bullet (i.e. - - Parameters: - - `content`: - : list of items - - Returns: bullet list element - -[`CodeBlock (text[, attr])`]{#CodeBlock} - -: Creates a code block element - - Parameters: - - `text`: - : code string - - `attr`: - : element attributes - - Returns: code block element - -[`DefinitionList (content)`]{#DefinitionList} - -: Creates a definition list, containing terms and their - explanation. - - Parameters: - - `content`: - : list of items - - Returns: definition list element - -[`Div (content[, attr])`]{#Div} - -: Creates a div element - - Parameters: - - `content`: - : block content - - `attr`: - : element attributes - - Returns: div element - -[`Header (level, content[, attr])`]{#Header} - -: Creates a header element. - - Parameters: - - `level`: - : header level - - `content`: - : inline content - - `attr`: - : element attributes - - Returns: header element - -[`HorizontalRule ()`]{#HorizontalRule} - -: Creates a horizontal rule. - - Returns: horizontal rule - -[`LineBlock (content)`]{#LineBlock} - -: Creates a line block element. - - Parameters: - - `content`: - : inline content - - Returns: line block element - -[`Null ()`]{#Null} - -: Creates a null element. - - Returns: null element - -[`OrderedList (items[, listAttributes])`]{#OrderedList} - -: Creates an ordered list. - - Parameters: - - `items`: - : list items - - `listAttributes`: - : list parameters - - Returns: ordered list element - -[`Para (content)`]{#Para} - -: Creates a para element. - - Parameters: - - `content`: - : inline content - - Returns: paragraph element - -[`Plain (content)`]{#Plain} - -: Creates a plain element. - - Parameters: - - `content`: - : inline content - - Returns: plain element - -[`RawBlock (format, text)`]{#RawBlock} - -: Creates a raw content block of the specified format. - - Parameters: - - `format`: - : format of content - - `text`: - : string content - - Returns: raw block element - -[`Table (caption, aligns, widths, headers, rows)`]{#Table} - -: Creates a table element. - - Parameters: - - `caption`: - : table caption - - `aligns`: - : alignments - - `widths`: - : column widths - - `headers`: - : header row - - `rows`: - : table rows - - Returns: table element - -## Inline - -[`Inline`]{#Inline} - -: Inline element class - -[`Cite (content, citations)`]{#Cite} - -: Creates a Cite inline element - - Parameters: - - `content`: - : List of inlines - - `citations`: - : List of citations - - Returns: citations element - -[`Code (text[, attr])`]{#Code} - -: Creates a Code inline element - - Parameters: - - `text`: - : brief image description - - `attr`: - : additional attributes - - Returns: code element - -[`Emph (content)`]{#Emph} - -: Creates an inline element representing emphasised text. - - Parameters: - - `content`: - : inline content - - Returns: emphasis element - -[`Image (caption, src[, title[, attr]])`]{#Image} - -: Creates a Image inline element - - Parameters: - - `caption`: - : text used to describe the image - - `src`: - : path to the image file - - `title`: - : brief image description - - `attr`: - : additional attributes - - Returns: image element - -[`LineBreak ()`]{#LineBreak} - -: Create a LineBreak inline element - - Returns: linebreak element - -[`Link (content, target[, title[, attr]])`]{#Link} - -: Creates a link inline element, usually a hyperlink. - - Parameters: - - `content`: - : text for this link - - `target`: - : the link target - - `title`: - : brief link description - - `attr`: - : additional attributes - - Returns: image element - -[`Math (mathtype, text)`]{#Math} - -: Creates a Math element, either inline or displayed. - - Parameters: - - `mathtype`: - : rendering specifier - - `text`: - : Math content - - Returns: Math element - -[`DisplayMath (text)`]{#DisplayMath} - -: Creates a DisplayMath element (DEPRECATED). - - Parameters: - - `text`: - : Math content - - Returns: Math element - -[`InlineMath (text)`]{#InlineMath} - -: Creates an InlineMath inline element (DEPRECATED). - - Parameters: - - `text`: - : Math content - - Returns: Math element - -[`Note (content)`]{#Note} - -: Creates a Note inline element - - Parameters: - - `content`: - : footnote block content - -[`Quoted (quotetype, content)`]{#Quoted} - -: Creates a Quoted inline element given the quote type and - quoted content. - - Parameters: - - `quotetype`: - : type of quotes to be used - - `content`: - : inline content - - Returns: quoted element - -[`SingleQuoted (content)`]{#SingleQuoted} - -: Creates a single-quoted inline element (DEPRECATED). - - Parameters: - - `content`: - : inline content - - Returns: quoted element - - See also: [Quoted](#Quoted) - -[`DoubleQuoted (content)`]{#DoubleQuoted} - -: Creates a single-quoted inline element (DEPRECATED). - - Parameters: - - `content`: - : inline content - - Returns: quoted element - - See also: [Quoted](#Quoted) - -[`RawInline (format, text)`]{#RawInline} - -: Creates a RawInline inline element - - Parameters: - - `format`: - : format of the contents - - `text`: - : string content - - Returns: raw inline element - -[`SmallCaps (content)`]{#SmallCaps} - -: Creates text rendered in small caps - - Parameters: - - `content`: - : inline content - - Returns: smallcaps element - -[`SoftBreak ()`]{#SoftBreak} - -: Creates a SoftBreak inline element. - - Returns: softbreak element - -[`Space ()`]{#Space} - -: Create a Space inline element - - Returns: space element - -[`Span (content[, attr])`]{#Span} - -: Creates a Span inline element - - Parameters: - - `content`: - : inline content - - `attr`: - : additional attributes - - Returns: span element - -[`Str (text)`]{#Str} - -: Creates a Str inline element - - Parameters: - - `text`: - : content - - Returns: string element - -[`Strikeout (content)`]{#Strikeout} - -: Creates text which is striked out. - - Parameters: - - `content`: - : inline content - - Returns: strikeout element - -[`Strong (content)`]{#Strong} - -: Creates a Strong element, whose text is usually displayed in - a bold font. - - Parameters: - - `content`: - : inline content - - Returns: strong element - -[`Subscript (content)`]{#Subscript} - -: Creates a Subscript inline element - - Parameters: - - `content`: - : inline content - - Returns: subscript element - -[`Superscript (content)`]{#Superscript} - -: Creates a Superscript inline element - - Parameters: - - `content`: - : inline content - - Returns: strong element - -## Element components - -[`Attr ([identifier[, classes[, attributes]]])`]{#Attr} - -: Create a new set of attributes (Attr). - - Parameters: - - `identifier`: - : element identifier - - `classes`: - : element classes - - `attributes`: - : table containing string keys and values - - Returns: element attributes - -[`Citation (id, mode[, prefix[, suffix[, note_num[, hash]]]])`]{#Citation} - -: Creates a single citation. - - Parameters: - - `id`: - : citation identifier (like a bibtex key) - - `mode`: - : citation mode - - `prefix`: - : citation prefix - - `suffix`: - : citation suffix - - `note_num`: - : note number - - `hash`: - : hash number - -## Constants - -[`AuthorInText`]{#AuthorInText} - -: Author name is mentioned in the text. - - See also: [Citation](#Citation) - -[`SuppressAuthor`]{#SuppressAuthor} - -: Author name is suppressed. - - See also: [Citation](#Citation) - -[`NormalCitation`]{#NormalCitation} - -: Default citation style is used. - - See also: [Citation](#Citation) - -[`AlignLeft`]{#AlignLeft} - -: Table cells aligned left. - - See also: [Table](#Table) - -[`AlignRight`]{#AlignRight} - -: Table cells right-aligned. - - See also: [Table](#Table) - -[`AlignCenter`]{#AlignCenter} - -: Table cell content is centered. - - See also: [Table](#Table) - -[`AlignDefault`]{#AlignDefault} - -: Table cells are alignment is unaltered. - - See also: [Table](#Table) - -[`DefaultDelim`]{#DefaultDelim} - -: Default list number delimiters are used. - - See also: [OrderedList](#OrderedList) - -[`Period`]{#Period} - -: List numbers are delimited by a period. - - See also: [OrderedList](#OrderedList) - -[`OneParen`]{#OneParen} - -: List numbers are delimited by a single parenthesis. - - See also: [OrderedList](#OrderedList) - -[`TwoParens`]{#TwoParens} - -: List numbers are delimited by a double parentheses. - - See also: [OrderedList](#OrderedList) - -[`DefaultStyle`]{#DefaultStyle} - -: List are numbered in the default style - - See also: [OrderedList](#OrderedList) - -[`Example`]{#Example} - -: List items are numbered as examples. - - See also: [OrderedList](#OrderedList) - -[`Decimal`]{#Decimal} - -: List are numbered using decimal integers. - - See also: [OrderedList](#OrderedList) - -[`LowerRoman`]{#LowerRoman} - -: List are numbered using lower-case roman numerals. - - See also: [OrderedList](#OrderedList) - -[`UpperRoman`]{#UpperRoman} - -: List are numbered using upper-case roman numerals - - See also: [OrderedList](#OrderedList) - -[`LowerAlpha`]{#LowerAlpha} - -: List are numbered using lower-case alphabetic characters. - - See also: [OrderedList](#OrderedList) - -[`UpperAlpha`]{#UpperAlpha} - -: List are numbered using upper-case alphabetic characters. - - See also: [OrderedList](#OrderedList) - -## Helper functions - -[`pipe (command, args, input)`]{#pipe} - -: Runs command with arguments, passing it some input, and - returns the output. - - Returns: - - - Output of command. - - Raises: - - - A table containing the keys `command`, `error_code`, and - `output` is thrown if the command exits with a non-zero - error code. - - Usage: - - local output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc") - -[`walk_block (element, filter)`]{#walk_block} - -: Apply a filter inside a block element, walking its contents. - - Parameters: - - `element`: - : the block element - - `filter`: - : a lua filter (table of functions) to be applied within - the block element - - Returns: the transformed block element - -[`walk_inline (element, filter)`]{#walk_inline} - -: Apply a filter inside an inline element, walking its - contents. - - Parameters: - - `element`: - : the inline element - - `filter`: - : a lua filter (table of functions) to be applied within - the inline element - - Returns: the transformed inline element - -[`read (markup[, format])`]{#read} - -: Parse the given string into a Pandoc document. - - Parameters: - - `markup`: - : the markup to be parsed - - `format`: - : format specification, defaults to \"markdown\". - - Returns: pandoc document - - Usage: - - local org_markup = "/emphasis/" -- Input to be read - local document = pandoc.read(org_markup, "org") - -- Get the first block of the document - local block = document.blocks[1] - -- The inline element in that block is an `Emph` - assert(block.content[1].t == "Emph") - -# Module pandoc.utils - -This module exposes internal pandoc functions and utility -functions. - -[`hierarchicalize (blocks)`]{#utils-hierarchicalize} - -: Convert list of blocks into an hierarchical list. An - hierarchical elements is either a normal block (but no - Header), or a `Sec` element. The latter has the following - fields: - - - level: level in the document hierarchy; - - numbering: list of integers of length `level`, - specifying the absolute position of the section in the - document; - - attr: section attributes (see [Attr](#Attr)); - - contents: nested list of hierarchical elements. - - Returns: - - - List of hierarchical elements - - Usage: - - local blocks = { - pandoc.Header(2, pandoc.Str 'first'), - pandoc.Header(2, pandoc.Str 'second'), - } - local elements = pandoc.utils.hierarchicalize(blocks) - print(table.concat(elements[1].numbering, '.')) -- 0.1 - print(table.concat(elements[2].numbering, '.')) -- 0.2 - -[`run_json_filter (doc, filter[, args])`]{#utils-run_json_filter} - -: Filter the given doc by passing it through the a JSON filter. - - Parameters: - - `doc`: - : the Pandoc document to filter - - `filter`: - : filter to run - - `args`: - : list of arguments passed to the filter. Defaults to - `{FORMAT}`. - - Returns: - - - ([Pandoc](#Pandoc)) Filtered document - - Usage: - - -- Assumes `some_blocks` contains blocks for which a - -- separate literature section is required. - local sub_doc = pandoc.Pandoc(some_blocks, metadata) - sub_doc_with_bib = pandoc.utils.run_json_filter( - sub_doc, - 'pandoc-citeproc' - ) - some_blocks = sub_doc.blocks -- some blocks with bib - -[`normalize_date (date_string)`]{#utils-normalize_date} - -: Parse a date and convert (if possible) to "YYYY-MM-DD" - format. We limit years to the range 1601-9999 (ISO 8601 - accepts greater than or equal to 1583, but MS Word only - accepts dates starting 1601). - - Returns: - - - A date string, or nil when the conversion failed. - -[`sha1 (contents)`]{#utils-sha1} - -: Returns the SHA1 has of the contents. - - Returns: - - - SHA1 hash of the contents. - - Usage: - - local fp = pandoc.utils.sha1("foobar") - -[`stringify (element)`]{#utils-stringify} - -: Converts the given element (Pandoc, Meta, Block, or Inline) - into a string with all formatting removed. - - Returns: - - - A plain string representation of the given element. - - Usage: - - local inline = pandoc.Emph{pandoc.Str 'Moin'} - -- outputs "Moin" - print(pandoc.utils.stringify(inline)) - -[`to_roman_numeral (integer)`]{#utils-to_roman_numeral} - -: Converts an integer \< 4000 to uppercase roman numeral. - - Returns: - - - A roman numeral string. - - Usage: - - local to_roman_numeral = pandoc.utils.to_roman_numeral - local pandoc_birth_year = to_roman_numeral(2006) - -- pandoc_birth_year == 'MMVI' - -# Module pandoc.mediabag - -The `pandoc.mediabag` module allows accessing pandoc's media -storage. The "media bag" is used when pandoc is called with the -`--extract-media` or `--standalone`/`-s` option. - -[`insert (filepath, mime_type, contents)`]{#mediabag-insert} - -: Adds a new entry to pandoc's media bag. - - Parameters: - - `filepath`: - : filename and path relative to the output folder. - - `mime_type`: - : the file's MIME type - - `contents`: - : the binary contents of the file. - - Usage: - - local fp = "media/hello.txt" - local mt = "text/plain" - local contents = "Hello, World!" - pandoc.mediabag(fp, mt, contents) - -[`list ()`]{#mediabag-list} - -: Get a summary of the current media bag contents. - - Returns: A list of elements summarizing each entry in the - media bag. The summary item contains the keys `path`, - `type`, and `length`, giving the filepath, MIME type, and - length of contents in bytes, respectively. - - Usage: - - -- calculate the size of the media bag. - local mb_items = pandoc.mediabag.list() - local sum = 0 - for i = 1, #mb_items: - sum = sum + mb_items[i].length - end - print(sum) - -[`lookup (filepath)`]{#mediabag-lookup} - -: Lookup a media item in the media bag, returning mime type - and contents. - - Parameters: - - `filepath`: - : name of the file to look up. - - Returns: - - - the entries MIME type, or nil if the file was not found. - - contents of the file, or nil if the file was not found. - - Usage: - - local filename = "media/diagram.png" - local mt, contents = pandoc.mediabag.lookup(filename) - -[`fetch (source, base_url)`]{#mediabag-fetch} - -: Fetches the given source from a URL or local file. Returns - two values: the contents of the file and the mime type (or - an empty string). - - Returns: - - - the entries MIME type, or nil if the file was not found. - - contents of the file, or nil if the file was not found. - - Usage: - - local diagram_url = "https://pandoc.org/diagram.jpg" - local contents = pandoc.mediabag.fetch(diagram_url, ".") - -# Module pandoc.List - -Pandoc\'s List type and helper methods - -## Metamethods - -[`pandoc.List:__concat (list)`]{#pandoc.List:__concat} - -: Concatenates two lists. - - Parameters: - - `list`: - : second list concatenated to the first - - Returns: a new list containing all elements from list1 and - list2 - -## Methods - -[`pandoc.List:clone ()`]{#pandoc.List:clone} - -: Returns a (shallow) copy of the list. - -[`pandoc.List:includes (needle, init)`]{#pandoc.List:includes} - -: Checks if the list has an item equal to the given needle. - - Parameters: - - `needle`: - : item to search for - - `init`: - : index at which the search is started - - Returns: true if a list item is equal to the needle, false - otherwise - -[`pandoc.List:find (needle, init)`]{#pandoc.List:find} - -: Returns the value and index of the first occurrence of the - given item. - - Parameters: - - `needle`: - : item to search for - - `init`: - : index at which the search is started - - Returns: first item equal to the needle, or nil if no such - item exists. - -[`pandoc.List:find_if (pred, init)`]{#pandoc.List:find_if} - -: Returns the value and index of the first element for which - the predicate holds true. - - Parameters: - - `pred`: - : the predicate function - - `init`: - : index at which the search is started - - Returns: first item for which \`test\` succeeds, or nil if - no such item exists. - -[`pandoc.List:extend (list)`]{#pandoc.List:extend} - -: Adds the given list to the end of this list. - - Parameters: - - `list`: - : list to appended - -[`pandoc.List:map (fn)`]{#pandoc.List:map} - -: Returns a copy of the current list by applying the given - function to all elements. - - Parameters: - - `fn`: - : function which is applied to all list items. - -[`pandoc.List:filter (pred)`]{#pandoc.List:filter} - -: Returns a new list containing all items satisfying a given - condition. - - Parameters: - - `pred`: - : condition items must satisfy. - - Returns: a new list containing all items for which \`test\` - was true. diff --git a/doc/org.md b/doc/org.md deleted file mode 100644 index 2a87f826c..000000000 --- a/doc/org.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: Org-mode features and differences -author: Albert Krewinkel ---- - -Pandoc handles org files very similarly to Emacs org-mode. -However, there are differences worth highlighting. - - -Citations -========= - -Emacs org-mode lacks an official citation syntax, leading to -multiple syntaxes coexisting. Pandoc recognizes four different -syntaxes for citations. - -Berkeley-style citations ------------------------- - -The semi-offical Org-mode citation syntax is based on John -MacFarlane's Pandoc syntax and org-oriented enhancements -contributed by Richard Lawrence and others. It's dubbed Berkeley -syntax due the place of activity of its main contributors. - -Example: - - See @john_doe_2006. - [cite: See; @Mandelkern1981; and @Watson1953] - [(cite): See; @Mandelkern1981; and @Watson1953] - - -org-ref citations ------------------ - -The [org-ref] package is in wide use to handle citations and has -excellent tooling support in Emacs. Its citation syntax is -geared towards users in the natural sciences but still very -flexible regardless. - - cite:doe_john_2000 - citep:doe_jane_1989 - [[citep:Dominik201408][See page 20 of::, for example]] - - -Pandoc-Markdown-like syntax ---------------------------- - -Historically, Markdown-style citations syntax was the first that -was added to pandoc's org reader. It is almost identical to -Markdown's citation syntax. - -Example: - - [prefix @citekey suffix] - [see @doe2000 p. 23-42] - - -LaTeX-Syntax ------------- - -Use normal latex citation commands like `\cite{x}` or -`\citet{y}`. - -[org-ref]: https://github.com/jkitchin/org-ref - - -Emphasis rules -============== - -Org-mode uses complex rules to decide whether a string -represents emphasized text. In Emacs, this can be customized via -the variable `org-emphasis-regexp-components`. A variable like -this doesn't fit well with pandoc's model. Instead, it is -possible to use special lines to change these values: - - #+pandoc-emphasis-pre: "-\t ('\"{" - #+pandoc-emphasis-post: "-\t\n .,:!?;'\")}[" - -The above describes the default values of these variables. The -arguments must be valid (Haskell) strings. If interpretation of -the argument as string fails, the default is restored. - -Changing emphasis rules only affect the part of the document -following the special lines. They must be some of the first -lines to alter parsing behavior for the whole document. It is -also possible to change the values temporarily for selected -sections only. The string `test` in the following snippet will -be read as emphasized text, while the rest of the document will -be parsed using default emphasis rules: - - #+pandoc-emphasis-pre: "[" - #+pandoc-emphasis-post: "]" - [/test/] - #+pandoc-emphasis-pre: - #+pandoc-emphasis-post: diff --git a/doc/using-the-pandoc-api.md b/doc/using-the-pandoc-api.md deleted file mode 100644 index 8527f6373..000000000 --- a/doc/using-the-pandoc-api.md +++ /dev/null @@ -1,462 +0,0 @@ -% Using the pandoc API -% John MacFarlane - -Pandoc can be used as a Haskell library, to write your own -conversion tools or power a web application. This document -offers an introduction to using the pandoc API. - -Detailed API documentation at the level of individual functions -and types is available at -<https://hackage.haskell.org/package/pandoc>. - -# Pandoc's architecture - -Pandoc is structured as a set of *readers*, which translate -various input formats into an abstract syntax tree (the -Pandoc AST) representing a structured document, and a set of -*writers*, which render this AST into various input formats. -Pictorially: - -``` -[input format] ==reader==> [Pandoc AST] ==writer==> [output format] -``` - -This architecture allows pandoc to perform $M \times N$ -conversions with $M$ readers and $N$ writers. - -The Pandoc AST is defined in the -[pandoc-types](https://hackage.haskell.org/package/pandoc-types) -package. You should start by looking at the Haddock -documentation for [Text.Pandoc.Definition]. As you'll see, a -`Pandoc` is composed of some metadata and a list of `Block`s. -There are various kinds of `Block`, including `Para` -(paragraph), `Header` (section heading), and `BlockQuote`. Some -of the `Block`s (like `BlockQuote`) contain lists of `Block`s, -while others (like `Para`) contain lists of `Inline`s, and still -others (like `CodeBlock`) contain plain text or nothing. -`Inline`s are the basic elements of paragraphs. The distinction -between `Block` and `Inline` in the type system makes it -impossible to represent, for example, a link (`Inline`) whose -link text is a block quote (`Block`). This expressive -limitation is mostly a help rather than a hindrance, since many -of the formats pandoc supports have similar limitations. - -The best way to explore the pandoc AST is to use `pandoc -t -native`, which will display the AST correspoding to some -Markdown input: - -``` -% echo -e "1. *foo*\n2. bar" | pandoc -t native -[OrderedList (1,Decimal,Period) - [[Plain [Emph [Str "foo"]]] - ,[Plain [Str "bar"]]]] -``` - -# A simple example - -Here is a simple example of the use of a pandoc reader and -writer to perform a conversion: - -```haskell -import Text.Pandoc -import qualified Data.Text as T -import qualified Data.Text.IO as TIO - -main :: IO () -main = do - result <- runIO $ do - doc <- readMarkdown def (T.pack "[testing](url)") - writeRST def doc - rst <- handleError result - TIO.putStrLn rst -``` - -Some notes: - -1. The first part constructs a conversion pipeline: the input - string is passed to `readMarkdown`, and the resulting Pandoc - AST (`doc`) is then rendered by `writeRST`. The conversion - pipeline is "run" by `runIO`---more on that below. - -2. `result` has the type `Either PandocError Text`. We could - pattern-match on this manually, but it's simpler in this - context to use the `handleError` function from - Text.Pandoc.Error. This exits with an appropriate error - code and message if the value is a `Left`, and returns the - `Text` if the value is a `Right`. - -# The PandocMonad class - -Let's look at the types of `readMarkdown` and `writeRST`: - -```haskell -readMarkdown :: PandocMonad m => ReaderOptions -> Text -> m Pandoc -writeRST :: PandocMonad m => WriterOptions -> Pandoc -> m Text -``` - -The `PandocMonad m =>` part is a typeclass constraint. -It says that `readMarkdown` and `writeRST` define computations -that can be used in any instance of the `PandocMonad` -type class. `PandocMonad` is defined in the module -[Text.Pandoc.Class]. - -Two instances of `PandocMonad` are provided: `PandocIO` and -`PandocPure`. The difference is that computations run in -`PandocIO` are allowed to do IO (for example, read a file), -while computations in `PandocPure` are free of any side effects. -`PandocPure` is useful for sandboxed environments, when you want -to prevent users from doing anything malicious. To run the -conversion in `PandocIO`, use `runIO` (as above). To run it in -`PandocPure`, use `runPure`. - -As you can see from the Haddocks, [Text.Pandoc.Class] -exports many auxiliary functions that can be used in any -instance of `PandocMonad`. For example: - -```haskell --- | Get the verbosity level. -getVerbosity :: PandocMonad m => m Verbosity - --- | Set the verbosity level. -setVerbosity :: PandocMonad m => Verbosity -> m () - --- Get the accomulated log messages (in temporal order). -getLog :: PandocMonad m => m [LogMessage] -getLog = reverse <$> getsCommonState stLog - --- | Log a message using 'logOutput'. Note that 'logOutput' is --- called only if the verbosity level exceeds the level of the --- message, but the message is added to the list of log messages --- that will be retrieved by 'getLog' regardless of its verbosity level. -report :: PandocMonad m => LogMessage -> m () - --- | Fetch an image or other item from the local filesystem or the net. --- Returns raw content and maybe mime type. -fetchItem :: PandocMonad m - => String - -> m (B.ByteString, Maybe MimeType) - --- Set the resource path searched by 'fetchItem'. -setResourcePath :: PandocMonad m => [FilePath] -> m () -``` - -If we wanted more verbose informational messages -during the conversion we defined in the previous -section, we could do this: - -```haskell - result <- runIO $ do - setVerbosity INFO - doc <- readMarkdown def (T.pack "[testing](url)") - writeRST def doc -``` - -Note that `PandocIO` is an instance of `MonadIO`, so you can -use `liftIO` to perform arbitrary IO operations inside a pandoc -conversion chain. - -# Options - -The first argument of each reader or writer is for -options controlling the behavior of the reader or writer: -`ReaderOptions` for readers and `WriterOptions` -for writers. These are defined in [Text.Pandoc.Options]. It is -a good idea to study these options to see what can be adjusted. - -`def` (from Data.Default) denotes a default value for -each kind of option. (You can also use `defaultWriterOptions` -and `defaultReaderOptions`.) Generally you'll want to use -the defaults and modify them only when needed, for example: - -```haskell - writeRST def{ writerReferenceLinks = True } -``` - -Some particularly important options to know about: - -1. `writerTemplate`: By default, this is `Nothing`, which - means that a document fragment will be produced. If you - want a full document, you need to specify `Just template`, - where `template` is a String containing the template's - contents (not the path). - -2. `readerExtensions` and `writerExtensions`: These specify - the extensions to be used in parsing and rendering. - Extensions are defined in [Text.Pandoc.Extensions]. - -# Builder - -Sometimes it's useful to construct a Pandoc document -programatically. To make this easier we provide the -module [Text.Pandoc.Builder] `pandoc-types`. - -Because concatenating lists is slow, we use special -types `Inlines` and `Blocks` that wrap a `Sequence` of -`Inline` and `Block` elements. These are instances -of the Monoid typeclass and can easily be concatenated: - -```haskell -import Text.Pandoc.Builder - -mydoc :: Pandoc -mydoc = doc $ header 1 (text "Hello!") - <> para (emph (text "hello world") <> text ".") - -main :: IO () -main = print mydoc -``` - -If you use the `OverloadedStrings` pragma, you can -simplify this further: - -```haskell -mydoc = doc $ header 1 "Hello!" - <> para (emph "hello world" <> ".") -``` - -Here's a more realistic example. Suppose your boss says: write -me a letter in Word listing all the filling stations in Chicago -that take the Voyager card. You find some JSON data in this -format (`fuel.json`): - -```json -[ { - "state" : "IL", - "city" : "Chicago", - "fuel_type_code" : "CNG", - "zip" : "60607", - "station_name" : "Clean Energy - Yellow Cab", - "cards_accepted" : "A D M V Voyager Wright_Exp CleanEnergy", - "street_address" : "540 W Grenshaw" -}, ... -``` - -And then use aeson and pandoc to parse the JSON and create -the Word document: - -```haskell -{-# LANGUAGE OverloadedStrings #-} -import Text.Pandoc.Builder -import Text.Pandoc -import Data.Monoid ((<>), mempty, mconcat) -import Data.Aeson -import Control.Applicative -import Control.Monad (mzero) -import qualified Data.ByteString.Lazy as BL -import qualified Data.Text as T -import Data.List (intersperse) - -data Station = Station{ - address :: String - , name :: String - , cardsAccepted :: [String] - } deriving Show - -instance FromJSON Station where - parseJSON (Object v) = Station <$> - v .: "street_address" <*> - v .: "station_name" <*> - (words <$> (v .:? "cards_accepted" .!= "")) - parseJSON _ = mzero - -createLetter :: [Station] -> Pandoc -createLetter stations = doc $ - para "Dear Boss:" <> - para "Here are the CNG stations that accept Voyager cards:" <> - simpleTable [plain "Station", plain "Address", plain "Cards accepted"] - (map stationToRow stations) <> - para "Your loyal servant," <> - plain (image "JohnHancock.png" "" mempty) - where - stationToRow station = - [ plain (text $ name station) - , plain (text $ address station) - , plain (mconcat $ intersperse linebreak - $ map text $ cardsAccepted station) - ] - -main :: IO () -main = do - json <- BL.readFile "fuel.json" - let letter = case decode json of - Just stations -> createLetter [s | s <- stations, - "Voyager" `elem` cardsAccepted s] - Nothing -> error "Could not decode JSON" - docx <- runIO (writeDocx def letter) >>= handleError - BL.writeFile "letter.docx" docx - putStrLn "Created letter.docx" -``` - -Voila! You've written the letter without using Word and -without looking at the data. - -# Data files - -Pandoc has a number of data files, which can be found in the -`data/` subdirectory of the repository. These are installed -with pandoc (or, if pandoc was compiled with the -`embed_data_files` flag, they are embedded in the binary). -You can retrieve data files using `readDataFile` from -Text.Pandoc.Class. `readDataFile` will first look for the -file in the "user data directory" (`setUserDataDir`, -`getUserDataDir`), and if it is not found there, it will -return the default installed with the system. -To force the use of the default, `setUserDataDir Nothing`. - -# Templates - -Pandoc has its own template system, described in the User's -Guide. To retrieve the default template for a system, -use `getDefaultTemplate` from [Text.Pandoc.Templates]. -Note that this looks first in the -`templates` subdirectory of the user data directory, allowing -users to override the system defaults. If you want to disable -this behavior, use `setUserDataDir Nothing`. - -To render a template, use `renderTemplate'`, which takes two -arguments, a template (String) and a context (any instance -of ToJSON). If you want to create a context from the metadata -part of a Pandoc document, use `metaToJSON'` from -[Text.Pandoc.Writers.Shared]. If you also want to incorporate -values from variables, use `metaToJSON` instead, and make sure -`writerVariables` is set in `WriterOptions`. - - -# Handling errors and warnings - -`runIO` and `runPure` return an `Either PandocError a`. All errors -raised in running a `PandocMonad` computation will be trapped -and returned as a `Left` value, so they can be handled by -the calling program. To see the constructors for `PandocError`, -see the documentation for [Text.Pandoc.Error]. - -To raise a `PandocError` from inside a `PandocMonad` computation, -use `throwError`. - -In addition to errors, which stop execution of the conversion -pipeline, one can generate informational messages. -Use `report` from [Text.Pandoc.Class] to issue a `LogMessage`. -For a list of cosntructors for `LogMessage`, see -[Text.Pandoc.Logging]. Note that each type of log message -is associated with a verbosity level. The verbosity level -(`setVerbosity`/`getVerbosity`) determines whether the report -will be printed to stderr (when running in `PandocIO`), but -regardless of verbosity level, all reported messages are stored -internally and may be retrieved using `getLog`. - -# Walking the AST - -It is often useful to walk the Pandoc AST either to extract -information (e.g., what are all the URLs linked to in this -document?, do all the code samples compile?) or to transform a -document (e.g., increase the level of every section header, -remove emphasis, or replace specially marked code blocks with -images). To make this easier and more efficient, `pandoc-types` -includes a module [Text.Pandoc.Walk]. - -Here's the essential documentation: - -```haskell -class Walkable a b where - -- | @walk f x@ walks the structure @x@ (bottom up) and replaces every - -- occurrence of an @a@ with the result of applying @f@ to it. - walk :: (a -> a) -> b -> b - walk f = runIdentity . walkM (return . f) - -- | A monadic version of 'walk'. - walkM :: (Monad m, Functor m) => (a -> m a) -> b -> m b - -- | @query f x@ walks the structure @x@ (bottom up) and applies @f@ - -- to every @a@, appending the results. - query :: Monoid c => (a -> c) -> b -> c -``` - -`Walkable` instances are defined for most combinations of -Pandoc types. For example, the `Walkable Inline Block` -instance allows you to take a function `Inline -> Inline` -and apply it over every inline in a `Block`. And -`Walkable [Inline] Pandoc` allows you to take a function -`[Inline] -> [Inline]` and apply it over every maximal -list of `Inline`s in a `Pandoc`. - -Here's a simple example of a function that promotes -the levels of headers: - -```haskell -promoteHeaderLevels :: Pandoc -> Pandoc -promoteHeaderLevels = walk promote - where promote :: Block -> Block - promote (Header lev attr ils) = Header (lev + 1) attr ils - promote x = x -``` - -`walkM` is a monadic version of `walk`; it can be used, for -example, when you need your transformations to perform IO -operations, use PandocMonad operations, or update internal -state. Here's an example using the State monad to add unique -identifiers to each code block: - -```haskell -addCodeIdentifiers :: Pandoc -> Pandoc -addCodeIdentifiers doc = evalState (walkM addCodeId doc) 1 - where addCodeId :: Block -> State Int Block - addCodeId (CodeBlock (_,classes,kvs) code) = do - curId <- get - put (curId + 1) - return $ CodeBlock (show curId,classes,kvs) code - addCodeId x = return x -``` - -`query` is used to collect information from the AST. -Its argument is a query function that produces a result -in some monoidal type (e.g. a list). The results are -concatenated together. Here's an example that returns a -list of the URLs linked to in a document: - -```haskell -listURLs :: Pandoc -> [String] -listURLs = query urls - where urls (Link _ _ (src, _)) = [src] - urls _ = [] -``` - -# Creating a front-end - -All of the functionality of the command-line program `pandoc` -has been abstracted out in `convertWithOpts` in -the module [Text.Pandoc.App]. Creating a GUI front-end for -pandoc is thus just a matter of populating the `Opts` -structure and calling this function. - -# Notes on using pandoc in web applications - -1. Pandoc's parsers can exhibit pathological behavior on some - inputs. So it is always a good idea to wrap uses of pandoc - in a timeout function (e.g. `System.Timeout.timeout` from `base`) - to prevent DOS attacks. - -2. If pandoc generates HTML from untrusted user input, it is - always a good idea to filter the generated HTML through - a sanitizer (such as `xss-sanitize`) to avoid security - problems. - -3. Using `runPure` rather than `runIO` will ensure that - pandoc's functions perform no IO operations (e.g. writing - files). If some resources need to be made available, a - "fake environment" is provided inside the state available - to `runPure` (see `PureState` and its associated functions - in [Text.Pandoc.Class]). It is also possible to write - a custom instance of `PandocMonad` that, for example, - makes wiki resources available as files in the fake environment, - while isolating pandoc from the rest of the system. - - -[Text.Pandoc.Definition]: https://hackage.haskell.org/package/pandoc-types/docs/Text-Pandoc-Definition.html -[Text.Pandoc.Walk]: https://hackage.haskell.org/package/pandoc-types/docs/Text-Pandoc-Walk.html -[Text.Pandoc.Class]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Class.html -[Text.Pandoc.Options]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Options.html -[Text.Pandoc.Extensions]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Extensions.html -[Text.Pandoc.Builder]: https://hackage.haskell.org/package/pandoc-types/docs/Text-Pandoc-Builder.html -[Text.Pandoc.Templates]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Templates.html -[Text.Pandoc.Logging]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Logging.html -[Text.Pandoc.App]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-App.html -[Text.Pandoc.Error]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Error.html -[Text.Pandoc.Writers.Shared]: https://hackage.haskell.org/package/pandoc/docs/Text-Pandoc-Writers.Shared.html diff --git a/lib/fonts/Makefile b/lib/fonts/Makefile deleted file mode 100644 index 5693ee054..000000000 --- a/lib/fonts/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -symbol.hs: symbol.txt - runghc parseUnicodeMapping.hs symbol.txt - -.PHONY: clean -clean: - -rm symbol.hs diff --git a/lib/fonts/parseUnicodeMapping.hs b/lib/fonts/parseUnicodeMapping.hs deleted file mode 100644 index 4f7ff692b..000000000 --- a/lib/fonts/parseUnicodeMapping.hs +++ /dev/null @@ -1,40 +0,0 @@ -import System.FilePath -import Text.Parsec -import Data.Char -import System.Environment -import Control.Applicative hiding (many) -import Data.List - -main :: IO () -main = (head <$> getArgs) >>= parseUnicodeMapping - - -parseUnicodeMapping :: FilePath -> IO () -parseUnicodeMapping fname = do - fin <- readFile fname - let mapname = dropExtension . takeFileName $ fname - let res = runParse fin - let header = "-- Generated from " ++ fname ++ "\n" ++ - mapname ++ " :: [(Char, Char)]\n" ++ mapname ++" =\n [ " - let footer = "]" - writeFile (replaceExtension fname ".hs") - (header ++ (concat $ intersperse "\n , " (map show res)) ++ footer) - -type Unicode = Char - -runParse :: String -> [(Char, Unicode)] -runParse s= either (error . show) id (parse parseMap "" s) - -anyline = manyTill anyChar newline - -getHexChar :: Parsec String () Char -getHexChar = do - [(c,_)] <- readLitChar . ("\\x" ++) <$> many1 hexDigit - return c - -parseMap :: Parsec String () [(Char, Unicode)] -parseMap = do - skipMany (char '#' >> anyline) - many (flip (,) <$> getHexChar <* tab <*> getHexChar <* anyline) - - diff --git a/lib/fonts/symbol.txt b/lib/fonts/symbol.txt deleted file mode 100644 index b98baf6cf..000000000 --- a/lib/fonts/symbol.txt +++ /dev/null @@ -1,256 +0,0 @@ -# -# Name: Adobe Symbol Encoding to Unicode -# Unicode version: 2.0 -# Table version: 1.0 -# Date: 2011 July 12 -# -# Copyright (c) 1991-2011 Unicode, Inc. All Rights reserved. -# -# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). No -# claims are made as to fitness for any particular purpose. No warranties of -# any kind are expressed or implied. The recipient agrees to determine -# applicability of information provided. If this file has been provided on -# magnetic media by Unicode, Inc., the sole remedy for any claim will be -# exchange of defective media within 90 days of receipt. -# -# Unicode, Inc. hereby grants the right to freely use the information -# supplied in this file in the creation of products supporting the -# Unicode Standard, and to make copies of this file in any form for -# internal or external distribution as long as this notice remains -# attached. -# -# Format: 4 tab-delimited fields: -# -# (1) The Unicode value (in hexadecimal) -# (2) The Symbol Encoding code point (in hexadecimal) -# (3) # Unicode name -# (4) # PostScript character name -# -# General Notes: -# -# The Unicode values in this table were produced as the result of applying -# the algorithm described in the section "Populating a Unicode space" in the -# document "Unicode and Glyph Names," at -# http://partners.adobe.com/asn/developer/typeforum/unicodegn.html -# to the characters in Symbol. Note that some characters, such as "space", -# are mapped to 2 Unicode values. 29 characters have assignments in the -# Corporate Use Subarea; these are indicated by "(CUS)" in field 4. Refer to -# the above document for more details. -# -# 2011 July 12: The above link is no longer valid. For comparable, -# more current information, see the document, "Glyph", at: -# <http://www.adobe.com/devnet/opentype/archives/glyph.html> -# -# Revision History: -# -# [v1.0, 2011 July 12] -# Updated terms of use to current wording. -# Updated contact information and document link. -# No changes to the mapping data. -# -# [v0.2, 30 March 1999] -# Different algorithm to produce Unicode values (see notes above) results in -# some character codes being mapped to 2 Unicode values; use of Corporate -# Use subarea values; addition of the euro character; changed assignments of -# some characters such as the COPYRIGHT SIGNs and RADICAL EXTENDER. Updated -# Unicode names to Unicode 2.0 names. -# -# [v0.1, 5 May 1995] First release. -# -# Use the Unicode reporting form <http://www.unicode.org/reporting.html> -# for any questions or comments or to report errors in the data. -# -0020 20 # SPACE # space -00A0 20 # NO-BREAK SPACE # space -0021 21 # EXCLAMATION MARK # exclam -2200 22 # FOR ALL # universal -0023 23 # NUMBER SIGN # numbersign -2203 24 # THERE EXISTS # existential -0025 25 # PERCENT SIGN # percent -0026 26 # AMPERSAND # ampersand -220B 27 # CONTAINS AS MEMBER # suchthat -0028 28 # LEFT PARENTHESIS # parenleft -0029 29 # RIGHT PARENTHESIS # parenright -2217 2A # ASTERISK OPERATOR # asteriskmath -002B 2B # PLUS SIGN # plus -002C 2C # COMMA # comma -2212 2D # MINUS SIGN # minus -002E 2E # FULL STOP # period -002F 2F # SOLIDUS # slash -0030 30 # DIGIT ZERO # zero -0031 31 # DIGIT ONE # one -0032 32 # DIGIT TWO # two -0033 33 # DIGIT THREE # three -0034 34 # DIGIT FOUR # four -0035 35 # DIGIT FIVE # five -0036 36 # DIGIT SIX # six -0037 37 # DIGIT SEVEN # seven -0038 38 # DIGIT EIGHT # eight -0039 39 # DIGIT NINE # nine -003A 3A # COLON # colon -003B 3B # SEMICOLON # semicolon -003C 3C # LESS-THAN SIGN # less -003D 3D # EQUALS SIGN # equal -003E 3E # GREATER-THAN SIGN # greater -003F 3F # QUESTION MARK # question -2245 40 # APPROXIMATELY EQUAL TO # congruent -0391 41 # GREEK CAPITAL LETTER ALPHA # Alpha -0392 42 # GREEK CAPITAL LETTER BETA # Beta -03A7 43 # GREEK CAPITAL LETTER CHI # Chi -0394 44 # GREEK CAPITAL LETTER DELTA # Delta -2206 44 # INCREMENT # Delta -0395 45 # GREEK CAPITAL LETTER EPSILON # Epsilon -03A6 46 # GREEK CAPITAL LETTER PHI # Phi -0393 47 # GREEK CAPITAL LETTER GAMMA # Gamma -0397 48 # GREEK CAPITAL LETTER ETA # Eta -0399 49 # GREEK CAPITAL LETTER IOTA # Iota -03D1 4A # GREEK THETA SYMBOL # theta1 -039A 4B # GREEK CAPITAL LETTER KAPPA # Kappa -039B 4C # GREEK CAPITAL LETTER LAMDA # Lambda -039C 4D # GREEK CAPITAL LETTER MU # Mu -039D 4E # GREEK CAPITAL LETTER NU # Nu -039F 4F # GREEK CAPITAL LETTER OMICRON # Omicron -03A0 50 # GREEK CAPITAL LETTER PI # Pi -0398 51 # GREEK CAPITAL LETTER THETA # Theta -03A1 52 # GREEK CAPITAL LETTER RHO # Rho -03A3 53 # GREEK CAPITAL LETTER SIGMA # Sigma -03A4 54 # GREEK CAPITAL LETTER TAU # Tau -03A5 55 # GREEK CAPITAL LETTER UPSILON # Upsilon -03C2 56 # GREEK SMALL LETTER FINAL SIGMA # sigma1 -03A9 57 # GREEK CAPITAL LETTER OMEGA # Omega -2126 57 # OHM SIGN # Omega -039E 58 # GREEK CAPITAL LETTER XI # Xi -03A8 59 # GREEK CAPITAL LETTER PSI # Psi -0396 5A # GREEK CAPITAL LETTER ZETA # Zeta -005B 5B # LEFT SQUARE BRACKET # bracketleft -2234 5C # THEREFORE # therefore -005D 5D # RIGHT SQUARE BRACKET # bracketright -22A5 5E # UP TACK # perpendicular -005F 5F # LOW LINE # underscore -F8E5 60 # RADICAL EXTENDER # radicalex (CUS) -03B1 61 # GREEK SMALL LETTER ALPHA # alpha -03B2 62 # GREEK SMALL LETTER BETA # beta -03C7 63 # GREEK SMALL LETTER CHI # chi -03B4 64 # GREEK SMALL LETTER DELTA # delta -03B5 65 # GREEK SMALL LETTER EPSILON # epsilon -03C6 66 # GREEK SMALL LETTER PHI # phi -03B3 67 # GREEK SMALL LETTER GAMMA # gamma -03B7 68 # GREEK SMALL LETTER ETA # eta -03B9 69 # GREEK SMALL LETTER IOTA # iota -03D5 6A # GREEK PHI SYMBOL # phi1 -03BA 6B # GREEK SMALL LETTER KAPPA # kappa -03BB 6C # GREEK SMALL LETTER LAMDA # lambda -00B5 6D # MICRO SIGN # mu -03BC 6D # GREEK SMALL LETTER MU # mu -03BD 6E # GREEK SMALL LETTER NU # nu -03BF 6F # GREEK SMALL LETTER OMICRON # omicron -03C0 70 # GREEK SMALL LETTER PI # pi -03B8 71 # GREEK SMALL LETTER THETA # theta -03C1 72 # GREEK SMALL LETTER RHO # rho -03C3 73 # GREEK SMALL LETTER SIGMA # sigma -03C4 74 # GREEK SMALL LETTER TAU # tau -03C5 75 # GREEK SMALL LETTER UPSILON # upsilon -03D6 76 # GREEK PI SYMBOL # omega1 -03C9 77 # GREEK SMALL LETTER OMEGA # omega -03BE 78 # GREEK SMALL LETTER XI # xi -03C8 79 # GREEK SMALL LETTER PSI # psi -03B6 7A # GREEK SMALL LETTER ZETA # zeta -007B 7B # LEFT CURLY BRACKET # braceleft -007C 7C # VERTICAL LINE # bar -007D 7D # RIGHT CURLY BRACKET # braceright -223C 7E # TILDE OPERATOR # similar -20AC A0 # EURO SIGN # Euro -03D2 A1 # GREEK UPSILON WITH HOOK SYMBOL # Upsilon1 -2032 A2 # PRIME # minute -2264 A3 # LESS-THAN OR EQUAL TO # lessequal -2044 A4 # FRACTION SLASH # fraction -2215 A4 # DIVISION SLASH # fraction -221E A5 # INFINITY # infinity -0192 A6 # LATIN SMALL LETTER F WITH HOOK # florin -2663 A7 # BLACK CLUB SUIT # club -2666 A8 # BLACK DIAMOND SUIT # diamond -2665 A9 # BLACK HEART SUIT # heart -2660 AA # BLACK SPADE SUIT # spade -2194 AB # LEFT RIGHT ARROW # arrowboth -2190 AC # LEFTWARDS ARROW # arrowleft -2191 AD # UPWARDS ARROW # arrowup -2192 AE # RIGHTWARDS ARROW # arrowright -2193 AF # DOWNWARDS ARROW # arrowdown -00B0 B0 # DEGREE SIGN # degree -00B1 B1 # PLUS-MINUS SIGN # plusminus -2033 B2 # DOUBLE PRIME # second -2265 B3 # GREATER-THAN OR EQUAL TO # greaterequal -00D7 B4 # MULTIPLICATION SIGN # multiply -221D B5 # PROPORTIONAL TO # proportional -2202 B6 # PARTIAL DIFFERENTIAL # partialdiff -2022 B7 # BULLET # bullet -00F7 B8 # DIVISION SIGN # divide -2260 B9 # NOT EQUAL TO # notequal -2261 BA # IDENTICAL TO # equivalence -2248 BB # ALMOST EQUAL TO # approxequal -2026 BC # HORIZONTAL ELLIPSIS # ellipsis -F8E6 BD # VERTICAL ARROW EXTENDER # arrowvertex (CUS) -F8E7 BE # HORIZONTAL ARROW EXTENDER # arrowhorizex (CUS) -21B5 BF # DOWNWARDS ARROW WITH CORNER LEFTWARDS # carriagereturn -2135 C0 # ALEF SYMBOL # aleph -2111 C1 # BLACK-LETTER CAPITAL I # Ifraktur -211C C2 # BLACK-LETTER CAPITAL R # Rfraktur -2118 C3 # SCRIPT CAPITAL P # weierstrass -2297 C4 # CIRCLED TIMES # circlemultiply -2295 C5 # CIRCLED PLUS # circleplus -2205 C6 # EMPTY SET # emptyset -2229 C7 # INTERSECTION # intersection -222A C8 # UNION # union -2283 C9 # SUPERSET OF # propersuperset -2287 CA # SUPERSET OF OR EQUAL TO # reflexsuperset -2284 CB # NOT A SUBSET OF # notsubset -2282 CC # SUBSET OF # propersubset -2286 CD # SUBSET OF OR EQUAL TO # reflexsubset -2208 CE # ELEMENT OF # element -2209 CF # NOT AN ELEMENT OF # notelement -2220 D0 # ANGLE # angle -2207 D1 # NABLA # gradient -F6DA D2 # REGISTERED SIGN SERIF # registerserif (CUS) -F6D9 D3 # COPYRIGHT SIGN SERIF # copyrightserif (CUS) -F6DB D4 # TRADE MARK SIGN SERIF # trademarkserif (CUS) -220F D5 # N-ARY PRODUCT # product -221A D6 # SQUARE ROOT # radical -22C5 D7 # DOT OPERATOR # dotmath -00AC D8 # NOT SIGN # logicalnot -2227 D9 # LOGICAL AND # logicaland -2228 DA # LOGICAL OR # logicalor -21D4 DB # LEFT RIGHT DOUBLE ARROW # arrowdblboth -21D0 DC # LEFTWARDS DOUBLE ARROW # arrowdblleft -21D1 DD # UPWARDS DOUBLE ARROW # arrowdblup -21D2 DE # RIGHTWARDS DOUBLE ARROW # arrowdblright -21D3 DF # DOWNWARDS DOUBLE ARROW # arrowdbldown -25CA E0 # LOZENGE # lozenge -2329 E1 # LEFT-POINTING ANGLE BRACKET # angleleft -F8E8 E2 # REGISTERED SIGN SANS SERIF # registersans (CUS) -F8E9 E3 # COPYRIGHT SIGN SANS SERIF # copyrightsans (CUS) -F8EA E4 # TRADE MARK SIGN SANS SERIF # trademarksans (CUS) -2211 E5 # N-ARY SUMMATION # summation -F8EB E6 # LEFT PAREN TOP # parenlefttp (CUS) -F8EC E7 # LEFT PAREN EXTENDER # parenleftex (CUS) -F8ED E8 # LEFT PAREN BOTTOM # parenleftbt (CUS) -F8EE E9 # LEFT SQUARE BRACKET TOP # bracketlefttp (CUS) -F8EF EA # LEFT SQUARE BRACKET EXTENDER # bracketleftex (CUS) -F8F0 EB # LEFT SQUARE BRACKET BOTTOM # bracketleftbt (CUS) -F8F1 EC # LEFT CURLY BRACKET TOP # bracelefttp (CUS) -F8F2 ED # LEFT CURLY BRACKET MID # braceleftmid (CUS) -F8F3 EE # LEFT CURLY BRACKET BOTTOM # braceleftbt (CUS) -F8F4 EF # CURLY BRACKET EXTENDER # braceex (CUS) -232A F1 # RIGHT-POINTING ANGLE BRACKET # angleright -222B F2 # INTEGRAL # integral -2320 F3 # TOP HALF INTEGRAL # integraltp -F8F5 F4 # INTEGRAL EXTENDER # integralex (CUS) -2321 F5 # BOTTOM HALF INTEGRAL # integralbt -F8F6 F6 # RIGHT PAREN TOP # parenrighttp (CUS) -F8F7 F7 # RIGHT PAREN EXTENDER # parenrightex (CUS) -F8F8 F8 # RIGHT PAREN BOTTOM # parenrightbt (CUS) -F8F9 F9 # RIGHT SQUARE BRACKET TOP # bracketrighttp (CUS) -F8FA FA # RIGHT SQUARE BRACKET EXTENDER # bracketrightex (CUS) -F8FB FB # RIGHT SQUARE BRACKET BOTTOM # bracketrightbt (CUS) -F8FC FC # RIGHT CURLY BRACKET TOP # bracerighttp (CUS) -F8FD FD # RIGHT CURLY BRACKET MID # bracerightmid (CUS) -F8FE FE # RIGHT CURLY BRACKET BOTTOM # bracerightbt (CUS) diff --git a/linux/Dockerfile b/linux/Dockerfile deleted file mode 100644 index 40d37d13d..000000000 --- a/linux/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# USE ALPINE LINUX -FROM alpine:edge -RUN echo "https://s3-us-west-2.amazonaws.com/alpine-ghc/8.0" >> /etc/apk/repositories -ADD https://raw.githubusercontent.com/mitchty/alpine-ghc/master/mitch.tishmack%40gmail.com-55881c97.rsa.pub \ - /etc/apk/keys/mitch.tishmack@gmail.com-55881c97.rsa.pub -RUN apk update -RUN apk add alpine-sdk git ca-certificates ghc cabal stack zlib-dev \ - dpkg fakeroot sed gawk grep bash linux-headers -RUN stack update -RUN stack config set system-ghc --global true -#RUN mkdir -p /etc/stack -#RUN echo "build: { split-objs: true }" > /etc/stack/config.yaml -RUN mkdir -p /usr/src/ -WORKDIR /usr/src/ -RUN git clone https://github.com/jgm/pandoc -WORKDIR /usr/src/pandoc -RUN stack install --stack-yaml stack.lts9.yaml \ - --only-dependencies \ - --flag 'pandoc:static' \ - --flag 'pandoc:embed_data_files' \ - --flag 'pandoc-citeproc:static' \ - --flag 'pandoc-citeproc:embed_data_files' \ - --flag 'hslua:-export-dynamic' \ - --ghc-options '-O2 -optc-Os -optl=-pthread -optl=-static -fPIC' \ - aeson -RUN stack install --stack-yaml stack.lts9.yaml \ - --only-dependencies \ - --flag 'pandoc:static' \ - --flag 'pandoc:embed_data_files' \ - --flag 'pandoc-citeproc:static' \ - --flag 'pandoc-citeproc:embed_data_files' \ - --flag 'hslua:-export-dynamic' \ - --ghc-options '-O2 -optc-Os -optl=-pthread -optl=-static -fPIC' \ - http-client-tls -RUN stack install --stack-yaml stack.lts9.yaml \ - --only-dependencies \ - --flag 'pandoc:static' \ - --flag 'pandoc:embed_data_files' \ - --flag 'pandoc-citeproc:static' \ - --flag 'pandoc-citeproc:embed_data_files' \ - --flag 'hslua:-export-dynamic' \ - --ghc-options '-O2 -optc-Os -optl=-pthread -optl=-static -fPIC' \ - pandoc pandoc-citeproc -CMD git pull && \ - git checkout -b work $TREE && \ - stack install --stack-yaml stack.lts9.yaml \ - --flag 'pandoc:static' \ - --flag 'pandoc:embed_data_files' \ - --flag 'pandoc-citeproc:static' \ - --flag 'pandoc-citeproc:embed_data_files' \ - --flag 'hslua:-export-dynamic' \ - --ghc-options '-O2 -optc-Os -optl=-pthread -optl=-static -fPIC' \ - --local-bin-path /artifacts \ - pandoc pandoc-citeproc && \ - bash linux/make_deb.sh && \ - bash linux/make_tarball.sh diff --git a/linux/Makefile b/linux/Makefile deleted file mode 100644 index 4e8eeb00a..000000000 --- a/linux/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TREE?=HEAD -ARTIFACTS=`pwd`/artifacts -REVISION?=1 - -build: - mkdir -p $(ARTIFACTS) - docker build -t alpine-pandoc . - docker run --env TREE=$(TREE) --env REVISION=$(REVISION) \ - -v $(ARTIFACTS):/artifacts alpine-pandoc - -interact: - docker run --env TREE=$(TREE) --env REVISION=$(REVISION) \ - -v $(ARTIFACTS):/artifacts -it alpine-pandoc bash - -setup: - docker pull alpine:edge - -.PHONY: build setup interact diff --git a/linux/control.in b/linux/control.in deleted file mode 100644 index de0be6c58..000000000 --- a/linux/control.in +++ /dev/null @@ -1,26 +0,0 @@ -Package: pandoc -Version: VERSION -Section: text -Priority: optional -Architecture: ARCHITECTURE -Installed-Size: INSTALLED_SIZE -Depends: libc6 (>= 2.13), libgmp10, zlib1g (>= 1:1.1.4) -Replaces: pandoc-data, pandoc-citeproc -Suggests: texlive-latex-recommended, texlive-xetex, - texlive-fonts-recommended -Maintainer: John MacFarlane <jgm@berkeley.edu> -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 several dialects of Markdown and - (subsets of) HTML, reStructuredText, LaTeX, DocBook, - MediaWiki markup, TWiki markup, TikiWiki markup, Haddock - markup, OPML, Emacs Org-Mode, txt2tags, Muse, Vimwiki, - Word Docx, ODT, and Textile, and it can write Markdown, - reStructuredText, XHTML, HTML 5, LaTeX, ConTeXt, DocBook, - JATS, OPML, TEI, OpenDocument, ODT, Word docx, RTF, - MediaWiki, DokuWiki, ZimWiki, Textile, groff man, groff - ms, plain text, Emacs Org-Mode, AsciiDoc, Haddock markup, - EPUB (v2 and v3), FictionBook2, InDesign ICML, Muse, and - several kinds of HTML/JavaScript slide shows (S5, Slidy, - Slideous, DZSlides, reveal.js). diff --git a/linux/make_deb.sh b/linux/make_deb.sh deleted file mode 100755 index cbbc8a184..000000000 --- a/linux/make_deb.sh +++ /dev/null @@ -1,51 +0,0 @@ -set -e - -MACHINE=$(uname -m) -case "$MACHINE" in - x86_64) ARCHITECTURE=amd64;; - i686) ARCHITECTURE=i386;; - i386) ARCHITECTURE=i386;; -esac - -ARTIFACTS="${ARTIFACTS:-/artifacts}" - -VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'` -REVISION=${REVISION:-1} -DEBVER=$VERSION-$REVISION -BASE=pandoc-$DEBVER-$ARCHITECTURE -DIST=`pwd`/$BASE -DEST=$DIST/usr -COPYRIGHT=$DEST/share/doc/pandoc/copyright - -PANDOC_CITEPROC_VERSION=`$ARTIFACTS/pandoc-citeproc --version | awk '{print $2;}'` - -mkdir -p $DEST/bin -mkdir -p $DEST/share/man/man1 -mkdir -p $DEST/share/doc/pandoc - -mkdir -p $DEST/share/doc/pandoc-citeproc -find $DIST -type d | xargs chmod 755 -cp $ARTIFACTS/pandoc $DEST/bin/ -cp $ARTIFACTS/pandoc-citeproc $DEST/bin/ -strip $DEST/bin/pandoc -strip $DEST/bin/pandoc-citeproc -cp man/pandoc.1 $DEST/share/man/man1/pandoc.1 -$ARTIFACTS/pandoc-citeproc --man > $DEST/share/man/man1/pandoc-citeproc.1 -gzip -9 $DEST/share/man/man1/pandoc.1 -gzip -9 $DEST/share/man/man1/pandoc-citeproc.1 - -cp COPYRIGHT $COPYRIGHT -echo "" >> $COPYRIGHT -echo "pandoc-citeproc" >> $COPYRIGHT -$ARTIFACTS/pandoc-citeproc --license >> $COPYRIGHT - -INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}') -mkdir $DIST/DEBIAN -perl -pe "s/VERSION/$DEBVER/" linux/control.in | \ - perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \ - perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \ - > $DIST/DEBIAN/control - -fakeroot dpkg-deb --build $DIST -rm -rf $DIST -cp $BASE.deb $ARTIFACTS/ diff --git a/linux/make_tarball.sh b/linux/make_tarball.sh deleted file mode 100644 index cc1cc49cd..000000000 --- a/linux/make_tarball.sh +++ /dev/null @@ -1,19 +0,0 @@ -set -e - -ARTIFACTS="${ARTIFACTS:-/artifacts}" -VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'` -TARGET=pandoc-$VERSION - -cd $ARTIFACTS -rm -rf $TARGET -mkdir $TARGET -mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1 -./pandoc-citeproc --man > $TARGET/share/man/man1/pandoc-citeproc.1 -cp /usr/src/pandoc/man/pandoc.1 $TARGET/share/man/man1 -mv pandoc pandoc-citeproc $TARGET/bin -strip $TARGET/bin/pandoc -strip $TARGET/bin/pandoc-citeproc -gzip -9 $TARGET/share/man/man1/pandoc.1 -gzip -9 $TARGET/share/man/man1/pandoc-citeproc.1 -tar cvzf $TARGET-linux.tar.gz $TARGET -rm -r $TARGET diff --git a/macos/distribution.xml.in b/macos/distribution.xml.in deleted file mode 100644 index 145fc0f21..000000000 --- a/macos/distribution.xml.in +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="no"?> -<installer-gui-script minSpecVersion="1"> - <title>pandoc</title> - <organization>net.johnmacfarlane.pandoc</organization> - <domains enable_localSystem="true" enable_anywhere="true" /> - <options customize="allow" require-scripts="false" rootVolumeOnly="false" /> - <!-- Define documents displayed at various steps --> - <!-- <welcome file="welcome.html" mime-type="text/html" /> --> - <license file="license.html" mime-type="text/html" /> - <!-- <conclusion file="conclusion.html" mime-type="text/html" /> --> - <options hostArchitectures="x86_64" /> - <!-- List all component packages --> - <pkg-ref id="net.johnmacfarlane.pandoc" - version="PANDOCVERSION" - auth="root">pandoc.pkg</pkg-ref> - <!-- List them again here. They can now be organized - as a hierarchy if you want. --> - <choices-outline> - <line choice="net.johnmacfarlane.pandoc"/> - </choices-outline> - <!-- Define each choice above --> - <choice - id="net.johnmacfarlane.pandoc" - visible="false" - title="pandoc" - description="pandoc - universal text converter" - start_selected="true"> - <pkg-ref id="net.johnmacfarlane.pandoc"/> - </choice> -</installer-gui-script> diff --git a/macos/make_macos_package.sh b/macos/make_macos_package.sh deleted file mode 100755 index 85155c66c..000000000 --- a/macos/make_macos_package.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -e - -LOCALBIN=$HOME/.local/bin -BASEDIR=`pwd` -DIST=`pwd`/macos_package -MACOS=`pwd`/macos -RESOURCES=$DIST/Resources -ROOT=$DIST/pandoc -DEST=$ROOT/usr/local -PANDOC=$DEST/bin/pandoc -SCRIPTS=$MACOS/macos-resources -ME=$(whoami) -PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker -DEVELOPER_ID_APPLICATION=${DEVELOPER_ID_APPLICATION:-Developer ID Application: John Macfarlane} -DEVELOPER_ID_INSTALLER=${DEVELOPER_ID_INSTALLER:-Developer ID Installer: John Macfarlane} - -export MACMACOS_DEPLOYMENT_TARGET=10.7 - -# echo Removing old files... -rm -rf $DIST -mkdir -p $DIST -mkdir -p $RESOURCES -mkdir -p $DEST/bin -mkdir -p $DEST/share/man/man1 - -stack setup - -echo Building pandoc... -stack clean -stack install --ghc-options="-O2" --local-bin-path $DEST/bin/ pandoc pandoc-citeproc - -strip $DEST/bin/pandoc -strip $DEST/bin/pandoc-citeproc - -echo Getting man pages... -make man/pandoc.1 - -# get pandoc-citeproc man page: -PANDOC_CITEPROC_VERSION=`$DEST/bin/pandoc-citeproc --version | awk '{print $2;exit;}'` -PANDOC_CITEPROC_TARBALL=https://hackage.haskell.org/package/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}/pandoc-citeproc-${PANDOC_CITEPROC_VERSION}.tar.gz -curl ${PANDOC_CITEPROC_TARBALL} | tar xzC $DIST -PANDOC_CITEPROC_PATH=$DIST/pandoc-citeproc-${PANDOC_CITEPROC_VERSION} - -cp $PANDOC_CITEPROC_PATH/man/man1/pandoc-citeproc.1 $DEST/share/man/man1/ -cp man/pandoc.1 $DEST/share/man/man1/ - -chown -R $ME:staff $DIST - -echo Copying license... -$PANDOC --data data -t html5 -s COPYING.md -Vpagetitle="License" -o $RESOURCES/license.html - -# Removing executable signing because of a problem that arose in El Capitan -# "source=obsolete resource envelope" - -#echo Signing pandoc executable... - -#codesign --force --sign "${DEVELOPER_ID_APPLICATION}" $DEST/bin/pandoc -# make sure it's valid... returns nonzero exit code if it isn't: -#spctl --assess --type execute $DEST/bin/pandoc - -echo Creating macOS package... - -VERSION=`$DEST/bin/pandoc --version | awk '{print $2;exit;}'` -BASE=pandoc-$VERSION - -sed -e "s/PANDOCVERSION/$VERSION/" $MACOS/distribution.xml.in > $MACOS/distribution.xml - -pkgbuild --root $ROOT --identifier net.johnmacfarlane.pandoc --version $VERSION --ownership recommended $DIST/pandoc.pkg -productbuild --distribution $MACOS/distribution.xml --resources $DIST/Resources --package-path $DIST --version $VERSION --sign "${DEVELOPER_ID_INSTALLER}" $BASE-macOS.pkg - -# verify signature -spctl --assess --type install $BASE-macOS.pkg - -echo "Created $BASE-macOS.pkg" - -# create zip -cd $DEST -cd .. -mv local $BASE -zip -r $BASEDIR/$BASE-macOS.zip $BASE -cd $BASEDIR - -echo "Created $BASE-macOS.zip" - -# cleanup -rm -r $DIST diff --git a/macos/uninstall-pandoc.pl b/macos/uninstall-pandoc.pl deleted file mode 100755 index c853727d9..000000000 --- a/macos/uninstall-pandoc.pl +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl - -# Script to remove all files installed by the macOS pandoc installer -# and unregister the package. Modified from a script contributed -# by Daniel T. Staal. - -use warnings; -use strict; - -use File::Spec; - -# The main info: this is the list of files to remove and the pkg_id. -my $pkg_id = 'net.johnmacfarlane.pandoc'; - -# Find which, if any, volume Pandoc is installed on. -my $volume; - -# First check /, then other volumes on the box. -my $cur_test = `pkgutil --pkgs=$pkg_id`; -if ( $cur_test =~ m/$pkg_id/ ) { - $volume = '/'; -} else { - opendir( my $dh, '/Volumes' ) or die "Can't list Volumes: $!\n"; - foreach my $dir ( readdir($dh) ) { - next if $dir =~ m/^\./; # Skip dotfiles. - - my $path = File::Spec->rel2abs( $dir, '/Volumes' ); - next if !( -d $path ); # Skip anything that isn't a directory. - - my $cur_test = `pkgutil --pkgs=$pkg_id --volume '$path'`; - if ( $cur_test =~ m/$pkg_id/ ) { - $volume = $path; - last; - } - } -} - -die "Pandoc not installed.\n" if !( defined($volume) ); - -# Get the list of files to remove. -my @pkg_files = `pkgutil --volume '$volume' --only-files --files '$pkg_id'`; -@pkg_files = map { chomp; File::Spec->rel2abs($_, $volume) } @pkg_files; - -# Confirm uninistall with the user. -print "The following files will be deleted:\n\n"; -print join("\n", @pkg_files); -print "\n\n"; -print "Do you want to proceed and uninstall pandoc (Y/N)?"; -my $input = <STDIN>; - -if ($input =~ m/^[Yy]/) { - - # Actually remove the files. - foreach my $file (@pkg_files) { - if ( -e $file ) { - if ( system( 'sudo', 'rm', $file ) == 0 ) { - warn "Deleted $file\n"; - } else { - warn "Unable to delete $file: $?\n"; - die "Aborting Uninstall.\n"; - } - } else { - warn "File $file does not exist. Skipping.\n"; - } - } - - # Clean up the install. - if (system('sudo', 'pkgutil', '--forget', $pkg_id, '--volume', $volume) != 0) { - die "Unable to clean up install: $?\n"; - } - -} else { - - print "OK, aborting uninstall.\n"; - exit; -} - -print "Pandoc has been successfully uninstalled.\n"; -exit; diff --git a/stack.lts9.yaml b/stack.lts9.yaml deleted file mode 100644 index 64384e52d..000000000 --- a/stack.lts9.yaml +++ /dev/null @@ -1,30 +0,0 @@ -flags: - pandoc: - trypandoc: false - embed_data_files: true - old-locale: false - network-uri: true - pandoc-citeproc: - bibutils: true - embed_data_files: true - unicode_collation: false - test_citeproc: false - debug: false -packages: -- '.' -extra-deps: -- pandoc-types-1.17.3 -- hslua-0.9.5 -- hslua-module-text-0.1.2 -- skylighting-0.6 -- ansi-terminal-0.7.1.1 -- texmath-0.10.1.1 -- cmark-gfm-0.1.1 -- QuickCheck-2.10.0.1 -- tasty-quickcheck-0.9.1 -- doctemplates-0.2.1 -- haddock-library-1.4.3 -- hs-bibutils-6.2.0.1 -- pandoc-citeproc-0.14.1.5 -- tagsoup-0.14.6 -resolver: lts-9.14 diff --git a/test/command/custom-attributes.html b/test/command/custom-attributes.html deleted file mode 100644 index 67dccc1b8..000000000 --- a/test/command/custom-attributes.html +++ /dev/null @@ -1,16 +0,0 @@ -Custom attributes should automatically have data- added -in HTML5: -``` -% pandoc -t html5 -[hello]{foo="bar"} -^D -<span data-foo="bar">hello</span> -``` - -but not in HTML4: -``` -% pandoc -t html4 -[hello]{foo="bar"} -^D -<span foo="bar">hello</span> -``` diff --git a/tools/extract-changes.hs b/tools/extract-changes.hs deleted file mode 100644 index 8c8160c2c..000000000 --- a/tools/extract-changes.hs +++ /dev/null @@ -1,9 +0,0 @@ --- Extract changes from latest version in changelog. -import Text.Pandoc.JSON - -main = toJSONFilter extractFirst - -extractFirst :: Pandoc -> Pandoc -extractFirst (Pandoc meta (Para{} : BulletList bs : _)) = - Pandoc meta [BulletList bs] -extractFirst x = x diff --git a/tools/github-upload.sh b/tools/github-upload.sh deleted file mode 100755 index 875d51831..000000000 --- a/tools/github-upload.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -VERSION=$1 -FULLNAME=pandoc-$VERSION -read -s -p "Token (https://github.com/settings/applications): " TOKEN - -curl -H "Authorization: token $TOKEN" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/x-apple-diskimage" \ - --data-binary @$FULLNAME.pkg.zip \ - "https://uploads.github.com/repos/jgm/pandoc/releases/$VERSION/assets?name=$FULLNAME.pkg.zip" - -curl -H "Authorization: token $TOKEN" \ - -H "Accept: application/vnd.github.manifold-preview" \ - -H "Content-Type: application/x-msi" \ - --data-binary @$FULLNAME.msi \ - "https://uploads.github.com/repos/jgm/pandoc/releases/$VERSION/assets?name=$FULLNAME.msi" - diff --git a/tools/ldoc.ltp b/tools/ldoc.ltp deleted file mode 100644 index 3fa96bb0f..000000000 --- a/tools/ldoc.ltp +++ /dev/null @@ -1,38 +0,0 @@ -# local iter = ldoc.modules.iter -# local M = ldoc.markup - -<h1>Module $(module.name)</h1> - -<p>$(M(module.summary))</p> - -# for kind, items in module.kinds() do - -<h2>$(kind)</h2> - <dl> -# for item in items() do ldoc.item = item -- provides context for M() - <dt><span id="$(item.name)"><code>$(ldoc.display_name(item))</code></span></dt> - <dd> - <p>$(item.summary)</p> -# if item.params and #item.params > 0 then - $(module.kinds:type_of(item).subnames): - <dl> -# for p in iter(item.params) do - <dt><code>$(p)</code>:</dt> - <dd>$(M(item.params.map[p]))</dd> -# end -- for - </dl> -# end -- if params -# if item.ret then - <p>Returns: $(item.ret[1])</p> -# end -- if returns -# if item.usage then - <p>Usage:</p> - <pre><code>$(item.usage[1])</code></pre> -# end -- if usage -# if item.see then - See also: <a href="#$(item.see[1].label)">$(item.see[1].label)</a> - -# end -- if see -# end -- for items - </dl> -# end -- for kinds diff --git a/tools/pandoc-template-mode.el b/tools/pandoc-template-mode.el deleted file mode 100644 index c0f1c6e39..000000000 --- a/tools/pandoc-template-mode.el +++ /dev/null @@ -1,64 +0,0 @@ - ;;; pandoc-template-mode.el --- Pandoc-Template major mode - -;; Copyright (C) 2017 - -;; Author: Václav Haisman -;; Keywords: extensions - -;; This file 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, or (at your option) -;; any later version. - -;; This file 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 GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. - - ;;; Commentary: - -;; - - ;;; Code: - -(defvar pandoc-template-font-lock-keywords - '(("\\(\\$--.*\\)$" - (1 font-lock-comment-face)) - ("\\(\\$\\)\\(if\\|for\\)(\\([^)]+\\))\\(\\$\\)" - (1 font-lock-preprocessor-face) - (2 font-lock-keyword-face) - (3 font-lock-variable-name-face) - (4 font-lock-preprocessor-face)) - ("\\(\\$\\)\\(endif\\|endfor\\|else\\)\\(\\$\\)" - (1 font-lock-preprocessor-face) - (2 font-lock-keyword-face) - (3 font-lock-preprocessor-face)) - ("\\(\\$\\)\\(sep\\)\\(\\$\\)" - (1 font-lock-preprocessor-face) - (2 font-lock-builtin-face) - (3 font-lock-preprocessor-face)) - ("\\(\\$\\)\\([^$]+\\)\\(\\$\\)" - (1 font-lock-preprocessor-face) - (2 font-lock-variable-name-face) - (3 font-lock-preprocessor-face)) - ) - "Keyword highlighting specification for `pandoc-template-mode'.") - - ;;;###autoload -(define-derived-mode pandoc-template-mode fundamental-mode "Pandoc-Template" - "A major mode for editing Pandoc-Template files." - :syntax-table text-mode-syntax-table - (setq-local font-lock-defaults - '(pandoc-template-font-lock-keywords)) - (setq-local comment-start "$--") - (setq-local comment-start-skip "\\$--[ \t]*") - (setq-local comment-end "") - (setq-local comment-end-skip "[ \t]*$")) - -(provide 'pandoc-template-mode) - ;;; pandoc-template.el ends here diff --git a/tools/update-lua-docs.lua b/tools/update-lua-docs.lua deleted file mode 100644 index 746dce984..000000000 --- a/tools/update-lua-docs.lua +++ /dev/null @@ -1,49 +0,0 @@ -local in_module_section = false - --- Generate tmp folder -local tmp_folder = os.tmpname() -os.remove(tmp_folder) -os.execute("mkdir -p " .. tmp_folder) - -function extend(list1, list2) - for i = 1, #list2 do - list1[#list1 + 1] = list2[i] - end -end - -function module_blocks(module_filenames) - local blocks = {} - for _, filename in pairs(module_filenames) do - os.execute("ldoc -q -l tools -d " .. tmp_folder .. " " .. filename) - local module_file = io.open(tmp_folder .. "/index.html") - local module_html = module_file:read("*a") - local module_doc = pandoc.read(module_html, "html") - extend(blocks, module_doc.blocks) - end - return blocks -end - -function Header (el) - if in_module_section then - if el.level == 1 or - -- special case for Module pandoc - (el.level == 2 and el.identifier == 'helper-functions') then - in_module_section = false - return el - else - return {} - end - elseif el.identifier == "module-pandoc" then - in_module_section = true - return module_blocks{'data/pandoc.lua'} - elseif el.identifier == "module-pandoc.list" then - in_module_section = true - return module_blocks{'data/pandoc.List.lua'} - end -end - -function Block (el) - if in_module_section then - return {} - end -end diff --git a/tools/update-readme.lua b/tools/update-readme.lua deleted file mode 100644 index 4f77c59c2..000000000 --- a/tools/update-readme.lua +++ /dev/null @@ -1,38 +0,0 @@ --- update README.md based on MANUAL.txt --- assumes that the README.md has a div with id 'description'. --- this gets replaced by the contents of the 'description' section --- of the manual. - -function Div(elem) - if elem.classes[1] and elem.classes[1] == 'description' then - local f = assert(io.open("MANUAL.txt", "r")) - local manual = f:read("*all") - f:close() - local description = {} - local i = 1 - local include = false - local mdoc = pandoc.read(manual, "markdown") - local blocks = mdoc.blocks - while blocks[i] do - if blocks[i].t == 'Header' then - include = false - end - if include then - table.insert(description, pandoc.walk_block(blocks[i], - -- remove internal links - { Link = function(el) - if el.target:match("^#") then - return el.content - end - end })) - end - if blocks[i].t == 'Header' and - blocks[i].identifier == 'description' then - include = true - end - i = i + 1 - end - return pandoc.Div(description, pandoc.Attr("description",{},{})) - end -end - diff --git a/windows/AdvancedWelcomeEulaDlg_Custom.wxs b/windows/AdvancedWelcomeEulaDlg_Custom.wxs deleted file mode 100644 index 61e6d8e00..000000000 --- a/windows/AdvancedWelcomeEulaDlg_Custom.wxs +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - <copyright file="AdvancedWelcomeEulaDlg.wxs" company="Outercurve Foundation"> - Copyright (c) 2004, Outercurve Foundation. - This software is released under Microsoft Reciprocal License (MS-RL). - The license and further copyright text can be found in the file - LICENSE.TXT at the root directory of the distribution. - </copyright> ---> -<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> - <Fragment> - <UI> - <Dialog Id="AdvancedWelcomeEulaDlg_Custom" Width="370" Height="270" Title="!(loc.AdvancedWelcomeEulaDlg_Title)"> - - <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.AdvancedWelcomeEulaDlgBannerBitmap)" /> - <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" /> - <Control Id="Title" Type="Text" X="20" Y="10" Width="300" Height="24" Transparent="yes" NoPrefix="yes" Text="!(loc.AdvancedWelcomeEulaDlgTitle)" /> - - <Control Id="LicenseAcceptedCheckBox" Type="CheckBox" X="20" Y="140" Width="226" Height="19" CheckBoxValue="1" Property="LicenseAccepted" Text="!(loc.WelcomeEulaDlgLicenseAcceptedCheckBox)" /> - - <Control Id="ScopeGroupBox" Type="GroupBox" X="20" Y="155" Height="70" Width="330" /> - - <Control Id="AllUsersCheckBox" Type="CheckBox" X="88" Y="200" Width="226" Height="18" CheckBoxValue="1" Property="ALLUSERS" Text="!(loc.InstallScopeDlgPerMachine)"> - <Condition Action="enable">LicenseAccepted AND (WixUISupportPerUser = 1)</Condition> - <Condition Action="disable">(NOT LicenseAccepted) OR (WixUISupportPerUser = 0)</Condition> - </Control> - - <Control Id="PerUserDescription" Type="Text" X="30" Y="167" Width="300" Height="36" NoPrefix="yes" Text="!(loc.InstallScopeDlgPerUserDescription)"> - <Condition Action="hide">ALLUSERS</Condition> - <Condition Action="show">NOT (ALLUSERS = 1)</Condition> - <Condition Action="disable">NOT LicenseAccepted</Condition> - <Condition Action="enable">LicenseAccepted</Condition> - </Control> - - <Control Id="PerMachineDescription" Type="Text" X="30" Y="167" Width="300" Height="36" Hidden="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgPerMachineDescription)"> - <Condition Action="hide">NOT (ALLUSERS = 1)</Condition> - <Condition Action="show">ALLUSERS = 1</Condition> - <Condition Action="disable">NOT LicenseAccepted</Condition> - <Condition Action="enable">LicenseAccepted</Condition> - </Control> - - <Control Id="Print" Type="PushButton" X="88" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)"> - <Publish Event="DoAction" Value="WixUIPrintEula">1</Publish> - </Control> - - <Control Id="Advanced" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.AdvancedWelcomeEulaDlgAdvanced)"> - <Condition Action="disable">NOT LicenseAccepted OR NOT (ALLUSERS = 1)</Condition> - <Condition Action="enable">(LicenseAccepted = "1") AND (ALLUSERS = 1)</Condition> - </Control> - - <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="!(loc.AdvancedWelcomeEulaDlgInstall)" Hidden="yes"> - <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish> - <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish> - <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish> - <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish> - <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish> - <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish> - <Condition Action="disable">NOT LicenseAccepted</Condition> - <Condition Action="enable">LicenseAccepted = "1"</Condition> - <Condition Action="show">ALLUSERS = 1</Condition> - <Condition Action="hide">NOT (ALLUSERS = 1)</Condition> - </Control> - <Control Id="InstallNoShield" Type="PushButton" ElevationShield="no" X="212" Y="243" Width="80" Height="17" Default="yes" Text="!(loc.AdvancedWelcomeEulaDlgInstall)" Hidden="yes"> - <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish> - <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish> - <Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish> - <Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish> - <Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish> - <Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish> - <Condition Action="disable">NOT LicenseAccepted</Condition> - <Condition Action="enable">LicenseAccepted = "1"</Condition> - <Condition Action="show">NOT (ALLUSERS = 1)</Condition> - <Condition Action="hide">ALLUSERS = 1</Condition> - </Control> - - <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)"> - <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> - </Control> - <Control Id="LicenseText" Type="ScrollableText" X="20" Y="55" Width="330" Height="80" Sunken="yes" TabSkip="no"> - <!--<Text SourceFile="!(wix.WixUILicenseRtf=$(var.licenseRtf))" />--> - <Text SourceFile="!(loc.LicenseRtf)" /> - </Control> - </Dialog> - </UI> - - <InstallUISequence> - <Show Dialog="AdvancedWelcomeEulaDlg_Custom" Before="ProgressDlg">NOT Installed</Show> - </InstallUISequence> - </Fragment> -</Wix>
\ No newline at end of file diff --git a/windows/Pandoc-en-us.wxl b/windows/Pandoc-en-us.wxl deleted file mode 100644 index f1acbb00e..000000000 --- a/windows/Pandoc-en-us.wxl +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<WixLocalization Culture="en-us" Codepage="1252" xmlns="http://schemas.microsoft.com/wix/2006/localization"> - <String Id="Language">1033</String> - <!-- Supported language and codepage codes can be found here: http://www.tramontana.co.hu/wix/lesson2.php#2.4 --> - - <String Id="LicenseRtf" Overridable="yes">COPYING.rtf</String> - - <String Id="ExitDialogText">[ProductName] was installed in - -[APPLICATIONFOLDER]. - -You may need to restart Cmd/Powershell Windows before using it.</String> - -</WixLocalization>
\ No newline at end of file diff --git a/windows/WixUI_Advanced_Custom.wxs b/windows/WixUI_Advanced_Custom.wxs deleted file mode 100644 index 6f85d9961..000000000 --- a/windows/WixUI_Advanced_Custom.wxs +++ /dev/null @@ -1,142 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?if $(sys.BUILDARCH)=x64?> -<?define ProgFilesFolder="ProgramFiles64Folder"?> -<?else?> -<?define ProgFilesFolder="ProgramFilesFolder"?> -<?endif?> -<!-- - <copyright file="WixUI_Advanced_Custom.wxs" company="Outercurve Foundation"> - Copyright (c) 2004, Outercurve Foundation. - This software is released under Microsoft Reciprocal License (MS-RL). - The license and further copyright text can be found in the file - LICENSE.TXT at the root directory of the distribution. - </copyright> ---> - -<!-- -WixUI_Advanced_Custom offers a two-click install (EULA checkbox and Install button) -and offers an Advanced button that lets users choose per-machine or per-user -installs, install path, and features. - -WiX variables used: - - WixUISupportPerMachine - - WixUISupportPerUser - -Todo: - - Clicking Install doesn't work! - APPLICATIONFOLDER isn't set; need to accept another "incoming" property. - - Replace this dialog set UI fragment with the UI extension. - = This set is still in active development. - = Future releases are likely to be incompatible. - = Future releases are likely to be much easier to use. - = Use at your own risk. - ---> - -<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> - <Fragment> - <WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" /> - <WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" /> - - <PropertyRef Id="ApplicationFolderName" /> - - <CustomAction Id="WixSetDefaultPerUserFolder2" Property="WixPerUserFolder" Value="[LocalAppDataFolder][ApplicationFolderName]" Execute="immediate" /> - <CustomAction Id="WixSetDefaultPerMachineFolder2" Property="WixPerMachineFolder" Value="[$(var.ProgFilesFolder)][ApplicationFolderName]" Execute="immediate" /> - <CustomAction Id="WixSetPerUserFolder2" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Execute="immediate" /> - <CustomAction Id="WixSetPerMachineFolder2" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Execute="immediate" /> - - <InstallExecuteSequence> - <Custom Action="WixSetDefaultPerUserFolder2" Before="CostFinalize" /> - <Custom Action="WixSetDefaultPerMachineFolder2" After="WixSetDefaultPerUserFolder2" /> - <Custom Action="WixSetPerUserFolder2" After="WixSetDefaultPerMachineFolder2">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged)))</Custom> - <Custom Action="WixSetPerMachineFolder2" After="WixSetPerUserFolder2">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))</Custom> - </InstallExecuteSequence> - <InstallUISequence> - <Custom Action="WixSetDefaultPerUserFolder2" Before="CostFinalize" /> - <Custom Action="WixSetDefaultPerMachineFolder2" After="WixSetDefaultPerUserFolder2" /> - <Custom Action="WixSetPerUserFolder2" After="WixSetDefaultPerMachineFolder2">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged)))</Custom> - <Custom Action="WixSetPerMachineFolder2" After="WixSetPerUserFolder2">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))</Custom> - </InstallUISequence> - - <UI Id="WixUI_Advanced_Custom"> - <TextStyle Id="WixUI_Font_Normal" FaceName="!(loc.Advanced_Font_FaceName)" Size="!(loc.Advanced_Font_Normal_Size)" /> - <TextStyle Id="WixUI_Font_Bigger" FaceName="!(loc.Advanced_Font_FaceName)" Size="!(loc.Advanced_Font_Bigger_Size)" /> - <TextStyle Id="WixUI_Font_Title" FaceName="!(loc.Advanced_Font_FaceName)" Size="!(loc.Advanced_Font_Title_Size)" Bold="yes" /> - <TextStyle Id="WixUI_Font_Emphasized" FaceName="!(loc.Advanced_Font_FaceName)" Size="!(loc.Advanced_Font_Emphasized_Size)" Bold="yes" /> - - <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" /> - <Property Id="WixUI_Mode" Value="Advanced" /> - - <DialogRef Id="BrowseDlg" /> - <DialogRef Id="DiskCostDlg" /> - <DialogRef Id="ErrorDlg" /> - <DialogRef Id="FatalError" /> - <DialogRef Id="FilesInUse" /> - <DialogRef Id="MsiRMFilesInUse" /> - <DialogRef Id="PrepareDlg" /> - <DialogRef Id="ProgressDlg" /> - <DialogRef Id="ResumeDlg" /> - <DialogRef Id="UserExit" /> - <DialogRef Id="WelcomeDlg"/> - - <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish> - - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="1">1</Publish> - <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="2"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish> - - <!--<Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="Advanced" Event="NewDialog" Value="InstallScopeDlg" Order="1">!(wix.WixUISupportPerMachine) AND !(wix.WixUISupportPerUser)</Publish>--> - <!--<Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="Advanced" Event="NewDialog" Value="FeaturesDlg" Order="2">NOT !(wix.WixUISupportPerMachine)</Publish>--> - <!--<Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="Advanced" Event="NewDialog" Value="InstallDirDlg" Order="3">!(wix.WixUISupportPerMachine) AND NOT !(wix.WixUISupportPerUser)</Publish>--> - - <Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="Advanced" Property="WixAppFolder" Value="WixPerMachineFolder" Order="1">ALLUSERS = 1</Publish> - <Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="Advanced" Property="APPLICATIONFOLDER" Value="[$(var.ProgFilesFolder)][ApplicationFolderName]" Order="2">ALLUSERS = 1</Publish> - <Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="Advanced" Event="NewDialog" Value="InstallDirDlg" Order="3">!(wix.WixUISupportPerMachine) AND !(wix.WixUISupportPerUser)</Publish> - - <Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="AllUsersCheckBox" Property="WixAppFolder" Value="WixPerMachineFolder" Order="1">ALLUSERS = 1</Publish> - <Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="AllUsersCheckBox" Property="APPLICATIONFOLDER" Value="[$(var.ProgFilesFolder)][ApplicationFolderName]" Order="2">ALLUSERS = 1</Publish> - - <Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="AllUsersCheckBox" Property="WixAppFolder" Value="WixPerUserFolder" Order="1">NOT (ALLUSERS = 1)</Publish> - <Publish Dialog="AdvancedWelcomeEulaDlg_Custom" Control="AllUsersCheckBox" Property="APPLICATIONFOLDER" Value="[LocalAppDataFolder][ApplicationFolderName]" Order="2">NOT (ALLUSERS = 1)</Publish> - - <!--<Publish Dialog="InstallScopeDlg" Control="Back" Event="NewDialog" Value="AdvancedWelcomeEulaDlg_Custom">1</Publish>--> - <!-- override default WixAppFolder of WixPerMachineFolder as standard user won't be shown the radio group to set WixAppFolder --> - - <!--<Publish Dialog="InstallScopeDlg" Control="Next" Property="WixAppFolder" Value="WixPerUserFolder" Order="1">!(wix.WixUISupportPerUser) AND NOT Privileged</Publish>--> - - - - <!--<Publish Dialog="InstallScopeDlg" Control="Next" Event="NewDialog" Value="FeaturesDlg" Order="6">WixAppFolder = "WixPerUserFolder"</Publish> - <Publish Dialog="InstallScopeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="7">WixAppFolder = "WixPerMachineFolder"</Publish>--> - - <!--<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlg">!(wix.WixUISupportPerUser)</Publish>--> - <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="AdvancedWelcomeEulaDlg_Custom">1</Publish> - <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish> - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish> - <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish> - <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish> - <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish> - <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish> - - <!--<Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlg">NOT Installed AND WixAppFolder = "WixPerUserFolder"</Publish>--> - <Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg">NOT Installed AND WixAppFolder = "WixPerMachineFolder"</Publish> - <Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">Installed</Publish> - - <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish> - - <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> - <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> - <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish> - - <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish> - <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish> - - <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish> - </UI> - - <InstallUISequence> - <Show Dialog="WelcomeDlg" Before="AdvancedWelcomeEulaDlg_Custom" >Installed AND PATCH</Show> - </InstallUISequence> - - <Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONFOLDER" /> - <UIRef Id="WixUI_Common" /> - </Fragment> -</Wix>
\ No newline at end of file diff --git a/windows/make-windows-installer.bat b/windows/make-windows-installer.bat deleted file mode 100644 index a64af6621..000000000 --- a/windows/make-windows-installer.bat +++ /dev/null @@ -1,29 +0,0 @@ -@echo off
-stack install --test --ghc-options="-O2" --stack-yaml=..\stack.yaml
-if %errorlevel% neq 0 exit /b %errorlevel%
-for /f "delims=" %%a in ('stack path --local-bin-path') do @set BINPATH=%%a
-%BINPATH%\pandoc.exe -s --toc ..\MANUAL.txt -o MANUAL.html
-if %errorlevel% neq 0 exit /b %errorlevel%
-%BINPATH%\pandoc.exe -s ..\COPYING.md -t rtf -o COPYING.rtf
-if %errorlevel% neq 0 exit /b %errorlevel%
-copy ..\COPYRIGHT COPYRIGHT.txt
-for /f "tokens=1-2 delims= " %%a in ('%BINPATH%\pandoc.exe --version') do (
- @set VERSION=%%b
- goto :next
- )
-:next
-if "%VERSION%" == "" (
- echo Error: could not determine version number.
- exit /b 1
-)
-echo Detected version %VERSION%
-echo Creating msi...
-candle -dVERSION=%VERSION% -dBINPATH=%BINPATH% *.wxs -out wixobj\
-if %errorlevel% neq 0 exit /b %errorlevel%
-light -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us -loc Pandoc-en-us.wxl -out pandoc-%VERSION%-windows.msi wixobj\*.wixobj
-if %errorlevel% neq 0 exit /b %errorlevel%
-echo Starting kSign: sign, then quit kSign to complete the build...
-kSign
-
-echo Copying to shared drive
-copy pandoc-%VERSION%-windows.msi \\VBOXSVR\WindowsShared\
diff --git a/windows/pandoc.wxs b/windows/pandoc.wxs deleted file mode 100644 index dcdd3f582..000000000 --- a/windows/pandoc.wxs +++ /dev/null @@ -1,188 +0,0 @@ -<?define UpgradeCode = "A68E8EF6-ABB1-4F22-A3C5-68DFDF0AB562" ?> -<?if $(sys.BUILDARCH)=x64?> -<?define ProgFilesFolder="ProgramFiles64Folder"?> -<?else?> -<?define ProgFilesFolder="ProgramFilesFolder"?> -<?endif?> -<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> - <Product Id="*" - UpgradeCode="$(var.UpgradeCode)" Name="Pandoc $(var.VERSION)" - Version="$(var.VERSION)" Manufacturer="John MacFarlane" - Language="1033"> - - <Package InstallerVersion="301" Compressed="yes" - Comments="Windows Installer Package" /> - <Media Id="1" Cabinet="product.cab" EmbedCab="yes" /> - <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" /> - <Upgrade Id="$(var.UpgradeCode)"> - <UpgradeVersion Property='PREVIOUSVERSIONSINSTALLED' - Minimum='0.0.0.0' IncludeMinimum='yes' - Maximum="99.0.0.0" IncludeMaximum="no" /> - </Upgrade> - - <InstallExecuteSequence> - <RemoveExistingProducts After="InstallFinalize"/> - </InstallExecuteSequence> - - <Property Id="DISABLEADVTSHORTCUTS" Value="1" /> - - <Directory Id="TARGETDIR" Name="SourceDir"> - - <Directory Id="$(var.ProgFilesFolder)"> - <Directory Id="APPLICATIONFOLDER" Name="Pandoc"> - <Component Id="MainExecutable" - Guid="ECD35082-4C28-49E1-977E-B90FC7C400C7"> - <RegistryValue Root="HKMU" - Key="Software\John MacFarlane\Pandoc" - Name="Version" Type="string" Value="[ProductVersion]" - KeyPath="yes"/> - <RemoveFolder Id="APPLICATIONFOLDER" On="uninstall"/> - <File Id="pandocEXE" Name="pandoc.exe" - Source="$(var.BINPATH)\pandoc.exe" /> - <File Id="pandocCOPYRIGHT" Name="COPYRIGHT.txt" - Source="COPYRIGHT.txt" /> - <File Id="pandocCOPYING" Name="COPYING.rtf" - Source="COPYING.rtf" /> - </Component> - - <Component Id="CitationSupport" - Guid="0A214839-2E69-4026-8DBB-0F0A9DB75C12"> - <RegistryValue Root="HKMU" - Key="Software\John MacFarlane\Pandoc" - Name="Version" Type="string" Value="[ProductVersion]" - KeyPath="yes"/> - <File Id="pandoc_citeprocEXE" Name="pandoc-citeproc.exe" - Source="$(var.BINPATH)\pandoc-citeproc.exe" /> - </Component> - - <Component Id="Documentation" - Guid="A8D54A76-1A3D-4647-8327-81B69D39D8A3"> - <File Id="pandocMANUAL" Name="Pandoc User's Guide.html" - Source="MANUAL.html" KeyPath="yes"> - <Shortcut Id="ApplicationStartMenuShortcut" - Directory="ApplicationProgramsFolder" - Name="Pandoc User’s Guide" Advertise="yes" /> - </File> - </Component> - - - <Component Id="UpdateUserPath" - Guid="7ECEAD05-CA5C-4147-82CB-F7CADABAC7F3" - KeyPath="yes"> - <Condition>ALLUSERS = "" OR ALLUSERS = 2</Condition> - <Environment Id='SetUserPath' Name='PATH' Action='set' - Permanent='no' System='no' Part='last' - Value='[APPLICATIONFOLDER]' /> - </Component> - - <Component Id="UpdateSystemPath" - Guid="F8AC4135-C0AE-48C7-BAC5-311DAC97CFD8" - KeyPath="yes"> - <Condition>ALLUSERS = 1</Condition> - <Environment Id='SetSystemPath' Name='PATH' Action='set' - Permanent='no' System='yes' Part='last' - Value='[APPLICATIONFOLDER]' /> - </Component> - - </Directory> - </Directory> - - <Directory Id="ProgramMenuFolder"> - <Directory Id="ApplicationProgramsFolder" Name="Pandoc"> - <Component Id="ApplicationShortcut" - Guid="7F807DD5-CC54-474A-B571-89630893F563"> - <RemoveFolder Id="ApplicationProgramsFolder" - On="uninstall"/> - <RegistryValue Root="HKMU" Key="Software\John MacFarlane\Pandoc" - Name="ShortcutInstalled" Type="integer" Value="1" - KeyPath="yes"/> - </Component> - </Directory> - </Directory> - - </Directory> - - <Feature Id="Complete" Level="1" Title="Pandoc $(var.VERSION)" - Description="Complete package" Display="expand" - ConfigurableDirectory="APPLICATIONFOLDER"> - <Feature Id="MainProgram" - Title="Program" - Description="The main executable." - Level="1"> - <ComponentRef Id="MainExecutable" /> - <ComponentRef Id="UpdateUserPath" /> - <ComponentRef Id="UpdateSystemPath" /> - </Feature> - <Feature Id="Manual" Title="Manual"> - <ComponentRef Id="Documentation" /> - <ComponentRef Id="ApplicationShortcut" /> - </Feature> - <Feature Id="Citation" Title="Citation Support" - Description="Citation support."> - <ComponentRef Id="CitationSupport" /> - </Feature> - </Feature> - - - <!-- Set properties for add/remove programs --> - <Property Id="ARPURLINFOABOUT" Value="http://pandoc.org" /> - <Property Id="ARPHELPLINK" Value="http://pandoc.org" /> - <Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair --> - <Property Id="ARPNOMODIFY" Value="yes" Secure="yes" /> <!-- Remove modify --> - - - <!--Needed for WixUI_Advanced--> - <Property Id="ApplicationFolderName" Value="Pandoc" /> - <Property Id="WixAppFolder" Value="WixPerUserFolder" /> - - <!--For Single Package for dual purpose i.e. per User/Machine--> - <!--<Property Id="ALLUSERS" Value="2" Secure="yes" />--> - <Property Id="MSIINSTALLPERUSER" Value="1" /> - - <!--Inform about installed location--> - <SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" - After="CostFinalize" /> - <CustomAction Id="SetExitDialogOptText" - Property="WIXUI_EXITDIALOGOPTIONALTEXT" - Value="!(loc.ExitDialogText)" /> - - <!--Offer Per User installs only on workstations (block on servers)--> - <!--Unless ALLUSERS=1 is specified on command line--> - <SetProperty Id="WixUISupportPerUser" Value="0" Before="FindRelatedProducts"> - <!--https://msdn.microsoft.com/en-us/library/windows/desktop/aa370329(v=vs.85).aspx--> - MsiNTProductType > 1 - </SetProperty> - <SetProperty Id="WixUISupportPerUser" Value="1" Before="FindRelatedProducts" Action="CASupportPerUser"> - MsiNTProductType = 1 - </SetProperty> - <SetProperty Id="ALLUSERS" Value="1" Before="FindRelatedProducts"> - MsiNTProductType > 1 - </SetProperty> - <SetProperty Id="ALLUSERS" Value="{}" Before="FindRelatedProducts" Action="CASetPuaPackage"> - (NOT ALLUSERS = 1) AND MsiNTProductType = 1 - </SetProperty> - <SetProperty Id="MSIINSTALLPERUSER" Value="1" Before="FindRelatedProducts"> - (NOT ALLUSERS = 1) AND MsiNTProductType = 1 - </SetProperty> - <SetProperty Id="WixAppFolder" Value="WixPerMachineFolder" Before="FindRelatedProducts"> - MsiNTProductType > 1 - </SetProperty> - - <!--Make changes to PATH visible immeidiately--> - <CustomActionRef Id="WixBroadcastSettingChange" /> - <CustomActionRef Id="WixBroadcastEnvironmentChange" /> - - <InstallUISequence> - <Custom Action="SetExitDialogOptText" Before="ExecuteAction"> - NOT Installed - </Custom> - </InstallUISequence> - - <UIRef Id="WixUI_Advanced_Custom"/> - <!--Enable better description when debug logging--> - <UIRef Id="WixUI_ErrorProgressText" /> - - </Product> - - -</Wix> |