summaryrefslogtreecommitdiff
path: root/.emacs.d/org-7.4/contrib/scripts
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-04-13 23:20:15 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-04-13 23:20:15 -0400
commitf7464fdd2e33e5dc6c159a4adc8f53902e6d4511 (patch)
treeb1d65db982af54cc2088de3228174c4ea710c2f4 /.emacs.d/org-7.4/contrib/scripts
Initial commit of Luke Shumaker's "dot-files".
Diffstat (limited to '.emacs.d/org-7.4/contrib/scripts')
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/.DS_Storebin0 -> 6148 bytes
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/.gitignore1
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/StartOzServer.oz220
-rwxr-xr-x.emacs.d/org-7.4/contrib/scripts/dir2org.zsh56
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/ditaa.jarbin0 -> 210364 bytes
-rwxr-xr-x.emacs.d/org-7.4/contrib/scripts/org2hpda106
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/.gitignore1
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.org79
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.txt91
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/application.ini11
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest1
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js198
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.xul11
-rw-r--r--.emacs.d/org-7.4/contrib/scripts/staticmathjax/defaults/preferences/prefs.js1
14 files changed, 776 insertions, 0 deletions
diff --git a/.emacs.d/org-7.4/contrib/scripts/.DS_Store b/.emacs.d/org-7.4/contrib/scripts/.DS_Store
new file mode 100644
index 0000000..5008ddf
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/.DS_Store
Binary files differ
diff --git a/.emacs.d/org-7.4/contrib/scripts/.gitignore b/.emacs.d/org-7.4/contrib/scripts/.gitignore
new file mode 100644
index 0000000..20d5925
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/.gitignore
@@ -0,0 +1 @@
+plantuml.jar
diff --git a/.emacs.d/org-7.4/contrib/scripts/StartOzServer.oz b/.emacs.d/org-7.4/contrib/scripts/StartOzServer.oz
new file mode 100644
index 0000000..4d5144e
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/StartOzServer.oz
@@ -0,0 +1,220 @@
+%%% *************************************************************
+%%% Copyright (C) 2009 Torsten Anders (www.torsten-anders.de)
+%%% This program is free software; you can redistribute it and/or
+%%% modify it under the terms of the GNU General Public License
+%%% as published by the Free Software Foundation; either version 2
+%%% of the License, or (at your option) any later version.
+%%% This program is distributed in the hope that it will be useful,
+%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%%% GNU General Public License for more details.
+%%% *************************************************************
+
+%%
+%% This code implements the Oz-side of the Org-babel Oz interface. It
+%% creates a socket server (to which org-babel-oz.el then
+%% connects). Any input to this socket must be an Oz expression. The
+%% input is fed to the OPI oz compiler, and the results are send back
+%% via the socket.
+%%
+
+
+declare
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% Accessing the OPI compiler
+%%
+
+MyCompiler = Emacs.condSend.compiler
+
+
+/* % testing
+
+%% Feed an expression (result browsed)
+{MyCompiler enqueue(setSwitch(expression true))}
+{Browse
+ {MyCompiler enqueue(feedVirtualString("1 + 2" return(result: $)))}}
+{MyCompiler enqueue(setSwitch(expression false))}
+
+%% It is really the OPI: I can use declare!
+{MyCompiler enqueue(setSwitch(expression false))}
+{MyCompiler enqueue(feedVirtualString("declare X=3\n{Browse X*X}"))}
+
+%% Note: expressions starting with keyword declare need keyword in
+{MyCompiler enqueue(setSwitch(expression true))}
+{Browse
+ {MyCompiler enqueue(feedVirtualString("declare X=3\nin X*X" return(result: $)))}}
+{MyCompiler enqueue(setSwitch(expression false))}
+
+%% Alternatively you use a session with multiple feeds: first declare (statement), and then feed an expression
+{MyCompiler enqueue(setSwitch(expression false))}
+{MyCompiler enqueue(feedVirtualString("declare X=7" return))}
+{MyCompiler enqueue(setSwitch(expression true))}
+{Browse
+ {MyCompiler enqueue(feedVirtualString("X*X" return(result: $)))}}
+{MyCompiler enqueue(setSwitch(expression false))}
+
+%% !!?? does not work?
+%% return nil in case of any error (division by 0)
+{MyCompiler enqueue(setSwitch(expression true))}
+{Browse
+ {MyCompiler enqueue(feedVirtualString(
+ {LUtils.accum ["try\n"
+% "skip\n" % do something in any case..
+ "1 div 0" % my code
+% "1" % my code
+ "\ncatch E then {Error.printException E}\n"
+ "error\n" % always return nil
+ "end\n"]
+ List.append}
+ return(result: $)))}}
+{MyCompiler enqueue(setSwitch(expression false))}
+
+
+%% !! catching some exceptions does not work??
+
+%% exception is not catched
+try {Bla} catch E then {Error.printException E} {Browse nil} end
+
+%% exception is catched
+try {Browse 1 div 0} catch E then {Error.printException E} {Browse nil} end
+{Browse ok}
+
+
+*/
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% Socket interface
+%%
+
+
+%%
+%% Create socket
+%%
+
+MyPort = 6001
+
+/** %% Creates a TCP socket server. Expects a Host (e.g., 'localhost') and a PortNo and returns a server plus its corresponding client. This client is an instance of Open.socket, and is the interface for reading and writing into the socket.
+%% MakeServer blocks until the server listens. However, waiting until a connection has been accepted happens in its own thread (i.e. MakeServer does only block until the server listens).
+%% NB: A port can be used only once, so assign it carefully. In case this postnnumber was shortly used before, you may need to wait a bit before reusing it.
+%% */
+%% !! Alternatively, let it assign automatically and output the port number..
+%%
+%% NOTE: for supporting multiple connections see http://www.mozart-oz.org/documentation/op/node13.html#section.sockets.accept
+proc {MakeServer Host PortNo ?MyServer ?MyClient}
+ proc {Accept MyClient}
+ thread H in % P
+ %% suspends until a connection has been accepted
+ {MyServer accept(host:H
+ acceptClass:Open.socket
+ accepted:?MyClient)}
+% {Myserver accept(host:H port:P)} % suspends until a connection has been accepted
+ %% !!?? port number of client is usually created randomly..
+ {System.showInfo "% connection accepted from host "#H}
+ end
+ %% !!???
+ %% If Accept is called recursively, then server accepts multiple connections. These share the same compiler instance (e.g. variable bindings are shared). For multiple independent compiler instances call the OzServer application multiple times.
+ %% However, how shall the output for multiple connections be sorted?? Would using the different client sockets created with the Server accept method work?
+ %% NB: The number of clients accepted concurrently must be limited to the number set by {MyServer listen}
+ % {Accept}
+ end
+in
+ MyServer = {New Open.socket init}
+ %% To avoid problems with portnumbers, the port could be assigned automatically and then output..
+ %%{MyServer bind(port:PortNo)}
+ {MyServer bind(host:Host takePort:PortNo)}
+ {MyServer listen}
+ {System.showInfo "% OzServer started at host "#Host#" and port "#PortNo}
+ MyClient = {Accept}
+end
+%%
+MySocket = {MakeServer localhost MyPort _/*MyServer*/}
+
+
+%%
+%% Read socket input
+%%
+
+declare
+%% Copied from OzServer/source/Socket.oz
+local
+ proc {Aux Socket Size Stream}
+ In = {Socket read(list:$
+ size:Size)}
+ in
+ {Wait In}
+ %% !! Is this the right way to stop the processing??
+ %%
+ %% abort condition when client stream ended (i.e. nothing was sent)
+ if In == nil
+ then {System.showInfo "socket stream ended"}
+ Stream = nil
+ else Stream = In | {Aux Socket Size}
+ end
+ end
+in
+ /** %% The socket Server returns a stream of the strings it receives. The Server always waits until someone writes something into the socket, then the input is immediately written to a stream and the Server waits again.
+ %% */
+ proc {ReadToStream Socket Size Xs}
+ thread {Aux Socket Size Xs} end
+ end
+end
+
+/* % test
+
+MyStream = {ReadToStream MySocket 1024}
+
+*/
+
+/* % test
+
+%% writing
+{MySocket write(vs:"this is a test")}
+
+*/
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% Send socket input to compiler and send results back to socket
+%%
+
+%% NOTE: Input code must be expression
+thread
+ {ForAll {ReadToStream MySocket 1024}
+ proc {$ Code}
+ Result
+ %% Catch any exception (so the will not cause blocking) and return nil in that case
+ FullCode = {LUtils.accum ["try\n"
+% "skip\n" % do something in any case..
+ Code
+ "\ncatch E then {Error.printException E}\n"
+ "error\n" % in case of an error, return 'error'
+ "end\n"]
+ List.append}
+ in
+ %% ?? Should I make setting switches etc atomic?
+ {MyCompiler enqueue(setSwitch(expression true))}
+ Result = {MyCompiler enqueue(feedVirtualString(FullCode return(result: $)))}
+ {MyCompiler enqueue(setSwitch(expression false))}
+ %%
+ {Wait Result}
+ {MySocket write(vs: if {VirtualString.is Result}
+ then Result
+ else {Value.toVirtualString Result 1000 1000}
+ end)}
+ {Show 'Org-babel result: '#Result}
+ end}
+end
+
+
+
+
+
+
+
+
+
diff --git a/.emacs.d/org-7.4/contrib/scripts/dir2org.zsh b/.emacs.d/org-7.4/contrib/scripts/dir2org.zsh
new file mode 100755
index 0000000..f91ff17
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/dir2org.zsh
@@ -0,0 +1,56 @@
+#!/usr/bin/env zsh
+
+# desc:
+#
+# Output an org compatible structure representing the filesystem from
+# the point passed on the command line (or . by default).
+#
+# options:
+# none
+#
+# usage:
+# dir2org.zsh [DIR]...
+#
+# author:
+# Phil Jackson (phil@shellarchive.co.uk)
+
+set -e
+
+function headline {
+ local depth="${1}"
+ local text="${2}"
+
+ printf "%${depth}s %s" "" | tr ' ' '*'
+ echo " ${text}"
+}
+
+function scan_and_populate {
+ local depth="${1}"
+ local dir="${2}"
+
+ headline ${depth} "${dir}"
+
+ # if there is no files in dir then just move on
+ [[ $(ls "${dir}" | wc -l) -eq 0 ]] && return
+
+ (( depth += 1 ))
+
+ for f in $(ls -d "${dir}"/*); do
+ if [ -d "${f}" ]; then
+ scan_and_populate ${depth} "${f}"
+ else
+ headline ${depth} "[[file://${f}][${${f##*/}%.*}]]"
+ fi
+ done
+
+ (( depth -= 1 ))
+}
+
+function main {
+ local scan_dir="${1:-$(pwd)}"
+ local depth=0
+
+ scan_and_populate ${depth} "${scan_dir}"
+}
+
+main "${@}"
diff --git a/.emacs.d/org-7.4/contrib/scripts/ditaa.jar b/.emacs.d/org-7.4/contrib/scripts/ditaa.jar
new file mode 100644
index 0000000..6f10d4e
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/ditaa.jar
Binary files differ
diff --git a/.emacs.d/org-7.4/contrib/scripts/org2hpda b/.emacs.d/org-7.4/contrib/scripts/org2hpda
new file mode 100755
index 0000000..6b308f3
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/org2hpda
@@ -0,0 +1,106 @@
+# org2hpda - a small utility to generate hipster pda style printouts from org mode
+# Copyright (C) 2007 Christian Egli
+#
+# Version: 0.6
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Commentary:
+# ===========
+#
+# set cal-tex-diary to true so that diary entries show up in the calendar
+#
+# Usage:
+# ======
+#
+# run this makefile with
+#
+# make -f org2hpda
+#
+# The makfile will take the entries from your diary file and generate
+# two PDFs containing nicely printed weekly and monthly calendars. One
+# is done in the style of a pocketMod (http://www.pocketmod.com/) and
+# the other is done in the style of the Hipster PDA
+# (http://en.wikipedia.org/wiki/Hipster_PDA).
+#
+# Requirements:
+# =============
+#
+# the pdf* commands are part of the pdfjam package which can be found
+# at http://www.warwick.ac.uk/go/pdfjam
+
+EMACS = emacs -batch -l ~/.emacs
+LATEX = latex
+DIARY = $($(EMACS) -eval "diary-file")
+
+# Number of weeks to be printed. Should be a multiple of 4, because 4
+# of them are merged on one page. Can be set when invoking the script
+# as follows: make NUMBER_OF_WEEKS=8 -f org2hpda
+NUMBER_OF_WEEKS = 4
+
+hipsterFiles = weekCalendar.pdf yearCalendar.pdf monthCalendar3.pdf monthCalendar2.pdf monthCalendar1.pdf
+pocketModFiles = weekCalendar.pdf yearCalendar-rotated.pdf \
+ monthCalendar3-rotated.pdf monthCalendar2-rotated.pdf monthCalendar1-rotated.pdf
+
+all: pocketMod.pdf hipsterPDA.pdf
+
+%.dvi: %.tex
+ # Quick hack to massage the LaTeX produced by cal-tex
+ # quote '@', then increase font size of week calendars,
+ # increase font of diary entries in moth calendar and
+ # finally reduce links to their destination, i.e.
+ # change '[[http://foo][bar]]' to 'bar'
+ sed -e 's/\\verb|@|/\@/g' \
+ -e 's/documentclass\[11pt\]/documentclass[12pt]/g' \
+ -e 's/{\\tiny \\raggedright #3}/{\\small \\raggedright #3}/g' \
+ -e 's/\[\[[^]]\+\]\[\([^]]\+\)\]\]/\1/g' \
+ < $< > /tmp/temp-org-file.$$$$; mv /tmp/temp-org-file.$$$$ $<
+ $(LATEX) $^
+
+%.pdf: %.dvi
+ dvipdf $^
+
+%-rotated.pdf: %.pdf
+ cp $^ $@
+ for n in 1 2 3; do \
+ pdf90 --outfile tmp.pdf $@; mv tmp.pdf $@; \
+ done
+
+weekCalendar.tex: $(DIARY)
+ $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-week-iso $(NUMBER_OF_WEEKS)) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
+
+monthCalendar1.tex: $(DIARY)
+ $(EMACS) -eval "(progn (calendar) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
+
+monthCalendar2.tex: $(DIARY)
+ $(EMACS) -eval "(progn (calendar) (calendar-forward-month 1) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
+
+monthCalendar3.tex: $(DIARY)
+ $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-month-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
+
+yearCalendar.tex: $(DIARY)
+ $(EMACS) -eval "(progn (calendar) (calendar-forward-month 2) (cal-tex-cursor-year-landscape 1) (with-current-buffer cal-tex-buffer (write-file \"$@\")))"
+
+pocketMod.pdf: $(pocketModFiles)
+ pdfjoin --outfile tmp.pdf $^
+ pdfnup tmp.pdf --outfile $@ --nup 4x2 --frame true
+
+hipsterPDA.pdf: $(hipsterFiles)
+ pdfnup weekCalendar.pdf --outfile page1.pdf --nup 2x2 --frame true
+ pdfjoin --outfile tmp.pdf monthCalendar[1-3]-rotated.pdf yearCalendar-rotated.pdf
+ pdfnup tmp.pdf --outfile page2.pdf --nup 2x2 --frame true
+ pdfjoin --outfile $@ page1.pdf page2.pdf
+
+clean:
+ rm -rf *.aux *.dvi *.tex *.log *.pdf
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/.gitignore b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/.gitignore
new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/.gitignore
@@ -0,0 +1 @@
+*~
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.org b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.org
new file mode 100644
index 0000000..d28fc90
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.org
@@ -0,0 +1,79 @@
+Static MathJax v0.1 README
+#+AUTHOR: Jan Böcker <jan.boecker@jboecker.de>
+
+Static MathJax is a XULRunner application which loads a HTML input
+file that uses MathJax into a browser, waits until MathJax is done
+processing, and then writes the formatted result to an output HTML
+file.
+
+I have only tested exports from Emacs Org-mode as input files. (As of
+2010-08-14, MathJax is used by default with HTML exports in the
+current Org development version.)
+
+Optionally, references to the math fonts used will be converted to
+"data:" URIs, thus embedding the font data into the HTML file itself.
+(see [[http://en.wikipedia.org/wiki/Data_URI_scheme]])
+
+The code is licensed under the GNU General Public License version
+2, or, at your option, any later version.
+
+
+* Usage
+ To run Static MathJax, an existing XULRunner installation is
+ required. From the directory to which you unpacked Static MathJax,
+ run:
+
+ xulrunner application.ini <--embed-fonts | --final-mathjax-url <URL>>
+ <input file> <output file>
+
+ If you prefer to call "staticmathjax" instead of "xulrunner
+ application.ini", link xulrunner-stub into the directory:
+ ln /usr/lib/xulrunner-1.9.2.8/xulrunner-stub ./staticmathjax
+
+ - input file ::
+ name of the input file (the result of a HTML export
+ from Org-mode). It is assumed that this file uses the
+ UTF-8 character encoding.
+
+ - output file ::
+ name of the output file.
+
+ - --embed-fonts ::
+ if specified, the math fonts will be embedded into
+ the output file using data: URIs
+
+ - --final-mathjax-url <URL> ::
+ if --embed-fonts is not specified, this
+ must be the URL to a MathJax installation folder (e.g. "MathJax"
+ if MathJax is installed in a subdirectory, or
+ "http://orgmode.org/mathjax" to use the version hosted on the Org
+ website.
+
+ All references to math fonts in the output file will point to
+ this directory.
+
+* Caveats
+
+ The input file must not use a MathJax installation on the
+ web. Otherwise, due to a security feature of Firefox, MathJax will
+ fallback to image fonts. If you have unpacked MathJax to a
+ subdirectory "MathJax", specify the following in your Org file:
+
+ #+MathJax: path:"MathJax"
+
+ The math is rendered in Firefox, so MathJax applies its
+ Firefox-specific settings. When viewing the output files in other
+ browsers, it will look slightly different than the result that
+ running MathJax in that browser would produce.
+
+ Internet Explorer does not use the correct font, because it only
+ supports the EOT font format. For all other browsers (including
+ Firefox), MathJax uses the OTF font format.
+
+ Embedding fonts into the HTML file wastes some space due to the
+ base64 encoding used in data: URIs.
+
+ I have found no way to access stdout or set an exit code in an
+ XULRunner app, so any code which calls Static MathJax has no idea if
+ processing was successful and when an error occurs, graphical
+ message boxes are displayed.
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.txt b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.txt
new file mode 100644
index 0000000..cbcaea1
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/README.txt
@@ -0,0 +1,91 @@
+ Static MathJax v0.1 README
+ ==========================
+
+Author: Jan Böcker <jan.boecker@jboecker.de>
+Date: 2010-08-15 13:53:39 CEST
+
+
+Static MathJax is a XULRunner application which loads a HTML input
+file that uses MathJax into a browser, waits until MathJax is done
+processing, and then writes the formatted result to an output HTML
+file.
+
+I have only tested exports from Emacs Org-mode as input files. (As of
+2010-08-14, MathJax is used by default with HTML exports in the
+current Org development version.)
+
+Optionally, references to the math fonts used will be converted to
+"data:" URIs, thus embedding the font data into the HTML file itself.
+(see [http://en.wikipedia.org/wiki/Data_URI_scheme])
+
+The code is licensed under the GNU General Public License version
+2, or, at your option, any later version.
+
+
+Table of Contents
+=================
+1 Usage
+2 Caveats
+
+
+1 Usage
+~~~~~~~~
+ To run Static MathJax, an existing XULRunner installation is
+ required. From the directory to which you unpacked Static MathJax,
+ run:
+
+ xulrunner application.ini <--embed-fonts | --final-mathjax-url <URL>>
+ <input file> <output file>
+
+ If you prefer to call "staticmathjax" instead of "xulrunner
+ application.ini", link xulrunner-stub into the directory:
+ ln /usr/lib/xulrunner-1.9.2.8/xulrunner-stub ./staticmathjax
+
+ input file:
+ name of the input file (the result of a HTML export
+ from Org-mode). It is assumed that this file uses the
+ UTF-8 character encoding.
+
+ output file:
+ name of the output file.
+
+ --embed-fonts:
+ if specified, the math fonts will be embedded into
+ the output file using data: URIs
+
+ --final-mathjax-url <URL>:
+ if --embed-fonts is not specified, this
+ must be the URL to a MathJax installation folder (e.g. "MathJax"
+ if MathJax is installed in a subdirectory, or
+ "[http://orgmode.org/mathjax]" to use the version hosted on the Org
+ website.
+
+ All references to math fonts in the output file will point to
+ this directory.
+
+2 Caveats
+~~~~~~~~~~
+
+ The input file must not use a MathJax installation on the
+ web. Otherwise, due to a security feature of Firefox, MathJax will
+ fallback to image fonts. If you have unpacked MathJax to a
+ subdirectory "MathJax", specify the following in your Org file:
+
+ #+MathJax: path:"MathJax"
+
+ The math is rendered in Firefox, so MathJax applies its
+ Firefox-specific settings. When viewing the output files in other
+ browsers, it will look slightly different than the result that
+ running MathJax in that browser would produce.
+
+ Internet Explorer does not use the correct font, because it only
+ supports the EOT font format. For all other browsers (including
+ Firefox), MathJax uses the OTF font format.
+
+ Embedding fonts into the HTML file wastes some space due to the
+ base64 encoding used in data: URIs.
+
+ I have found no way to access stdout or set an exit code in an
+ XULRunner app, so any code which calls Static MathJax has no idea if
+ processing was successful and when an error occurs, graphical
+ message boxes are displayed.
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/application.ini b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/application.ini
new file mode 100644
index 0000000..d7957b0
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/application.ini
@@ -0,0 +1,11 @@
+[App]
+Vendor=Jan Boecker
+Name=StaticMathJax
+Version=0.2
+BuildID=2
+Copyright=Copyright (c) 2010 Jan Boecker
+ID=xulapp@jboecker.de
+
+[Gecko]
+MinVersion=1.8
+
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest
new file mode 100644
index 0000000..a05d8c8
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/chrome.manifest
@@ -0,0 +1 @@
+content staticmathjax file:content/
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js
new file mode 100644
index 0000000..2e71f3b
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.js
@@ -0,0 +1,198 @@
+var docFrame;
+var logtextbox;
+var destFile;
+var embedFonts = false;
+var finalMathJaxURL = null;
+
+function log(text)
+{
+ logtextbox.setAttribute("value", logtextbox.getAttribute("value") + "\n" + text);
+}
+
+function init()
+{
+ try {
+ docFrame = document.getElementById("docFrame");
+ logtextbox = document.getElementById("logtextbox");
+
+ // parse command line arguments
+ var cmdLine = window.arguments[0];
+ cmdLine = cmdLine.QueryInterface(Components.interfaces.nsICommandLine);
+
+ embedFonts = cmdLine.handleFlag("embed-fonts", false);
+ finalMathJaxURL = cmdLine.handleFlagWithParam("final-mathjax-url", false);
+
+ if (!embedFonts && !finalMathJaxURL) {
+ alert("You must eiher specify --embed-fonts or --final-mathjax-url");
+ window.close();
+ return;
+ }
+
+ sourceFilePath = cmdLine.getArgument(0);
+ destFilePath = cmdLine.getArgument(1);
+ if ( !sourceFilePath || !destFilePath ) {
+ alert("Not enough parameters, expecting two arguments:\nInput file, output file");
+ window.close();
+ return;
+ }
+
+ sourceFile = cmdLine.resolveFile(sourceFilePath);
+ if (! (sourceFile.exists() && sourceFile.isFile()) ) {
+ alert("Invalid source file path.");
+ window.close();
+ return;
+ }
+ sourceURI = cmdLine.resolveURI(sourceFilePath);
+
+ // create a nsIFile object for the output file
+ try{
+ destFile = cmdLine.resolveURI(destFilePath).QueryInterface(Components.interfaces.nsIFileURL).file;
+ }catch(e){
+ alert("Invalid destination file.\n\nException:\n" + e);
+ window.close();
+ return;
+ }
+
+ // add iframeLoaded() as an onload event handler, then navigate to the source file
+ docFrame.addEventListener("DOMContentLoaded", iframeLoaded, true);
+ docFrame.setAttribute("src", sourceURI.spec);
+
+ } catch (e) {
+ alert("Error in init():\n\n" + e);
+ window.close();
+ return;
+ }
+}
+
+function iframeLoaded()
+{
+ /*
+ // print every MathJax signal to the log
+ docFrame.contentWindow.MathJax.Hub.Startup.signal.Interest(
+ function (message) {log("Startup: "+message)}
+ );
+ docFrame.contentWindow.MathJax.Hub.signal.Interest(
+ function (message) {log("Hub: "+message)}
+ );
+ */
+
+ // tell MathJax to call serialize() when finished
+ docFrame.contentWindow.MathJax.Hub.Register.StartupHook("End", function() {serialize();});
+}
+
+function fileURLtoDataURI(url)
+{
+ var ios = Components.classes["@mozilla.org/network/io-service;1"]
+ .getService(Components.interfaces.nsIIOService);
+ var url_object = ios.newURI(url, "", null);
+ var file = url_object.QueryInterface(Components.interfaces.nsIFileURL).file;
+
+ var data = "";
+ var fstream = Components.classes["@mozilla.org/network/file-input-stream;1"].
+ createInstance(Components.interfaces.nsIFileInputStream);
+ fstream.init(file, -1, -1, false);
+ var bstream = Components.classes["@mozilla.org/binaryinputstream;1"].
+ createInstance(Components.interfaces.nsIBinaryInputStream);
+ bstream.setInputStream(fstream);
+
+ var bytes = bstream.readBytes(bstream.available());
+ b64bytes = btoa(bytes);
+
+ return "data:;base64," + b64bytes;
+
+}
+
+function serialize()
+{
+ var MathJaxURL = docFrame.contentWindow.MathJax.Hub.config.root;
+
+ var searchURIList = new Array();
+ var replacementURIList = new Array();
+
+ log("serialize: preprocessing");
+
+ // remove the MathJax status message window
+ msgdiv = docFrame.contentDocument.getElementById("MathJax_Message");
+ msgdiv.parentNode.removeChild(msgdiv);
+
+ /* Loop through all CSS rules to find all @font-face rules.
+ At this point, they refer to local absolute paths using file:// URLs.
+ Replace them either with appropriate URLs relative to finalMathJaxURL
+ or with data URIs. */
+
+ for (var i = 0; i<docFrame.contentDocument.styleSheets.length; i++) {
+ var stylesheet = docFrame.contentDocument.styleSheets[i];
+
+ for (var j=0; j< stylesheet.cssRules.length; j++) {
+ var rule = stylesheet.cssRules[j];
+ if (rule.cssText.match("font-face")) {
+
+ url = rule.style.getPropertyValue("src");
+ url = url.match(/url\(\"(.+)\"\)/)[1];
+
+ // Since the properties seem read-only here, we populate
+ // searchURIList and replacementURIList to do text substitution
+ // after serialization
+ searchURIList.push(url);
+ if (embedFonts) {
+ replacementURIList.push(fileURLtoDataURI(url));
+ } else {
+ replacementURIList.push(url.replace(MathJaxURL, finalMathJaxURL));
+ }
+ }
+ }
+ }
+
+
+ // find and remove the MathJax <script> tag
+ try{
+ var scriptTags = docFrame.contentDocument.getElementsByTagName("script");
+ for (var i=0; i<scriptTags.length; i++) {
+ if (scriptTags[i].getAttribute("src") && scriptTags[i].getAttribute("src").match(/MathJax.js/i))
+ scriptTags[i].parentNode.removeChild(scriptTags[i]);
+ }
+ }catch(e){alert(e);}
+
+ log("serialize: serializing");
+
+ var serializer = new XMLSerializer();
+ var xhtml = serializer.serializeToString(docFrame.contentDocument);
+
+ log("serialize: postprocessing");
+ // make the MathJax URL relative again
+ // xhtml = xhtml.replace(findMathJaxURL, "MathJax");
+
+ try{
+ r1 = RegExp("&lt;!--/\\*--&gt;&lt;!\\[CDATA\\[/\\*&gt;&lt;!--\\*/", "g");
+ xhtml = xhtml.replace(r1, "");
+ r2 = RegExp("/\\*\\]\\]&gt;\\*/--&gt;", "g");
+ xhtml = xhtml.replace(r2, "");
+ r3 = RegExp("/\\*\\]\\]&gt;\\*///--&gt;", "g");
+ xhtml = xhtml.replace(r3, "");
+ }catch(e){alert(e);}
+ for (var i=0; i<searchURIList.length; i++)
+ xhtml = xhtml.replace(searchURIList[i], replacementURIList[i]);
+
+ save(xhtml);
+ window.close();
+}
+
+function save(xhtml)
+{
+ try {
+ var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
+ createInstance(Components.interfaces.nsIFileOutputStream);
+
+ foStream.init(destFile, 0x02 | 0x08 | 0x20, 0666, 0);
+ // write, create, truncate
+
+ // write in UTF-8 encoding
+ var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].
+ createInstance(Components.interfaces.nsIConverterOutputStream);
+ converter.init(foStream, "UTF-8", 0, 0);
+ converter.writeString(xhtml);
+ converter.close(); // this closes foStream
+ } catch (e) {
+ alert("Error in save():\n\n" + e);
+ }
+}
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.xul b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.xul
new file mode 100644
index 0000000..35a00f2
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/chrome/content/main.xul
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<window onload="init();" id="main" title="Static MathJax" width="300" height="300"
+xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script language="JavaScript" src="chrome://staticmathjax/content/main.js"/>
+
+ <browser flex="1" id="docFrame" src="" style="background-color:white;"/>
+ <textbox flex="1" id="logtextbox" multiline="true" style="display:none;"/>
+</window>
diff --git a/.emacs.d/org-7.4/contrib/scripts/staticmathjax/defaults/preferences/prefs.js b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/defaults/preferences/prefs.js
new file mode 100644
index 0000000..0532ce0
--- /dev/null
+++ b/.emacs.d/org-7.4/contrib/scripts/staticmathjax/defaults/preferences/prefs.js
@@ -0,0 +1 @@
+pref("toolkit.defaultChromeURI", "chrome://staticmathjax/content/main.xul");