r111154 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111153‎ | r111154 | r111155 >
Date:13:30, 10 February 2012
Author:demon
Status:deferred
Tags:
Comment:
Move WikiTex to the attic
Modified paths:
  • /trunk/ATTIC/wikitex (added) (history)
  • /trunk/wikitex (deleted) (history)

Diff [purge]

Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/TODO
@@ -0,0 +1,463 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 2.0-beta TODO
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+ http://wikisophia.org
 15+
 16+
 17+
 18+ ABSTRACT
 19+
 20+ Things to do (exigenda) and things done
 21+ (exacta) are recorded here.
 22+
 23+
 24+
 25+23 January 2007
 26+
 27+
 28+
 29+
 30+
 31+
 32+
 33+
 34+
 35+
 36+
 37+
 38+
 39+
 40+
 41+
 42+
 43+
 44+
 45+
 46+
 47+
 48+
 49+
 50+
 51+
 52+
 53+
 54+
 55+
 56+
 57+
 58+
 59+
 60+
 61+
 62+
 63+
 64+
 65+
 66+
 67+
 68+
 69+
 70+
 71+TODO -i- WikiTeX 2.0-beta
 72+
 73+
 74+ Table of Contents
 75+
 76+
 77+1. Exigenda . . . . . . . . . . . . . . . . . . . . . . 1
 78+ 1.1. Generic . . . . . . . . . . . . . . . . . . . 1
 79+ 1.2. Server . . . . . . . . . . . . . . . . . . . 1
 80+ 1.3. Client . . . . . . . . . . . . . . . . . . . 1
 81+ 1.4. Documentation . . . . . . . . . . . . . . . . 1
 82+ 1.5. Handler . . . . . . . . . . . . . . . . . . . 1
 83+2. Exacta . . . . . . . . . . . . . . . . . . . . . . . 2
 84+ 2.1. Generic . . . . . . . . . . . . . . . . . . . 2
 85+ 2.1.1. Cache . . . . . . . . . . . . . . . . 3
 86+ 2.2. Server . . . . . . . . . . . . . . . . . . . 3
 87+ 2.3. Client . . . . . . . . . . . . . . . . . . . 4
 88+ 2.3.1. Cache . . . . . . . . . . . . . . . . 4
 89+ 2.4. Documentation . . . . . . . . . . . . . . . . 4
 90+3. Copyright . . . . . . . . . . . . . . . . . . . . . 4
 91+4. Colophon . . . . . . . . . . . . . . . . . . . . . . 5
 92+
 93+
 94+
 95+
 96+
 97+
 98+
 99+
 100+
 101+
 102+
 103+
 104+
 105+
 106+
 107+
 108+
 109+
 110+
 111+
 112+
 113+
 114+
 115+
 116+
 117+
 118+
 119+
 120+
 121+
 122+
 123+
 124+
 125+
 126+
 127+
 128+
 129+
 130+
 131+ 23 January 2007
 132+
 133+
 134+
 135+
 136+
 137+
 138+TODO -1- WikiTeX 2.0-beta
 139+
 140+
 141+
 142+
 143+
 144+ WikiTeX 2.0-beta TODO
 145+
 146+ Peter Danenberg <pcd at wikitex dot org>
 147+ http://wikisophia.org
 148+
 149+
 150+1. Exigenda
 151+
 152+ 1.1. Generic
 153+
 154+ 1.2. Server
 155+
 156+ Crontab
 157+ Crontab to delete daily cruft (left over from
 158+ over-ambitious users who outstrip resources,
 159+ causing files.
 160+
 161+ Actions
 162+ Plenary Classes
 163+
 164+ Install
 165+ Replace ad-hoc installations by copytree;
 166+ fail on directory existence.
 167+
 168+ 1.3. Client
 169+
 170+ 1.4. Documentation
 171+
 172+ Territory
 173+ Copyright notices, etc.
 174+
 175+ Permissions
 176+ Work with MediaWiki to restrict usage
 177+ (optionally) to certain classes of users.
 178+
 179+ XML-RPC-lib
 180+ Add fallback-support for phpxmlrpc or Incutio
 181+ for those with little control over their
 182+ installations, willing to take a performance
 183+ hit.
 184+
 185+ 1.5. Handler
 186+
 187+ Database
 188+ Swap out home-brew lock system for some
 189+ heavy-duty piece-of-shit (mysql, say; post-
 190+ gre; or even sqlite3).
 191+
 192+
 193+
 194+
 195+
 196+
 197+
 198+ 23 January 2007
 199+
 200+
 201+
 202+
 203+
 204+TODO -2- WikiTeX 2.0-beta
 205+
 206+
 207+2. Exacta
 208+
 209+ Packaging
 210+ Combine both server and client into a common pack-
 211+ age, or utterly segregated (thus possibly not con-
 212+ fusing the client-users)?
 213+
 214+ Latter: combined source; `src' directory: con-
 215+ tains: `client', `server'.
 216+
 217+ PHP-client
 218+ Basic request working; now to do something useful
 219+ with it.
 220+
 221+ Temp-dir
 222+ Does cleanup happen after exceptions? (The object
 223+ is deleted, after all.)
 224+
 225+ Yes.
 226+
 227+ Python Apache-handler
 228+ Trader Joe acts as a middle-man between locally
 229+ running, unprivileged, chrooted servers and the
 230+ requesting public.
 231+
 232+ More efficient? Possibly; will rebuke the prema-
 233+ ture optimization for now.
 234+
 235+ THANKS
 236+ Get Erik in there. Hephaistos, Hermes Charmophron,
 237+ Apollon, Hestia, Hera, Athena, dodeka Theoi.
 238+
 239+ Footer/Header
 240+ WikiTeX <VERSION> in footers or headers, across
 241+ from date
 242+
 243+ Honest work in subserver
 244+ Invocation of latex, dvipng
 245+
 246+ Web install
 247+ Installs into web-root and changes ownership.
 248+
 249+ Title page
 250+ ms-macro to institute title page (include with
 251+ .so)
 252+
 253+ License
 254+ Includable ms-file for license (.so)
 255+
 256+ 2.1. Generic
 257+
 258+
 259+
 260+
 261+
 262+
 263+
 264+ 23 January 2007
 265+
 266+
 267+
 268+
 269+
 270+TODO -3- WikiTeX 2.0-beta
 271+
 272+
 273+ 2.1.1. Cache
 274+
 275+ Purview
 276+ Client-, server-side or both?
 277+
 278+ Failure
 279+ Problem: in 1.0+, failed rendering don't
 280+ get cached and are rerendered every day.
 281+
 282+ Distinguish, therefore, between server-
 283+ and syntax-failures; and cache accord-
 284+ ingly.
 285+
 286+ No: a simple flag PHP side will turn
 287+ on/off error caching; functioning sys-
 288+ tems can turn it off for performance,
 289+ and for debugging purposes: back on.
 290+
 291+ It may be useful to distinguish between
 292+ temporary and permanent errors, now that
 293+ we have ad-hoc classes.
 294+
 295+ 2.2. Server
 296+
 297+ Debug
 298+ build_scripts command which takes --debug and
 299+ disables optimization in wikitex-main.py
 300+
 301+ No: rather a wikitex/main.py, and two trivial
 302+ wrappers: wikitex and wikitex- debug, which
 303+ are invoked with `python -O' and `python'
 304+ respectively.
 305+
 306+ IP-throttle
 307+ Database of author vs. time
 308+
 309+ setrlimit
 310+ Per-request (post droppriv)
 311+
 312+ MIME-types
 313+ Currently a non-descript list in Constants;
 314+ instantiate MIME-wrappers with well-defined
 315+ instance variables.
 316+
 317+ Delivery
 318+ Client-server contract for the delivery of
 319+ content (keys for XMLRPC response); encode in
 320+ a format parseable by PHP: XML, say?
 321+
 322+ Right now: using an implicit contract (image:
 323+ content). A low-tech published API may suf-
 324+ fice.
 325+
 326+
 327+
 328+
 329+
 330+ 23 January 2007
 331+
 332+
 333+
 334+
 335+
 336+TODO -4- WikiTeX 2.0-beta
 337+
 338+
 339+ 2.3. Client
 340+
 341+ Source
 342+ `errors' directory to house the manifold.
 343+
 344+ Authentication
 345+ CURL-lib on PHP can handle basic and key-
 346+ based.
 347+
 348+ Errors
 349+ Unified error presentation.
 350+
 351+ Documentation
 352+ Own PHP-client documentation, or combined
 353+ with server's (current).
 354+
 355+ 2.3.1. Cache
 356+
 357+ Purview
 358+ Use MediaWiki mechanism with its over-
 359+ head, or some ad-hoc system?
 360+
 361+ MediaWiki
 362+ MediaWiki mechanism: must be tweaked to
 363+ forbid arbitrary upload; but can detect
 364+ orphaned files: Special:Unusedimages.
 365+
 366+ Must forge, apparently, a subclass of
 367+ WebRequest, filling in artificial val-
 368+ ues.
 369+
 370+ Home-brew
 371+ Own mechanism: lightweight; but respon-
 372+ sibility (cruft).
 373+
 374+ 2.4. Documentation
 375+
 376+ README Mon Jan 22 08:36:11 PST 2007
 377+ Installation
 378+
 379+ Build Sun Jan 21 01:46:55 PST 2007
 380+ Build target in Setup.py which invokes the
 381+ Makefile in doc.
 382+
 383+3. Copyright
 384+
 385+ WikiTeX: expansible LaTeX module for MediaWiki
 386+ Copyright (C) 2004-7 Peter Danenberg
 387+
 388+ You should have received a copy of the GNU General
 389+ Public License along with this program; if not, write
 390+ to the Free Software Foundation, Inc., 51 Franklin
 391+ Street, Fifth Floor, Boston, MA 02110-1301, USA.
 392+
 393+
 394+
 395+
 396+ 23 January 2007
 397+
 398+
 399+
 400+
 401+
 402+TODO -5- WikiTeX 2.0-beta
 403+
 404+
 405+4. Colophon
 406+
 407+ This document was prepared in GNU troff using the
 408+ ms macro package; preprocessed with tbl, the table for-
 409+ matter; and lastly filtered through col to remove
 410+ reverse line feeds and tabs:
 411+
 412+ groff -ms -t -Tascii SOURCE | col -bx > OUT
 413+
 414+ Automatically generated contents were moved from page
 415+ last to first with an ad-hoc bash-diddy.
 416+
 417+
 418+
 419+
 420+
 421+
 422+
 423+
 424+
 425+
 426+
 427+
 428+
 429+
 430+
 431+
 432+
 433+
 434+
 435+
 436+
 437+
 438+
 439+
 440+
 441+
 442+
 443+
 444+
 445+
 446+
 447+
 448+
 449+
 450+
 451+
 452+
 453+
 454+
 455+
 456+
 457+
 458+
 459+
 460+
 461+
 462+ 23 January 2007
 463+
 464+
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/dot/wikitex.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/dot/wikitex.png
___________________________________________________________________
Added: svn:mime-type
1465 + application/octet-stream
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/dot/wikitex.dot
@@ -0,0 +1,33 @@
 2+#!/usr/bin/env fdp
 3+// WikiTeX: expansible LaTeX module for MediaWiki
 4+// Copyright (C) 2004-7 Peter Danenberg
 5+// See doc/COPYING for details.
 6+digraph wikitex {
 7+ graph [splines=true]
 8+ edge [dir=none]
 9+ net [label="Das Intarweb", style=dotted]
 10+ client [label="Other client"]
 11+ subgraph cluster_php {
 12+ graph [label="PHP"]
 13+ mediawiki [label="MediaWiki client"]
 14+ }
 15+ subgraph cluster_apache {
 16+ graph [label="Apache"]
 17+ handler [label="Trader Joe"]
 18+ }
 19+ subgraph cluster_python {
 20+ graph [label="Python"]
 21+ latex [label="LaTeX-daemon"]
 22+ gnuplot [label="gnuplot-daemon"]
 23+ lilypond [label="LilyPond-daemon"]
 24+ }
 25+ daemon [label="Other daemon"]
 26+ net -> mediawiki [label="http"]
 27+ net -> client
 28+ mediawiki -> handler [label="XML-RPC"]
 29+ client -> handler
 30+ handler -> latex
 31+ handler -> gnuplot
 32+ handler -> lilypond
 33+ handler -> daemon
 34+}
Property changes on: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/dot/wikitex.dot
___________________________________________________________________
Added: svn:executable
135 + *
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/colophon.ms
@@ -0,0 +1,13 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.so heading.ms
 8+.XH 1 Colophon
 9+.PP
 10+This document was prepared in GNU troff using the ms macro package; preprocessed with tbl, the table formatter; and lastly filtered through col to remove reverse line feeds and tabs:
 11+.QP
 12+groff -ms -t -Tascii SOURCE | col -bx > OUT
 13+.LP
 14+Automatically generated contents were moved from page last to first with an ad-hoc bash-diddy.
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/Makefile.in
@@ -0,0 +1,33 @@
 2+# WikiTeX: expansible LaTeX module for MediaWiki
 3+# Copyright (C) 2004-7 Peter Danenberg
 4+# See doc/COPYING for details.
 5+VERSION=%(version)s
 6+TARGET=..
 7+GROFF=groff -ms -Tascii
 8+GRFLAGS=-ms -Tascii
 9+COL=col
 10+COFLAGS=-bx
 11+CP=cp
 12+CPFLAGS=-v
 13+REORDER=./reorder.sh
 14+DOCS=TODO THANKS README
 15+ALL=title.ms COPYING ${DOCS}
 16+
 17+.SUFFIXES: .ms
 18+
 19+all: ${ALL}
 20+
 21+title.ms: title.in.ms
 22+ sed -e "s/@VERSION@/${VERSION}/g" ${?} > ${@}
 23+
 24+COPYING: COPYING.ms
 25+ ${GROFF} ${GRFLAGS} ${<} | ${COL} ${COFLAGS} > ${@} && \
 26+ ${CP} ${CPFLAGS} ${@} ${TARGET}
 27+
 28+.ms :
 29+ ${GROFF} ${GRFLAGS} ${<} | ${COL} ${COFLAGS} > ${@:=.tmp} && \
 30+ ${REORDER} ${@:=.tmp} > ${@} && \
 31+ ${CP} ${CPFLAGS} ${@} ${TARGET}
 32+
 33+clean:
 34+ rm -vf ${ALL} ${DOCS:=.tmp}
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/TODO.ms
@@ -0,0 +1,137 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.so header.ms
 8+.TI TODO "Things to do (exigenda) and things done (exacta) are recorded \
 9+here."
 10+.XH 1 Exigenda
 11+.
 12+.XH 2 Generic
 13+.
 14+.XH 2 Server
 15+.IP Crontab
 16+Crontab to delete daily cruft (left over from over-ambitious users who
 17+outstrip resources, causing files.
 18+.IP Actions
 19+Plenary Classes
 20+.IP Install
 21+Replace ad-hoc installations by copytree; fail on directory existence.
 22+.
 23+.XH 2 Client
 24+.
 25+.XH 2 Documentation
 26+.IP Territory
 27+Copyright notices, etc.
 28+.IP Permissions
 29+Work with MediaWiki to restrict usage (optionally) to certain classes of
 30+users.
 31+.IP XML-RPC-lib
 32+Add fallback-support for phpxmlrpc or Incutio for those with little
 33+control over their installations, willing to take a performance hit.
 34+.
 35+.XH 2 Handler
 36+.IP Database
 37+Swap out home-brew lock system for some heavy-duty piece-of-shit (mysql,
 38+say; postgre; or even sqlite3).
 39+.
 40+.XH 1 Exacta
 41+.IP Packaging
 42+Combine both server and client into a common package, or utterly segregated
 43+(thus possibly not confusing the client-users)?
 44+.IP
 45+Latter: combined source; `src' directory: contains: `client', `server'.
 46+.IP PHP-client
 47+Basic request working; now to do something useful with it.
 48+.IP Temp-dir
 49+Does cleanup happen after exceptions? (The object is deleted, after all.)
 50+.IP
 51+Yes.
 52+.IP "Python Apache-handler"
 53+Trader Joe acts as a middle-man between locally running, unprivileged,
 54+chrooted servers and the requesting public.
 55+.IP
 56+More efficient? Possibly; will rebuke the premature optimization for now.
 57+.IP THANKS
 58+Get Erik in there. Hephaistos, Hermes Charmophron, Apollon, Hestia, Hera,
 59+Athena, dodeka Theoi.
 60+.IP Footer/Header
 61+WikiTeX <VERSION> in footers or headers, across from date
 62+.IP "Honest work in subserver"
 63+Invocation of latex, dvipng
 64+.IP "Web install"
 65+Installs into web-root and changes ownership.
 66+.IP "Title page"
 67+ms-macro to institute title page (include with .so)
 68+.IP License
 69+Includable ms-file for license (.so)
 70+.
 71+.XH 2 Generic
 72+.
 73+.XH 3 Cache
 74+.IP Purview
 75+Client-, server-side or both?
 76+.IP Failure
 77+Problem: in 1.0+, failed rendering don't get cached and are rerendered
 78+every day.
 79+.IP
 80+Distinguish, therefore, between server- and syntax-failures; and cache
 81+accordingly.
 82+.IP
 83+No: a simple flag PHP side will turn on/off error caching; functioning
 84+systems can turn it off for performance, and for debugging purposes:
 85+back on.
 86+.IP
 87+It may be useful to distinguish between temporary and permanent errors,
 88+now that we have ad-hoc classes.
 89+.
 90+.XH 2 Server
 91+.IP Debug
 92+build_scripts command which takes --debug and disables optimization in
 93+wikitex-main.py
 94+.IP
 95+No: rather a wikitex/main.py, and two trivial wrappers: wikitex and wikitex-
 96+debug, which are invoked with `python -O' and `python' respectively.
 97+.IP IP-throttle
 98+Database of author vs. time
 99+.IP setrlimit
 100+Per-request (post droppriv)
 101+.IP MIME-types
 102+Currently a non-descript list in Constants; instantiate MIME-wrappers
 103+with well-defined instance variables.
 104+.IP Delivery
 105+Client-server contract for the delivery of content (keys for XMLRPC
 106+response); encode in a format parseable by PHP: XML, say?
 107+.IP
 108+Right now: using an implicit contract (image: content). A low-tech
 109+published API may suffice.
 110+.
 111+.XH 2 Client
 112+.IP Source
 113+`errors' directory to house the manifold.
 114+.IP Authentication
 115+CURL-lib on PHP can handle basic and key-based.
 116+.IP Errors
 117+Unified error presentation.
 118+.IP Documentation
 119+Own PHP-client documentation, or combined with server's (current).
 120+.
 121+.XH 3 Cache
 122+.IP Purview
 123+Use MediaWiki mechanism with its overhead, or some ad-hoc system?
 124+.IP MediaWiki
 125+MediaWiki mechanism: must be tweaked to forbid arbitrary upload; but can
 126+detect orphaned files: Special:Unusedimages.
 127+.IP
 128+Must forge, apparently, a subclass of WebRequest, filling in artificial
 129+values.
 130+.IP Home-brew
 131+Own mechanism: lightweight; but responsibility (cruft).
 132+.
 133+.XH 2 Documentation
 134+.IP "README Mon Jan 22 08:36:11 PST 2007"
 135+Installation
 136+.IP "Build Sun Jan 21 01:46:55 PST 2007"
 137+Build target in Setup.py which invokes the Makefile in doc.
 138+.so footer.ms
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/title.in.ms
@@ -0,0 +1,22 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.de TI
 8+.RP
 9+.\" Rethink headers/footers
 10+.DA
 11+.ds LH \\$1
 12+.ds RH WikiTeX @VERSION@
 13+.P1
 14+.TL
 15+WikiTeX @VERSION@ \\$1
 16+.AU
 17+Peter Danenberg <pcd at wikitex dot org>
 18+.AI
 19+http://wikisophia.org
 20+.AB
 21+\\$2
 22+.AE
 23+..
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/COPYING.ms
@@ -0,0 +1,246 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.TL
 8+GNU GENERAL PUBLIC LICENSE
 9+.br
 10+Version 2, June 1991
 11+.LP
 12+Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 13+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 14+.CD
 15+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
 16+.br
 17+MODIFICATION
 18+.DE
 19+.nr i -1 1
 20+.IP \n+i.
 21+This License applies to any program or other work which contains
 22+a notice placed by the copyright holder saying it may be distributed
 23+under the terms of this General Public License. The "Program", below,
 24+refers to any such program or work, and a "work based on the Program"
 25+means either the Program or any derivative work under copyright law:
 26+that is to say, a work containing the Program or a portion of it,
 27+either verbatim or with modifications and/or translated into another
 28+language. (Hereinafter, translation is included without limitation in
 29+the term "modification".) Each licensee is addressed as "you".
 30+.IP
 31+Activities other than copying, distribution and modification are not
 32+covered by this License; they are outside its scope. The act of
 33+running the Program is not restricted, and the output from the Program
 34+is covered only if its contents constitute a work based on the
 35+Program (independent of having been made by running the Program).
 36+Whether that is true depends on what the Program does.
 37+.IP \n+i.
 38+You may copy and distribute verbatim copies of the Program's
 39+source code as you receive it, in any medium, provided that you
 40+conspicuously and appropriately publish on each copy an appropriate
 41+copyright notice and disclaimer of warranty; keep intact all the
 42+notices that refer to this License and to the absence of any warranty;
 43+and give any other recipients of the Program a copy of this License
 44+along with the Program.
 45+.IP
 46+You may charge a fee for the physical act of transferring a copy, and
 47+you may at your option offer warranty protection in exchange for a fee.
 48+.IP \n+i.
 49+You may modify your copy or copies of the Program or any portion
 50+of it, thus forming a work based on the Program, and copy and
 51+distribute such modifications or work under the terms of Section 1
 52+above, provided that you also meet all of these conditions:
 53+.nr j 0 1
 54+.af j a
 55+.RS
 56+.IP \n+j.
 57+You must cause the modified files to carry prominent notices
 58+stating that you changed the files and the date of any change.
 59+.IP \n+j.
 60+You must cause any work that you distribute or publish, that in
 61+whole or in part contains or is derived from the Program or any
 62+part thereof, to be licensed as a whole at no charge to all third
 63+parties under the terms of this License.
 64+.IP \n+j.
 65+If the modified program normally reads commands interactively
 66+when run, you must cause it, when started running for such
 67+interactive use in the most ordinary way, to print or display an
 68+announcement including an appropriate copyright notice and a
 69+notice that there is no warranty (or else, saying that you provide
 70+a warranty) and that users may redistribute the program under
 71+these conditions, and telling the user how to view a copy of this
 72+License. (Exception: if the Program itself is interactive but
 73+does not normally print such an announcement, your work based on
 74+the Program is not required to print an announcement.)
 75+.RE
 76+.IP
 77+These requirements apply to the modified work as a whole. If
 78+identifiable sections of that work are not derived from the Program,
 79+and can be reasonably considered independent and separate works in
 80+themselves, then this License, and its terms, do not apply to those
 81+sections when you distribute them as separate works. But when you
 82+distribute the same sections as part of a whole which is a work based
 83+on the Program, the distribution of the whole must be on the terms of
 84+this License, whose permissions for other licensees extend to the
 85+entire whole, and thus to each and every part regardless of who wrote it.
 86+.IP
 87+Thus, it is not the intent of this section to claim rights or contest
 88+your rights to work written entirely by you; rather, the intent is to
 89+exercise the right to control the distribution of derivative or
 90+collective works based on the Program.
 91+.IP
 92+In addition, mere aggregation of another work not based on the Program
 93+with the Program (or with a work based on the Program) on a volume of
 94+a storage or distribution medium does not bring the other work under
 95+the scope of this License.
 96+.IP \n+i.
 97+You may copy and distribute the Program (or a work based on it,
 98+under Section 2) in object code or executable form under the terms of
 99+Sections 1 and 2 above provided that you also do one of the following:
 100+.RS
 101+.nr j 0 1
 102+.IP \n+j.
 103+Accompany it with the complete corresponding machine-readable
 104+source code, which must be distributed under the terms of Sections
 105+1 and 2 above on a medium customarily used for software interchange; or,
 106+.IP \n+j.
 107+Accompany it with a written offer, valid for at least three
 108+years, to give any third party, for a charge no more than your
 109+cost of physically performing source distribution, a complete
 110+machine-readable copy of the corresponding source code, to be
 111+distributed under the terms of Sections 1 and 2 above on a medium
 112+customarily used for software interchange; or,
 113+.IP \n+j.
 114+Accompany it with the information you received as to the offer
 115+to distribute corresponding source code. (This alternative is
 116+allowed only for noncommercial distribution and only if you
 117+received the program in object code or executable form with such
 118+an offer, in accord with Subsection b above.)
 119+.RE
 120+.IP
 121+The source code for a work means the preferred form of the work for
 122+making modifications to it. For an executable work, complete source
 123+code means all the source code for all modules it contains, plus any
 124+associated interface definition files, plus the scripts used to
 125+control compilation and installation of the executable. However, as a
 126+special exception, the source code distributed need not include
 127+anything that is normally distributed (in either source or binary
 128+form) with the major components (compiler, kernel, and so on) of the
 129+operating system on which the executable runs, unless that component
 130+itself accompanies the executable.
 131+.IP
 132+If distribution of executable or object code is made by offering
 133+access to copy from a designated place, then offering equivalent
 134+access to copy the source code from the same place counts as
 135+distribution of the source code, even though third parties are not
 136+compelled to copy the source along with the object code.
 137+.IP \n+i.
 138+You may not copy, modify, sublicense, or distribute the Program
 139+except as expressly provided under this License. Any attempt
 140+otherwise to copy, modify, sublicense or distribute the Program is
 141+void, and will automatically terminate your rights under this License.
 142+However, parties who have received copies, or rights, from you under
 143+this License will not have their licenses terminated so long as such
 144+parties remain in full compliance.
 145+.IP \n+i.
 146+You are not required to accept this License, since you have not
 147+signed it. However, nothing else grants you permission to modify or
 148+distribute the Program or its derivative works. These actions are
 149+prohibited by law if you do not accept this License. Therefore, by
 150+modifying or distributing the Program (or any work based on the
 151+Program), you indicate your acceptance of this License to do so, and
 152+all its terms and conditions for copying, distributing or modifying
 153+the Program or works based on it.
 154+.IP \n+i.
 155+Each time you redistribute the Program (or any work based on the
 156+Program), the recipient automatically receives a license from the
 157+original licensor to copy, distribute or modify the Program subject to
 158+these terms and conditions. You may not impose any further
 159+restrictions on the recipients' exercise of the rights granted herein.
 160+You are not responsible for enforcing compliance by third parties to
 161+this License.
 162+.IP \n+i.
 163+If, as a consequence of a court judgment or allegation of patent
 164+infringement or for any other reason (not limited to patent issues),
 165+conditions are imposed on you (whether by court order, agreement or
 166+otherwise) that contradict the conditions of this License, they do not
 167+excuse you from the conditions of this License. If you cannot
 168+distribute so as to satisfy simultaneously your obligations under this
 169+License and any other pertinent obligations, then as a consequence you
 170+may not distribute the Program at all. For example, if a patent
 171+license would not permit royalty-free redistribution of the Program by
 172+all those who receive copies directly or indirectly through you, then
 173+the only way you could satisfy both it and this License would be to
 174+refrain entirely from distribution of the Program.
 175+.IP
 176+If any portion of this section is held invalid or unenforceable under
 177+any particular circumstance, the balance of the section is intended to
 178+apply and the section as a whole is intended to apply in other
 179+circumstances.
 180+.IP
 181+It is not the purpose of this section to induce you to infringe any
 182+patents or other property right claims or to contest validity of any
 183+such claims; this section has the sole purpose of protecting the
 184+integrity of the free software distribution system, which is
 185+implemented by public license practices. Many people have made
 186+generous contributions to the wide range of software distributed
 187+through that system in reliance on consistent application of that
 188+system; it is up to the author/donor to decide if he or she is willing
 189+to distribute software through any other system and a licensee cannot
 190+impose that choice.
 191+.IP
 192+This section is intended to make thoroughly clear what is believed to
 193+be a consequence of the rest of this License.
 194+.IP \n+i.
 195+If the distribution and/or use of the Program is restricted in
 196+certain countries either by patents or by copyrighted interfaces, the
 197+original copyright holder who places the Program under this License
 198+may add an explicit geographical distribution limitation excluding
 199+those countries, so that distribution is permitted only in or among
 200+countries not thus excluded. In such case, this License incorporates
 201+the limitation as if written in the body of this License.
 202+.IP \n+i.
 203+The Free Software Foundation may publish revised and/or new versions
 204+of the General Public License from time to time. Such new versions will
 205+be similar in spirit to the present version, but may differ in detail to
 206+address new problems or concerns.
 207+.IP
 208+Each version is given a distinguishing version number. If the Program
 209+specifies a version number of this License which applies to it and "any
 210+later version", you have the option of following the terms and conditions
 211+either of that version or of any later version published by the Free
 212+Software Foundation. If the Program does not specify a version number of
 213+this License, you may choose any version ever published by the Free Software
 214+Foundation.
 215+.IP \n+i.
 216+If you wish to incorporate parts of the Program into other free
 217+programs whose distribution conditions are different, write to the author
 218+to ask for permission. For software which is copyrighted by the Free
 219+Software Foundation, write to the Free Software Foundation; we sometimes
 220+make exceptions for this. Our decision will be guided by the two goals
 221+of preserving the free status of all derivatives of our free software and
 222+of promoting the sharing and reuse of software generally.
 223+.SH
 224+NO WARRANTY
 225+.IP \n+i.
 226+BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 227+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
 228+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
 229+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
 230+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 231+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
 232+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
 233+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
 234+REPAIR OR CORRECTION.
 235+.IP \n+i.
 236+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
 237+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
 238+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
 239+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
 240+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
 241+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
 242+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 243+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 244+POSSIBILITY OF SUCH DAMAGES.
 245+.CD
 246+END OF TERMS AND CONDITIONS
 247+.DE
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/THANKS.ms
@@ -0,0 +1,34 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.so header.ms
 8+.TI THANKS "Those gods and things thanked (gratulatus)."
 9+.XH 1 Gratulati
 10+.XH 2 Dii
 11+.IP Hephaistos
 12+Piety
 13+.IP "Hermes Charmophron"
 14+Genius
 15+.IP Hestia
 16+Home
 17+.IP "Apollon Hekebole"
 18+Insight
 19+.IP Here
 20+Gameia
 21+.IP "Pallas Athene"
 22+Summachia
 23+.IP Asklepios
 24+Corporal sanity
 25+.XH 2 Homines
 26+.IP "Genevieve Danenberg"
 27+Thanks, above all, to my transcendent wife; co-authrix of Beisammensein.
 28+.IP "Erik Moeller"
 29+Advocacy amongst Wikimedians
 30+.XH 2 Instituta
 31+.IP "Information Sciences Institute"
 32+Unmolestation
 33+.IP "University of Southern California"
 34+Abstraction
 35+.so footer.ms
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/copyright.ms
@@ -0,0 +1,15 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.so heading.ms
 8+.XH 1 Copyright
 9+.LP
 10+WikiTeX: expansible LaTeX module for MediaWiki
 11+.br
 12+Copyright \(co 2004-7 Peter Danenberg
 13+.PP
 14+You should have received a copy of the GNU General Public License
 15+along with this program; if not, write to the Free Software
 16+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/header.ms
@@ -0,0 +1,11 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.so heading.ms
 8+.so title.ms
 9+.\" Footnotes-numbers trailed by `.'.
 10+.nr FF 1
 11+.\" Redefine footnote-numberer to have enclosing braces.
 12+.ds * [\\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]]
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/README.ms
@@ -0,0 +1,253 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.so header.ms
 8+.TI README "README covers hortation and installation."
 9+.XH 1 Prerequisites S 0
 10+.XH 2 Client
 11+.IP \(bu
 12+MediaWiki
 13+.IP \(bu
 14+PHP compiled with curl and xmlrpc\**
 15+.FS
 16+We'd like to remove the curl- and xmlrpc-requirements in the future by providing an (albeit slower) XML-RPC fallback like phpxmlrpc or Incutio.
 17+.FE
 18+.XH 2 Server
 19+.IP \(bu
 20+Apache
 21+.IP \(bu
 22+mod_python
 23+.IP \(bu
 24+teTeX and dvipng (or TeX Live)
 25+.IP \(bu
 26+Python 2.5\**
 27+.FS
 28+We take advantage of with-statements which will become native in 2.6.
 29+.FE
 30+.XH 1 Installation
 31+.PP
 32+If you'd merely like to connect to a WikiTeX server, read Client Installation and forget the rest. If you'd like to set up your own server, on the other hand, read it all.
 33+.XH 2 Client
 34+.nr i 0 1
 35+.IP \n+i.
 36+Copy <wikitex>/src/client/mediawiki to:
 37+.IP
 38+.RS
 39+<mediawiki>/extensions/wikitex
 40+.RE
 41+.IP \n+i.
 42+Copy config/default.php to config/local.php.
 43+.IP \n+i.
 44+Edit local.php to satisfaction.
 45+.IP \n+i.
 46+To <mediawiki>/LocalSettings.php, add:
 47+.IP
 48+.RS
 49+\%include_once('./extensions/wikitex/main.php');
 50+.RE
 51+.PP
 52+There's also an optional install_client target included in the Python-distribution.
 53+.XH 2 Server
 54+.nr i 0 1
 55+.IP \n+i.
 56+Copy src/server/wikitex/config/default.py to:
 57+.IP
 58+.RS
 59+src/server/wikitex/config/local.py
 60+.RE
 61+.IP \n+i.
 62+Edit local.py to satisfaction.\**
 63+.FS
 64+See section 3, Configuration.
 65+.FE
 66+.IP \n+i.
 67+Run:
 68+.IP
 69+.RS
 70+python setup.py build
 71+.RE
 72+.IP
 73+and:
 74+.IP
 75+.RS
 76+sudo python setup.py install
 77+.RE
 78+.IP \n+i.
 79+(Optional) Mount /usr/local/var/wikitex on its own partition with NOSUID.
 80+.IP \n+i.
 81+Set up a chroot environment in /usr/local/var/wikitex/latex for teTeX and dvipng.\**
 82+.FS
 83+See section 4, Chroot.
 84+.FE
 85+.IP \n+i.
 86+Within the chroot, edit texmf.cnf to read:
 87+.IP
 88+.RS
 89+shell_escape = f
 90+.br
 91+openout_any = p
 92+.br
 93+openin_any = p
 94+.RE
 95+.IP \n+i.
 96+???
 97+.IP \n+i.
 98+Profit!
 99+.XH 2 Handler
 100+.PP
 101+The Apache-handler mediates between the client and chrooted daemons; it requires mod_python.
 102+.nr i 0 1
 103+.IP \n+i.
 104+Install mod_python,\**
 105+.FS
 106+http://www.modpython.org
 107+.FE
 108+if necessary.
 109+.IP \n+i.
 110+You may need to edit the .htaccess which was installed, by default, in:
 111+.IP
 112+.RS
 113+\%/usr/local/apache2/htdocs/wikitex/.htaccess
 114+.RE
 115+.XH 1 Execution
 116+.PP
 117+`wikitex' and `wikitex-debug' are installed by default in /usr/local/bin. They both take `start' and `stop' as arguments, but `wikitex-debug' provides some additional output to the syslog and keeps all work directories intact in /usr/local/var/wikitex/latex/tmp for inspection.
 118+.PP
 119+`wikitex', on the other hand, cleans up work directories (except in cases of resource-faults); and prints minimally to syslog.
 120+.PP
 121+`wikitex' and `wikitex-debug' need to be run as root to chroot into the rendering environment, but drop privileges immediately to wikitex:wikitex.
 122+.XH 1 Configuration
 123+.XH 2 Directories
 124+.PP
 125+WikiTeX allows relatively fine-tuned control over the install-location, and provides some reasonable defaults.
 126+.XH 2 Users
 127+.PP
 128+WikiTeX also allows the ability to specify the nonprivileged user to whom it will drop after detaching from the console; it should be distinct from the Apache user, and ideally ad-hoc.
 129+.XH 2 Facilities
 130+.PP
 131+Please inspect the facilities section to make sure that they correspond to your chroot environment; in particular, you will need to specify absolute paths to binaries.
 132+.XH 2 Resources
 133+.PP
 134+WikiTeX's resource managament has three layers: internal, kernel-enforced and per-user.
 135+.XH 3 Internal
 136+.PP
 137+The `default_wait' dictionary provides fine-grained control over signals sent to runaway processes; `default_wait' works over and above RLIMIT_CPU, whose effects can be hard to predict.
 138+.XH 3 Kernel-Enforced
 139+.PP
 140+Read more about kernel-limits in `man setrlimit'; WikiTeX includes fairly Draconian policies which may need to be relaxed for production-sites.
 141+.XH 3 Per-User
 142+.PP
 143+`ctime_unit' and `max_ctime_per_unit' provide ways to limit resource-usage from particular users. WikiTeX calculates how much CPU-time a user has usurped within one `ctime_unit'; if its usage exceeds `max_ctime_per_unit' with that unit of time, the request is temporarily denied.
 144+.PP
 145+The upshot is that users may have to submit several requests to complete a particularly time-consuming document.
 146+.XH 1 Chroot
 147+.PP
 148+Chrooting is art and science; and can be risky if, for instance, you leave suid-binaries lying around.
 149+.PP
 150+That said, jailkit\**
 151+.FS
 152+http://olivier.sessink.nl/jailkit
 153+.FE
 154+and makejail\**
 155+.FS
 156+http://www.floc.net/makejail
 157+.FE
 158+are useful utilities.
 159+.XH 2 teTeX
 160+.PP
 161+By way of example, the following outlines how dvipng and teTeX were chrooted on our local machine.
 162+.nr i 0 1
 163+.IP \n+i.
 164+Install teTeX relative to the chroot, passing the following to configure; where <root> corresponds to /usr/local/var/wikitex/latex (or similar):
 165+.IP
 166+.RS
 167+\&./configure --disable-multiplatform \\
 168+.br
 169+--prefix=<root>/usr/local/teTeX
 170+.RE
 171+.IP \n+i.
 172+Similarly for dvipng:
 173+.IP
 174+.RS
 175+\&./configure --prefix=<root>/usr/local
 176+.RE
 177+.IP \n+i.
 178+Finally, these libraries were necessary on Fedora Core 6 (your mileage may vary):
 179+.RS
 180+.LD
 181+/lib/libm.so.6
 182+/lib/libexpat.so.0
 183+/lib/libdl-2.5.so
 184+/lib/libexpat.so.0.5.0
 185+/lib/libgcc_s.so.1
 186+/lib/libstdc++.so.6
 187+/lib/ld-2.5.so
 188+/lib/libm-2.5.so
 189+/lib/libc-2.5.so
 190+/lib/ld-linux.so.2
 191+/lib/libdl.so.2
 192+/lib/libc.so.6
 193+/lib/libtermcap.so.2
 194+/usr/lib/libfontconfig.so.1
 195+/usr/lib/libgd.so.2
 196+/usr/lib/libjpeg.so.62
 197+/usr/lib/libX11.so.6.2.0
 198+/usr/lib/libz.so.1
 199+/usr/lib/libgd.so.2.0.0
 200+/usr/lib/libXpm.so.4.11.0
 201+/usr/lib/libpng12.so.0.10.0
 202+/usr/lib/libXau.so.6.0.0
 203+/usr/lib/libfontconfig.so.1.1.0
 204+/usr/lib/libXau.so.6
 205+/usr/lib/libXpm.so.4
 206+/usr/lib/libXdmcp.so.6.0.0
 207+/usr/lib/libX11.so.6
 208+/usr/lib/libXdmcp.so.6
 209+/usr/lib/libfreetype.so.6.3.10
 210+/usr/lib/libjpeg.so.62.0.0
 211+/usr/lib/libz.so.1.2.3
 212+/usr/lib/libpng12.so.0
 213+/usr/lib/libfreetype.so.6
 214+/etc/ld.so.cache
 215+.DE
 216+.RE
 217+.XH 2 "TeX Live"
 218+.PP
 219+Alternatively, TeX Live\**
 220+.FS
 221+http://www.tug.org/texlive
 222+.FE
 223+provides a statically-linked dvipng in its full installation, and significantly reduces the library-overhead.
 224+.PP
 225+When running `install-tl.sh', supply the following (or similar) for TEXDIR:
 226+.QP
 227+\%/usr/local/var/wikitex/latex/usr/local/texlive
 228+.PP
 229+The latex-facility in local.py may need to be adjusted accordingly; for instance:
 230+.QP
 231+\%/usr/local/texlive/bin/i386-linux/latex
 232+.LP
 233+in lieu of /usr/local/teTeX/bin/latex.
 234+.XH 1 Architecture
 235+.PP
 236+In short, an XML-RPC client (e.g., the MediaWiki-client) connects to the mod_python frontend (\(lqTrader Joe\(rq) served by Apache.
 237+.PP
 238+Trader Joe, in turn, connects to autonomous, unprivileged, chrooted d\(aemons sitting on arbitrary machines, that actually render the content.
 239+.PP
 240+After authentication,\**
 241+.FS
 242+Trader Joe uses basic-, but key-based-auth should be possible using curl's transport-layer.
 243+.FE
 244+but before Trader Joe befrays the rendering drones, he checks an IP->CPU-time database to see whether the client has used up their allotted rendering time.
 245+.LD
 246+ LaTeX-d\(aemon
 247+ /
 248+client<--(auth)-->traderjoe<--(resource)-->LilyPond-d\(aemon
 249+ \\
 250+ ...-d\(aemon
 251+.DE
 252+.PP
 253+The d\(aemons should not be accessible to the intarweb at large.
 254+.so footer.ms
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/reorder.sh
@@ -0,0 +1,29 @@
 2+#!/usr/bin/env bash
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+#
 6+# Reorders groff output from cover, body, toc to cover, toc, body.
 7+# Stream-based alternative, with separate functions for cover, toc and body
 8+# could be done in one pass with multiple file descriptors. Also: a slightly
 9+# more intelligent solution using csplit with offsets.
 10+declare -r USAGE="Usage: reorder.sh DOC\nOrder groff-DOC in cover, toc, body."
 11+declare -r DOC="${1}"
 12+declare -ri FAIL=1
 13+# Heuristic: lines-per-page in groff-ms-ascii.
 14+# Dynamic alternative: parse wc output from a blank
 15+# page run in groff.
 16+declare -ri LPP=66
 17+
 18+(( ${#} )) || {
 19+ echo -e "${USAGE}" 1>&2
 20+ exit $FAIL
 21+}
 22+
 23+# Output title page
 24+head -n $LPP "${DOC}"
 25+
 26+# Output contents
 27+tail -n $LPP "${DOC}"
 28+
 29+# Output body
 30+tail -n +$LPP "${DOC}" | head -n -$LPP
Property changes on: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/reorder.sh
___________________________________________________________________
Added: svn:executable
131 + *
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/footer.ms
@@ -0,0 +1,8 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.so copyright.ms
 8+.so colophon.ms
 9+.XHE
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/src/heading.ms
@@ -0,0 +1,80 @@
 2+.ig
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+Copyright (C) 2004-7 Peter Danenberg
 5+See doc/COPYING for details.
 6+..
 7+.\" ms-macro to produce numbered heading and insert the same into the
 8+.\" table of contents; also: indent accordingly.
 9+.
 10+.\" Document will be followed by `.XHE' to reset indentation
 11+.\" and include TOC.
 12+.
 13+.\" Art schon included, baby? (`.if r': groff extension.)
 14+.if r XH*I .nx
 15+.nr XH*I 1
 16+.de EI \" Equalize indent
 17+.nr ei*ti \\$1 \" Target indent
 18+.\" Define current indent if not defined (not usually defined until the
 19+.\" first `.RS'.
 20+.if !r \\n[.ev]:il \{\
 21+. if r DB .tm \\n[.ev]:il not defined
 22+. nr \\n[.ev]:il 0
 23+.\}
 24+.\" If the target indent and current indent are equal, there is
 25+.\" no work to be done.
 26+.if (\\n[ei*ti]=\\n[\\n[.ev]:il]) \{\
 27+. if r DB .tm ei*d and .ev:il are identical
 28+. return
 29+.\}
 30+.\" If the target indent is greater than the current indent,
 31+.\" we need to `.RS' up to it.
 32+.if (\\n[ei*ti]>\\n[\\n[.ev]:il]) \{\
 33+. if r DB .tm ei*d is @RS
 34+. als ei*d @RS \" RS causes stack overflow
 35+.\}
 36+.\" If the target indent is less than the current indent,
 37+.\" we need to `.RE' down to it.
 38+.if (\\n[ei*ti]<\\n[\\n[.ev]:il]) \{\
 39+. if r DB .tm ei*d is @RE
 40+. als ei*d @RE
 41+.\}
 42+.while !(\\n[ei*ti]=\\n[\\n[.ev]:il]) \{\
 43+. if r DB .tm applying ei*d
 44+. ei*d
 45+.\}
 46+..
 47+.\" Argument thus supplied should be: 1) depth; 2) the symbolic heading
 48+.\" and TOC-entry. Includes an optional `S xx [xx [...]] a la `.NH'
 49+.\" to micromanage the section-number.
 50+.de XH
 51+.nr xh*i \\$1
 52+.ds xh*h \\$2
 53+.EI \\n[xh*i]-1
 54+.ie '\\$3'S' \{\
 55+. shift 3
 56+. NH S \\$@
 57+.\}
 58+.el \{\
 59+. NH \\n[xh*i]
 60+.\}
 61+\\*[xh*h]
 62+.\" Preliminary tabs before each entry in XS, corresponding to level.
 63+.ds xh*tabs
 64+.nr xh*tablevel 1
 65+.while \\n[nh*hl]>\\n[xh*tablevel] \{\
 66+. nr xh*tablevel +1
 67+. as xh*tabs \t
 68+.\}
 69+.XS
 70+\\*[xh*tabs]\\*[SN] \\*[xh*h]
 71+.XE
 72+.EI \\n[xh*i]
 73+..
 74+.\" Reduces the current ident to nil and displays TOC.
 75+.de XHE
 76+.EI 0
 77+.TC
 78+..
 79+.\" End-of-input trap to show the TOC (doesn't work: gets cut off,
 80+.\" I presume after the `.bp').
 81+.em XHE
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/COPYING
@@ -0,0 +1,396 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ GNU GENERAL PUBLIC LICENSE
 12+ Version 2, June 1991
 13+
 14+
 15+Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51
 16+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 17+
 18+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
 19+ MODIFICATION
 20+
 21+
 22+0. This License applies to any program or other work which
 23+ contains a notice placed by the copyright holder saying
 24+ it may be distributed under the terms of this General
 25+ Public License. The "Program", below, refers to any
 26+ such program or work, and a "work based on the Program"
 27+ means either the Program or any derivative work under
 28+ copyright law: that is to say, a work containing the
 29+ Program or a portion of it, either verbatim or with
 30+ modifications and/or translated into another language.
 31+ (Hereinafter, translation is included without limita-
 32+ tion in the term "modification".) Each licensee is
 33+ addressed as "you".
 34+
 35+ Activities other than copying, distribution and modifi-
 36+ cation are not covered by this License; they are out-
 37+ side its scope. The act of running the Program is not
 38+ restricted, and the output from the Program is covered
 39+ only if its contents constitute a work based on the
 40+ Program (independent of having been made by running the
 41+ Program). Whether that is true depends on what the
 42+ Program does.
 43+
 44+1. You may copy and distribute verbatim copies of the Pro-
 45+ gram's source code as you receive it, in any medium,
 46+ provided that you conspicuously and appropriately pub-
 47+ lish on each copy an appropriate copyright notice and
 48+ disclaimer of warranty; keep intact all the notices
 49+ that refer to this License and to the absence of any
 50+ warranty; and give any other recipients of the Program
 51+ a copy of this License along with the Program.
 52+
 53+ You may charge a fee for the physical act of transfer-
 54+ ring a copy, and you may at your option offer warranty
 55+ protection in exchange for a fee.
 56+
 57+2. You may modify your copy or copies of the Program or
 58+ any portion of it, thus forming a work based on the
 59+ Program, and copy and distribute such modifications or
 60+ work under the terms of Section 1 above, provided that
 61+ you also meet all of these conditions:
 62+
 63+
 64+
 65+
 66+
 67+
 68+
 69+
 70+
 71+ -2-
 72+
 73+
 74+ a. You must cause the modified files to carry promi-
 75+ nent notices stating that you changed the files
 76+ and the date of any change.
 77+
 78+ b. You must cause any work that you distribute or
 79+ publish, that in whole or in part contains or is
 80+ derived from the Program or any part thereof, to
 81+ be licensed as a whole at no charge to all third
 82+ parties under the terms of this License.
 83+
 84+ c. If the modified program normally reads commands
 85+ interactively when run, you must cause it, when
 86+ started running for such interactive use in the
 87+ most ordinary way, to print or display an
 88+ announcement including an appropriate copyright
 89+ notice and a notice that there is no warranty (or
 90+ else, saying that you provide a warranty) and that
 91+ users may redistribute the program under these
 92+ conditions, and telling the user how to view a
 93+ copy of this License. (Exception: if the Program
 94+ itself is interactive but does not normally print
 95+ such an announcement, your work based on the Pro-
 96+ gram is not required to print an announcement.)
 97+
 98+ These requirements apply to the modified work as a
 99+ whole. If identifiable sections of that work are not
 100+ derived from the Program, and can be reasonably consid-
 101+ ered independent and separate works in themselves, then
 102+ this License, and its terms, do not apply to those sec-
 103+ tions when you distribute them as separate works. But
 104+ when you distribute the same sections as part of a
 105+ whole which is a work based on the Program, the distri-
 106+ bution of the whole must be on the terms of this
 107+ License, whose permissions for other licensees extend
 108+ to the entire whole, and thus to each and every part
 109+ regardless of who wrote it.
 110+
 111+ Thus, it is not the intent of this section to claim
 112+ rights or contest your rights to work written entirely
 113+ by you; rather, the intent is to exercise the right to
 114+ control the distribution of derivative or collective
 115+ works based on the Program.
 116+
 117+ In addition, mere aggregation of another work not based
 118+ on the Program with the Program (or with a work based
 119+ on the Program) on a volume of a storage or distribu-
 120+ tion medium does not bring the other work under the
 121+ scope of this License.
 122+
 123+3. You may copy and distribute the Program (or a work
 124+ based on it, under Section 2) in object code or exe-
 125+ cutable form under the terms of Sections 1 and 2 above
 126+ provided that you also do one of the following:
 127+
 128+
 129+
 130+
 131+
 132+
 133+
 134+
 135+
 136+
 137+ -3-
 138+
 139+
 140+ a. Accompany it with the complete corresponding
 141+ machine-readable source code, which must be dis-
 142+ tributed under the terms of Sections 1 and 2 above
 143+ on a medium customarily used for software inter-
 144+ change; or,
 145+
 146+ b. Accompany it with a written offer, valid for at
 147+ least three years, to give any third party, for a
 148+ charge no more than your cost of physically per-
 149+ forming source distribution, a complete machine-
 150+ readable copy of the corresponding source code, to
 151+ be distributed under the terms of Sections 1 and 2
 152+ above on a medium customarily used for software
 153+ interchange; or,
 154+
 155+ c. Accompany it with the information you received as
 156+ to the offer to distribute corresponding source
 157+ code. (This alternative is allowed only for non-
 158+ commercial distribution and only if you received
 159+ the program in object code or executable form with
 160+ such an offer, in accord with Subsection b above.)
 161+
 162+ The source code for a work means the preferred form of
 163+ the work for making modifications to it. For an exe-
 164+ cutable work, complete source code means all the source
 165+ code for all modules it contains, plus any associated
 166+ interface definition files, plus the scripts used to
 167+ control compilation and installation of the executable.
 168+ However, as a special exception, the source code dis-
 169+ tributed need not include anything that is normally
 170+ distributed (in either source or binary form) with the
 171+ major components (compiler, kernel, and so on) of the
 172+ operating system on which the executable runs, unless
 173+ that component itself accompanies the executable.
 174+
 175+ If distribution of executable or object code is made by
 176+ offering access to copy from a designated place, then
 177+ offering equivalent access to copy the source code from
 178+ the same place counts as distribution of the source
 179+ code, even though third parties are not compelled to
 180+ copy the source along with the object code.
 181+
 182+4. You may not copy, modify, sublicense, or distribute the
 183+ Program except as expressly provided under this
 184+ License. Any attempt otherwise to copy, modify, subli-
 185+ cense or distribute the Program is void, and will auto-
 186+ matically terminate your rights under this License.
 187+ However, parties who have received copies, or rights,
 188+ from you under this License will not have their
 189+ licenses terminated so long as such parties remain in
 190+ full compliance.
 191+
 192+5. You are not required to accept this License, since you
 193+ have not signed it. However, nothing else grants you
 194+
 195+
 196+
 197+
 198+
 199+
 200+
 201+
 202+
 203+ -4-
 204+
 205+
 206+ permission to modify or distribute the Program or its
 207+ derivative works. These actions are prohibited by law
 208+ if you do not accept this License. Therefore, by modi-
 209+ fying or distributing the Program (or any work based on
 210+ the Program), you indicate your acceptance of this
 211+ License to do so, and all its terms and conditions for
 212+ copying, distributing or modifying the Program or works
 213+ based on it.
 214+
 215+6. Each time you redistribute the Program (or any work
 216+ based on the Program), the recipient automatically
 217+ receives a license from the original licensor to copy,
 218+ distribute or modify the Program subject to these terms
 219+ and conditions. You may not impose any further
 220+ restrictions on the recipients' exercise of the rights
 221+ granted herein. You are not responsible for enforcing
 222+ compliance by third parties to this License.
 223+
 224+7. If, as a consequence of a court judgment or allegation
 225+ of patent infringement or for any other reason (not
 226+ limited to patent issues), conditions are imposed on
 227+ you (whether by court order, agreement or otherwise)
 228+ that contradict the conditions of this License, they do
 229+ not excuse you from the conditions of this License. If
 230+ you cannot distribute so as to satisfy simultaneously
 231+ your obligations under this License and any other per-
 232+ tinent obligations, then as a consequence you may not
 233+ distribute the Program at all. For example, if a
 234+ patent license would not permit royalty-free redistri-
 235+ bution of the Program by all those who receive copies
 236+ directly or indirectly through you, then the only way
 237+ you could satisfy both it and this License would be to
 238+ refrain entirely from distribution of the Program.
 239+
 240+ If any portion of this section is held invalid or unen-
 241+ forceable under any particular circumstance, the bal-
 242+ ance of the section is intended to apply and the sec-
 243+ tion as a whole is intended to apply in other circum-
 244+ stances.
 245+
 246+ It is not the purpose of this section to induce you to
 247+ infringe any patents or other property right claims or
 248+ to contest validity of any such claims; this section
 249+ has the sole purpose of protecting the integrity of the
 250+ free software distribution system, which is implemented
 251+ by public license practices. Many people have made
 252+ generous contributions to the wide range of software
 253+ distributed through that system in reliance on consis-
 254+ tent application of that system; it is up to the
 255+ author/donor to decide if he or she is willing to dis-
 256+ tribute software through any other system and a
 257+ licensee cannot impose that choice.
 258+
 259+
 260+
 261+
 262+
 263+
 264+
 265+
 266+
 267+
 268+
 269+ -5-
 270+
 271+
 272+ This section is intended to make thoroughly clear what
 273+ is believed to be a consequence of the rest of this
 274+ License.
 275+
 276+8. If the distribution and/or use of the Program is
 277+ restricted in certain countries either by patents or by
 278+ copyrighted interfaces, the original copyright holder
 279+ who places the Program under this License may add an
 280+ explicit geographical distribution limitation excluding
 281+ those countries, so that distribution is permitted only
 282+ in or among countries not thus excluded. In such case,
 283+ this License incorporates the limitation as if written
 284+ in the body of this License.
 285+
 286+9. The Free Software Foundation may publish revised and/or
 287+ new versions of the General Public License from time to
 288+ time. Such new versions will be similar in spirit to
 289+ the present version, but may differ in detail to
 290+ address new problems or concerns.
 291+
 292+ Each version is given a distinguishing version number.
 293+ If the Program specifies a version number of this
 294+ License which applies to it and "any later version",
 295+ you have the option of following the terms and condi-
 296+ tions either of that version or of any later version
 297+ published by the Free Software Foundation. If the Pro-
 298+ gram does not specify a version number of this License,
 299+ you may choose any version ever published by the Free
 300+ Software Foundation.
 301+
 302+10. If you wish to incorporate parts of the Program into
 303+ other free programs whose distribution conditions are
 304+ different, write to the author to ask for permission.
 305+ For software which is copyrighted by the Free Software
 306+ Foundation, write to the Free Software Foundation; we
 307+ sometimes make exceptions for this. Our decision will
 308+ be guided by the two goals of preserving the free sta-
 309+ tus of all derivatives of our free software and of pro-
 310+ moting the sharing and reuse of software generally.
 311+
 312+NO WARRANTY
 313+
 314+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE
 315+ IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED
 316+ BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN
 317+ WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PRO-
 318+ VIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
 319+ EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED
 320+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
 321+ NESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO
 322+ THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
 323+ SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST
 324+ OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 325+
 326+
 327+
 328+
 329+
 330+
 331+
 332+
 333+
 334+
 335+ -6-
 336+
 337+
 338+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
 339+ TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER
 340+ PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
 341+ PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUD-
 342+ ING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
 343+ DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
 344+ PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
 345+ DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
 346+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO
 347+ OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
 348+ OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
 349+ SUCH DAMAGES.
 350+
 351+ END OF TERMS AND CONDITIONS
 352+
 353+
 354+
 355+
 356+
 357+
 358+
 359+
 360+
 361+
 362+
 363+
 364+
 365+
 366+
 367+
 368+
 369+
 370+
 371+
 372+
 373+
 374+
 375+
 376+
 377+
 378+
 379+
 380+
 381+
 382+
 383+
 384+
 385+
 386+
 387+
 388+
 389+
 390+
 391+
 392+
 393+
 394+
 395+
 396+
 397+
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/THANKS
@@ -0,0 +1,265 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 2.0-beta THANKS
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+ http://wikisophia.org
 15+
 16+
 17+
 18+ ABSTRACT
 19+
 20+ Those gods and things thanked (gratulatus).
 21+
 22+
 23+
 24+23 January 2007
 25+
 26+
 27+
 28+
 29+
 30+
 31+
 32+
 33+
 34+
 35+
 36+
 37+
 38+
 39+
 40+
 41+
 42+
 43+
 44+
 45+
 46+
 47+
 48+
 49+
 50+
 51+
 52+
 53+
 54+
 55+
 56+
 57+
 58+
 59+
 60+
 61+
 62+
 63+
 64+
 65+
 66+
 67+
 68+
 69+
 70+
 71+THANKS -i- WikiTeX 2.0-beta
 72+
 73+
 74+ Table of Contents
 75+
 76+
 77+1. Gratulati . . . . . . . . . . . . . . . . . . . . . 1
 78+ 1.1. Dii . . . . . . . . . . . . . . . . . . . . . 1
 79+ 1.2. Homines . . . . . . . . . . . . . . . . . . . 1
 80+ 1.3. Instituta . . . . . . . . . . . . . . . . . . 1
 81+2. Copyright . . . . . . . . . . . . . . . . . . . . . 1
 82+3. Colophon . . . . . . . . . . . . . . . . . . . . . . 2
 83+
 84+
 85+
 86+
 87+
 88+
 89+
 90+
 91+
 92+
 93+
 94+
 95+
 96+
 97+
 98+
 99+
 100+
 101+
 102+
 103+
 104+
 105+
 106+
 107+
 108+
 109+
 110+
 111+
 112+
 113+
 114+
 115+
 116+
 117+
 118+
 119+
 120+
 121+
 122+
 123+
 124+
 125+
 126+
 127+
 128+
 129+
 130+
 131+ 23 January 2007
 132+
 133+
 134+
 135+
 136+
 137+
 138+THANKS -1- WikiTeX 2.0-beta
 139+
 140+
 141+
 142+
 143+
 144+ WikiTeX 2.0-beta THANKS
 145+
 146+ Peter Danenberg <pcd at wikitex dot org>
 147+ http://wikisophia.org
 148+
 149+
 150+1. Gratulati
 151+
 152+ 1.1. Dii
 153+
 154+ Hephaistos
 155+ Piety
 156+
 157+ Hermes Charmophron
 158+ Genius
 159+
 160+ Hestia
 161+ Home
 162+
 163+ Apollon Hekebole
 164+ Insight
 165+
 166+ Here Gameia
 167+
 168+ Pallas Athene
 169+ Summachia
 170+
 171+ Asklepios
 172+ Corporal sanity
 173+
 174+ 1.2. Homines
 175+
 176+ Genevieve Danenberg
 177+ Thanks, above all, to my transcendent wife;
 178+ co-authrix of Beisammensein.
 179+
 180+ Erik Moeller
 181+ Advocacy amongst Wikimedians
 182+
 183+ 1.3. Instituta
 184+
 185+ Information Sciences Institute
 186+ Unmolestation
 187+
 188+ University of Southern California
 189+ Abstraction
 190+
 191+2. Copyright
 192+
 193+ WikiTeX: expansible LaTeX module for MediaWiki
 194+ Copyright (C) 2004-7 Peter Danenberg
 195+
 196+
 197+
 198+ 23 January 2007
 199+
 200+
 201+
 202+
 203+
 204+THANKS -2- WikiTeX 2.0-beta
 205+
 206+
 207+ You should have received a copy of the GNU General
 208+ Public License along with this program; if not, write
 209+ to the Free Software Foundation, Inc., 51 Franklin
 210+ Street, Fifth Floor, Boston, MA 02110-1301, USA.
 211+
 212+3. Colophon
 213+
 214+ This document was prepared in GNU troff using the
 215+ ms macro package; preprocessed with tbl, the table for-
 216+ matter; and lastly filtered through col to remove
 217+ reverse line feeds and tabs:
 218+
 219+ groff -ms -t -Tascii SOURCE | col -bx > OUT
 220+
 221+ Automatically generated contents were moved from page
 222+ last to first with an ad-hoc bash-diddy.
 223+
 224+
 225+
 226+
 227+
 228+
 229+
 230+
 231+
 232+
 233+
 234+
 235+
 236+
 237+
 238+
 239+
 240+
 241+
 242+
 243+
 244+
 245+
 246+
 247+
 248+
 249+
 250+
 251+
 252+
 253+
 254+
 255+
 256+
 257+
 258+
 259+
 260+
 261+
 262+
 263+
 264+ 23 January 2007
 265+
 266+
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/doc/README
@@ -0,0 +1,529 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 2.0-beta README
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+ http://wikisophia.org
 15+
 16+
 17+
 18+ ABSTRACT
 19+
 20+ README covers hortation and installation.
 21+
 22+
 23+
 24+23 January 2007
 25+
 26+
 27+
 28+
 29+
 30+
 31+
 32+
 33+
 34+
 35+
 36+
 37+
 38+
 39+
 40+
 41+
 42+
 43+
 44+
 45+
 46+
 47+
 48+
 49+
 50+
 51+
 52+
 53+
 54+
 55+
 56+
 57+
 58+
 59+
 60+
 61+
 62+
 63+
 64+
 65+
 66+
 67+
 68+
 69+
 70+
 71+README -i- WikiTeX 2.0-beta
 72+
 73+
 74+ Table of Contents
 75+
 76+
 77+0. Prerequisites . . . . . . . . . . . . . . . . . . . 1
 78+ 0.1. Client . . . . . . . . . . . . . . . . . . . 1
 79+ 0.2. Server . . . . . . . . . . . . . . . . . . . 1
 80+1. Installation . . . . . . . . . . . . . . . . . . . . 1
 81+ 1.1. Client . . . . . . . . . . . . . . . . . . . 1
 82+ 1.2. Server . . . . . . . . . . . . . . . . . . . 2
 83+ 1.3. Handler . . . . . . . . . . . . . . . . . . . 2
 84+2. Execution . . . . . . . . . . . . . . . . . . . . . 3
 85+3. Configuration . . . . . . . . . . . . . . . . . . . 3
 86+ 3.1. Directories . . . . . . . . . . . . . . . . . 3
 87+ 3.2. Users . . . . . . . . . . . . . . . . . . . . 3
 88+ 3.3. Facilities . . . . . . . . . . . . . . . . . 3
 89+ 3.4. Resources . . . . . . . . . . . . . . . . . . 3
 90+ 3.4.1. Internal . . . . . . . . . . . . . . . 3
 91+ 3.4.2. Kernel-Enforced . . . . . . . . . . . 4
 92+ 3.4.3. Per-User . . . . . . . . . . . . . . . 4
 93+4. Chroot . . . . . . . . . . . . . . . . . . . . . . . 4
 94+ 4.1. teTeX . . . . . . . . . . . . . . . . . . . . 4
 95+ 4.2. TeX Live . . . . . . . . . . . . . . . . . . 5
 96+5. Architecture . . . . . . . . . . . . . . . . . . . . 6
 97+6. Copyright . . . . . . . . . . . . . . . . . . . . . 6
 98+7. Colophon . . . . . . . . . . . . . . . . . . . . . . 6
 99+
 100+
 101+
 102+
 103+
 104+
 105+
 106+
 107+
 108+
 109+
 110+
 111+
 112+
 113+
 114+
 115+
 116+
 117+
 118+
 119+
 120+
 121+
 122+
 123+
 124+
 125+
 126+
 127+
 128+
 129+
 130+
 131+ 23 January 2007
 132+
 133+
 134+
 135+
 136+
 137+
 138+README -1- WikiTeX 2.0-beta
 139+
 140+
 141+
 142+
 143+
 144+ WikiTeX 2.0-beta README
 145+
 146+ Peter Danenberg <pcd at wikitex dot org>
 147+ http://wikisophia.org
 148+
 149+
 150+0. Prerequisites
 151+
 152+ 0.1. Client
 153+
 154+ o MediaWiki
 155+
 156+ o PHP compiled with curl and xmlrpc[1]
 157+
 158+ 0.2. Server
 159+
 160+ o Apache
 161+
 162+ o mod_python
 163+
 164+ o teTeX and dvipng (or TeX Live)
 165+
 166+ o Python 2.5[2]
 167+
 168+1. Installation
 169+
 170+ If you'd merely like to connect to a WikiTeX
 171+ server, read Client Installation and forget the rest.
 172+ If you'd like to set up your own server, on the other
 173+ hand, read it all.
 174+
 175+ 1.1. Client
 176+
 177+ 1. Copy <wikitex>/src/client/mediawiki to:
 178+
 179+ <mediawiki>/extensions/wikitex
 180+
 181+ 2. Copy config/default.php to config/local.php.
 182+
 183+ 3. Edit local.php to satisfaction.
 184+
 185+ 4. To <mediawiki>/LocalSettings.php, add:
 186+
 187+
 188+-----------
 189+ 1. We'd like to remove the curl- and xmlrpc-
 190+requirements in the future by providing an (albeit
 191+slower) XML-RPC fallback like phpxmlrpc or Incu-
 192+tio.
 193+ 2. We take advantage of with-statements which
 194+will become native in 2.6.
 195+
 196+
 197+
 198+ 23 January 2007
 199+
 200+
 201+
 202+
 203+
 204+README -2- WikiTeX 2.0-beta
 205+
 206+
 207+ include_once('./extensions/wikitex/main.php');
 208+
 209+ There's also an optional install_client tar-
 210+ get included in the Python-distribution.
 211+
 212+ 1.2. Server
 213+
 214+ 1. Copy src/server/wikitex/config/default.py to:
 215+
 216+ src/server/wikitex/config/local.py
 217+
 218+ 2. Edit local.py to satisfaction.[3]
 219+
 220+ 3. Run:
 221+
 222+ python setup.py build
 223+
 224+ and:
 225+
 226+ sudo python setup.py install
 227+
 228+ 4. (Optional) Mount /usr/local/var/wikitex on
 229+ its own partition with NOSUID.
 230+
 231+ 5. Set up a chroot environment in
 232+ /usr/local/var/wikitex/latex for teTeX and
 233+ dvipng.[4]
 234+
 235+ 6. Within the chroot, edit texmf.cnf to read:
 236+
 237+ shell_escape = f
 238+ openout_any = p
 239+ openin_any = p
 240+
 241+ 7. ???
 242+
 243+ 8. Profit!
 244+
 245+ 1.3. Handler
 246+
 247+ The Apache-handler mediates between the
 248+ client and chrooted daemons; it requires
 249+ mod_python.
 250+
 251+ 1. Install mod_python,[5] if necessary.
 252+
 253+ 2. You may need to edit the .htaccess which was
 254+ installed, by default, in:
 255+
 256+
 257+-----------
 258+ 3. See section 3, Configuration.
 259+ 4. See section 4, Chroot.
 260+ 5. http://www.modpython.org
 261+
 262+
 263+
 264+ 23 January 2007
 265+
 266+
 267+
 268+
 269+
 270+README -3- WikiTeX 2.0-beta
 271+
 272+
 273+ /usr/local/apache2/htdocs/wikitex/.htaccess
 274+
 275+2. Execution
 276+
 277+ `wikitex' and `wikitex-debug' are installed by
 278+ default in /usr/local/bin. They both take `start' and
 279+ `stop' as arguments, but `wikitex-debug' provides some
 280+ additional output to the syslog and keeps all work
 281+ directories intact in /usr/local/var/wikitex/latex/tmp
 282+ for inspection.
 283+
 284+ `wikitex', on the other hand, cleans up work
 285+ directories (except in cases of resource-faults); and
 286+ prints minimally to syslog.
 287+
 288+ `wikitex' and `wikitex-debug' need to be run as
 289+ root to chroot into the rendering environment, but drop
 290+ privileges immediately to wikitex:wikitex.
 291+
 292+3. Configuration
 293+
 294+ 3.1. Directories
 295+
 296+ WikiTeX allows relatively fine-tuned control
 297+ over the install-location, and provides some rea-
 298+ sonable defaults.
 299+
 300+ 3.2. Users
 301+
 302+ WikiTeX also allows the ability to specify
 303+ the nonprivileged user to whom it will drop after
 304+ detaching from the console; it should be distinct
 305+ from the Apache user, and ideally ad-hoc.
 306+
 307+ 3.3. Facilities
 308+
 309+ Please inspect the facilities section to make
 310+ sure that they correspond to your chroot environ-
 311+ ment; in particular, you will need to specify
 312+ absolute paths to binaries.
 313+
 314+ 3.4. Resources
 315+
 316+ WikiTeX's resource managament has three lay-
 317+ ers: internal, kernel-enforced and per-user.
 318+
 319+ 3.4.1. Internal
 320+
 321+ The `default_wait' dictionary provides
 322+ fine-grained control over signals sent to
 323+ runaway processes; `default_wait' works over
 324+ and above RLIMIT_CPU, whose effects can be
 325+ hard to predict.
 326+
 327+
 328+
 329+
 330+ 23 January 2007
 331+
 332+
 333+
 334+
 335+
 336+README -4- WikiTeX 2.0-beta
 337+
 338+
 339+ 3.4.2. Kernel-Enforced
 340+
 341+ Read more about kernel-limits in `man
 342+ setrlimit'; WikiTeX includes fairly Draconian
 343+ policies which may need to be relaxed for
 344+ production-sites.
 345+
 346+ 3.4.3. Per-User
 347+
 348+ `ctime_unit' and `max_ctime_per_unit'
 349+ provide ways to limit resource-usage from
 350+ particular users. WikiTeX calculates how
 351+ much CPU-time a user has usurped within one
 352+ `ctime_unit'; if its usage exceeds
 353+ `max_ctime_per_unit' with that unit of time,
 354+ the request is temporarily denied.
 355+
 356+ The upshot is that users may have to
 357+ submit several requests to complete a partic-
 358+ ularly time-consuming document.
 359+
 360+4. Chroot
 361+
 362+ Chrooting is art and science; and can be risky if,
 363+ for instance, you leave suid-binaries lying around.
 364+
 365+ That said, jailkit[6] and makejail[7] are useful
 366+ utilities.
 367+
 368+ 4.1. teTeX
 369+
 370+ By way of example, the following outlines how
 371+ dvipng and teTeX were chrooted on our local
 372+ machine.
 373+
 374+ 1. Install teTeX relative to the chroot, passing
 375+ the following to configure; where <root> cor-
 376+ responds to /usr/local/var/wikitex/latex (or
 377+ similar):
 378+
 379+ ./configure --disable-multiplatform \
 380+ --prefix=<root>/usr/local/teTeX
 381+
 382+ 2. Similarly for dvipng:
 383+
 384+ ./configure --prefix=<root>/usr/local
 385+
 386+ 3. Finally, these libraries were necessary on
 387+ Fedora Core 6 (your mileage may vary):
 388+
 389+ /lib/libm.so.6
 390+-----------
 391+ 6. http://olivier.sessink.nl/jailkit
 392+ 7. http://www.floc.net/makejail
 393+
 394+
 395+
 396+ 23 January 2007
 397+
 398+
 399+
 400+
 401+
 402+README -5- WikiTeX 2.0-beta
 403+
 404+
 405+ /lib/libexpat.so.0
 406+ /lib/libdl-2.5.so
 407+ /lib/libexpat.so.0.5.0
 408+ /lib/libgcc_s.so.1
 409+ /lib/libstdc++.so.6
 410+ /lib/ld-2.5.so
 411+ /lib/libm-2.5.so
 412+ /lib/libc-2.5.so
 413+ /lib/ld-linux.so.2
 414+ /lib/libdl.so.2
 415+ /lib/libc.so.6
 416+ /lib/libtermcap.so.2
 417+ /usr/lib/libfontconfig.so.1
 418+ /usr/lib/libgd.so.2
 419+ /usr/lib/libjpeg.so.62
 420+ /usr/lib/libX11.so.6.2.0
 421+ /usr/lib/libz.so.1
 422+ /usr/lib/libgd.so.2.0.0
 423+ /usr/lib/libXpm.so.4.11.0
 424+ /usr/lib/libpng12.so.0.10.0
 425+ /usr/lib/libXau.so.6.0.0
 426+ /usr/lib/libfontconfig.so.1.1.0
 427+ /usr/lib/libXau.so.6
 428+ /usr/lib/libXpm.so.4
 429+ /usr/lib/libXdmcp.so.6.0.0
 430+ /usr/lib/libX11.so.6
 431+ /usr/lib/libXdmcp.so.6
 432+ /usr/lib/libfreetype.so.6.3.10
 433+ /usr/lib/libjpeg.so.62.0.0
 434+ /usr/lib/libz.so.1.2.3
 435+ /usr/lib/libpng12.so.0
 436+ /usr/lib/libfreetype.so.6
 437+ /etc/ld.so.cache
 438+
 439+
 440+ 4.2. TeX Live
 441+
 442+ Alternatively, TeX Live[8] provides a stati-
 443+ cally-linked dvipng in its full installation, and
 444+ significantly reduces the library-overhead.
 445+
 446+ When running `install-tl.sh', supply the fol-
 447+ lowing (or similar) for TEXDIR:
 448+
 449+ /usr/local/var/wikitex/latex/usr/local/texlive
 450+
 451+ The latex-facility in local.py may need to be
 452+ adjusted accordingly; for instance:
 453+
 454+ /usr/local/texlive/bin/i386-linux/latex
 455+
 456+
 457+-----------
 458+ 8. http://www.tug.org/texlive
 459+
 460+
 461+
 462+ 23 January 2007
 463+
 464+
 465+
 466+
 467+
 468+README -6- WikiTeX 2.0-beta
 469+
 470+
 471+ in lieu of /usr/local/teTeX/bin/latex.
 472+
 473+5. Architecture
 474+
 475+ In short, an XML-RPC client (e.g., the MediaWiki-
 476+ client) connects to the mod_python frontend ("Trader
 477+ Joe") served by Apache.
 478+
 479+ Trader Joe, in turn, connects to autonomous,
 480+ unprivileged, chrooted daemons sitting on arbitrary
 481+ machines, that actually render the content.
 482+
 483+ After authentication,[9] but before Trader Joe
 484+ befrays the rendering drones, he checks an IP->CPU-time
 485+ database to see whether the client has used up their
 486+ allotted rendering time.
 487+
 488+ LaTeX-daemon
 489+ /
 490+ client<--(auth)-->traderjoe<--(resource)-->LilyPond-daemon
 491+ \
 492+ ...-daemon
 493+
 494+
 495+ The daemons should not be accessible to the intar-
 496+ web at large.
 497+
 498+6. Copyright
 499+
 500+ WikiTeX: expansible LaTeX module for MediaWiki
 501+ Copyright (C) 2004-7 Peter Danenberg
 502+
 503+ You should have received a copy of the GNU General
 504+ Public License along with this program; if not, write
 505+ to the Free Software Foundation, Inc., 51 Franklin
 506+ Street, Fifth Floor, Boston, MA 02110-1301, USA.
 507+
 508+7. Colophon
 509+
 510+ This document was prepared in GNU troff using the
 511+ ms macro package; preprocessed with tbl, the table for-
 512+ matter; and lastly filtered through col to remove
 513+ reverse line feeds and tabs:
 514+
 515+ groff -ms -t -Tascii SOURCE | col -bx > OUT
 516+
 517+ Automatically generated contents were moved from page
 518+ last to first with an ad-hoc bash-diddy.
 519+
 520+
 521+
 522+-----------
 523+ 9. Trader Joe uses basic-, but key-based-auth
 524+should be possible using curl's transport-layer.
 525+
 526+
 527+
 528+ 23 January 2007
 529+
 530+
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/setup.py
@@ -0,0 +1,47 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from distutils.core import setup, Extension
 7+from sys import path
 8+
 9+path.insert(0, './src/server')
 10+
 11+from wikitex.config import *
 12+from wikitex.install import install_wikitex
 13+from wikitex.install import install_root
 14+from wikitex.install import install_client
 15+from wikitex.install import install_handler
 16+from wikitex.install import install_scripts
 17+from wikitex.install import install_docs
 18+from wikitex.build import build_wikitex
 19+from wikitex.build import build_docs
 20+from wikitex.build import build_scripts
 21+
 22+setup(name='wikitex',
 23+ version='2.0-beta',
 24+ description='Expansible LaTeX module for MediaWiki',
 25+ long_description=('Server-component of the WikiTeX module, complementary ' +
 26+ 'to the integrated PHP client for MediaWiki.'),
 27+ platforms='Linux',
 28+ license='GPLv2',
 29+ author='Peter Danenberg',
 30+ author_email='<pcd at wikitex dot org>',
 31+ url='http://wikitex.org',
 32+ package_dir={'wikitex': 'src/server/wikitex'},
 33+ packages=['wikitex', 'wikitex.actions', 'wikitex.config'],
 34+ package_data={'wikitex': ['templates/*']},
 35+ data_files=[(Config.web, ['src/handler/.htaccess',
 36+ 'src/handler/traderjoe.py'])],
 37+ cmdclass={'build': build_wikitex,
 38+ 'build_docs': build_docs,
 39+ 'build_scripts': build_scripts,
 40+ 'install': install_wikitex,
 41+ 'install_root': install_root,
 42+ # We don't do client by default
 43+ 'install_client': install_client,
 44+ 'install_handler': install_handler,
 45+ 'install_scripts': install_scripts,
 46+ 'install_docs': install_docs,
 47+ }
 48+ )
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/gnuplot-4.0.0-no-system.patch
@@ -0,0 +1,202 @@
 2+--- gnuplot-4.0.0-orig/src/command.c 2004-04-13 06:00:01.000000000 -0700
 3+@@ -1846,9 +1846,7 @@ do_shell()
 4+ screen_ok = FALSE;
 5+ c_token++;
 6+
 7+- if ((vaxc$errno = lib$spawn()) != SS$_NORMAL) {
 8+- os_error(NO_CARET, "spawn error");
 9+- }
 10++ return;
 11+ }
 12+
 13+
 14+@@ -1856,21 +1854,7 @@ static void
 15+ do_system(cmd)
 16+ const char *cmd;
 17+ {
 18+-
 19+- if (!cmd)
 20+- return;
 21+-
 22+- /* input_line is filled by read_line or load_file, but
 23+- * line_desc length is set only by read_line; adjust now
 24+- */
 25+- line_desc.dsc$w_length = strlen(cmd);
 26+- line_desc.dsc$a_pointer = (char *) cmd;
 27+-
 28+- if ((vaxc$errno = lib$spawn(&line_desc)) != SS$_NORMAL)
 29+- os_error(NO_CARET, "spawn error");
 30+-
 31+- (void) putc('\n', stderr);
 32+-
 33++ return;
 34+ }
 35+ #endif /* VMS */
 36+
 37+@@ -2092,43 +2076,13 @@ do_system(cmd)
 38+ const char *cmd;
 39+ {
 40+ # ifdef AMIGA_AC_5
 41+- static char *parms[80];
 42+- if (!cmd)
 43+- return;
 44+- getparms(input_line + 1, parms);
 45+- fexecv(parms[0], parms);
 46++ return;
 47+ # elif (defined(ATARI) && defined(__GNUC__))
 48+-/* || (defined(MTOS) && defined(__GNUC__)) */
 49+- /* use preloaded shell, if available */
 50+- short (*shell_p) (char *command);
 51+- void *ssp;
 52+-
 53+- if (!cmd)
 54+- return;
 55+-
 56+- ssp = (void *) Super(NULL);
 57+- shell_p = *(short (**)(char *)) 0x4f6;
 58+- Super(ssp);
 59+-
 60+- /* this is a bit strange, but we have to have a single if */
 61+- if (shell_p)
 62+- (*shell_p) (cmd);
 63+- else
 64+- system(cmd);
 65++ return;
 66+ # elif defined(_Windows) && defined(USE_OWN_WINSYSTEM_FUNCTION)
 67+- if (!cmd)
 68+- return;
 69+- winsystem(cmd);
 70++ return;
 71+ # else /* !(AMIGA_AC_5 || ATARI && __GNUC__ || _Windows) */
 72+-/* (am, 19980929)
 73+- * OS/2 related note: cmd.exe returns 255 if called w/o argument.
 74+- * i.e. calling a shell by "!" will always end with an error message.
 75+- * A workaround has to include checking for EMX,OS/2, two environment
 76+- * variables,...
 77+- */
 78+- if (!cmd)
 79+- return;
 80+- system(cmd);
 81++ return;
 82+ # endif /* !(AMIGA_AC_5 || ATARI&&__GNUC__ || _Windows) */
 83+ }
 84+
 85+@@ -2234,16 +2188,7 @@ do_shell()
 86+ screen_ok = FALSE;
 87+ c_token++;
 88+
 89+- if (user_shell) {
 90+-# if defined(_Windows)
 91+- if (WinExec(user_shell, SW_SHOWNORMAL) <= 32)
 92+-# elif defined(DJGPP)
 93+- if (system(user_shell) == -1)
 94+-# else
 95+- if (spawnl(P_WAIT, user_shell, NULL) == -1)
 96+-# endif /* !(_Windows || DJGPP) */
 97+- os_error(NO_CARET, "unable to spawn shell");
 98+- }
 99++ return;
 100+ }
 101+
 102+ # elif defined(AMIGA_SC_6_1)
 103+@@ -2254,11 +2199,7 @@ do_shell()
 104+ screen_ok = FALSE;
 105+ c_token++;
 106+
 107+- if (user_shell) {
 108+- if (system(user_shell))
 109+- os_error(NO_CARET, "system() failed");
 110+- }
 111+- (void) putc('\n', stderr);
 112++ return;
 113+ }
 114+
 115+ # elif defined(OS2)
 116+@@ -2269,12 +2210,7 @@ do_shell()
 117+ screen_ok = FALSE;
 118+ c_token++;
 119+
 120+- if (user_shell) {
 121+- if (system(user_shell) == -1)
 122+- os_error(NO_CARET, "system() failed");
 123+-
 124+- }
 125+- (void) putc('\n', stderr);
 126++ return;
 127+ }
 128+
 129+ # else /* !OS2 */
 130+@@ -2285,17 +2221,10 @@ do_shell()
 131+ void
 132+ do_shell()
 133+ {
 134+- static char exec[100] = EXEC;
 135+-
 136+ screen_ok = FALSE;
 137+ c_token++;
 138+
 139+- if (user_shell) {
 140+- if (system(safe_strncpy(&exec[sizeof(EXEC) - 1], user_shell,
 141+- sizeof(exec) - sizeof(EXEC) - 1)))
 142+- os_error(NO_CARET, "system() failed");
 143+- }
 144+- (void) putc('\n', stderr);
 145++ return;
 146+ }
 147+
 148+ # endif /* !MSDOS */
 149+@@ -2503,52 +2432,7 @@ read_line(prompt)
 150+ static int
 151+ winsystem(const char *s)
 152+ {
 153+- LPSTR comspec;
 154+- LPSTR execstr;
 155+- LPCSTR p;
 156+-
 157+- /* get COMSPEC environment variable */
 158+-# ifdef WIN32
 159+- char envbuf[81];
 160+- GetEnvironmentVariable("COMSPEC", envbuf, 80);
 161+- if (*envbuf == NUL)
 162+- comspec = "\\command.com";
 163+- else
 164+- comspec = envbuf;
 165+-# else
 166+- p = GetDOSEnvironment();
 167+- comspec = "\\command.com";
 168+- while (*p) {
 169+- if (!strncmp(p, "COMSPEC=", 8)) {
 170+- comspec = p + 8;
 171+- break;
 172+- }
 173+- p += strlen(p) + 1;
 174+- }
 175+-# endif
 176+- /* if the command is blank we must use command.com */
 177+- p = s;
 178+- while ((*p == ' ') || (*p == '\n') || (*p == '\r'))
 179+- p++;
 180+- if (*p == NUL) {
 181+- WinExec(comspec, SW_SHOWNORMAL);
 182+- } else {
 183+- /* attempt to run the windows/dos program via windows */
 184+- if (WinExec(s, SW_SHOWNORMAL) <= 32) {
 185+- /* attempt to run it as a dos program from command line */
 186+- execstr = gp_alloc(strlen(s) + strlen(comspec) + 6,
 187+- "winsystem cmdline");
 188+- strcpy(execstr, comspec);
 189+- strcat(execstr, " /c ");
 190+- strcat(execstr, s);
 191+- WinExec(execstr, SW_SHOWNORMAL);
 192+- free(execstr);
 193+- }
 194+- }
 195+-
 196+- /* regardless of the reality return OK - the consequences of */
 197+- /* failure include shutting down Windows */
 198+- return (0); /* success */
 199++ return(0);
 200+ }
 201+
 202+ void
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/__init__.py
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/build.py
@@ -0,0 +1,61 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from __future__ import with_statement
 7+from distutils.command.build import build
 8+from distutils.core import Command
 9+from os.path import join
 10+from subprocess import call
 11+from glob import glob
 12+from sys import executable
 13+from os import chmod
 14+
 15+class build_wikitex(build):
 16+ # Don't build docs by default (already in source-dist).
 17+ # build.sub_commands.append(('build_docs', lambda self:True))
 18+ build.sub_commands.append(('build_scripts', lambda self:True))
 19+
 20+class build_scripts(Command):
 21+ description = 'build scripts'
 22+ user_options = []
 23+
 24+ def initialize_options(self):
 25+ pass
 26+
 27+ def finalize_options(self):
 28+ pass
 29+
 30+ def run(self):
 31+ SCRIPTS = './bin/wikitex*.in'
 32+ MOD = 0755
 33+ for scriptfilename in glob(SCRIPTS):
 34+ with open(scriptfilename) as scriptfile:
 35+ script = scriptfile.read() % {'python': executable}
 36+ scriptfilename = scriptfilename[:scriptfilename.rfind('.')]
 37+ with open(scriptfilename, 'w') as scriptfile:
 38+ scriptfile.write(script)
 39+ chmod(scriptfilename, MOD)
 40+
 41+
 42+class build_docs(Command):
 43+ description = 'build documentation'
 44+ user_options = []
 45+
 46+ def initialize_options(self):
 47+ pass
 48+
 49+ def finalize_options(self):
 50+ pass
 51+
 52+ def run(self):
 53+ DOCS = './doc/src'
 54+ MAKEFILE = 'Makefile.in'
 55+ VERSION = self.distribution.get_version()
 56+ makefilename = join(DOCS, MAKEFILE)
 57+ with open(makefilename) as makefile:
 58+ make = makefile.read() % {'version': VERSION}
 59+ with open(makefilename[:makefilename.rfind('.')], 'w') as makefile:
 60+ makefile.write(make)
 61+ call(['make', '-C', DOCS])
 62+
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/execution.py
@@ -0,0 +1,72 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from os import EX_SOFTWARE, kill, WIFEXITED, WIFSIGNALED, WIFSTOPPED, \
 7+ WTERMSIG, WSTOPSIG, WEXITSTATUS, EX_OK
 8+from syslog import syslog
 9+from popen2 import Popen4
 10+from threading import Timer
 11+from os.path import basename
 12+from signal import SIGKILL
 13+
 14+from wikitex.constants import Constants
 15+
 16+class ExecutionError(Exception):
 17+ def __init__(self, errno, strerr):
 18+ Exception.__init__(self, errno, strerr)
 19+
 20+class Execution(object):
 21+ def __init__(self, facility):
 22+ self.facility = facility
 23+
 24+ def kill(self, pid, signal):
 25+ try:
 26+ kill(pid, signal)
 27+ except OSError:
 28+ # Whoops: done-in, I believe, by a race condition
 29+ # (e.g., the process finished while we were iterating
 30+ # through timers).
 31+ syslog('`%s\' met with a stale timer' % self.facility.path)
 32+
 33+ def execute(self, *args):
 34+ process = Popen4([self.facility.path] + self.facility.args + list(args))
 35+ timers = [Timer(time, self.kill, [process.pid, signal]) for time, signal in
 36+ self.facility.wait.iteritems()]
 37+ for timer in timers:
 38+ timer.start()
 39+ status = process.wait()
 40+ for timer in timers:
 41+ # No penalty, btw, for cancelling a dead timer
 42+ if timer.isAlive():
 43+ timer.cancel()
 44+ process.tochild.close()
 45+ if __debug__:
 46+ while True:
 47+ line = process.fromchild.readline()
 48+ if line:
 49+ syslog(line)
 50+ else:
 51+ break
 52+ process.fromchild.close()
 53+ command = basename(self.facility.path)
 54+ if WIFEXITED(status):
 55+ exit_status = WEXITSTATUS(status)
 56+ if exit_status != EX_OK:
 57+ raise ExecutionError(EX_SOFTWARE, '`%(command)s\' exited with \
 58+ error-code %(exit_status)d' % {'command': command,
 59+ 'exit_status': exit_status})
 60+ elif WIFSIGNALED(status):
 61+ raise ExecutionError(EX_SOFTWARE, '`%(command)s\' terminated \
 62+ with signal %(signal)d' % {'command': command,
 63+ 'signal': WTERMSIG(status)})
 64+ elif WIFSTOPPED(status):
 65+ raise ExecutionError(EX_SOFTWARE, '`%(command)s\' stopped with \
 66+ signal %(signal)d' % {'command': command,
 67+ 'signal': WSTOPSIG(status)})
 68+ else:
 69+ # Failsafe: timers should have killed the process by this point, or
 70+ # it should have ended naturally.
 71+ kill(process.pid, SIGKILL)
 72+ raise ExecutionError(EX_SOFTWARE, 'Failed timer on `%(command)s\'; \
 73+ terminating the process extraordinarily.' % {'command': command})
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/facility.py
@@ -0,0 +1,19 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+class Facility(object):
 7+ def __eq__(self, other):
 8+ return (self.root, self.host, other.port) == \
 9+ (other.root, other.host, other.port)
 10+
 11+ def __ne__(self, other):
 12+ return not self.__eq__(other)
 13+
 14+ def __init__(self, root, host, port, path, wait, args):
 15+ self.root = root
 16+ self.host = host
 17+ self.port = port
 18+ self.path = path
 19+ self.wait = wait
 20+ self.args = args
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/droppriv.py
@@ -0,0 +1,31 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from syslog import syslog
 7+from os import setregid, setgroups, setreuid, setuid, EX_NOPERM
 8+
 9+class RootEscalationError(Exception):
 10+ SAW = 'Process is yet able to become root'
 11+
 12+ def __init__(self, saw=SAW):
 13+ Exception.__init__(self, saw)
 14+
 15+def droppriv(uid, gid, code=0):
 16+ # Set group must be done before user.
 17+ setregid(gid, gid)
 18+ # Reduce supplementary groups
 19+ setgroups([gid])
 20+ # Finally, set user.
 21+ setreuid(uid, uid)
 22+ # Test that we cannot re-root
 23+ try:
 24+ setuid(0)
 25+ except OSError:
 26+ pass
 27+ else:
 28+ if code:
 29+ print >> stderr, RootEscalationError().message
 30+ exit(code)
 31+ else:
 32+ raise RootEscalationError()
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/install.py
@@ -0,0 +1,242 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from __future__ import with_statement
 7+from distutils.command.install import install
 8+from distutils.core import Command
 9+from distutils import log
 10+from os import makedirs, umask, chown, chdir, mknod, makedev, chmod, \
 11+ getcwd, stat, listdir, environ, system
 12+from stat import S_IFCHR, S_IRUSR, S_IWUSR, S_IRGRP, S_IWGRP, S_IROTH, \
 13+ S_IWOTH
 14+from os.path import join, exists, realpath, dirname, isfile, basename
 15+from shutil import copy
 16+from glob import glob
 17+from pwd import getpwnam
 18+from grp import getgrnam
 19+from subprocess import call
 20+
 21+from wikitex.config import *
 22+from wikitex.constants import Constants
 23+
 24+def declare_copy(whence, whither):
 25+ print '%(whence)s -> %(whither)s' % {'whence': whence,
 26+ 'whither': whither}
 27+ copy(whence, whither)
 28+
 29+def declare_chown(possidendum, uid, gid):
 30+ print 'changing ownership of %(possidendum)s to %(uid)s:%(gid)s' % \
 31+ {'possidendum': possidendum, 'uid': uid, 'gid': gid}
 32+ chown(possidendum, uid, gid)
 33+
 34+def declare_chmod(modificandum, modus):
 35+ print 'modifying %(modificandum)s to %(modus)d' % \
 36+ {'modificandum': modificandum, 'modus': modus}
 37+
 38+class install_wikitex(install):
 39+ install.sub_commands.append(('install_root', lambda self:True))
 40+ # Don't do client by default
 41+ # install.sub_commands.append(('install_client', lambda self:True))
 42+ install.sub_commands.append(('install_handler', lambda self:True))
 43+ install.sub_commands.append(('install_scripts', lambda self:True))
 44+ install.sub_commands.append(('install_docs', lambda self:True))
 45+
 46+class install_docs(Command):
 47+
 48+ description = 'install documentation'
 49+
 50+ user_options = [
 51+ ('doc-dir=', 'd', 'whither docs'),
 52+ ]
 53+
 54+ def initialize_options(self):
 55+ self.doc_dir = None
 56+
 57+ def finalize_options(self):
 58+ if self.doc_dir is None:
 59+ self.doc_dir = Config.docs
 60+
 61+ def run(self):
 62+ UMASK = 0022
 63+ DOCS = './doc'
 64+ umask(UMASK)
 65+ if not exists(self.doc_dir):
 66+ makedirs(self.doc_dir)
 67+ # Copy only a subset?
 68+ for doc in listdir(DOCS):
 69+ docfile = join(DOCS, doc)
 70+ if isfile(docfile):
 71+ declare_copy(docfile, self.doc_dir)
 72+
 73+class install_scripts(Command):
 74+
 75+ description = 'install entry points into WikiTeX'
 76+
 77+ user_options = [
 78+ ('script-dir=', 's', 'where will lie scripts'),
 79+ ]
 80+
 81+ def initialize_options(self):
 82+ self.script_dir = None
 83+
 84+ def finalize_options(self):
 85+ if self.script_dir is None:
 86+ self.script_dir = Config.scripts
 87+
 88+ def run(self):
 89+ SCRIPT_DIR = './bin'
 90+ SCRIPTS = ['wikitex', 'wikitex-debug']
 91+ for scriptfilename in [join(SCRIPT_DIR, script) for script in SCRIPTS]:
 92+ declare_copy(scriptfilename, self.script_dir)
 93+
 94+class install_handler(Command):
 95+
 96+ description = 'install Apache handler'
 97+
 98+ user_options = [
 99+ ('handler-dir=', 'h', 'where lieth target handler-dir'),
 100+ ]
 101+
 102+ def initialize_options(self):
 103+ self.handler_dir = None
 104+
 105+ def finalize_options(self):
 106+ if self.handler_dir is None:
 107+ self.handler_dir = Config.web
 108+
 109+ def run(self):
 110+ HANDLER = './src/handler'
 111+ GLOBS = ['.htaccess', '*.py']
 112+
 113+ if not exists(self.handler_dir):
 114+ makedirs(self.handler_dir)
 115+ declare_chown(self.handler_dir, Config.http_uid, Config.http_gid)
 116+ for globs in GLOBS:
 117+ for file in glob(join(HANDLER, globs)):
 118+ # Will overwrite .htaccess modifications
 119+ if isfile(file):
 120+ declare_copy(file, self.handler_dir)
 121+ declare_chown(join(self.handler_dir, basename(file)),
 122+ Config.http_uid, Config.http_gid)
 123+ if not exists(Config.db_root):
 124+ makedirs(Config.db_root)
 125+ declare_chown(Config.db_root, Config.http_uid, Config.http_gid)
 126+
 127+class install_client(Command):
 128+
 129+ description = 'copy files to mediawiki'
 130+
 131+ user_options = [
 132+ ('mediawiki-config=', 'm', 'LocalSettings.php of MediaWiki'),
 133+ ('extensions-dir=', 'e', 'target directory for wikitex extension'),
 134+ ]
 135+
 136+ def initialize_options(self):
 137+ self.mediawiki_config = None
 138+ self.extensions_dir = None
 139+
 140+ def finalize_options(self):
 141+ if self.mediawiki_config is None:
 142+ self.mediawiki_config = Config.mediawiki
 143+ if self.extensions_dir is None:
 144+ self.extensions_dir = Config.extension
 145+
 146+ ##
 147+ # Attempt, among other things, a configuration of MediaWiki
 148+ # after copying thither the client files.
 149+ def run(self):
 150+ UMASK = 0022
 151+ BACKUP = '%(file)s.bak'
 152+ INCLUDE = 'include_once(\'./extensions/wikitex/main.php\');\n'
 153+ TERMINUS = '?>\n'
 154+ WIKITEX_LOCAL = './src/client/mediawiki'
 155+ LOCAL = ''
 156+ ERRORS = 'errors'
 157+ CONFIG = 'config'
 158+ GLOB = '*.php'
 159+
 160+ umask(UMASK)
 161+ if not exists(self.mediawiki_config):
 162+ raise Exception('LocalSettings.php existeth otherwhere than ' +
 163+ '%(settings)s, Freund.' % {'settings':
 164+ self.mediawiki_config})
 165+ declare_copy(self.mediawiki_config, BACKUP %
 166+ {'file': self.mediawiki_config})
 167+ with open(self.mediawiki_config) as settingsfile:
 168+ settings = settingsfile.readlines()
 169+ if not INCLUDE in settings:
 170+ if not TERMINUS in settings:
 171+ raise Exception('There lacketh a naked %(term)s in ' %
 172+ {'term': TERMINUS} + self.mediawiki_config)
 173+ settings.insert(settings.index(TERMINUS), INCLUDE)
 174+ with open(self.mediawiki_config, 'w') as settingsfile:
 175+ settingsfile.writelines(settings)
 176+ if not exists(Config.extension):
 177+ makedirs(Config.extension)
 178+ for dir in [LOCAL, ERRORS, CONFIG]:
 179+ extension_dir = join(Config.extension, dir)
 180+ if not exists(extension_dir):
 181+ makedirs(extension_dir)
 182+ for file in glob(join(WIKITEX_LOCAL, dir, GLOB)):
 183+ if isfile(file):
 184+ declare_copy(file, extension_dir)
 185+ if not exists(Config.cache):
 186+ makedirs(Config.cache)
 187+ declare_chown(Config.cache, Config.http_uid, Config.http_gid)
 188+
 189+class install_root(Command):
 190+ description = 'create chroot skeleton'
 191+
 192+ user_options = [
 193+ ('root-dir=', 'd', 'directory whither common root'),
 194+ ('temp-dir=', 't', 'temp directory within given root'),
 195+ ]
 196+
 197+ subradices = ['latex']
 198+
 199+ def initialize_options(self):
 200+ self.root_dir = None
 201+ self.temp_dir = None
 202+
 203+ def finalize_options(self):
 204+ if self.root_dir is None:
 205+ self.root_dir = Config.root
 206+ if self.temp_dir is None:
 207+ self.temp_dir = Constants.TEMP
 208+
 209+ def run(self):
 210+ UMASK = 0022
 211+ DEV = Constants.DEV
 212+ DEVICES = [(Constants.ZERO, 1, 5),
 213+ (Constants.NULL, 1, 3)]
 214+ MODE = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
 215+ DEVICE = 0
 216+ MAJOR = 1
 217+ MINOR = 2
 218+
 219+ # 0644 by default
 220+ umask(UMASK)
 221+ # Create root
 222+ if not exists(self.root_dir):
 223+ makedirs(self.root_dir)
 224+ # chdir(self.root_dir)
 225+
 226+ for subradix in self.subradices:
 227+ # Data dir in respective root (common to all modules)
 228+ sub_root_temp_dir = join(self.root_dir, subradix, Constants.TEMP)
 229+ if not exists(sub_root_temp_dir):
 230+ makedirs(sub_root_temp_dir)
 231+ declare_chown(sub_root_temp_dir, Config.uid, Config.gid)
 232+ # Device directory
 233+ dev = join(self.root_dir, subradix, DEV)
 234+ if not exists(dev):
 235+ makedirs(dev)
 236+ # Create /dev/null and /dev/zero, setting appropriate
 237+ # permissions
 238+ for device in DEVICES:
 239+ dev_device = join(dev, device[DEVICE])
 240+ if not exists(dev_device):
 241+ mknod(dev_device, MODE | S_IFCHR,
 242+ makedev(device[MAJOR], device[MINOR]))
 243+ declare_chmod(dev_device, MODE)
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/server.py
@@ -0,0 +1,185 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
 7+from SocketServer import ForkingMixIn
 8+from codecs import lookup
 9+from os.path import join, isfile
 10+from os import chroot, chdir, setreuid, setgroups, setregid, setuid, close, \
 11+ fork, umask, setsid, open, dup, O_RDWR, getpid, _exit, EX_OSERR, \
 12+ EX_OK, EX_NOPERM, O_RDWR, O_CREAT, SEEK_SET, ftruncate, write, unlink, \
 13+ chown
 14+from resource import setrlimit, getrlimit, RLIMIT_NOFILE, RLIM_INFINITY
 15+# stdout, stderr, stdin demandeth naked importation
 16+import sys
 17+from sys import exit
 18+from signal import signal, SIG_IGN, SIGHUP, SIGTERM, SIGINT
 19+from syslog import syslog, openlog, LOG_CONS, LOG_DAEMON, LOG_ERR
 20+from stat import S_IRUSR, S_IWUSR, S_IRGRP, S_IROTH
 21+from errno import EAGAIN, EACCES
 22+from fcntl import LOCK_EX, LOCK_NB, lockf
 23+from atexit import register
 24+
 25+from wikitex.config import *
 26+from wikitex.actions.math import Math
 27+from wikitex.facility import Facility
 28+from wikitex.constants import Constants
 29+from wikitex.droppriv import droppriv
 30+from wikitex.logger import Logger
 31+
 32+class WikitexActions(object):
 33+ action_to_method = {}
 34+
 35+ def __init__(self, actions):
 36+ for action in actions:
 37+ self.action_to_method[action.name] = action.method
 38+
 39+ def _dispatch(self, action, params):
 40+ return self.action_to_method[action.lower()](*params)
 41+
 42+class WikitexForkingMixIn(ForkingMixIn):
 43+ max_children = Config.max_children
 44+
 45+class WikitexRequestHandler(SimpleXMLRPCRequestHandler):
 46+ def setrlimits(self):
 47+ for resource, limit in Config.limits.iteritems():
 48+ try:
 49+ setrlimit(resource, limit)
 50+ except Exception, e:
 51+ syslog('Failed to set resource limit %(resource)d ' %
 52+ {'resource': resource} + 'to %(limit)s: %(message)s' %
 53+ {'limit': limit,
 54+ 'message': e.message});
 55+
 56+ def setup(self):
 57+ SimpleXMLRPCRequestHandler.setup(self)
 58+ self.setrlimits()
 59+
 60+class WikitexServer(WikitexForkingMixIn, SimpleXMLRPCServer):
 61+ class IrreducibleFacilityError(Exception):
 62+ SAW = 'The facilities of this action-set are irreducible'
 63+
 64+ def __init__(self, saw=SAW):
 65+ Exception.__init__(self, saw)
 66+
 67+ def __init__(self, actions):
 68+ # facility = reduce(lambda a, b: a, [action.facility for action
 69+ # in actions])
 70+ facility = reduce(self.reduce_facilities,
 71+ [action.facility for action in actions])
 72+ # Detach from the parent
 73+ self.daemonize(Constants.APPLICATION % {'action': facility.root})
 74+ # Store encodings in cache before chroot
 75+ for encoding in Constants.ENCODINGS:
 76+ lookup(encoding)
 77+ # Changing root does not automatically change dir.
 78+ root = join(Config.root, facility.root)
 79+ chdir(root)
 80+ chroot(root)
 81+ # Reduce to unprivileged user
 82+ droppriv(Config.uid, Config.gid, EX_NOPERM)
 83+
 84+ SimpleXMLRPCServer.__init__(self, (facility.host, facility.port),
 85+ requestHandler=WikitexRequestHandler)
 86+ self.register_instance(WikitexActions(actions))
 87+ self.serve_forever()
 88+ # self.handle_request()
 89+
 90+ def reduce_facilities(self, superducendum, subducendum):
 91+ if superducendum != subducendum:
 92+ raise self.IrreducibleFacilityError()
 93+ return superducendum
 94+
 95+ def daemonize(self, application):
 96+ IDENTITY = application + '[%(pid)d]'
 97+ DESCRIPTORS = 1024
 98+ HARD_LIMIT = 1
 99+ STDIN = 0
 100+ STDOUT = 1
 101+ STDERR = 2
 102+ UMASK = 0022
 103+ FLAGS = O_RDWR | O_CREAT
 104+ LOCKMODE = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
 105+ LENGTH = START = 0
 106+
 107+ umask(UMASK)
 108+ descriptors = getrlimit(RLIMIT_NOFILE)[HARD_LIMIT]
 109+ pid = fork()
 110+ if pid:
 111+ _exit(EX_OK)
 112+ setsid()
 113+ signal(SIGHUP, SIG_IGN)
 114+ pid = fork()
 115+ if pid:
 116+ _exit(EX_OK)
 117+ # chdir
 118+ # Obtain lock on pid-file
 119+ lockfile = join(Config.run, Constants.LOCKFILE %
 120+ {'application': application})
 121+ lockfile_descriptor = open(lockfile, FLAGS, LOCKMODE)
 122+ self.lockfile_descriptor = lockfile_descriptor
 123+ try:
 124+ lockf(lockfile_descriptor, LOCK_EX | LOCK_NB, LENGTH, START,
 125+ SEEK_SET)
 126+ except IOError, e:
 127+ if e.errno == EAGAIN or e.errno == EACCES:
 128+ exit("Can't obtain lock on %s; another process is using it." %
 129+ lockfile)
 130+ else:
 131+ exit("Can't obtain lock on %s." % lockfile)
 132+ # Reduce lockfile to nought
 133+ ftruncate(lockfile_descriptor, 0)
 134+ pid = getpid()
 135+ # Record pid in lockfile
 136+ write(lockfile_descriptor, str(pid))
 137+
 138+ # Allow us to handle cleanup on terminate and interrupt
 139+ signal(SIGTERM, self.terminate)
 140+ signal(SIGINT, self.terminate)
 141+ # Register lockfile's release on exit
 142+ register(self.release_lockfile, lockfile_descriptor)
 143+
 144+ # Close remaining open descriptors
 145+ if descriptors == RLIM_INFINITY:
 146+ descriptors = DESCRIPTORS
 147+ for descriptor in range(0, descriptors - 1):
 148+ try:
 149+ if descriptor != lockfile_descriptor:
 150+ close(descriptor)
 151+ except OSError:
 152+ pass
 153+ # Point stdin to '/dev/null'
 154+ # Stevens' protocoll dictates closing the following; it shuts
 155+ # off my access to syslog, though!
 156+ # stdin = open(join(Constants.DEV, Constants.NULL), O_RDWR)
 157+ # stdout = dup(stdin)
 158+ # stderr = dup(stdin)
 159+ identity = IDENTITY % {'pid': pid}
 160+ openlog(identity, LOG_CONS, LOG_DAEMON)
 161+ sys.stdout = sys.stderr = Logger
 162+ # Prime the syslog-redirect
 163+ syslog('Process %s is ready, sir.' % getpid())
 164+
 165+ # Correllary to Stevens' protocoll above
 166+ # if stdin != STDIN or stdout != STDOUT or stderr != STDERR:
 167+ # syslog(LOG_ERR, 'unexpected file descriptors %d %d %d' %
 168+ # (stdin, stdout, stderr))
 169+ # exit(EX_OSERR)
 170+
 171+ def release_lockfile(self, lockfile_descriptor):
 172+ # Strictly speaking, superfluous; in addition:
 173+ # can't unlink the lockfile itself, since it
 174+ # existeth outside our jail.
 175+ # TODO: move lockfiles inside jail like Apache?
 176+ # To unlink it inside the jail, however, it must
 177+ # be owned or writable by the process: which leaves
 178+ # the lockfile open to mischief.
 179+ close(lockfile_descriptor)
 180+
 181+ def terminate(self, signal, frame):
 182+ PREFIX = 2**7
 183+
 184+ syslog('Terminating')
 185+ # Allow cleanup functions to be called
 186+ exit(PREFIX + signal)
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/templates/math.tex
@@ -0,0 +1,9 @@
 2+%% WikiTeX: expansible LaTeX module for MediaWiki
 3+%% Copyright (C) 2004-7 Peter Danenberg
 4+%% See doc/COPYING for details.
 5+\documentclass[12pt]{article}
 6+\usepackage{amsmath}
 7+\pagestyle{empty}
 8+\begin{document}
 9+\begin{displaymath}%(math)s\end{displaymath}
 10+\end{document}
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/templates/latex.tex
@@ -0,0 +1,8 @@
 2+%% WikiTeX: expansible LaTeX module for MediaWiki
 3+%% Copyright (C) 2004-7 Peter Danenberg
 4+%% See doc/COPYING for details.
 5+\documentclass[12pt]{article}
 6+\pagestyle{empty}
 7+\begin{document}
 8+%(latex)s
 9+\end{document}
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/actions/math.py
@@ -0,0 +1,21 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from wikitex.actions.latex import Latex
 7+from wikitex.constants import Constants
 8+from wikitex.config import *
 9+
 10+class Math(Latex):
 11+ NAME = 'math'
 12+ TEMPLATE_FILE = Constants.TEMPLATE % {'file': NAME,
 13+ 'suffix': Constants.MIMES['latex'][1]}
 14+ FACILITY = Config.facilities['latex']
 15+
 16+ def __init__(self, name=NAME, method=None, template_file=TEMPLATE_FILE, facility=FACILITY):
 17+ if not method:
 18+ method = self.render
 19+ super(Math, self).__init__(name, method, template_file, facility)
 20+
 21+ def render(self, reddendum):
 22+ return Latex.render(self, reddendum)
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/actions/latex.py
@@ -0,0 +1,55 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from __future__ import with_statement
 7+from xmlrpclib import Binary, Fault
 8+from glob import glob
 9+
 10+from wikitex.cleanup import Cleanup
 11+from wikitex.constants import Constants
 12+from wikitex.action import Action
 13+from wikitex.config import *
 14+from wikitex.execution import Execution, ExecutionError
 15+
 16+class Latex(Action):
 17+ NAME = 'latex'
 18+ TEMPLATE_FILE = Constants.TEMPLATE % {'file': NAME,
 19+ 'suffix': Constants.MIMES['latex'][1]}
 20+ FACILITY = Config.facilities[NAME]
 21+
 22+ def __init__(self, name=NAME, method=None, template_file=TEMPLATE_FILE,
 23+ facility=FACILITY):
 24+ if not method:
 25+ method = self.render
 26+ super(Latex, self).__init__(name, method, template_file, facility)
 27+
 28+ ##
 29+ # @param reddendum neuter singular gerund of reddere, &ldquo;to give back.&rdquo;
 30+ # @param self reference
 31+ # @return a dictionary comprising resultate image and source;
 32+ # {'image/png': &ldquo;result&rdquo;, 'application/x-latex': &ldquo;source&rdquo;}.
 33+ def render(self, reddendum):
 34+ # Take only the first image produced by dvipng;
 35+ # TODO: glob and deliver n images.
 36+ SOURCE = '%(source)s.%(suffix)s'
 37+ IMAGE = '%(image)s1.%(suffix)s'
 38+ IMG_MIME, IMG_EXT = Constants.MIMES['png']
 39+ SRC_MIME, SRC_EXT = Constants.MIMES['latex']
 40+
 41+ # Should persist through execution, and be deleted during garbage-
 42+ # collection; taking with it the temporary directory.
 43+ cleanup = super(Latex, self).populate_tmpdir({self.name: reddendum})
 44+ try:
 45+ Execution(self.facility).execute(self.name)
 46+ Execution(Config.facilities[Constants.DVIPNG]).execute(self.name)
 47+ except ExecutionError, (errno, strerr):
 48+ raise Fault(errno, strerr)
 49+ sourcefilename = SOURCE % {'source': self.name, 'suffix': SRC_EXT}
 50+ with open(sourcefilename) as sourcefile:
 51+ source = sourcefile.read()
 52+ imagefilename = IMAGE % {'image': self.name, 'suffix': IMG_EXT}
 53+ with open(imagefilename) as imagefile:
 54+ image = imagefile.read()
 55+ response = {IMG_MIME: Binary(image), SRC_MIME: Binary(source)}
 56+ return response
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/actions/__init__.py
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/capability.c
@@ -0,0 +1,70 @@
 2+#undef _POSIX_SOURCE
 3+#include <Python.h>
 4+/* cap_set_proc, etc. */
 5+#include <sys/capability.h>
 6+/* perror */
 7+#include <stdio.h>
 8+/* errno */
 9+#include <errno.h>
 10+/* strerror */
 11+#include <string.h>
 12+/* setuid, getuid */
 13+#include <sys/types.h>
 14+#include <unistd.h>
 15+#include <stdbool.h>
 16+#include <sys/prctl.h>
 17+#include <grp.h>
 18+
 19+#define DEBUG(p) if (!debug(p)) return NULL
 20+#define DEFAULT_ID 65535
 21+
 22+static bool debug(int value)
 23+{
 24+ if (value < 0) {
 25+ PyErr_SetFromErrno(PyExc_OSError);
 26+ return false;
 27+ }
 28+ else {
 29+ return true;
 30+ }
 31+}
 32+
 33+static PyObject *capability_droppriv(PyObject *self, PyObject *args)
 34+{
 35+ cap_value_t capvals[1] = { CAP_SYS_CHROOT };
 36+ cap_t cap = cap_get_proc();
 37+ const unsigned int capvals_num = sizeof(capvals) / sizeof(cap_value_t);
 38+ unsigned int uid = DEFAULT_ID, gid = DEFAULT_ID;
 39+
 40+ if (!PyArg_ParseTuple(args, "ii:capability", &uid, &gid)) {
 41+ return NULL;
 42+ }
 43+
 44+ const gid_t groups[1] = { gid };
 45+
 46+ DEBUG(prctl(PR_SET_KEEPCAPS, 1));
 47+ DEBUG(setregid(gid, gid));
 48+ DEBUG(setgid(gid));
 49+ DEBUG(setgroups(1, groups));
 50+ DEBUG(setuid(uid));
 51+ DEBUG(setreuid(uid, uid));
 52+ DEBUG(cap_clear(cap));
 53+ DEBUG(cap_set_flag(cap, CAP_EFFECTIVE, capvals_num, capvals, CAP_SET));
 54+ DEBUG(cap_set_flag(cap, CAP_PERMITTED, capvals_num, capvals, CAP_SET));
 55+/* DEBUG(cap_set_flag(cap, CAP_INHERITABLE, capvals_num, capvals, CAP_SET)); */
 56+ DEBUG(cap_set_proc(cap));
 57+ DEBUG(cap_free(cap));
 58+ DEBUG(prctl(PR_SET_KEEPCAPS, 0));
 59+ Py_RETURN_NONE;
 60+}
 61+
 62+static PyMethodDef capability_methods[] = {
 63+ {"droppriv", capability_droppriv, METH_VARARGS,
 64+ "Drop to non-su, maintaining CAP_SYS_CHROOT (the ability to chroot)."},
 65+ {NULL, NULL, 0, NULL}
 66+};
 67+
 68+PyMODINIT_FUNC initcapability(void)
 69+{
 70+ (void) Py_InitModule("capability", capability_methods);
 71+}
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/constants.py
@@ -0,0 +1,51 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from resource import RLIMIT_CORE, RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, \
 7+ RLIMIT_STACK, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE, RLIMIT_OFILE, \
 8+ RLIMIT_MEMLOCK, RLIMIT_AS
 9+
 10+class Constants(object):
 11+ # Cacheable error-code
 12+ EX_CACHEABLE = 2**15
 13+ # That runneth
 14+ APPLICATION = 'wikitex-%(action)s'
 15+ # Device-dir to relative root
 16+ DEV = 'dev'
 17+ # Null relative to dev
 18+ NULL = 'null'
 19+ # Zero relative to dev
 20+ ZERO = 'zero'
 21+ # Temp-dir to relative root
 22+ TEMP = 'tmp'
 23+ # Prograpso-glossia
 24+ ENCODINGS = ['utf-8', 'ascii', 'latin-1']
 25+ # Lock-file template
 26+ LOCKFILE = '%(application)s.pid'
 27+ # Path-keys
 28+ LATEX = 'latex'
 29+ DVIPNG = 'dvipng'
 30+ MATH = 'math'
 31+ # Mapping of type to extension
 32+ MIMES = {'latex': ('application/x-latex', 'tex'),
 33+ 'png': ('image/png', 'png'),
 34+ 'midi': ('audio/midi', 'midi')}
 35+ # Template-file-template
 36+ TEMPLATE = '%(file)s.%(suffix)s'
 37+ # Default resource limits
 38+ LIMITS = {
 39+ RLIMIT_CORE: (0L, -1L),
 40+ RLIMIT_CPU: (-1L, -1L),
 41+ RLIMIT_FSIZE: (-1L, -1L),
 42+ RLIMIT_DATA: (-1L, -1L),
 43+ RLIMIT_STACK: (8388608L, -1L),
 44+ RLIMIT_RSS: (-1L, -1L),
 45+ RLIMIT_NPROC: (16239L, 16239L),
 46+ RLIMIT_NOFILE: (1024L, 1024L),
 47+ RLIMIT_OFILE: (1024L, 1024L),
 48+ RLIMIT_MEMLOCK: (32768L, 32768L),
 49+ RLIMIT_AS: (-1L, -1L),
 50+ }
 51+ MiB = 2**20
 52+ KiB = 2**10
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/action.py
@@ -0,0 +1,53 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from __future__ import with_statement
 7+from os.path import join, dirname
 8+from xmlrpclib import Binary
 9+from tempfile import mkdtemp
 10+from os import rmdir, chdir
 11+from hashlib import md5
 12+
 13+from wikitex.config import *
 14+from wikitex.constants import Constants
 15+from wikitex.cleanup import Cleanup
 16+
 17+class Action(object):
 18+ LIBRARY_PATH = join(dirname(__file__), 'templates')
 19+
 20+ def __init__(self, name, method, template_file, facility):
 21+ super(Action, self).__init__(self, name, method, template_file, facility)
 22+ self.name = name
 23+ self.method = method
 24+ self.template_file = template_file
 25+ # Reads the template here, before chroot renders it
 26+ # unavailable.
 27+ with open(join(self.LIBRARY_PATH, template_file)) as template:
 28+ self.template = template.read()
 29+ self.facility = facility
 30+
 31+ ##
 32+ # Render the content.
 33+ #
 34+ # @param reddendum A dictionary of template substitutions.
 35+ def render(self, reddendum):
 36+ self.populate_tmpdir(reddendum)
 37+
 38+ ##
 39+ # Create and populate the work directory.
 40+ #
 41+ # Create the temp directory; chdir thither; and register the
 42+ # directory to be cleaned up, unless __debug__ is active (i.e.,
 43+ # Python was started without -O.
 44+ #
 45+ # @param populandum a dictionary of template substitutions.
 46+ # @return Reference to the cleanup mechanism that should
 47+ # persist as long as needed
 48+ def populate_tmpdir(self, populandum):
 49+ temp_dir = mkdtemp(Constants.TEMP)
 50+ chdir(temp_dir)
 51+ with open(self.template_file, 'w') as template:
 52+ template.write(self.template % populandum)
 53+ # Register deletion (unless __debug__) of temp_dir
 54+ return Cleanup(temp_dir)
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/config/__init__.py
@@ -0,0 +1,16 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from pwd import getpwnam
 7+from grp import getgrnam
 8+
 9+try:
 10+ from wikitex.config.local import Config
 11+except ImportError:
 12+ from wikitex.config.default import Config
 13+
 14+Config.uid = getpwnam(Config.user).pw_uid
 15+Config.gid = getgrnam(Config.group).gr_gid
 16+Config.http_uid = getpwnam(Config.http_user).pw_uid
 17+Config.http_gid = getgrnam(Config.http_group).gr_gid
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/config/default.py
@@ -0,0 +1,100 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from signal import SIGTERM, SIGKILL
 7+from resource import RLIMIT_CORE, RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, \
 8+ RLIMIT_STACK, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE, RLIMIT_OFILE, \
 9+ RLIMIT_MEMLOCK, RLIMIT_AS
 10+from os.path import join, dirname
 11+
 12+from wikitex.facility import Facility
 13+from wikitex.constants import Constants
 14+
 15+class Config(object):
 16+ # Where groupeth the sundry radices
 17+ root = '/usr/local/var/wikitex'
 18+ # Where rooteth the exposed web dir
 19+ webroot = '/usr/local/apache2/htdocs'
 20+ # Where will lie the Apache handler
 21+ web = join(webroot, 'wikitex')
 22+ # Where lieth MediaWiki's root
 23+ mediawiki = join(webroot, 'mediawiki/LocalSettings.php')
 24+ # Where will lie MediaWiki-client
 25+ extension = join(dirname(mediawiki), 'extensions/wikitex')
 26+ # Where will lie MediaWiki-client-cache
 27+ cache = join(extension, 'cache')
 28+ # Dir to store executable scripts
 29+ scripts = '/usr/local/bin'
 30+ # Dir to store documentation
 31+ docs = '/usr/local/share/wikitex'
 32+ # Dir that storeth process-identification
 33+ run = '/var/run'
 34+ # Dir that containeth our play-dbs
 35+ db_root = join(root, 'db')
 36+ # File that databaseth
 37+ db = join(db_root, 'wikitex')
 38+ # File that locketh writing
 39+ db_lock = join(db_root, 'wikitex.lock')
 40+ # User that runneth
 41+ user = 'wikitex'
 42+ # Group that o'er-runneth
 43+ group = 'wikitex'
 44+ # Apache-user
 45+ http_user = 'nobody'
 46+ # Apache-group
 47+ http_group = 'nobody'
 48+ # Haven where bindeth socket
 49+ default_port = 8000
 50+ # Guest's correlative where bindeth socket
 51+ default_host = '127.0.0.1'
 52+ # When and how to signal runaway children (independent of resource limits)
 53+ default_wait = {45: SIGTERM,
 54+ 50: SIGKILL}
 55+ # Specifica (values preset to None are typically ignored);
 56+ # env is currently superfluous.
 57+ # Base values, replicated in the subclasses
 58+ facilities = {Constants.LATEX: Facility(root='latex',
 59+ host=default_host,
 60+ port=default_port + 0,
 61+ path='/usr/local/teTeX/bin/latex',
 62+ wait=default_wait,
 63+ args=['--interaction=nonstopmode']),
 64+ Constants.DVIPNG: Facility(root=None,
 65+ host=None,
 66+ port=None,
 67+ path='/usr/local/bin/dvipng',
 68+ wait=default_wait,
 69+ args=['--strict', '-l', '=1', '-bg', 'Transparent', '-T', 'tight'])}
 70+ # Selectively map public interfaces to private facilities
 71+ publicae = {Constants.MATH: facilities[Constants.LATEX]}
 72+ # Process-ceiling for ForkingMixIn (independent of resource limits)
 73+ max_children = 40
 74+ # Resource limits (see Constants for defaults).
 75+ limits = {
 76+ # Core file (don't produce them)
 77+ RLIMIT_CORE: (0, 0),
 78+ # CPU time
 79+ RLIMIT_CPU: (0, 0),
 80+ # Maximum file size
 81+ RLIMIT_FSIZE: (Constants.MiB, Constants.MiB),
 82+ # (Un)initialized data plus heap
 83+ RLIMIT_DATA: (0, 0),
 84+ # Stack
 85+ RLIMIT_STACK: (0, 0),
 86+ # Resident set size (low memory conditions)
 87+ RLIMIT_RSS: (0, 0),
 88+ # Child processes
 89+ RLIMIT_NPROC: (2**3, 2**3),
 90+ # Open files
 91+ RLIMIT_NOFILE: (2**3, 2**3),
 92+ # Memory lock
 93+ RLIMIT_MEMLOCK: (0, 0),
 94+ # Total available memory
 95+ RLIMIT_AS: (2**6 * Constants.MiB, 2**6 * Constants.MiB),
 96+ }
 97+ # Unit of processor time
 98+ ctime_unit = 60.0
 99+ # Maximum processor time per unit processor time
 100+ # that a client can usurp.
 101+ max_ctime_per_unit = ctime_unit * 0.5
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/logger.py
@@ -0,0 +1,10 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from syslog import syslog
 7+
 8+class Logger(object):
 9+ @staticmethod
 10+ def write(scribendum):
 11+ syslog(scribendum)
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/main.py
@@ -0,0 +1,77 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from __future__ import with_statement
 7+from os import EX_USAGE, EX_NOPERM, kill
 8+from sys import argv, stderr
 9+from glob import glob
 10+from os.path import join
 11+from signal import SIGTERM
 12+
 13+from wikitex.server import WikitexServer
 14+from wikitex.actions.math import Math
 15+from wikitex.config import *
 16+from wikitex.droppriv import droppriv
 17+from wikitex.constants import Constants
 18+
 19+USAGE = 'Usage: %(file)s start|stop' % {'file': __file__}
 20+
 21+def err(error, code=0):
 22+ print >> stderr, '%(file)s: %(error)s' % {'file': __file__,
 23+ 'error': error}
 24+ if code:
 25+ exit(code)
 26+
 27+try:
 28+ COMMAND, DIRECTIVE = argv
 29+except ValueError:
 30+ err(USAGE, EX_USAGE)
 31+
 32+class Main(object):
 33+ ACTIONS = [Math()]
 34+
 35+ def start(self):
 36+ WikitexServer(self.ACTIONS)
 37+
 38+ def stop(self):
 39+ WILD_CARD = '*'
 40+ ERR_NO_SUCH_PROCESS = 3
 41+
 42+ # Drop to unprivileged user, kill the pids associated with
 43+ # respective wikitex servers. DRAWBACK: leaves pid-file-
 44+ # skeletons behind; on the other hand, will not kill privileged
 45+ # processes if pid files have been tampered with.
 46+ #
 47+ # A file-descriptor is left open in each process so as to maintain
 48+ # a write-lock on the pid-file; worst case: it may be tampered with.
 49+
 50+ # Drop privileges per configuration
 51+ droppriv(Config.uid, Config.gid, EX_NOPERM)
 52+ for lockfilename in glob(join(Config.run, Constants.LOCKFILE % \
 53+ {'application': Constants.APPLICATION % \
 54+ {'action': WILD_CARD}})):
 55+ with open(lockfilename) as lockfile:
 56+ try:
 57+ pid_string = lockfile.read()
 58+ pid = int(pid_string)
 59+ kill(pid, SIGTERM)
 60+ err('Stopped `%(pid)d\'' % {'pid': pid})
 61+ except ValueError:
 62+ if pid_string:
 63+ err('`%(lockfilename)s\' contains an invalid pid' % \
 64+ {'lockfilename': lockfilename})
 65+ except OSError, (errno, strerror):
 66+ if errno != ERR_NO_SUCH_PROCESS:
 67+ err(('pid `%(pid)d\' from `%(lockfilename)s\' ' +
 68+ 'cannot be killed: %(strerror)s') % \
 69+ {'pid': pid,
 70+ 'strerror': strerror,
 71+ 'lockfilename': lockfilename})
 72+
 73+driver = Main()
 74+
 75+try:
 76+ {'start': driver.start, 'stop': driver.stop}[DIRECTIVE]()
 77+except KeyError:
 78+ err(USAGE, EX_USAGE)
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/server/wikitex/cleanup.py
@@ -0,0 +1,14 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+from os.path import abspath
 7+from shutil import rmtree
 8+
 9+class Cleanup(object):
 10+ def __init__(self, directory):
 11+ self.directory = directory
 12+
 13+ def __del__(self):
 14+ if not __debug__:
 15+ rmtree(abspath(self.directory))
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/handler/traderjoe.py
@@ -0,0 +1,118 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+"""Trader Joe striveth to evade the middleman; he becometh one here.
 7+
 8+Quoth the Fearless Flyer: "I want to grow up to be just like Trader Joe, so I can eliminate the
 9+middleman and get my cookies directly."
 10+
 11+"""
 12+
 13+from mod_python.apache import OK, HTTP_NOT_IMPLEMENTED, log_error, \
 14+ import_module, HTTP_SERVICE_UNAVAILABLE
 15+from sys import modules
 16+from re import compile, search, DOTALL, IGNORECASE
 17+from os import EX_DATAERR, EX_UNAVAILABLE, EX_PROTOCOL, EX_UNAVAILABLE
 18+from xmlrpclib import Fault, ServerProxy, loads, dumps
 19+from xml.parsers.expat import ExpatError
 20+from gdbm import open as gdbm_open
 21+from os import open as os_open, close as os_close, O_RDWR, O_CREAT
 22+from fcntl import lockf, LOCK_EX, LOCK_NB
 23+from time import time
 24+from threading import Timer
 25+from shelve import open as shelve_open
 26+
 27+from wikitex.config import *
 28+
 29+METHOD = 'POST'
 30+
 31+def respond(request, respondendum):
 32+ request.write(dumps(respondendum))
 33+ return OK
 34+
 35+def close_db(db, lock):
 36+ if not db is None:
 37+ db.close()
 38+ if not lock is None:
 39+ os_close(lock)
 40+ return (None, None)
 41+
 42+##
 43+# Lock the lockfile for writing.
 44+# @return Lockfile-filedescriptor
 45+def get_write_lock():
 46+ lock = os_open(Config.db_lock, O_RDWR | O_CREAT)
 47+ lockf(lock, LOCK_EX)
 48+ return lock
 49+
 50+def open_db():
 51+ lock = get_write_lock()
 52+ db = None
 53+ try:
 54+ db = shelve_open(Config.db)
 55+ except:
 56+ close_db(db, lock)
 57+ raise Exception(EX_UNAVAILABLE, 'Can\'t open database for writing')
 58+ return (lock, db)
 59+
 60+def handler(request):
 61+ TIME = 't'
 62+ CTIME = 'c'
 63+ if request.method.upper() != METHOD.upper():
 64+ return HTTP_NOT_IMPLEMENTED
 65+ doc = request.read()
 66+ db = lock = None
 67+ response = OK
 68+ try:
 69+ args, action = loads(doc)
 70+ if not action:
 71+ return respond(request, Fault(EX_PROTOCOL, 'Invalid procedure-call'))
 72+ document, = args
 73+ content = str(document['content'])
 74+ author = str(document['author'])
 75+ thistime = time()
 76+ lock, db = open_db()
 77+ try:
 78+ lastedit = db[author]
 79+ except KeyError:
 80+ lastedit = {TIME: thistime, CTIME: 0.0}
 81+ db, lock = close_db(db, lock)
 82+ lasttime = lastedit[TIME]
 83+ ctime = lastedit[CTIME]
 84+ delta = thistime - lasttime
 85+ ctime_per_unit = 0.0
 86+ if not delta == 0.0:
 87+ ctime_per_unit = ctime / delta
 88+ if delta > Config.ctime_unit:
 89+ lasttime = thistime
 90+ elif ctime_per_unit > Config.max_ctime_per_unit:
 91+ # User has exceeded its CPU-ration; and instead
 92+ # of returning a true 503, we'll fashion a more
 93+ # descriptive fault and return OK.
 94+ # return HTTP_SERVICE_UNAVAILABLE
 95+ return respond(request,
 96+ Fault(EX_UNAVAILABLE, 'Thou hast, dear user, ' +
 97+ 'exceeded thine resource-allotment'))
 98+
 99+ facility = Config.publicae[action]
 100+ server = ServerProxy('http://%(host)s:%(port)d' %
 101+ {'host': facility.host,
 102+ 'port': facility.port})
 103+ cstart = time()
 104+ response = respond(request, (server.__getattr__(action).__call__(content),))
 105+ cdelta = time() - cstart
 106+ ctime += cdelta
 107+ thisedit = {TIME: lasttime, CTIME: ctime}
 108+ lock, db = open_db()
 109+ db[author] = thisedit
 110+ db, lock = close_db(db, lock)
 111+ except ExpatError:
 112+ response = respond(request, Fault(EX_PROTOCOL, 'Invalid procedure-call'))
 113+ except KeyError:
 114+ response = respond(request, Fault(EX_DATAERR, 'Unknown procedure-call'))
 115+ except Exception, message:
 116+ response = respond(request, Fault(EX_UNAVAILABLE, str(message)))
 117+ finally:
 118+ db, lock = close_db(db, lock)
 119+ return response
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/handler/ChangeLog
@@ -0,0 +1,5 @@
 2+2007-01-23 Peter Danenberg <pcd at wikitex dot org>
 3+
 4+ * traderjoe.py (handler): do our best to close lock
 5+ on fault; transition to real database.
 6+ Solve divide by zero error on new clients.
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/handler/.htaccess
@@ -0,0 +1,14 @@
 2+# WikiTeX: expansible LaTeX module for MediaWiki
 3+# Copyright (C) 2004-7 Peter Danenberg
 4+# See doc/COPYING for details.
 5+<Files traderjoe.py>
 6+ SetHandler mod_python
 7+</Files>
 8+DirectoryIndex traderjoe.py
 9+PythonHandler traderjoe
 10+PythonDebug off
 11+
 12+AuthType Basic
 13+AuthName "WikiTeX Server"
 14+AuthUserFile .htpasswd
 15+Require valid-user
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/WikitexConfig.php
@@ -0,0 +1,17 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+$LOCAL = WikitexConstants::getLocalConfig();
 10+$DEFAULT = WikitexConstants::getDefaultConfig();
 11+
 12+if (file_exists($LOCAL)) {
 13+ require_once $LOCAL;
 14+ } else {
 15+ require_once $DEFAULT;
 16+ }
 17+
 18+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/WikitexRequest.php
@@ -0,0 +1,137 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexRequest
 10+{
 11+ protected $action = NULL;
 12+ protected $content = NULL;
 13+ protected $author = NULL;
 14+
 15+ public function WikitexRequest($action, $content, $author=NULL) {
 16+ $this->action = $action;
 17+ $this->content = $content;
 18+ if (empty($author)) {
 19+ $author = $_SERVER['REMOTE_ADDR'];
 20+ }
 21+ $this->author = $author;
 22+ }
 23+
 24+ /**
 25+ * An ad-hoc call to check errore caching. Can be generalized
 26+ * by adding error to the list of interesting MIMEs, and giving
 27+ * it precedence, perhaps, over content-MIMEs?
 28+ *
 29+ * Should error have precedence?
 30+ *
 31+ * @param cache the instantiatied cache object.
 32+ * @return A mime -> error mapping in the case of cached error
 33+ * (and $DEBUG) or NULL.
 34+ */
 35+ public function checkCachedError(WikitexCache $cache) {
 36+ if (!WikitexConfig::$DEBUG &&
 37+ $cached = $cache->getCache(WikitexConstants::$MIMES['error'])) {
 38+ return array(WikitexConstants::$MIMES['error'] => $cached);
 39+ }
 40+ return NULL;
 41+ }
 42+
 43+ /**
 44+ * Configure curl (headers, etc.) Placeholder for basic/key-based
 45+ * auth switching.
 46+ * @return The so-configured request
 47+ */
 48+ public function getCurlRequest() {
 49+ xmlrpc_set_type($this->content, 'base64');
 50+ xmlrpc_set_type($this->author, 'base64');
 51+ $data = xmlrpc_encode_request($this->action,
 52+ array('content' => $this->content,
 53+ 'author' => $this->author));
 54+ $request = curl_init(WikitexConfig::$URL);
 55+ $url = parse_url(WikitexConfig::$URL);
 56+ $port = (isset($url['port']))
 57+ // chose {$ over ${ for continuity with {$a->a}
 58+ ? ":{$url['port']}"
 59+ : NULL;
 60+ $host = "{$url['host']}{$port}";
 61+ $agent = WikitexConstants::$AGENT;
 62+ $length = strlen($data);
 63+ $username = WikitexConfig::$USERNAME;
 64+ $password = WikitexConfig::$PASSWORD;
 65+ $options = array(
 66+ CURLOPT_POST => TRUE,
 67+ CURLOPT_HEADER => FALSE,
 68+ CURLOPT_HTTPHEADER =>
 69+ array("Host: {$host}",
 70+ "User-Agent: {$agent}",
 71+ "Content-Type: text/xml", // Mandated
 72+ "Content-Length: {$length}"),
 73+ CURLOPT_RETURNTRANSFER => TRUE,
 74+ CURLOPT_POSTFIELDS => $data,
 75+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0,
 76+ CURLOPT_FAILONERROR => TRUE,
 77+ CURLOPT_USERPWD => "{$username}:{$password}",
 78+ );
 79+ curl_setopt_array($request, $options);
 80+ return $request;
 81+ }
 82+
 83+ /**
 84+ * Dig up caches or befray the server. Client registers MIME-types of
 85+ * interest; these are systematically checked against the cache
 86+ * and atomically assembled into a document. If one mime existeth nought,
 87+ * we befray the server. Cached errors are checked first of all,
 88+ * and pre&euml;mpt other MIMEs unless WikitexConfig::$DEBUG is
 89+ * TRUE.
 90+ *
 91+ * @param mimes the MIME-types that interest us, and make up a whole
 92+ * document.
 93+ * @return A dictionary of MIME -> content mappings.
 94+ */
 95+ public function render(array $mimes) {
 96+ $cache = new WikitexCache($this->content);
 97+ if ($cached = $this->checkCachedError($cache)) {
 98+ return $cached;
 99+ }
 100+ $media = NULL;
 101+ foreach ($mimes as $mime) {
 102+ if ($content = $cache->getCache($mime)) {
 103+ $media[$mime] = $content;
 104+ } else {
 105+ $media = NULL;
 106+ break;
 107+ }
 108+ }
 109+ if ($media) {
 110+ return $media;
 111+ }
 112+ $request = $this->getCurlRequest();
 113+ $response = curl_exec($request);
 114+ $errno = curl_errno($request);
 115+ if ($errno) {
 116+ $cacheable = new WikitexCurlError(curl_error($request), $errno);
 117+ $cache->putCache($cacheable, WikitexConstants::$MIMES['error']);
 118+ throw $cacheable;
 119+ } else {
 120+ $document = xmlrpc_decode($response);
 121+ if (empty($document)) {
 122+ $cacheable = new WikitexRPCResponseError();
 123+ $cache->putCache($cacheable, WikitexConstants::$MIMES['error']);
 124+ throw $cacheable;
 125+ } else if (xmlrpc_is_fault($document)) {
 126+ $cacheable = new WikitexRPCFaultError($document);
 127+ $cache->putCache($cacheable, WikitexConstants::$MIMES['error']);
 128+ throw $cacheable;
 129+ }
 130+ foreach ($document as $mime => $content) {
 131+ $cache->putCache($content->scalar, $mime);
 132+ $media[$mime] = $cache->getCache($mime);
 133+ }
 134+ return $media;
 135+ }
 136+ }
 137+}
 138+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/config/default.php
@@ -0,0 +1,17 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexConfig
 10+{
 11+ // Bypass fault-cache.
 12+ public static $DEBUG = TRUE;
 13+ public static $URL = 'http://localhost/wikitex/';
 14+ public static $USERNAME = 'username';
 15+ public static $PASSWORD = 'password';
 16+}
 17+
 18+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/ChangeLog
@@ -0,0 +1,14 @@
 2+2007-01-19 Peter Danenberg <pcd at wikitex dot org>
 3+
 4+ * WikitexRequest.php: Check the cache for interesting mime-types;
 5+ errors are still cached regardless (when $DEBUG is true). This
 6+ doesn't seem to make sense for temporary errors such as `connection
 7+ refused'. TODO: Distinguish between cacheable and non-cacheable
 8+ errors.
 9+ Added username and password to curl-options.
 10+ Curl should fail on, exempli gratia, bad username/password
 11+ (CURLOPT_FAILONERROR).
 12+
 13+ * Wikitex.php: Added latex function to abstract the details from
 14+ LaTeX-dependant subrequests (say, amsmath).
 15+
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/WikitexConstants.php
@@ -0,0 +1,124 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexConstants
 10+{
 11+ public static $CONFIG_DIR = 'config';
 12+ public static $DEFAULT_CONFIG = 'default.php';
 13+ public static $LOCAL_CONFIG = 'local.php';
 14+
 15+ public static $SAWS =
 16+ array('cached_error' => '<span class="error">[Cached]</span>');
 17+
 18+ /**
 19+ * Relative path from wikitex's root in the file system
 20+ * to the cache directory.
 21+ */
 22+ public static $CACHE_FILEPATH = 'cache';
 23+
 24+ /**
 25+ * Relative path from MediaWiki's web-URI to the cache-URI.
 26+ */
 27+ public static $CACHE_WEBPATH = 'extensions/wikitex/cache';
 28+
 29+ /**
 30+ * Mappeth MIME-types to extensions.
 31+ */
 32+ public static $MIME_TO_EXT =
 33+ array(
 34+ 'application/x-latex' => 'tex',
 35+ 'application/x-wikitex-error' => 'error',
 36+ 'audio/midi' => 'midi',
 37+ 'image/png' => 'png',
 38+ );
 39+
 40+ /**
 41+ * Convenient handles to MIMEs.
 42+ */
 43+ public static $MIMES =
 44+ array(
 45+ 'error' => 'application/x-wikitex-error',
 46+ 'latex' => 'application/x-latex',
 47+ 'midi' => 'audio/midi',
 48+ 'png' => 'image/png',
 49+ );
 50+
 51+ public static $ERRORS =
 52+ array(
 53+ 'generic' => array('<span class="error">WikiTeX hath failed, milord: %s. (<em>Pecca fortiter!</em>)</span>',
 54+ 0),
 55+ 'blank' => array('We received a blank document from the webserver',
 56+ 1),
 57+ 'curl' => array('Curl reported error %d: %s', 2),
 58+ 'directory' => array('Can\'t create directory `%s\'', 3),
 59+ 'file' => array('Can\'t write to file `%s\'', 4),
 60+ 'fault' => array('The RPC-server reported fault %d: &ldquo;%s&rdquo;', 4),
 61+ );
 62+
 63+ public static $AGENT = 'WikiTeX-WikiMedia';
 64+
 65+ public static $HOOKS =
 66+ array('amsmath' => 'math');
 67+
 68+ /**
 69+ * Local to remote wethod mapping.
 70+ */
 71+ public static $METHODS =
 72+ array('math' => 'math');
 73+
 74+ public static $CLASSES =
 75+ array(
 76+ 'Wikitex' => 'Wikitex.php',
 77+ 'WikitexCache' => 'WikitexCache.php',
 78+ 'WikitexConfig' => 'WikitexConfig.php',
 79+ 'WikitexConstants' => 'WikitexConstants.php',
 80+ 'WikitexCurlError' => 'errors/WikitexCurlError.php',
 81+ 'WikitexDirectoryError' => 'errors/WikitexDirectoryError.php',
 82+ 'WikitexError' => 'errors/WikitexError.php',
 83+ 'WikitexFileError' => 'errors/WikitexFileError.php',
 84+ 'WikitexImage' => 'WikitexImage.php',
 85+ 'WikitexRequest' => 'WikitexRequest.php',
 86+ 'WikitexRPCFaultError' => 'errors/WikitexRPCFaultError.php',
 87+ 'WikitexRPCResponseError' => 'errors/WikitexRPCResponseError.php',
 88+ );
 89+
 90+ public static function getDir() {
 91+ return dirname(__FILE__);
 92+ }
 93+
 94+ public static function getCacheFilepath() {
 95+ return sprintf('%s/%s', self::getDir(), self::$CACHE_FILEPATH);
 96+ }
 97+
 98+ public static function getCacheWebpath() {
 99+ global $wgScriptPath;
 100+ return sprintf('%s/%s', $wgScriptPath, self::$CACHE_WEBPATH);
 101+ }
 102+
 103+ public static function getClasses() {
 104+ $dir = self::getDir();
 105+ $classes = array();
 106+ foreach (self::$CLASSES as $class => $file) {
 107+ $classes[$class] = "$dir/$file";
 108+ }
 109+ return $classes;
 110+ }
 111+
 112+ public static function getConfig($config) {
 113+ return sprintf('%s/%s/%s', dirname(__FILE__), self::$CONFIG_DIR, $config);
 114+ }
 115+
 116+ public static function getDefaultConfig() {
 117+ return self::getConfig(self::$DEFAULT_CONFIG);
 118+ }
 119+
 120+ public static function getLocalConfig() {
 121+ return self::getConfig(self::$LOCAL_CONFIG);
 122+ }
 123+}
 124+
 125+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/Wikitex.php
@@ -0,0 +1,52 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class Wikitex {
 10+ public static function registerHooks($parser) {
 11+ foreach (WikitexConstants::$HOOKS as $action => $hook) {
 12+ $parser->setHook($action, array(__CLASS__, $hook));
 13+ }
 14+ }
 15+
 16+ /**
 17+ * Superclass for all latex-based renderers.
 18+ *
 19+ * Is itself inaccessible from the wiki; must be accessed through its
 20+ * subclasses.
 21+ *
 22+ * @param content the twixt-tag-content.
 23+ * @param parms a dictionary of attribute-value pairs.
 24+ * @param action the remoted render-method to be invoked (probably identical
 25+ * to its local name).
 26+ * @return The rendered content
 27+ */
 28+ public static function latex($content, array $parms, $action=__FUNCTION__) {
 29+ $IMG_MIME = WikitexConstants::$MIMES['png'];
 30+ $SRC_MIME = WikitexConstants::$MIMES['latex'];
 31+ $ERR_MIME = WikitexConstants::$MIMES['error'];
 32+
 33+ $request = new WikitexRequest($action, $content);
 34+
 35+ try {
 36+ $redditum = $request->render(array($IMG_MIME, $SRC_MIME));
 37+ if (!empty($redditum[$ERR_MIME])) {
 38+ return $redditum[$ERR_MIME];
 39+ }
 40+ return (string) new WikitexImage($redditum[$SRC_MIME],
 41+ $redditum[$IMG_MIME]);
 42+ } catch (Exception $e) {
 43+ return (string) new WikitexError($e->getMessage(), $e->getCode());
 44+ }
 45+ return (string) new WikitexError('Bizzarly, execution continued <em>ins Nichts</em>: this shouldn\'t happen');
 46+ }
 47+
 48+ public static function math($content, array $parms) {
 49+ return self::latex($content, $parms, WikitexConstants::$METHODS[__FUNCTION__]);
 50+ }
 51+}
 52+
 53+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/main.php
@@ -0,0 +1,21 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+ // Paradox? Include to initiate autoload.
 10+include_once('WikitexConstants.php');
 11+
 12+ // Global magic
 13+$wgExtensionFunctions[] = 'wikitexRegisterHooks';
 14+$wgAutoloadClasses = array_merge($wgAutoloadClasses,
 15+ WikitexConstants::getClasses());
 16+
 17+function wikitexRegisterHooks() {
 18+ global $wgParser;
 19+ Wikitex::registerHooks($wgParser);
 20+}
 21+
 22+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/errors/WikitexError.php
@@ -0,0 +1,31 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexError extends Exception
 10+{
 11+ const CODE = 0;
 12+ const MESSAGE = '%d, %s';
 13+
 14+ protected $message = NULL;
 15+ protected $code = self::CODE;
 16+
 17+ public function WikitexError($message, $code = self::CODE) {
 18+ $this->message = $message;
 19+ $this->code = $code;
 20+ }
 21+
 22+ public function __toString() {
 23+ list($strerror, $errno) = WikitexConstants::$ERRORS['generic'];
 24+ $message = $this->message;
 25+ if ($this->code) {
 26+ $message = sprintf(self::MESSAGE, $this->code, $message);
 27+ }
 28+ return sprintf($strerror, $message);
 29+ }
 30+}
 31+
 32+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/errors/WikitexFileError.php
@@ -0,0 +1,17 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexFileError extends WikitexError
 10+{
 11+ public function WikitexFileError($file) {
 12+ list($strerror, $errno) = WikitexConstants::$ERRORS['file'];
 13+ parent::__construct(sprintf($strerror, $file), $errno);
 14+ }
 15+}
 16+
 17+?>
 18+
\ No newline at end of file
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/errors/WikitexRPCFaultError.php
@@ -0,0 +1,27 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+ /**
 10+ * In case of faults thrown from the RPC-server.
 11+ */
 12+class WikitexRPCFaultError extends WikitexError
 13+{
 14+ const STRING = 'faultString';
 15+ const CODE = 'faultCode';
 16+
 17+ /**
 18+ * @param document The parsed rpc-response.
 19+ */
 20+ public function WikitexRPCFaultError($document) {
 21+ list($strerror, $errno) = WikitexConstants::$ERRORS['fault'];
 22+ $fault_strerror = htmlentities($document[self::STRING]);
 23+ $fault_errno = $document[self::CODE];
 24+ parent::__construct(sprintf($strerror, $fault_errno, $fault_strerror), $errno);
 25+ }
 26+}
 27+
 28+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/errors/WikitexRPCResponseError.php
@@ -0,0 +1,20 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+ /**
 10+ * In case of blank or invalid documents for the RPC-server.
 11+ */
 12+class WikitexRPCResponseError extends WikitexError
 13+{
 14+ public function WikitexRPCResponseError() {
 15+ list($strerror, $errno) = WikitexConstants::$ERRORS['blank'];
 16+ parent::__construct($strerror, $errno);
 17+ }
 18+}
 19+
 20+?>
 21+
\ No newline at end of file
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/errors/WikitexDirectoryError.php
@@ -0,0 +1,17 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexDirectoryError extends WikitexError
 10+{
 11+ public function WikitexDirectoryError($dir) {
 12+ list($strerror, $errno) = WikitexConstants::$ERRORS['directory'];
 13+ parent::__construct(sprintf($strerror, $dir), $errno);
 14+ }
 15+}
 16+
 17+?>
 18+
\ No newline at end of file
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/errors/WikitexCurlError.php
@@ -0,0 +1,16 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexCurlError extends WikitexError
 10+{
 11+ public function WikitexCurlError($curl_strerr, $curl_errno) {
 12+ list($strerror, $errno) = WikitexConstants::$ERRORS['curl'];
 13+ parent::__construct(sprintf($strerror, $curl_errno, $curl_strerr), $errno);
 14+ }
 15+}
 16+
 17+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/WikitexImage.php
@@ -0,0 +1,32 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ * Copyright(C) 2004-7 Peter Danenberg
 6+ * See doc/COPYING for details.
 7+ */
 8+
 9+class WikitexImage
 10+{
 11+ const ELEMENT = '<a href="%s"><img src="%s" /></a>';
 12+
 13+ /**
 14+ * URI to the source behind the image.
 15+ */
 16+ protected $source = NULL;
 17+
 18+ /**
 19+ * URI to the image itself.
 20+ */
 21+ protected $image = NULL;
 22+
 23+ public function WikitexImage($source, $image) {
 24+ $this->source = $source;
 25+ $this->image = $image;
 26+ }
 27+
 28+ public function __toString() {
 29+ return sprintf(self::ELEMENT, $this->source, $this->image);
 30+ }
 31+}
 32+
 33+?>
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/src/client/mediawiki/WikitexCache.php
@@ -0,0 +1,116 @@
 2+<?php
 3+
 4+class WikitexCache
 5+{
 6+ /**
 7+ * Vide infra, putCache(), for justification of md4.
 8+ */
 9+ public static $HASH = 'md4';
 10+
 11+ /**
 12+ * Directories deep to place cache.
 13+ */
 14+ public static $HASH_DEPTH = 2;
 15+
 16+ /**
 17+ * Length of hash segments to use for
 18+ * $HASH_DEPTH-deep directories.
 19+ */
 20+ public static $HASH_SPLICE = 1;
 21+
 22+ public static $UMASK = 0022;
 23+ public static $MOD = 0700;
 24+
 25+ /**
 26+ * Cache-dir plus file prefix as needed
 27+ * to reference the file system.
 28+ */
 29+ protected $filepath = NULL;
 30+
 31+ /**
 32+ * Cache-dir plus file prefix as needed
 33+ * to reference URIs.
 34+ */
 35+ protected $webpath = NULL;
 36+
 37+ /**
 38+ * The source from which to compute hash (i.e.,
 39+ * uncompiled source).
 40+ */
 41+ protected $content = NULL;
 42+
 43+ /**
 44+ * The digested source, serves as filename.
 45+ */
 46+ protected $hash = NULL;
 47+
 48+ /**
 49+ * The compiled content to be stored in the cache
 50+ * file; consequence: hash cannot be computed from
 51+ * cache's contents.
 52+ */
 53+ protected $data = NULL;
 54+
 55+ public function WikitexCache($content) {
 56+ $this->content = $content;
 57+ $this->hash = self::hash($content);
 58+ $ext = NULL;
 59+ for ($i = 0; $i < self::$HASH_DEPTH; $i += self::$HASH_SPLICE) {
 60+ $hashchar = substr($this->hash, $i, self::$HASH_SPLICE);
 61+ $ext = "{$ext}/{$hashchar}";
 62+ }
 63+ $cache_filepath = WikitexConstants::getCacheFilepath();
 64+ $this->filepath = "{$cache_filepath}{$ext}";
 65+ $cache_webpath = WikitexConstants::getCacheWebpath();
 66+ $this->webpath = "{$cache_webpath}{$ext}";
 67+ }
 68+
 69+ public static function hash($content) {
 70+ return hash(WikitexCache::$HASH, $content);
 71+ }
 72+
 73+ public function getFilename($mime) {
 74+ $suffix = WikitexConstants::$MIME_TO_EXT[$mime];
 75+ return "{$this->filepath}/{$this->hash}.{$suffix}";
 76+ }
 77+
 78+ public function getWebname($mime) {
 79+ $suffix = WikitexConstants::$MIME_TO_EXT[$mime];
 80+ return "{$this->webpath}/{$this->hash}.{$suffix}";
 81+ }
 82+
 83+ public function getCache($mime) {
 84+ $filename = $this->getFilename($mime);
 85+ if (file_exists($filename)) {
 86+ $cached = ($mime == WikitexConstants::$MIMES['error'])
 87+ ? sprintf('%s %s', WikitexConstants::$SAWS['cached_error'],
 88+ file_get_contents($filename))
 89+ : $this->getWebname($mime);
 90+ return $cached;
 91+ } else {
 92+ return NULL;
 93+ }
 94+ }
 95+
 96+ /**
 97+ * Opting for $BASE/[m]/[n]/mnxxx..., where mnxxx... is the md5 hash
 98+ * of the content. md5 was chosen over md4 because, though the latter
 99+ * leads slightly in speed, the former is almost ubiquitous.
 100+ */
 101+ public function putCache($data, $type) {
 102+ umask(self::$UMASK);
 103+ if (!file_exists($this->filepath)) {
 104+ if (!mkdir($this->filepath, self::$MOD, TRUE)) {
 105+ // $this->filepath gives away too much info for public consumption;
 106+ // the logs should disclose more for the need-to-knowers.
 107+ throw new WikitexDirectoryError('CACHE_DIR');
 108+ }
 109+ }
 110+ $filename = $this->getFilename($type);
 111+ if (!file_put_contents($filename, (string) $data)) {
 112+ // $filename gives away too much for the nought-need-to-knowers.
 113+ throw new WikitexFileError('CACHE_FILE');
 114+ }
 115+ }
 116+}
 117+
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/bin/wikitex.in
@@ -0,0 +1,6 @@
 2+#!%(python)s -O
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+
 7+from wikitex.main import *
Property changes on: trunk/ATTIC/wikitex/branches/2.0-beta1/bin/wikitex.in
___________________________________________________________________
Added: svn:executable
18 + *
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/bin/wikitex-debug.in
@@ -0,0 +1,6 @@
 2+#!%(python)s
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+
 7+from wikitex.main import *
Property changes on: trunk/ATTIC/wikitex/branches/2.0-beta1/bin/wikitex-debug.in
___________________________________________________________________
Added: svn:executable
18 + *
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/MANIFEST.in
@@ -0,0 +1,10 @@
 2+##
 3+# WikiTeX: expansible LaTeX module for MediaWiki
 4+# Copyright (C) 2004-7 Peter Danenberg
 5+# See doc/COPYING for details.
 6+include doc/TODO doc/THANKS doc/README doc/COPYING
 7+recursive-include doc/src *.ms Makefile.in
 8+recursive-include doc/dot *.dot *.png
 9+exclude doc/src/title.ms
 10+recursive-include src/client *.php
 11+recursive-include src/handler .htaccess *.py
Index: trunk/ATTIC/wikitex/branches/2.0-beta1/README
@@ -0,0 +1 @@
 2+link doc/README
\ No newline at end of file
Property changes on: trunk/ATTIC/wikitex/branches/2.0-beta1/README
___________________________________________________________________
Added: svn:special
13 + *
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit-write.tex
@@ -0,0 +1,6 @@
 2+\documentclass{article}
 3+\begin{document}
 4+\immediate\openout0=../test\relax
 5+\write0{\noexpand\bf byebye}
 6+\closeout0
 7+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit-write.tex
___________________________________________________________________
Added: svn:keywords
18 + Author Date Id Revision
Added: svn:eol-style
29 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/Wikitex.in.php
@@ -0,0 +1,485 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ *
 6+ * PHP version 5
 7+ *
 8+ * WikiTeX is licensed under the Artistic License 2.0; to
 9+ * view a copy of this license, see COPYING or visit:
 10+ *
 11+ * http://dev.perl.org/perl6/rfc/346.html
 12+ *
 13+ * @package Wikitex
 14+ * @author Peter Danenberg <pcd at wikitex dot org>
 15+ * @copyright Copyright &copy; 2004-6 Peter Danenberg
 16+ * @version %VERSION%
 17+ * @link http://wikitex.org
 18+ * @since WikiTeX 1.1-beta2
 19+ */
 20+
 21+ /**
 22+ * Include those constants responsible for error' gestalt and
 23+ * class->function mapping.
 24+ */
 25+include_once('WikitexConstants.php');
 26+
 27+/**
 28+ * HTML element corresponding to errorous output (previously rendered of LaTeX: whoops!)
 29+ */
 30+define('WIKITEX_ERROR', '<span class="errwikitex">WikiTeX: %s</span>');
 31+
 32+/**
 33+ * Absolute path to the base extension.
 34+ */
 35+define('WIKITEX_PATH', "$IP/extensions/wikitex");
 36+
 37+/**
 38+ * Absolute path to the templates' directory.
 39+ */
 40+define('WIKITEX_TEMPLATE', WIKITEX_PATH . '/template/%s.*');
 41+
 42+/**
 43+ * Absolute path to the cache directory.
 44+ */
 45+define('WIKITEX_DIR', WIKITEX_PATH . '/tmp/');
 46+
 47+/**
 48+ * Uniform resource identifier associated with the
 49+ * cache directory.
 50+ */
 51+define('WIKITEX_URI', "$wgScriptPath/extensions/wikitex/tmp/");
 52+
 53+/**
 54+ * The anticipated form of the bash invocation,
 55+ * with triple argument: hash, module, outpath.
 56+ */
 57+define('WIKITEX_BASH', WIKITEX_PATH . '/wikitex.sh %s %s %s');
 58+
 59+/**
 60+ * Template for token substitution in template files.
 61+ */
 62+define('WIKITEX_TOKEN', '%%%s%%');
 63+
 64+/**
 65+ * Template for cache files.
 66+ */
 67+define('WIKITEX_CACHE', '%s.cache');
 68+
 69+/**
 70+ * Tag-property which invokes source-file or
 71+ * -page.
 72+ */
 73+define('WIKITEX_SOURCE', 'src');
 74+
 75+/**
 76+ * Tag-property which invokes apposite data
 77+ * (usurps not source).
 78+ */
 79+define('WIKITEX_DATA', 'data');
 80+
 81+/**
 82+ * Capital WikiTeX functionality.
 83+ *
 84+ * Provides translational functionality from class to method;
 85+ * mediates between PHP and shell interface.
 86+ *
 87+ * @package Wikitex
 88+ * @author Peter Danenberg <pcd@wikitex.org>
 89+ * @copyright Copyright (C) 2004-6 Peter Danenberg
 90+ * @version %VERSION%
 91+ * @link http://wikitex.org
 92+ * @since WikiTeX 1.1-beta2
 93+ */
 94+class Wikitex {
 95+
 96+ /**
 97+ * Placeholder for facultative token
 98+ * substitutions and directives
 99+ * particular to classes.
 100+ * @var array
 101+ */
 102+ protected static $defaults = array();
 103+
 104+ /**
 105+ * Register parser hooks.
 106+ *
 107+ * Iterate through the array of in-article classes,
 108+ * associating them with a function pointer within
 109+ * Parser.
 110+ * @param Parser $parser Parser object received from MediaWiki.
 111+ * @return void
 112+ * @access public
 113+ * @static
 114+ */
 115+ public static function registerHooks($parser) {
 116+ foreach (Wikitex_Constants::getHooks() as $class => $hook) {
 117+ $parser->setHook($class, array(__CLASS__, $hook));
 118+ }
 119+ }
 120+
 121+ /**
 122+ * Substitute string tokens.
 123+ *
 124+ * Using the {@link WIKITEX_TOKEN} template, substitute
 125+ * the tokens within the source material.
 126+ * @param string $partiendum the source material (Latin, partiendum: "to be parsed").
 127+ * @param array $partientes array mapping token to substitution (Latin, partientes: "parsing things").
 128+ * @return void
 129+ * @static
 130+ * @access public
 131+ */
 132+ public static function substituteTokens($partiendum, array $partientes)
 133+ {
 134+ foreach($partientes as $token => $substitution) {
 135+ $partiendum = strtr($partiendum, array(sprintf(WIKITEX_TOKEN, strtoupper($token)) => $substitution));
 136+ }
 137+ return $partiendum;
 138+ }
 139+
 140+ /**
 141+ * Constructs an HTML error according
 142+ * to the error template.
 143+ * @param string the class under whose auspices the error
 144+ * arose.
 145+ * @return string the so-gestalted error.
 146+ * @see WIKITEX_ERROR
 147+ */
 148+ public static function error($error) {
 149+ $errors = Wikitex_Constants::getErrors();
 150+ return sprintf(WIKITEX_ERROR, $errors[$error]);
 151+ }
 152+
 153+ /**
 154+ * Render content.
 155+ *
 156+ * The carnality or meat of WikiTeX; takes the
 157+ * to-be-rendered-content ($reddendum),
 158+ * which it renders according to $class
 159+ * and dispatches with the addition of said $properties.
 160+ *
 161+ * @param string $class the class under whose auspices we
 162+ * do peripatetically render (the students of Aristotle).
 163+ * @param string $reddendum the content to be rendered (Latin, reddendum: "to be rendered").
 164+ * @param array $properties an array consisting of token -> value
 165+ * substitutions in the template, or idio-directives (source, say, or data
 166+ * fetching).
 167+ * @return string the thus rendered content (or apposite error).
 168+ * @static
 169+ * @access public
 170+ */
 171+ public static function renderContent($reddendum, $class, $properties)
 172+ {
 173+ global $IP, $wgScriptPath;
 174+
 175+ // token => value substitution in template
 176+ $substitutions = array();
 177+
 178+ // content, whether from source file, cache, or template substitution and processing;
 179+ // filename of pre-processed content;
 180+ // MD5 hash of content
 181+ $template = $content = $cache = $hash = '';
 182+
 183+ // try reading from source
 184+ if (!empty($properties[WIKITEX_SOURCE])) {
 185+ if (!self::fetchContent($properties[WIKITEX_SOURCE], $content, false)) {
 186+ return $content; // an error occurred
 187+ }
 188+ }
 189+
 190+ // read from source failed
 191+ if (empty($content)) {
 192+ // check class template against glob: "template/<class>.*"
 193+ if (!($template = file_get_contents(current(glob(sprintf(WIKITEX_TEMPLATE, $class)))))) {
 194+ return self::error('temp');
 195+ }
 196+
 197+ // ad hoc substitution (superseded by value property)
 198+ $substitutions['value'] = $reddendum;
 199+
 200+ // superimpose properties [unto defaults] unto substitutions
 201+ $substitutions = array_merge($substitutions, (empty(self::$defaults[$class]) ? $properties : array_merge(self::$defaults[$class], $properties)));;
 202+
 203+ // token substitution; where each value of $subs substituted in $template: %VALUE%, %TEMPO%, etc.
 204+ $content = self::substituteTokens($template, $substitutions);
 205+ }
 206+
 207+ // derive the outfile hash
 208+ $hash = md5($content);
 209+
 210+ // change to cache directory
 211+ if (!chdir(WIKITEX_DIR)) {
 212+ return self::error('cache');
 213+ }
 214+
 215+ // check cache
 216+ if (is_readable($cache = sprintf(WIKITEX_CACHE, $hash))) {
 217+ return file_get_contents($cache);
 218+ }
 219+
 220+ // create working directory
 221+ if (!is_dir($hash) && !mkdir($hash)) {
 222+ return self::error('dir');
 223+ }
 224+
 225+ // allow wikitex to write to dir
 226+ if (!chmod($hash, 0777)) {
 227+ return self::error('perm');
 228+ }
 229+
 230+ // change to working directory
 231+ if (!chdir($hash)) {
 232+ return self::error('work');
 233+ }
 234+
 235+ // source
 236+ if (!file_put_contents($hash, $content)) {
 237+ return self::error('src');
 238+ }
 239+
 240+ // make supplemental data available
 241+ if (!empty($properties[WIKITEX_DATA])) {
 242+ if (!self::fetchContent($properties[WIKITEX_DATA], $content, true)) { // clobbers content in case of error
 243+ return $content; // an error occurred
 244+ }
 245+ }
 246+
 247+ // invoke handler
 248+ if (!is_executable(substr(WIKITEX_BASH, 0, strpos(WIKITEX_BASH, ' ')))) {
 249+ return self::error('bash');
 250+ } else {
 251+ return trim(shell_exec(sprintf(WIKITEX_BASH, $hash, $class, WIKITEX_URI)));
 252+ }
 253+ }
 254+
 255+ /**
 256+ * Fetch external content.
 257+ *
 258+ * Fetch external content given title; try uploaded files first, and if that
 259+ * fails: fall back on article fetchment.
 260+ *
 261+ * @param string $title the name of the resource (underscores or spaces).
 262+ * @param string &$content the fetched content or (in case of error) an error message.
 263+ * @param bool $copy whether to copy the file to the working directory (leaves
 264+ * $copy unmolested except in case of error).
 265+ * @return bool whether an error took place (in which case $content will contain
 266+ * the error message).
 267+ * @access public
 268+ * @static
 269+ * @since 1.1-beta3
 270+ */
 271+ public static function fetchContent($title, &$content, $copy = false) {
 272+ $file = Image::newFromName($title);
 273+ if ($file->exists() && is_readable($file->imagePath)) {
 274+ if ($copy) {
 275+ if (!copy($file->imagePath, './' . $file->getName())) {
 276+ $content = self::error('copy');
 277+ return false;
 278+ }
 279+ } else { // Not copying
 280+ $content = file_get_contents($file->imagePath);
 281+ }
 282+ } else { // File is illegible; try reading article
 283+ if (($article = Revision::newFromTitle(Title::newFromText($title))) != null) {
 284+ $text = $article->getText();
 285+ if ($copy) {
 286+ file_put_contents('./' . escapeshellcmd($title), $text);;
 287+ } else {
 288+ $content = $text;
 289+ }
 290+ } else { // Neither source is legible, nor article available.
 291+ $content = self::error('source');
 292+ return false;
 293+ }
 294+ }
 295+ return true;
 296+ }
 297+
 298+ /**
 299+ * Chess.
 300+ *
 301+ * {@link http://www.ctan.org/tex-archive/macros/latex/contrib/skak Skak} by Torben Hoffmann.
 302+ * @param string $content containing the tag's content, received from wgParser.
 303+ * @param array $parms of parameters corresponding to the tag's properties.
 304+ * @return string containing the processed tag, referencing novel
 305+ * content.
 306+ */
 307+ public static function chess($content, array $parms)
 308+ {
 309+ return self::renderContent($content, __FUNCTION__, $parms);
 310+ }
 311+
 312+ /**
 313+ * Feynman diagrams.
 314+ *
 315+ * {@link http://www.tex.ac.uk/cgi-bin/texfaq2html?label=drawFeyn Feynman} by Michael Levine
 316+ * @param string $content containing the tag's content, received from wgParser.
 317+ * @param array $parms of parameters corresponding to the tag's properties.
 318+ * @return string containing the processed tag, referencing novel
 319+ * content.
 320+ */
 321+ public static function feyn($content, array $parms)
 322+ {
 323+ return self::renderContent($content, __FUNCTION__, $parms);
 324+ }
 325+
 326+ /**
 327+ * Go.
 328+ *
 329+ * {@link http://match.stanford.edu/bump/go.html sgf2dg} by Daniel Bump and Reid Augustin.
 330+ * @param string $content containing the tag's content, received from wgParser.
 331+ * @param array $parms of parameters corresponding to the tag's properties.
 332+ * @return string containing the processed tag, referencing novel
 333+ * content.
 334+ */
 335+ public static function go($content, array $parms)
 336+ {
 337+ return self::renderContent($content, __FUNCTION__, $parms);
 338+ }
 339+
 340+ /**
 341+ * Graphviz.
 342+ *
 343+ * {@link http://www.graphviz.org/ Graphviz} by Lefty Koutsofios, et al.
 344+ * @param string $content containing the tag's content, received from wgParser.
 345+ * @param array $parms of parameters corresponding to the tag's properties.
 346+ * @return string containing the processed tag, referencing novel
 347+ * content.
 348+ */
 349+ public static function graph($content, array $parms)
 350+ {
 351+ switch ($parms['layout']) {
 352+ case 'neato':
 353+ $layout = $parms['layout'];
 354+ break;
 355+ case 'fdp':
 356+ $layout = $parms['layout'];
 357+ break;
 358+ case 'twopi':
 359+ $layout = $parms['layout'];
 360+ break;
 361+ case 'circo':
 362+ $layout = $parms['layout'];
 363+ break;
 364+ default:
 365+ $layout = 'graph';
 366+ }
 367+ return self::renderContent($content, $layout, $parms);
 368+ }
 369+
 370+ /**
 371+ * Ibycus Greek.
 372+ *
 373+ * {@link http://www.ctan.org/tex-archive/language/greek/ibygrk/?action=/tex-archive/language/greek/ Ibycus}
 374+ * by Pierre MacKay.
 375+ * @param string $content containing the tag's content, received from wgParser.
 376+ * @param array $parms array of parameters corresponding to the tag's properties.
 377+ * @return string containing the processed tag, referencing novel
 378+ * content.
 379+ */
 380+ public static function greek($content, array $parms)
 381+ {
 382+ return self::renderContent($content, __FUNCTION__, $parms);
 383+ }
 384+
 385+ /**
 386+ * American Mathematical Society.
 387+ *
 388+ * {@link http://www.ams.org/tex/amslatex.html AMS-LaTeX}, including commutative diagrams.
 389+ * @param string $content containing the tag's content, received from wgParser.
 390+ * @param array $parms of parameters corresponding to the tag's properties.
 391+ * @return string containing the processed tag, referencing novel
 392+ * content.
 393+ */
 394+ public static function amsmath($content, array $parms)
 395+ {
 396+ return self::renderContent($content, __FUNCTION__, $parms);
 397+ }
 398+
 399+ /**
 400+ * Lilypond.
 401+ *
 402+ * {@link http://www.lilypond.org/web/ Lilypond} with midi output.
 403+ * @param string $content containing the tag's content, received from wgParser.
 404+ * @param array $parms of parameters corresponding to the tag's properties.
 405+ * @return string containing the processed tag, referencing novel
 406+ * content.
 407+ */
 408+ public static function music($content, array $parms)
 409+ {
 410+ self::$defaults[__FUNCTION__] = array('tempo' => '80');
 411+ return self::renderContent($content, __FUNCTION__, $parms);
 412+ }
 413+
 414+ /**
 415+ * Gnuplot.
 416+ *
 417+ * {@link http://www.gnuplot.info Gnuplot} by Hans-Bernhard Broeker, <em>et al.\ </em>
 418+ * @param string $content containing the tag's content, received from wgParser.
 419+ * @param array $parms of parameters corresponding to the tag's properties.
 420+ * @return string containing the processed tag, referencing novel
 421+ * content.
 422+ */
 423+ public static function plot($content, array $parms)
 424+ {
 425+ return self::renderContent($content, __FUNCTION__, $parms);
 426+ }
 427+
 428+ /**
 429+ * ImageMagick's SVG.
 430+ *
 431+ * {@link http://www.imagemagick.org/ ImageMagick's} light SVG conversion.
 432+ * @param string $content containing the tag's content, received from wgParser.
 433+ * @param array $parms of parameters corresponding to the tag's properties.
 434+ * @return string containing the processed tag, referencing novel
 435+ * content.
 436+ */
 437+ public static function svg($content, array $parms)
 438+ {
 439+ self::$defaults[__FUNCTION__] = array('width' => '800',
 440+ 'height' => '600');
 441+ return self::renderContent($content, __FUNCTION__, $parms);
 442+ }
 443+
 444+ /**
 445+ * Tengwar.
 446+ *
 447+ * {@link http://tolklang.quettar.org/fonts/ TengTeX} by Ivan Derzhanski.
 448+ * @param string $content containing the tag's content, received from wgParser.
 449+ * @param array $parms of parameters corresponding to the tag's properties.
 450+ * @return string containing the processed tag, referencing novel
 451+ * content.
 452+ */
 453+ public static function teng($content, array $parms)
 454+ {
 455+ return self::renderContent($content, __FUNCTION__, $parms);
 456+ }
 457+
 458+ /**
 459+ * International Phonetic Alphabet.
 460+ *
 461+ * {@link http://www.l.u-tokyo.ac.jp/~fkr/tipa/ TIPA} International Phonetic Symbols.
 462+ * @param string $content containing the tag's content, received from wgParser.
 463+ * @param array $parms of parameters corresponding to the tag's properties.
 464+ * @return string containing the processed tag, referencing novel
 465+ * content.
 466+ */
 467+ public static function ipa($content, array $parms)
 468+ {
 469+ return self::renderContent($content, __FUNCTION__, $parms);
 470+ }
 471+
 472+ /**
 473+ * XyMTeX.
 474+ *
 475+ * {@link http://imt.chem.kit.ac.jp/fujita/fujitas3/xymtex/indexe.html XyMTeX} by Shinsaku Fujita.
 476+ * @param string $content containing the tag's content, received from wgParser.
 477+ * @param array $parms of parameters corresponding to the tag's properties.
 478+ * @return string containing the processed tag, referencing novel
 479+ * content.
 480+ */
 481+ public static function chem($content, array $parms)
 482+ {
 483+ return self::renderContent($content, __FUNCTION__, $parms);
 484+ }
 485+}
 486+?>
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/Wikitex.in.php
___________________________________________________________________
Added: svn:keywords
1487 + Author Date Id Revision
Added: svn:eol-style
2488 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/main.in.php
@@ -0,0 +1,39 @@
 2+<?php
 3+ /**
 4+ * WikiTeX: expansible LaTeX module for MediaWiki
 5+ *
 6+ * PHP version 5
 7+ *
 8+ * WikiTeX is licensed under the Artistic License 2.0; to
 9+ * view a copy of this license, see COPYING or visit:
 10+ *
 11+ * http://dev.perl.org/perl6/rfc/346.html
 12+ *
 13+ * @package Wikitex
 14+ * @author Peter Danenberg <pcd at wikitex dot org>
 15+ * @copyright Copyright &copy; 2004-6 Peter Danenberg
 16+ * @version %VERSION%
 17+ * @link http://wikitex.org
 18+ * @since WikiTeX 1.1-beta2
 19+ */
 20+
 21+ /**
 22+ * Include main functional class (which in turn includes
 23+ * constants).
 24+ */
 25+include_once('Wikitex.php');
 26+
 27+$wgExtensionFunctions[] = 'wikitexRegisterHooks';
 28+
 29+/**
 30+ * Register callbacks.
 31+ *
 32+ * Register callback function within the MediaWiki parser.
 33+ * @return void
 34+ */
 35+function wikitexRegisterHooks() {
 36+ global $wgParser;
 37+ Wikitex::registerHooks($wgParser);
 38+}
 39+
 40+?>
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/main.in.php
___________________________________________________________________
Added: svn:keywords
141 + Author Date Id Revision
Added: svn:eol-style
242 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/manifest.ms
@@ -0,0 +1,67 @@
 2+.DA
 3+.TL
 4+WikiTeX %VERSION% MANIFEST
 5+.AU
 6+Peter Danenberg <pcd at wikitex dot org>
 7+.NH
 8+Documents
 9+.RS
 10+.TS
 11+l l .
 12+ChangeLog Subdural mutations
 13+COPYING License
 14+copying.inc.ms Include license
 15+copying.ms COPYING source
 16+Makefile Compile docs from source
 17+MANIFEST Serial list
 18+manifest.ms MANIFEST source
 19+NEWS Visible changes and todo's
 20+news.ms NEWS source
 21+README Installation and expansion
 22+readme.ms README source
 23+THANKS Benedictum
 24+thanks.ms THANKS source
 25+.TE
 26+.RE
 27+.NH
 28+Module
 29+.RS
 30+.TS
 31+l l .
 32+main.in.php Driver
 33+wikitex-audit.in.sh Security auditor
 34+wikitex-audit-read.tex Audit reading from parent directories
 35+wikitex-audit-shell.tex Audit LaTeX execution
 36+wikitex-audit-write.tex Audit writing to parent directories
 37+wikitex-decruft.in.sh Clean cache directory of unused cruft
 38+WikitexConstants.in.php Parser header
 39+wikitex.in.cron Crontab template
 40+wikitex.in.sudoers Sodoers' template
 41+wikitex.in.ini phpDocumentor cruft
 42+Wikitex.in.php Parser
 43+wikitex.sh Shell interface
 44+.TE
 45+.RE
 46+.NH
 47+Templates (template/)
 48+.RS
 49+.TS
 50+l l .
 51+amsmath.tex AMS-LaTeX
 52+chem.tex XyMTeX
 53+chess.tex Skak
 54+circo.dot Graphviz circo
 55+fdp.dot Graphviz fdp
 56+feyn.tex feynMF
 57+go.sgf Go
 58+graph.dot Graphviz dot
 59+greek.tex Ibycus
 60+ipa.tex TIPA
 61+music.ly Lilypond
 62+plot.p Gnuplot
 63+svg.svg SVG
 64+teng.tex Tengwar
 65+twopi.dot Graphviz twopi
 66+.TE
 67+.RE
 68+.bp
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/manifest.ms
___________________________________________________________________
Added: svn:keywords
169 + Author Date Id Revision
Added: svn:eol-style
270 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/copying.ms
@@ -0,0 +1,121 @@
 2+.DA
 3+.TL
 4+WikiTeX %VERSION% LICENSE
 5+.AU
 6+Peter Danenberg <pcd at wikitex dot org>
 7+.SH
 8+The Artistic License Version 2.0beta4, October 2000
 9+.PP
 10+Copyright (C) 2000, Larry Wall. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
 11+.SH
 12+Preamble
 13+.RS
 14+.PP
 15+This copyright license states the terms under which a given free software Package may be copied, modified and/or redistributed, while the Originator(s) maintain some artistic control over the future development of that Package (at least as much artistic control as can be given under copyright law while still making the Package open source and free software).
 16+.PP
 17+This license is bound by copyright law, and thus it legally applies only to works which the copyright holder has permitted copying, distribution or modification under the terms of the Artistic License, Version 2.0.
 18+.PP
 19+You are reminded that You are always permitted to make arrangements wholly outside of a given copyright license directly with the copyright holder(s) of a given Package. If the terms of this license impede your ability to make full use of the Package, You are encouraged to contact the copyright holder(s) and seek a different licensing arrangement.
 20+.RE
 21+.SH
 22+Definitions
 23+.RS
 24+.IP \(lqPackage\(rq
 25+refers to the collection of files distributed by the Originator(s), and derivatives of that collection of files created through textual modification.
 26+.IP \(lqStandard\ Version\(rq
 27+refers to the Package if it has not been modified, or has been modified only in ways suggested by the Originator(s).
 28+.IP \(lqModified\ Version\(rq
 29+refers to the Package, if it has been changed by You via textual modification of the source code, and such changes were not suggested by the Originator(s).
 30+.IP \(lqOriginator\(rq
 31+refers to the author(s) and/or copyright holder(s) of the Standard Version of the Package.
 32+.IP \(lqYou\(rq\ and\ \(lqYour\(rq
 33+refers to any person who would like to copy, distribute, or modify the Package.
 34+.IP \(lqDistribution\ Fee\(rq
 35+is any fee that You charge for providing a copy of this Package to another party. It does not refer to licensing fees.
 36+.IP \(lqFreely\ Available\(rq
 37+means that:
 38+.RS
 39+.nr i 0 1
 40+.af i a
 41+.IP \n+i.
 42+no fee is charged for the right to use the item (though a Distribution Fee may be charged).
 43+.IP \n+i.
 44+recipients of the item may redistribute it under the same conditions they received it.
 45+.IP \n+i.
 46+If the item is a binary, object code, bytecode, the complete corresponding machine-readable source code is included with the item.
 47+.RE
 48+.RE
 49+.SH
 50+Permission for Use and Modification Without Redistribution
 51+.RS
 52+.nr j 0 1
 53+.IP \n+j.
 54+You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not redistribute the Modified Version to others outside of your company or organization.
 55+.RE
 56+.SH
 57+Permissions for Redistribution of the Standard Version
 58+.RS
 59+.IP \n+j.
 60+You may make available verbatim copies of the source code of the Standard Version of this Package in any medium without restriction, either gratis or for a Distribution Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At Your discretion, such verbatim copies may or may not include compiled bytecode, object code or binary versions of the corresponding source code in the same medium.
 61+.IP \n+j.
 62+You may apply any bug fixes, portability changes, and other modifications made available from any of the Originator(s). The resulting modified Package will still be considered the Standard Version, and may be copied, modified and redistributed under the terms of the original license of the Standard Version as if it were the Standard Version.
 63+.RE
 64+.SH
 65+Permissions for Redistribution of Modified Versions of the Package as Source
 66+.RS
 67+.IP \n+j.
 68+You may modify your copy of the source code of this Package in any way and distribute that Modified Version (either gratis or for a Distribution Fee, and with or without a corresponding binary, bytecode or object code version of the Modified Version) provided that You clearly indicate what changes You made to the Package, and provided that You do at least ONE of the following:
 69+.RS
 70+.nr i 0 1
 71+.IP \n+i.
 72+make the Modified Version available to the Originator(s) of the Standard Version, under the exact license of the Standard Version, so that the Originator(s) may include your modifications into the Standard Version (at their discretion).
 73+.IP \n+i.
 74+modify any installation scripts and procedures so that installation of the Modified Version will never conflict with an installation of the Standard Version, include for each program installed by the Modified Version clear documentation describing how it differs from the Standard Version, and rename your Modified Version so that the name is substantially different from the Standard Version.
 75+.IP \n+i.
 76+permit and encourage anyone who receives a copy of the Modified Version permission to make your modifications Freely Available in some specific way.
 77+.RE
 78+.IP
 79+If Your Modified Version is in turn derived from a Modified Version made by a third party, then You are still required to ensure that Your Modified Version complies with the requirements of this license.
 80+.RE
 81+.SH
 82+Permissions for Redistribution of Non-Source Versions of Package
 83+.RS
 84+.IP \n+j.
 85+You may distribute binary, object code, bytecode or other non-source versions of the Standard Version of the Package, provided that you include complete instructions on where to get the source code of the Standard Version. Such instructions must be valid at the time of Your distribution. If these instructions, at any time while You are carrying our such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If You cease distribution within thirty days after You become aware that the instructions are invalid, then You do not forfeit any of Your rights under this license.
 86+.IP \n+j.
 87+You may distribute binary, object code, bytecode or other non-source versions of a Modified Version provided that You do at least ONE of the following:
 88+.RS
 89+.nr i 0 1
 90+.IP \n+i.
 91+include a copy of the corresponding source code for the Modified Version under the terms indicated in (4).
 92+.IP \n+i.
 93+ensure that the installation of Your non-source Modified Version does not conflict in any way with an installation of the Standard Version, include for each program installed by the Modified Version clear documentation describing how it differs from the Standard Version, and rename your Modified Version so that the name is substantially different from the Standard Version.
 94+.IP \n+i.
 95+ensure that the Modified Version includes notification of the changes made from the Standard Version, and offer to provide machine-readable source code (under a license that permits making that source code Freely Available) of the Modified Version via mail order.
 96+.RE
 97+.RE
 98+.SH
 99+Permissions for Inclusion of the Package in Aggregate Works
 100+.RS
 101+.IP \n+j.
 102+You may aggregate this Package (either the Standard Version or Modified Version) with other packages and distribute the resulting aggregation provided that You do not charge a licensing fee for the Package. Distribution Fees are permitted, and licensing fees for other packages in the aggregation are permitted. Your permission to distribute Standard or Modified Versions of the Package is still subject to the other terms set forth in other sections of this license.
 103+.IP \n+j.
 104+In addition to the permissions given elsewhere by this license, You are also permitted to link Modified and Standard Versions of this Package with other works and distribute the inary program(s) that do not overtly expose the interfaces of the Package. This includes permission to embed the Package in a larger work of your own without exposing a direct interface to the Package. This also includes permission to build stand-alone binary or bytecode versions of your scripts that require the Package, but do not otherwise give the casual user direct access to the Package itself.
 105+.RE
 106+.SH
 107+Items That are Never Considered Part of a Modified Version Package
 108+.RS
 109+.IP \n+j.
 110+Works (including, but not limited to, subroutines and scripts) that you have linked or aggregated with the Package that merely extend or make use of the Package, but are not intended to cause the Package to operate differently from the Standard Version, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not bound by the terms of the Package's license.
 111+.RE
 112+.SH
 113+Acceptance of License and Disclaimer of Warranty
 114+.RS
 115+.IP \n+j.
 116+You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to copy, modify or distribute the Standard or Modified Versions of the Package. These actions are prohibited by copyright law if you do not accept this License. Therefore, by copying, modifying or distributing Standard and Modified Versions of the Package, you indicate your acceptance of the license of the Package.
 117+.IP \n+j.
 118+Disclaimer of Warranty:
 119+.IP
 120+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \(lqAS IS\(rq 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 UNLESS REQUIRED BY LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER OR CONTRIBUTOR 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, 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.
 121+.RE
 122+.bp
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/copying.ms
___________________________________________________________________
Added: svn:keywords
1123 + Author Date Id Revision
Added: svn:eol-style
2124 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/ChangeLog
@@ -0,0 +1,188 @@
 2+2006-02-19 Peter Danenberg <pcd at wikitex dot org>
 3+
 4+ * template/amsmath.tex: removed
 5+ reference to concrete math fonts.
 6+
 7+ * wikitex.sh: sundry Graphviz plus feynmf.
 8+
 9+ * wikitex-audit.in.sh: brought in sundry
 10+ Graphviz progs and metapost.
 11+
 12+ * template/feyn.tex: updated for feynmf.
 13+
 14+ * Wikitex.in.php: Added ability to source
 15+ external articles as well as uploaded files.
 16+
 17+2006-02-17 Peter Danenberg <pcd at wikitex dot org>
 18+
 19+ * WikitexConstants.in.php: added
 20+
 21+ * Wikitex.in.php: added; refactored for
 22+ Java-esqueliness
 23+
 24+ * wikitex.sh: links returned to graphviz
 25+
 26+2006-02-12 Peter Danenberg <pcd at wikitex dot org>
 27+
 28+ * wikitex-audit.in.sh: added security
 29+ auditor.
 30+
 31+ * wikitex-decruft.in.sh: added decrufter
 32+ of cache directory.
 33+
 34+ * wikitex-audit-shell.tex: added LaTeX-shell-
 35+ execution-audit.
 36+
 37+ * wikitex-audit-read.tex: added LaTeX-directory-
 38+ ascent-read-audit.
 39+
 40+ * wikitex-audit-write.tex: added LaTeX-directory-
 41+ ascent-write-audit.
 42+
 43+2006-02-10 Peter Danenberg <pcd at wikitex dot org>
 44+
 45+ * wikitex.php: refactored; Doxygenated; added
 46+ ability to source files; specify arbitrary properties
 47+ to templates.
 48+
 49+ * wikitex.sh: re-added svg (ImageMagick lite);
 50+ requires yet fixed size.
 51+
 52+2006-02-09 Peter Danenberg <pcd at wikitex dot org>
 53+
 54+ * template: directory to house templates.
 55+
 56+ * wikitex.inc.php: removed schem, ppch, ling
 57+
 58+ * wikitex.php: removed blacklists (rely upon sudo,
 59+ ulimit, quota, texmf.cnf)
 60+
 61+ * wikitex.sh: added sudo, ulimit; update for
 62+ lilypond-2.6; update for sgf2dg; sed fix
 63+
 64+2005-03-10 Peter Danenberg <pcd at wikitex dot org>
 65+
 66+ * manifest.ms: updated for skak
 67+
 68+ * readme.ms: updated for skak
 69+
 70+ * wikitex.plot.inc.p: filename placeholder
 71+
 72+ * wikitex.chess.inc.tex: updated for skak
 73+
 74+ * wikitex.sh: verbose errors enabled on plot;
 75+ 'export DISPLAY' localized
 76+
 77+ * wikitex.php: updated blacklist for skak
 78+
 79+2005-03-08 Peter Danenberg <pcd at wikitex dot org>
 80+
 81+ * readme.ms: clarified installation; added gschem
 82+ to xvfb requisants.
 83+
 84+ * wikitex.inc.php: added designator for <schem>;
 85+ switched out PPCH for Xym; called the former
 86+ <ppch>, the latter <chem>.
 87+
 88+ * wikitex.php (strSchem): added hook for
 89+ <schem> class
 90+
 91+ * wikitex.sh (wt_exec): added wt_exec so as to
 92+ catch errors and show not only whence, but why
 93+ a render failed.
 94+ (schem): added support for gschem
 95+
 96+2005-03-02 Peter Danenberg <pcd at wikitex dot org>
 97+
 98+ * copying.ms: verbatim license
 99+
 100+ * readme.ms: added colophon.
 101+
 102+2005-02-28 Peter Danenberg <pcd at wikitex dot org>
 103+
 104+ * wikitex.sh (wt_anch): fixed a catachrestical escape
 105+ which frustrated the source's display.
 106+
 107+2005-02-05 Peter Danenberg <pcd at wikitex dot org>
 108+
 109+ * thanks.ms: added.
 110+
 111+ * readme.ms: updated installation process.
 112+
 113+2005-01-29 Peter Danenberg <pcd at wikitex dot org>
 114+
 115+ * wikitex.sh: added support for gnuplot and graphviz;
 116+ <plot> and <graph> respectively. Added link to source
 117+ from each image.
 118+
 119+2005-01-28 Peter Danenberg <pcd at wikitex dot org>
 120+
 121+ * wikitex.sh: Utterly refactored; new features: modular
 122+ handlers; multi-page output; plain-text, detailed errors;
 123+ file-based output cache.
 124+
 125+2005-01-25 Peter Danenberg <pcd at wikitex dot org>
 126+
 127+ * wikitex.php (WikiTeX): \write, \let, \csname, \read,
 128+ and \open added to the blacklist; thanks to Johannes
 129+ Berg for the heads up.
 130+
 131+ * wikitex.sh (strInc): removed some lingering hard paths;
 132+ added support for dvipng; removed dvi2bitmap.
 133+
 134+ * wikitex.inc.php (WikiTeX): 'math' class changed to 'ams'
 135+ so as to avoid conflict with texvc; i.e. no chance of a
 136+ de-coupling of texvc and MediaWiki anytime soon.
 137+
 138+2004-10-04 Peter Danenberg <pcdanenb at mitdasein dot com>
 139+
 140+ * manifest.ms: updated
 141+
 142+ * readme.ms: installation process for svg and batik
 143+
 144+ * wikitex.php: added 'batik' and 'svg' elements; fixed
 145+ invalid constructor in objRend which gave syntax errors
 146+ in PHP4.
 147+
 148+ * wikitex.sh: added 'batik' and 'svg' elements; changed
 149+ error template to wikitex.error.inc.tex; and: transitioned
 150+ to png from gif.
 151+
 152+ * wikitex.svg.inc.svg: added
 153+
 154+ * wikitex.batik.inc.svg: added
 155+
 156+ * wikitex.inc.sh: inc.sh reintroduced; batik path in-
 157+ erted; as well as indications for an Apache bandaid
 158+ should defective paths prevail.
 159+
 160+2004-10-03 Peter Danenberg <pcd at wikitex dot org>
 161+
 162+ * wikitex.php: added support for SVG; deciding currently
 163+ on the Batikian solution (xml.apache.org/batik) since,
 164+ while slow, it is very complete. For oeconomy's sake,
 165+ may switch later to ImageMagick's more limited, but faster,
 166+ SVG subset.
 167+
 168+2004-09-07 Peter Danenberg <pcd at wikitex dot org>
 169+
 170+ * wikitex.inc.php: transferred parms from LocalSettings.php
 171+ hither; so as to produce a clean installation interface
 172+ (merely the addition of line for the stand-alone distributees).
 173+
 174+2004-09-06 Peter Danenberg <pcd at wikitex dot org>
 175+
 176+ * README: clarified acquisition
 177+
 178+ * wikitex.php: added PHP4 constructor
 179+
 180+ * wikitex.php: updated parse code to phase3 standards;
 181+ WikiTeX now parses like pseudo-XML: <math></math>,
 182+ <chem></chem>, etc.
 183+
 184+ * wikitex.php: added new classes: go, xym, teng, and feyn.
 185+
 186+2004-09-05 Peter Danenberg <pcd at wikitex dot org>
 187+
 188+ * README: added; with entry on extending WikiTeX.
 189+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/ChangeLog
___________________________________________________________________
Added: svn:keywords
1190 + Author Date Id Revision
Added: svn:eol-style
2191 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/THANKS
@@ -0,0 +1,132 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 1.1 BETA 3 THANKS
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+
 15+
 16+ WikiTeX was originally written by Peter Danenberg.
 17+Many people further contributed to WikiTeX by reporting
 18+problems, suggesting various improvements or submitting
 19+actual code. Here is a list of these people; help us keep
 20+it complete and exempt of errors:
 21+
 22+Tomasz Wegrzanowski impetus beer.com
 23+Brion Vibber security leuksman.com
 24+Erik Moeller press humanist.de/erik
 25+Phil Boswell docs User:Phil_Boswell
 26+Grendlekhan packages User:Grendlekhan
 27+Johannes Berg security sipsolutions.de
 28+Alexander Schremmer security alexanderweb.de
 29+Massoud Ghyam-khah support usc.edu
 30+Hugo Looyestijn testing phys.uu.nl
 31+Michel Hardy-Vallee testing mcgill.ca
 32+Jonathan Pennington testing oregonstate.edu
 33+Ales Hvezda Scheme seul.org
 34+Forrest Oliphant testing folktunes.org
 35+Carlo Vanini TikiWiki tikiwiki.org
 36+Salvatore Ingala Windows katamail.com
 37+Harold Martin testing cocoadev
 38+Gregor Rosenauer docs gmail.com
 39+
 40+
 41+
 42+
 43+
 44+
 45+
 46+
 47+
 48+
 49+
 50+
 51+
 52+
 53+
 54+
 55+
 56+
 57+
 58+
 59+
 60+
 61+
 62+
 63+
 64+
 65+ 18 February 2006
 66+
 67+
 68+
 69+
 70+
 71+ -2-
 72+
 73+
 74+WikiTeX: expansible LaTeX module for MediaWiki
 75+Copyright (C) 2004-6 Peter Danenberg
 76+
 77+ WikiTeX is licensed under the Artistic License 2.0; to
 78+view a copy of this license, see COPYING or visit:
 79+
 80+ http://dev.perl.org/perl6/rfc/346.html
 81+
 82+
 83+
 84+
 85+
 86+
 87+
 88+
 89+
 90+
 91+
 92+
 93+
 94+
 95+
 96+
 97+
 98+
 99+
 100+
 101+
 102+
 103+
 104+
 105+
 106+
 107+
 108+
 109+
 110+
 111+
 112+
 113+
 114+
 115+
 116+
 117+
 118+
 119+
 120+
 121+
 122+
 123+
 124+
 125+
 126+
 127+
 128+
 129+
 130+
 131+ 18 February 2006
 132+
 133+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/THANKS
___________________________________________________________________
Added: svn:keywords
1134 + Author Date Id Revision
Added: svn:eol-style
2135 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.in.cron
@@ -0,0 +1,3 @@
 2+MAILTO=%MAILTO%
 3+# At midnight, clean up WikiTeX cruft.
 4+0 0 * * * %DECRUFT% 2>&1
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.in.cron
___________________________________________________________________
Added: svn:keywords
15 + Author Date Id Revision
Added: svn:eol-style
26 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/news.ms
@@ -0,0 +1,136 @@
 2+.DA
 3+.TL
 4+WikiTeX %VERSION% NEWS
 5+.AU
 6+Peter Danenberg <pcd at wikitex dot org>
 7+.SH
 8+Sun Feb 19 17:34:41 PST 2006
 9+.RS
 10+.PP
 11+Added five layout properties for <graph>, corresponding to the suite of Graphviz utilities: dot (default), neato, fdp, twopi and circo.
 12+.PP
 13+<feyn> has been updated to accomodate Thorsten Ohl's powerf feynMF package.
 14+.RE
 15+.SH
 16+Sun Feb 12 16:21:57 PST 2006 Peter Danenberg
 17+.RS
 18+.PP
 19+WikiTeX's security model has been reimplemented from the ground up: We've doffed our dependence on blacklists, and instead rely on a combination of ulimit, quotas, sudo; and the native facilites of LaTeX and LilyPond for forbidding script execution and directory ascent.
 20+.PP
 21+In addition, the \(oqsrc\(cq and \(oqdata\(cq parameters allow you to reference uploads directly in your script; examples:
 22+.RS
 23+.LD
 24+<svg src="tiger.svg"></svg>
 25+.DE
 26+.RE
 27+to hide ugly code; or to plot data:
 28+.RS
 29+.LD
 30+<plot data="plot.dat">plot "plot.dat" using 1:3</plot>
 31+.DE
 32+.RE
 33+Files thus sourced forgo processing by the template.
 34+.RE
 35+.SH
 36+Thu Mar 10 01:26:39 PST 2005 Peter Danenberg
 37+.RS
 38+.PP
 39+Skak by Torben Hoffmann has replaced Piet Tutelaers' package as the <chess> renderer; Skak is backwards compatible and allows, amongst other things:
 40+.RS
 41+.IP \(bu
 42+SAN and PGN notation
 43+.IP \(bu
 44+large boards (with \\largeboard)
 45+.IP \(bu
 46+move arrows (with \\printarrow)
 47+.RE
 48+.LP
 49+see the docs for details.
 50+.RE
 51+.SH
 52+Tue Mar 8 16:53:39 PST 2005 Peter Danenberg
 53+.RS
 54+.PP
 55+<schem> added; id est, schematic capture with gschem (geda.seul.org). PPCH has been deprecated; XyMTeX, meanwhile, has taken its place as the <chem> renderer.
 56+.PP
 57+Effort is underway to replace our ad-hoc blacklists with chroot-based security; adieu, \(lqdirecta non grata!\(rq
 58+.PP
 59+Lastly, verbose errors now declare not only the whence, but the why of defects.
 60+.RE
 61+.SH
 62+Sun Feb 6 14:21:48 PST 2005 Peter Danenberg
 63+.RS
 64+.PP
 65+We've disassociated our versioning from MediaWiki, and started with a pristine 1.0; so that, should we bundle in the future, our release cycles can be distinct.
 66+.RE
 67+.SH
 68+Sat Jan 29 00:34:09 PST 2005 Peter Danenberg
 69+.RS
 70+.PP
 71+Changes almost too numerous to enumerate; but some of the more exciting:
 72+.IP \(bu
 73+Gnuplot and Graphviz: <plot> and <graph>, respectively
 74+.IP \(bu
 75+Multi-page output for music, go and chess
 76+.IP \(bu
 77+More detailed, helpful error messages
 78+.PP
 79+The installation process, to boot, is less error-prone; no Python: but the bash interface has been refactored.
 80+.RE
 81+.SH
 82+Tue Jan 25 11:23:48 PST 2005 Peter Danenberg
 83+.RS
 84+.PP
 85+This candidate both maintains by tightening down our blacklist (thanks, Johannes Berg); and innovates by introducing Jan-Aoke Larsson's dvipng. dvipng replaces dvi2bitmap; resulting in cleaner, faster renders.
 86+.PP
 87+<math></math> becomes <amsmath></amsmath> in the stand-alone version, to avoid conflicting with texvc; in pre-packaged WikiTeX, it replaces texvc.
 88+.PP
 89+I'd also like to un-cobweb that bash interface with Python before we go live.
 90+.RE
 91+.SH
 92+Mon Oct 4 01:56:23 PDT 2004 Peter Danenberg
 93+.RS
 94+.PP
 95+In order to plumb their several virtues' depth, the Batik toolkit ("heavy SVG"), will be available alongside ImageMagick; its more efficient kin.
 96+.PP
 97+Batik may be invoked by <batik></batik>; and <svg></svg>, ImageMagick.
 98+.RE
 99+.SH
 100+Sun Oct 3 17:38:03 PDT 2004 Peter Danenberg
 101+.RS
 102+.PP
 103+SVG is finally here; and we opted for Batik's SVG kit (xml.apache.org/batik) which, though very full-featured, suffers from a Java-like retardation. It were mere oeconomy that ever importuned us to return to ImageMagick's SVG subset.
 104+.RE
 105+.SH
 106+Mon Sep 6 03:20:26 PDT 2004 Peter Danenberg
 107+.RS
 108+.PP
 109+With the introduction of XML-like tags, we have cleared a major hurdle towards integration with Media\%Wiki; next on the list, parameters of the form:
 110+.QP
 111+<music tempo="80"></music>
 112+.LP
 113+WikiTeX' vulnerability to attack must also be thoroughly sounded.
 114+.RE
 115+.SH
 116+Sun May 30 00:00:00 PDT 2004 Peter Danenberg
 117+.RS
 118+.PP
 119+We're refactoring WikiTeX from the ground up to implement tags of the form:
 120+.QP
 121+<class [parm: value]>content</class>
 122+.LP
 123+and likely of an external parser; where a lex/yacc solution
 124+might be attractive. (Finite state recognition is probably
 125+what we're looking for, however, rather than look-ahead
 126+left-to-right parsing; i.e. top-down recursive descent.)
 127+.PP
 128+If WikiTeX' sum scope, on the other hand, resembles a
 129+glue-script with regular-expression grinding,*
 130+.FS *
 131+Raymond, Eric Steven. The Art of Unix Programming (faqs.org/docs/artu).
 132+.FE
 133+we might not need to look past Perl; PHP, in any case, just passes as
 134+lexer/parser: but we'd like something more robust and, above
 135+all, to separate application from interface.
 136+.RE
 137+.bp
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/news.ms
___________________________________________________________________
Added: svn:keywords
1138 + Author Date Id Revision
Added: svn:eol-style
2139 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-decruft.in.sh
@@ -0,0 +1,34 @@
 2+#!/usr/bin/env bash
 3+#
 4+# wikitex-decruft.sh: cleans the work folder from files
 5+# which don't appear to be in use (checks them
 6+# against objectcache in the database).
 7+#
 8+# WikiTeX: expansible LaTeX module for MediaWiki
 9+# Copyright (C) 2004-6 Peter Danenberg
 10+#
 11+# WikiTeX is licensed under the Artistic License 2.0; to
 12+# view a copy of this license, see COPYING or visit:
 13+#
 14+# http://dev.perl.org/perl6/rfc/346.html
 15+#
 16+
 17+declare -r DATABASE='%DATABASE%'
 18+declare -r USERNAME='%DBUSER%'
 19+declare -r PASSWORD='%DBPASS%'
 20+
 21+declare -r WORK='tmp'
 22+declare username
 23+declare password
 24+
 25+cd "$(dirname "${0}")/${WORK}"
 26+
 27+declare -ar HASHES=($(find . -maxdepth 1 ! -name '*\.*' -printf '%f '));
 28+
 29+[[ -z "${USERNAME}" ]] || username="-u ${USERNAME}"
 30+[[ -z "${PASSWORD}" ]] || password="-p${PASSWORD}"
 31+
 32+for (( i = ${#HASHES[*]}; --i >= 0; )); do
 33+ OUT=$(mysql ${username} ${password} -D "${DATABASE}" -e "SELECT DISTINCT NULL FROM \`objectcache\` WHERE \`value\` LIKE '%${HASHES[${i}]}%' LIMIT 1;";)
 34+ [[ ${?} -eq 0 && -z "${OUT}" ]] && rm -frv "${HASHES[${i}]}"*
 35+done
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-decruft.in.sh
___________________________________________________________________
Added: svn:keywords
136 + Author Date Id Revision
Added: svn:eol-style
237 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit-shell.tex
@@ -0,0 +1,4 @@
 2+\documentclass{article}
 3+\begin{document}
 4+\immediate\write18{ls}
 5+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit-shell.tex
___________________________________________________________________
Added: svn:keywords
16 + Author Date Id Revision
Added: svn:eol-style
27 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.sh
@@ -0,0 +1,210 @@
 2+#!/usr/bin/env bash
 3+# wikitex.sh: shell interface to wikitex.php
 4+# Assumes that $PWD is the base wiki dir.
 5+# Usage: FILE MODULE OUTPATH
 6+#
 7+# WikiTeX: expansible LaTeX module for MediaWiki
 8+# Copyright (C) 2004-6 Peter Danenberg
 9+#
 10+# WikiTeX is licensed under the Artistic License 2.0; to
 11+# view a copy of this license, see COPYING or visit:
 12+#
 13+# http://dev.perl.org/perl6/rfc/346.html
 14+#
 15+
 16+declare -ri ARGS=3
 17+declare -ri E_ARGS=2
 18+declare -ri E_FAIL=1
 19+declare -ri E_SUC=0
 20+declare -r HASH="${1}"
 21+declare -r MOD="${2}"
 22+declare -r OUT="${3}"
 23+declare -r EXT='.png'
 24+declare -r CHE='.cache'
 25+declare -r MID='.midi'
 26+declare -r MAP='.map'
 27+declare -r EPS='.eps'
 28+declare -r SUDO='wikitex'
 29+declare -r ERR='<span class="errwikitex">WikiTeX: %s reported a failure, namely:</span><pre>Error code: %d\n%s</pre>\n'
 30+declare -ra LIMIT=(\
 31+ 0 \ # The maximum size of core files created
 32+ unlimited \ # The maximum size of a process's data segment
 33+ unlimited \ # The maximum size of files created by the shell
 34+ 1024 \ # Pending signals
 35+ 32 \ # The maximum size that may be locked into memory
 36+ unlimited \ # The maximum resident set size
 37+ 1024 \ # The maximum number of open file descriptors (most systems
 38+ \ # do not allow this value to be set)
 39+ 8 \ # The pipe size in 512-byte blocks (this may not be set)
 40+ 819200 \ # POSIX message queues
 41+ 10240 \ # The maximum stack size
 42+ 30 \ # The maximum amount of cpu time in seconds
 43+ 8185 \ # The maximum number of processes available to a single
 44+ \ # user
 45+ unlimited \ # The maximum amount of virtual memory available to the
 46+ \ # shell
 47+ unlimited \ # File locks
 48+)
 49+
 50+function wt_error() {
 51+ printf "${ERR}" "${1}" ${?} "${2}"
 52+ exit ${3}
 53+}
 54+
 55+# Preliminaries
 56+(( ${#} >= ${ARGS} )) || wt_error 'wikitex.sh' 'usage: wikitex.sh HASH MODULE OUTPATH' $E_ARGS
 57+
 58+# $PWD is initially the wiki-base.
 59+cd "$(dirname "${0}")/tmp" || wt_error 'wikitex.sh' 'unable to change to cache directory' $E_FAIL
 60+
 61+# Check cache
 62+[ -r "${HASH}${CHE}" ] && { cat "${HASH}${CHE}"; exit $E_SUC; }
 63+
 64+# Requirement: scribe tmp, read hash
 65+[ -w '.' ] || wt_error 'wikitex.sh' "Can't scribe <code>${PWD}</code>; ownership and permissions should allow us to do so, precious." $E_FAIL
 66+[ -r "${HASH}" ] || wt_error 'wikitex.sh' "Can't hash, baby; ownership and permissions should allow us to perceive <code>${PWD}</code>." $E_FAIL
 67+
 68+# Perform self-limitation
 69+ulimit -c ${LIMIT[0]} -d ${LIMIT[1]} -f ${LIMIT[2]} -n ${LIMIT[6]} -s ${LIMIT[9]} -t ${LIMIT[10]} -v ${LIMIT[12]} || wt_error 'wikitex.sh' 'ulimit failed.' $E_FAIL
 70+
 71+# Move into work directory
 72+cd ${HASH} || wt_error 'wikitex.sh' 'unable to change into work directory.' $E_FAIL
 73+
 74+# Extract useful files from work directory
 75+function wt_out() {
 76+ wt_exec "mv ${@} ../"
 77+}
 78+
 79+# Output image
 80+function wt_img() {
 81+ STR="$STR"$(printf "<img src=\"%s\" alt=\"${MOD}\" />" "${1}")
 82+}
 83+
 84+# Output link
 85+function wt_anch() {
 86+ STR=$(printf '<a href="%s">%s</a>' "${OUT}${HASH}" "${STR}")
 87+}
 88+
 89+# Convert to final image
 90+function wt_dvipng() {
 91+ wt_sudo "dvipng -gamma 1.5 -T tight ${HASH}"
 92+}
 93+
 94+# Trim whitespace
 95+function wt_trim() {
 96+ wt_sudo "mogrify -trim ${@}"
 97+}
 98+
 99+# Generic execution, which allows for error trapping
 100+function wt_exec() {
 101+ PUT=$(${@} 2>&1) || wt_error "${@%%\ *}" "${PUT}" $E_FAIL
 102+}
 103+
 104+# Generic sudoing; use exec to protect product from being over-written
 105+# by wt_sudo actions.
 106+function wt_sudo() {
 107+ PUT=$(sudo -u ${SUDO} ${@} 2>&1) || wt_error "${@%%\ *}" "${PUT}" $E_FAIL
 108+}
 109+
 110+# Catch-all renderer
 111+function wt_generic() {
 112+ wt_sudo "latex --interaction=nonstopmode ${HASH}"
 113+ wt_dvipng
 114+ for i in ${HASH}*${EXT}; do wt_img "${OUT}${i}"; done
 115+ wt_anch
 116+}
 117+
 118+function wt_graph_map() {
 119+ wt_sudo "${1} -Tpng -o ${HASH}${EXT} ${HASH}"
 120+ wt_sudo "${1} -Tcmap -o ${HASH}${MAP} ${HASH}"
 121+ STR=$(printf '<map name="%s">%s</map>' "${HASH}" "$(<"${HASH}${MAP}")")
 122+ STR="${STR}"$(printf '<img src="%s" alt="%s" usemap="#%s"/>' "${OUT}${HASH}${EXT}" "${MOD}" "${HASH}")
 123+ STR="${STR}"$(printf '<a href="%s">[source]</a>' "${OUT}${HASH}")
 124+ wt_out "${HASH}${MAP}"
 125+}
 126+
 127+function circo() {
 128+ wt_graph_map "circo"
 129+}
 130+
 131+function go() {
 132+ wt_sudo "sgf2dg -twoColumn ${HASH}"
 133+ wt_sudo "tex --interaction=nonstopmode ${HASH}"
 134+ wt_dvipng
 135+ for i in ${HASH}*${EXT}; do wt_sudo "mogrify -crop +0-24! ${i}"; wt_trim "${i}"; wt_img "${OUT}${i}"; done
 136+ wt_anch
 137+}
 138+
 139+function fdp() {
 140+ wt_graph_map "fdp"
 141+}
 142+
 143+function feyn() {
 144+ wt_sudo "latex ${HASH}"
 145+ wt_sudo "mpost fmftempl.mp"
 146+ wt_sudo "latex ${HASH}"
 147+ wt_dvipng
 148+ for i in ${HASH}*${EXT}; do wt_img "${OUT}${i}"; done
 149+ wt_anch
 150+}
 151+
 152+function graph() {
 153+ wt_graph_map "dot"
 154+}
 155+
 156+function music() {
 157+ wt_sudo "lilypond -s -f png -b eps ${HASH}"
 158+ for i in ${HASH}*${EXT}; do wt_trim "${i}"; wt_img "${OUT}${i}"; done
 159+ wt_anch
 160+
 161+ # Sourced files may not produce midi
 162+ if [ -r "${HASH}${MID}" ]; then
 163+ STR="$STR"$(printf '<a href="%s">[listen]</a>' "${OUT}${HASH}${MID}")
 164+ wt_out "${HASH}${MID}"
 165+ fi
 166+}
 167+
 168+function neato() {
 169+ wt_graph_map "neato"
 170+}
 171+
 172+function plot() {
 173+ sed -i -e "s/\%OUTPUT\%/${HASH}${EXT}/" "${HASH}"
 174+ wt_sudo "gnuplot ${HASH}"
 175+ wt_trim "${HASH}${EXT}"
 176+ wt_img "${OUT}${HASH}${EXT}"
 177+ wt_anch
 178+}
 179+
 180+function svg() {
 181+ wt_sudo "convert -size 640x480 ${HASH} ${HASH}${EXT}"
 182+ wt_trim "${HASH}${EXT}"
 183+ wt_img "${OUT}${HASH}${EXT}"
 184+ wt_anch
 185+}
 186+
 187+function twopi() {
 188+ wt_graph_map "twopi"
 189+}
 190+
 191+# Check for module-specific functions; otherwise resort to generic.
 192+if [[ $(type -t "${MOD}") == 'function' ]]; then
 193+ "${MOD}" "${HASH}" "${OUT}"
 194+else
 195+ wt_generic "${HASH}" "${OUT}"
 196+fi
 197+
 198+# Extract images (additional files per class supra)
 199+wt_out ${HASH}*${EXT}
 200+
 201+# Move into cache directory; remove work files; extract source
 202+{ cd ..; rm -fr ${HASH}; cat > "${HASH}"; } < "${HASH}" || wt_error 'wikitex.sh' 'unable to remove work directory or add cache source' $E_FAIL
 203+
 204+# Cache
 205+echo "${STR}" > "${HASH}${CHE}"
 206+
 207+# Produce result
 208+echo "${STR}"
 209+
 210+# Adieu
 211+exit ${E_SUC}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.sh
___________________________________________________________________
Added: svn:keywords
1212 + Author Date Id Revision
Added: svn:eol-style
2213 + native
Added: svn:executable
3214 + *
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/README
@@ -0,0 +1,594 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 1.1 BETA 3 README
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+
 15+
 16+
 17+ ABSTRACT
 18+
 19+ THIS PRODUCT IS IN BETA, AND AS SUCH SHOULD
 20+ NOT BE DEPLOYED IN A PRODUCTION ENVIRONMENT.
 21+
 22+ Covers installation and expansion of the
 23+ WikiTeX system.
 24+
 25+ NOTICE: Failure to implement all security
 26+ measures in section 3.2 may expose your system to
 27+ loss or mischief.
 28+
 29+
 30+
 31+19 February 2006
 32+
 33+
 34+
 35+
 36+
 37+
 38+
 39+
 40+
 41+
 42+
 43+
 44+
 45+
 46+
 47+
 48+
 49+
 50+
 51+
 52+
 53+
 54+
 55+
 56+
 57+
 58+
 59+
 60+
 61+
 62+
 63+
 64+
 65+
 66+
 67+
 68+
 69+
 70+
 71+
 72+
 73+
 74+
 75+
 76+
 77+ WikiTeX 1.1 BETA 3 README
 78+
 79+ Peter Danenberg <pcd at wikitex dot org>
 80+
 81+ Table of Contents
 82+
 83+
 84+1. Introduction . . . . . . . . . . . . . . . . . . . . 1
 85+2. Acquisition . . . . . . . . . . . . . . . . . . . . . 1
 86+ 2.1 CVS . . . . . . . . . . . . . . . . . . . . . . 1
 87+ 2.2 FTP . . . . . . . . . . . . . . . . . . . . . . 2
 88+ 2.3 HTTP . . . . . . . . . . . . . . . . . . . . . 2
 89+ 2.4 Subversion . . . . . . . . . . . . . . . . . . 2
 90+3. Installation . . . . . . . . . . . . . . . . . . . . 2
 91+ 3.1. Prerequisites . . . . . . . . . . . . . . . . 2
 92+ 3.2. Security . . . . . . . . . . . . . . . . . . . 3
 93+ 3.2.1. Makefile . . . . . . . . . . . . . . . 3
 94+ 3.2.2. Unprivileged User . . . . . . . . . . . 3
 95+ 3.2.3. Disk Quota . . . . . . . . . . . . . . 3
 96+ 3.2.4. Cron . . . . . . . . . . . . . . . . . 4
 97+ 3.2.5. Sudo . . . . . . . . . . . . . . . . . 4
 98+ 3.2.6. Per Package . . . . . . . . . . . . . . 4
 99+ 3.2.6.1. LaTeX . . . . . . . . . . . . . 5
 100+ 3.2.7. Audit . . . . . . . . . . . . . . . . . 5
 101+ 3.3. Installation . . . . . . . . . . . . . . . . . 5
 102+4. Hacking . . . . . . . . . . . . . . . . . . . . . . . 6
 103+ 4.1. Getting Started . . . . . . . . . . . . . . . 6
 104+ 4.2. Extending WikiTeX . . . . . . . . . . . . . . 6
 105+5. Help . . . . . . . . . . . . . . . . . . . . . . . . 6
 106+6. Colophon . . . . . . . . . . . . . . . . . . . . . . 7
 107+7. Copyright . . . . . . . . . . . . . . . . . . . . . . 8
 108+
 109+1. Introduction
 110+
 111+ WikiTeX extends MediaWiki by allowing authors to
 112+ manipulate graphical objects directly in their arti-
 113+ cles; support so far includes: math, music, chess,
 114+ chemistry, go, plotting, relational diagrams and
 115+ schematic capture.
 116+
 117+ Visit http://wikitex.org to learn more; or to see
 118+ WikiTeX in action:
 119+
 120+ http://wikisophia.org
 121+
 122+2. Acquisition
 123+
 124+ 2.1. CVS
 125+
 126+ WikiTeX can be CVSed from MediaWiki's facil-
 127+
 128+
 129+
 130+
 131+ 19 February 2006
 132+
 133+
 134+
 135+
 136+
 137+ -2-
 138+
 139+
 140+ ity at SourceForge:*
 141+
 142+ cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/wikipedia \
 143+ co wikitex
 144+
 145+
 146+ 2.2. FTP
 147+
 148+ The latest stable releases can be downloaded
 149+ from:
 150+
 151+ ftp://wikitex.org
 152+
 153+ 2.3. HTTP
 154+
 155+ The latest releases can be browsed and down-
 156+ loaded from:
 157+
 158+ http://wikitex.org/wikitex
 159+
 160+ 2.4. Subversion
 161+
 162+ Use your Subversion client (http://subversion
 163+ .tigris.org) to get the latest development snap-
 164+ shot:
 165+
 166+ svn co http://svn.wikitex.org/wikitex/branches/1.1 \
 167+ wikitex
 168+
 169+ or visit http://wikitex.org/viewcvs/wikitex to
 170+ browse the codebase via web.
 171+
 172+3. Installation
 173+
 174+ 3.1. Prerequisites
 175+
 176+ In a nutshell, WikiTeX requires a successful
 177+ installation of:
 178+
 179+ o PHP 5.1.0+ (php.net)
 180+
 181+ o MediaWiki 1.6alpha1+ (wikipedia.sf.net)
 182+
 183+ o LaTeX (latex-project.org)
 184+
 185+ o ImageMagick (imagemagick.org)
 186+
 187+ o dvipng (dvipng.sf.net)
 188+
 189+ As of writing, WikiTeX requires the CVS ver-
 190+ sion of MediaWiki; to get it, issue:
 191+-----------
 192+ * For actual development snapshots see Subver-
 193+sion below.
 194+
 195+
 196+
 197+ 19 February 2006
 198+
 199+
 200+
 201+
 202+
 203+ -3-
 204+
 205+
 206+ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/wikipedia\
 207+ co -P phase3
 208+
 209+
 210+ Lilypond (lilypond.org), Gnuplot (gnu-
 211+ plot.info), and Graphviz (graphviz.org) are
 212+ required for music, plot, and graph; and as many
 213+ of the packages under 3.3.5 (see below) whose
 214+ classes you would like to support.
 215+
 216+ 3.2. Security
 217+
 218+ WikiTeX requires preparation to mitigate
 219+ risk; failure to prepare in whole or in part may
 220+ expose your system to loss and mischief.
 221+
 222+ 3.2.1. Makefile
 223+
 224+ We've gathered all the editable parame-
 225+ ters into one place; edit `Makefile' and run:
 226+
 227+ make
 228+
 229+ every time you've made changes.
 230+
 231+ 3.2.2. Unprivileged User
 232+
 233+ WikiTeX runs as the unprivileged user
 234+ `wikitex' to restrict access to the local
 235+ file-system. You must protect sensitive
 236+ world-writable and -readable resources, how-
 237+ ever.
 238+
 239+ Create the user wikitex:
 240+
 241+ useradd -M -s /sbin/nologin wikitex
 242+
 243+ 3.2.3. Disk Quota
 244+
 245+ To prevent runaway scripts or DoS
 246+ attacks from usurping storage, institute disk
 247+ quotas. See:
 248+
 249+ http://www.tldp.org/HOWTO/Quota.html
 250+
 251+ for details.
 252+
 253+ 1. Edit /etc/fstab and, next to "defaults,"
 254+ add "usrquota" for the partition on
 255+ which WikiTeX runs (hereafter /part);
 256+ e.g.:
 257+
 258+ /part /home reiserfs defaults,usrquota 1 1
 259+
 260+
 261+
 262+
 263+ 19 February 2006
 264+
 265+
 266+
 267+
 268+
 269+ -4-
 270+
 271+
 272+ 2. Remount /part:
 273+
 274+ mount -o remount /part
 275+
 276+ 3. Update quota data:
 277+
 278+ quotacheck -vguma
 279+
 280+ 4. Turn on quotas:
 281+
 282+ quotaon -av
 283+
 284+ 5. Implement quotas for user wikitex:
 285+
 286+ edquota -u wikitex
 287+
 288+ The following values will give WikiTeX
 289+ one hundred megabytes and ten thousand
 290+ files to play with (edit the values with
 291+ asterisks):
 292+
 293+ Filesystem blocks soft hard* inodes soft hard*
 294+ /part 186 0 100000 30 0 10000
 295+
 296+
 297+ 3.2.4. Cron
 298+
 299+ To prevent legitimate files from exceed-
 300+ ing the disk quota, set up a crontab to purge
 301+ unused files.
 302+
 303+ Determine your webserver's user (consult
 304+ `httpd.conf' for Apache), and execute:
 305+
 306+ crontab -u <apache-user> wikitex.cron
 307+
 308+ from extensions/wikitex.
 309+
 310+ 3.2.5. Sudo
 311+
 312+ You will need sudo version 1.6.8 or
 313+ above (verify by `sudo -V'), with support for
 314+ NOEXEC compiled in. Remove any WikiTeX cruft
 315+ from /etc/sudoers, and issue:
 316+
 317+ cat wikitex.sudoers >> /etc/sudoers
 318+
 319+ and then:
 320+
 321+ visudo -c
 322+
 323+ If there are parse errors, run `visudo' and
 324+ correct any mistakes.
 325+
 326+
 327+
 328+
 329+ 19 February 2006
 330+
 331+
 332+
 333+
 334+
 335+ -5-
 336+
 337+
 338+ 3.2.6. Per Package
 339+
 340+ Following are package-specific security
 341+ measures.
 342+
 343+ 3.2.6.1. LaTeX
 344+
 345+ Edit `texmf.cnf', modifying the
 346+ following variables:
 347+
 348+ shell_escape = f
 349+ openout_any = p
 350+ openin_any = p
 351+
 352+ 3.2.7. Audit
 353+
 354+ `wikitex-audit.sh' has been provided to
 355+ assess the integrity of an installation; as
 356+ root, run:
 357+
 358+ ./wikitex-audit.sh
 359+
 360+ until you satisfy it.
 361+
 362+ 3.3. Installation
 363+
 364+ NOTE: DON'T CONTINUE UNTIL wikitex-audit.sh
 365+ EXECUTES SANS FATAL ERRORS.
 366+
 367+ Fulfill the security guidelines per 3.2, and
 368+ install MediaWiki (see 3.1); then, working from
 369+ MediaWiki's base directory, perform the following:
 370+
 371+ 1. Create /extensions/wikitex and copy thither
 372+ the distribution.
 373+
 374+ 2. Add the following line to /LocalSettings.php
 375+ before the terminal `?>':
 376+
 377+ include './extensions/wikitex/Wikitex.php';
 378+
 379+ 3. Render /extensions/wikitex/tmp scribable to
 380+ the web server:*
 381+
 382+ chown nobody:nobody /extensions/wikitex/tmp
 383+
 384+ 4. Disable PHP in /extensions/wikitex/tmp by
 385+ issuing:
 386+
 387+ php_flag engine off
 388+
 389+-----------
 390+ * Consult your server config for the appropriate
 391+user and group id.
 392+
 393+
 394+
 395+ 19 February 2006
 396+
 397+
 398+
 399+
 400+
 401+ -6-
 402+
 403+
 404+ from .htaccess in the same directory; disable
 405+ CGI, if necessary.
 406+
 407+ 5. Install as many of the following packages
 408+ whose classes you would like to support, or
 409+ add your own (see Expanding WikiTeX):
 410+
 411+ Class Package Author URL
 412+ --------------------------------------------------------
 413+ amsmath AMS-LaTeX Amer. Math. Soc. ams.org
 414+ chem XyMTeX Shinsaku Fujita kit.ac.jp
 415+ chess Skak Torben Hoffmann ctan.org
 416+ feyn FenyMF Thorsten Ohl ctan.org
 417+ go Go Daniel Bump stanford.edu
 418+ graph Graphviz Emden Gansner research.att.com
 419+ greek Ibycus Pierre MacKay tug.org
 420+ music Lilypond Han-Wen Nienhuys lilypond.org
 421+ plot Gnuplot Nikos Drakos gnuplot.info
 422+ svg SVG lite ImageMagick imagemagick.org
 423+ teng Tengwar Ivan Derzhanski quettar.org
 424+ ipa TIPA Rei Fukui ctan.org
 425+
 426+
 427+ 6. (Optional) If you would like your users to be
 428+ able to source uploaded files, specify the
 429+ following in LocalSettings.php:
 430+
 431+ $wgStrictFileExtensions = false;
 432+
 433+4. Hacking WikiTeX
 434+
 435+ 4.1. Getting Started
 436+
 437+ Join the WikiTeX-l mailing list, where you
 438+ can communicate with other users and developers:
 439+
 440+ http://lists.wikitex.org/listinfo/wikitex-l
 441+
 442+ and familiarize yourself with Subversion
 443+ (http://subversion.tigris.org), our collaborative
 444+ development tool.
 445+
 446+ 4.2. Extending WikiTeX
 447+
 448+ Adding novel packages to WikiTeX can be
 449+ achieved in several discrete steps; after you have
 450+ downloaded and installed the package:
 451+
 452+ 1. Devise a class name for the package, and add
 453+ a template to /extensions/wikitex/template in
 454+ this form:
 455+
 456+ <classname>.<ext>
 457+
 458+
 459+
 460+
 461+ 19 February 2006
 462+
 463+
 464+
 465+
 466+
 467+ -7-
 468+
 469+
 470+ The template should expose said package to
 471+ the renderer; see the current templates for
 472+ examples.
 473+
 474+ 2. If the class requires non-standard (extra-
 475+ LaTeX) processing, add a new function in
 476+ wikitex.sh under <class>.
 477+
 478+ Consult wikitex.sh for examples.
 479+
 480+ 3. Lastly, add a hook to `wikitex.php' and an
 481+ element->hook mapping to `wikitex.inc.php'.
 482+
 483+5. Getting Help
 484+
 485+ A great way to meet users and developers is by
 486+ joining WikiTeX-l (see 4.1 above); alternatively,
 487+ visit:
 488+
 489+ http://archives.wikitex.org/wikitex-l
 490+
 491+ to browse the archives.
 492+
 493+6. Colophon
 494+
 495+ This document was prepared in GNU troff using the
 496+ ms macro package; preprocessed with tbl, the table for-
 497+ matter; and lastly filtered through col to remove
 498+ reverse line feeds and tabs:
 499+
 500+ groff -ms -t -Tascii SOURCE | col -bx > OUT
 501+
 502+
 503+
 504+
 505+
 506+
 507+
 508+
 509+
 510+
 511+
 512+
 513+
 514+
 515+
 516+
 517+
 518+
 519+
 520+
 521+
 522+
 523+
 524+
 525+
 526+
 527+ 19 February 2006
 528+
 529+
 530+
 531+
 532+
 533+ -8-
 534+
 535+
 536+WikiTeX: expansible LaTeX module for MediaWiki
 537+Copyright (C) 2004-6 Peter Danenberg
 538+
 539+ WikiTeX is licensed under the Artistic License 2.0; to
 540+view a copy of this license, see COPYING or visit:
 541+
 542+ http://dev.perl.org/perl6/rfc/346.html
 543+
 544+
 545+
 546+
 547+
 548+
 549+
 550+
 551+
 552+
 553+
 554+
 555+
 556+
 557+
 558+
 559+
 560+
 561+
 562+
 563+
 564+
 565+
 566+
 567+
 568+
 569+
 570+
 571+
 572+
 573+
 574+
 575+
 576+
 577+
 578+
 579+
 580+
 581+
 582+
 583+
 584+
 585+
 586+
 587+
 588+
 589+
 590+
 591+
 592+
 593+ 19 February 2006
 594+
 595+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/README
___________________________________________________________________
Added: svn:keywords
1596 + Author Date Id Revision
Added: svn:eol-style
2597 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/copying.inc.ms
@@ -0,0 +1,9 @@
 2+.LP
 3+WikiTeX: expansible LaTeX module for MediaWiki
 4+.br
 5+Copyright \(co 2004-6 Peter Danenberg
 6+.PP
 7+WikiTeX is licensed under the Artistic License 2.0; to view a copy of this license, see COPYING or visit:
 8+.QP
 9+http://dev.perl.org/perl6/rfc/346.html
 10+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/copying.inc.ms
___________________________________________________________________
Added: svn:keywords
111 + Author Date Id Revision
Added: svn:eol-style
212 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit-read.tex
@@ -0,0 +1,4 @@
 2+\documentclass{article}
 3+\begin{document}
 4+\input /etc/passwd
 5+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit-read.tex
___________________________________________________________________
Added: svn:keywords
16 + Author Date Id Revision
Added: svn:eol-style
27 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/tmp/.blank
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/tmp/.blank
___________________________________________________________________
Added: svn:keywords
38 + Author Date Id Revision
Added: svn:eol-style
49 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/MANIFEST
@@ -0,0 +1,198 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 1.1 BETA 3 MANIFEST
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+
 15+
 16+1. Documents
 17+
 18+ ChangeLog Subdural mutations
 19+ COPYING License
 20+ copying.inc.ms Include license
 21+ copying.ms COPYING source
 22+ Makefile Compile docs from source
 23+ MANIFEST Serial list
 24+ manifest.ms MANIFEST source
 25+ NEWS Visible changes and todo's
 26+ news.ms NEWS source
 27+ README Installation and expansion
 28+ readme.ms README source
 29+ THANKS Benedictum
 30+ thanks.ms THANKS source
 31+
 32+
 33+2. Module
 34+
 35+ main.in.php Driver
 36+ wikitex-audit.in.sh Security auditor
 37+ wikitex-audit-read.tex Audit reading from parent directories
 38+ wikitex-audit-shell.tex Audit LaTeX execution
 39+ wikitex-audit-write.tex Audit writing to parent directories
 40+ wikitex-decruft.in.sh Clean cache directory of unused cruft
 41+ WikitexConstants.in.php Parser header
 42+ wikitex.in.cron Crontab template
 43+ wikitex.in.sudoers Sodoers' template
 44+ wikitex.in.ini phpDocumentor cruft
 45+ Wikitex.in.php Parser
 46+ wikitex.sh Shell interface
 47+
 48+
 49+3. Templates (template/)
 50+
 51+ amsmath.tex AMS-LaTeX
 52+ chem.tex XyMTeX
 53+ chess.tex Skak
 54+ circo.dot Graphviz circo
 55+ fdp.dot Graphviz fdp
 56+ feyn.tex feynMF
 57+ go.sgf Go
 58+ graph.dot Graphviz dot
 59+ greek.tex Ibycus
 60+ ipa.tex TIPA
 61+
 62+
 63+
 64+
 65+ 19 February 2006
 66+
 67+
 68+
 69+
 70+
 71+ -2-
 72+
 73+
 74+ music.ly Lilypond
 75+ plot.p Gnuplot
 76+ svg.svg SVG
 77+ teng.tex Tengwar
 78+ twopi.dot Graphviz twopi
 79+
 80+
 81+
 82+
 83+
 84+
 85+
 86+
 87+
 88+
 89+
 90+
 91+
 92+
 93+
 94+
 95+
 96+
 97+
 98+
 99+
 100+
 101+
 102+
 103+
 104+
 105+
 106+
 107+
 108+
 109+
 110+
 111+
 112+
 113+
 114+
 115+
 116+
 117+
 118+
 119+
 120+
 121+
 122+
 123+
 124+
 125+
 126+
 127+
 128+
 129+
 130+
 131+ 19 February 2006
 132+
 133+
 134+
 135+
 136+
 137+ -3-
 138+
 139+
 140+WikiTeX: expansible LaTeX module for MediaWiki
 141+Copyright (C) 2004-6 Peter Danenberg
 142+
 143+ WikiTeX is licensed under the Artistic License 2.0; to
 144+view a copy of this license, see COPYING or visit:
 145+
 146+ http://dev.perl.org/perl6/rfc/346.html
 147+
 148+
 149+
 150+
 151+
 152+
 153+
 154+
 155+
 156+
 157+
 158+
 159+
 160+
 161+
 162+
 163+
 164+
 165+
 166+
 167+
 168+
 169+
 170+
 171+
 172+
 173+
 174+
 175+
 176+
 177+
 178+
 179+
 180+
 181+
 182+
 183+
 184+
 185+
 186+
 187+
 188+
 189+
 190+
 191+
 192+
 193+
 194+
 195+
 196+
 197+ 19 February 2006
 198+
 199+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/MANIFEST
___________________________________________________________________
Added: svn:keywords
1200 + Author Date Id Revision
Added: svn:eol-style
2201 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/thanks.ms
@@ -0,0 +1,29 @@
 2+.DA
 3+.TL
 4+WikiTeX %VERSION% THANKS
 5+.AU
 6+Peter Danenberg <pcd at wikitex dot org>
 7+.PP
 8+WikiTeX was originally written by Peter Danenberg. Many people further contributed to WikiTeX by reporting problems, suggesting various improvements or submitting actual code. Here is a list of these people; help us keep it complete and exempt of errors:
 9+.TS
 10+expand;
 11+l l r.
 12+Tomasz Wegrzanowski impetus beer.com
 13+Brion Vibber security leuksman.com
 14+Erik Moeller press humanist.de/erik
 15+Phil Boswell docs User:Phil_Boswell
 16+Grendlekhan packages User:Grendlekhan
 17+Johannes Berg security sipsolutions.de
 18+Alexander Schremmer security alexanderweb.de
 19+Massoud Ghyam-khah support usc.edu
 20+Hugo Looyestijn testing phys.uu.nl
 21+Michel Hardy-Vallee testing mcgill.ca
 22+Jonathan Pennington testing oregonstate.edu
 23+Ales Hvezda Scheme seul.org
 24+Forrest Oliphant testing folktunes.org
 25+Carlo Vanini TikiWiki tikiwiki.org
 26+Salvatore Ingala Windows katamail.com
 27+Harold Martin testing cocoadev
 28+Gregor Rosenauer docs gmail.com
 29+.TE
 30+.bp
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/thanks.ms
___________________________________________________________________
Added: svn:keywords
131 + Author Date Id Revision
Added: svn:eol-style
232 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit.in.sh
@@ -0,0 +1,176 @@
 2+#!/usr/bin/env bash
 3+#
 4+# wikitex-audit.sh: locates infelicities in
 5+# WikiTeX's installation.
 6+#
 7+# WikiTeX: expansible LaTeX module for MediaWiki
 8+# Copyright (C) 2004-6 Peter Danenberg
 9+#
 10+# WikiTeX is licensed under the Artistic License 2.0; to
 11+# view a copy of this license, see COPYING or visit:
 12+#
 13+# http://dev.perl.org/perl6/rfc/346.html
 14+#
 15+
 16+declare -r LATEX=%LATEX%
 17+declare -r TEXMF=$(kpsewhich -expand-var '$TEXMFMAIN')/web2c/texmf.cnf
 18+declare -r DVIPNG=%DVIPNG%
 19+declare -r MOGRIFY=%MOGRIFY%
 20+declare -r CONVERT=%CONVERT%
 21+declare -r LILYPOND=%LILYPOND%
 22+declare -r GNUPLOT=%GNUPLOT%
 23+declare -r DOT=%DOT%
 24+declare -r NEATO=%NEATO%,
 25+declare -r FDP=%FDP%,
 26+declare -r TWOPI=%TWOPI%,
 27+declare -r CIRCO=%CIRCO%,
 28+declare -r SGF2DG=%SGF2DG%
 29+declare -r TEX=%TEX%
 30+declare -r METAPOST=%METAPOST%
 31+
 32+declare -r PARTITION=%PARTITION%
 33+
 34+declare -r DECRUFT=%DECRUFT%
 35+declare -r DATABASE=%DATABASE%
 36+declare -r DBUSER=%DBUSER%
 37+declare -r DBPASS=%DBPASS%
 38+declare -r MAILTO=%MAILTO%
 39+
 40+declare -r APACHE=%APACHE%
 41+declare -r WIKITEX=%WIKITEX%
 42+declare -r HOST=%HOST%
 43+
 44+declare -ri SUCCESS=0
 45+declare -ri FAIL=1
 46+declare -ri ABORT=2
 47+
 48+declare -ri WARN=0
 49+declare -ri FATAL=1
 50+
 51+declare -ra OUTCOMES=('success' 'FAILURE')
 52+
 53+declare -ra TESTS=('root' 'user' 'nologin' 'usrquota' 'quotaed' 'blocks' 'files' 'crontab' 'decruft' 'latex' 'shell_escape' 'openout_any' 'openin_any' 'latex\ execute' 'latex\ read' 'latex\ write' 'dvipng' 'mogrify' 'convert' 'lilypond' 'gnuplot' 'gnuplot\ execute' 'dot' 'neato' 'fdp' 'twopi' 'circo' 'sgf2dg' 'tex' 'metapost')
 54+
 55+declare -ra DICTA=(
 56+ "You\ must\ be\ root\ to\ continue."
 57+ "User\ ${WIKITEX}\ existeth\ nought."
 58+ "User\ ${WIKITEX}\ does\ not\ have\ /sbin/nologin\ for\ a\ shell."
 59+ "usrquota\ does\ not\ appear\ in\ /etc/fstab\ for\ ${PARTITION}."
 60+ "User\ ${WIKITEX}\ has\ not\ been\ quotaed."
 61+ "Blocks\ have\ not\ been\ quotaed\ on\ ${PARTITION}\ for\ ${WIKITEX}."
 62+ "Files\ have\ not\ been\ quotaed\ on\ ${PARTITION}\ for\ ${WIKITEX}."
 63+ "There\ is\ no\ crontab\ for\ Apache\ user\ ${APACHE}."
 64+ "The\ crontab\ for\ Apache\ user\ ${APACHE}\ does\ not\ invoke\ ${DECRUFT}."
 65+ "${APACHE}\ cannot\ execute\ latex\ as\ ${WIKITEX}."
 66+ "shell_escape\ must\ be\ set\ to\ f\ in\ texmf.cnf"
 67+ "openout_any\ must\ be\ set\ to\ p\ in\ texmf.cnf"
 68+ "openin_any\ must\ be\ set\ to\ p\ in\ texmf.cnf"
 69+ "LaTeX\ appears\ to\ be\ able\ to\ execute\ scripts."
 70+ "LaTeX\ appears\ to\ be\ able\ to\ read\ files\ in\ parent\ directory."
 71+ "LaTeX\ appears\ to\ be\ able\ to\ write\ files\ in\ parent\ directory."
 72+ "${APACHE}\ cannot\ execute\ dvipng\ as\ ${WIKITEX}."
 73+ "${APACHE}\ cannot\ execute\ mogrify\ as\ ${WIKITEX}."
 74+ "${APACHE}\ cannot\ execute\ convert\ as\ ${WIKITEX}."
 75+ "${APACHE}\ cannot\ execute\ lilypond\ as\ ${WIKITEX}."
 76+ "${APACHE}\ cannot\ execute\ gnuplot\ as\ ${WIKITEX}."
 77+ "Gnuplot\ appears\ to\ be\ able\ to\ execute\ commands."
 78+ "${APACHE}\ cannot\ execute\ dot\ as\ ${WIKITEX}."
 79+ "${APACHE}\ cannot\ execute\ neato\ as\ ${WIKITEX}."
 80+ "${APACHE}\ cannot\ execute\ fdp\ as\ ${WIKITEX}."
 81+ "${APACHE}\ cannot\ execute\ twopi\ as\ ${WIKITEX}."
 82+ "${APACHE}\ cannot\ execute\ circo\ as\ ${WIKITEX}."
 83+ "${APACHE}\ cannot\ execute\ sgf2dg\ as\ ${WIKITEX}."
 84+ "${APACHE}\ cannot\ execute\ tex\ as\ ${WIKITEX}."
 85+ "${APACHE}\ cannot\ execute\ metapost\ as\ ${WIKITEX}."
 86+)
 87+
 88+declare -ar TERMS=(
 89+ 'Finished\ successfully.'
 90+ 'Finished\ with\ failures.'
 91+ 'Aborted\ on\ fatal\ error.'
 92+)
 93+
 94+declare -i status=${SUCCESS}
 95+declare -i test=0
 96+
 97+echo -e "outcome\ttest\n-------\t----"
 98+
 99+function au_run() {
 100+# echo ${@}
 101+ "${@}" &> /dev/null || {
 102+ echo -e "${OUTCOMES[FAIL]}\t${TESTS[test]}: ${DICTA[test]}"
 103+ return ${FAIL}
 104+ }
 105+ echo -e "${OUTCOMES[SUCCESS]}\t${TESTS[test]}"
 106+ return ${SUCCESS}
 107+}
 108+
 109+abort() {
 110+ echo "${TERMS[${ABORT}]}"
 111+ exit ${ABORT}
 112+}
 113+
 114+au_run [ $(id -u) == 0 ] || abort && (( test++ ))
 115+
 116+au_run id -u "${WIKITEX}" || abort && (( test++ ))
 117+
 118+au_run awk -F : -- "/${WIKITEX}/ { if (\$7 !~ /nologin/) exit ${FAIL}; }" /etc/passwd || abort && (( test++ ))
 119+
 120+au_run awk -- "\$1 ~ \"${PARTITION}\" { if (\$4 !~ /usrquota/) exit ${FAIL} }" /etc/fstab || abort && (( test++ ))
 121+
 122+au_run quota -qu "${WIKITEX}" || abort && (( test++ ))
 123+
 124+quota -vu "${WIKITEX}" | au_run awk -- "\$1 ~ \"${PARTITION}\" { if (\$4 == 0) exit ${FAIL} }" || abort && (( test++ ))
 125+
 126+quota -vu "${WIKITEX}" | au_run awk -- "\$1 ~ \"${PARTITION}\" { if (\$7 == 0) exit ${FAIL} }" || abort && (( test++ ))
 127+
 128+au_run crontab -lu "${APACHE}" || abort && (( test++ ))
 129+
 130+crontab -lu "${APACHE}" | au_run grep "${DECRUFT}" || status=${FAIL} && (( test++ ))
 131+
 132+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" latex -v || abort && (( test++ ))
 133+
 134+au_run grep '^shell_escape.*f$' "${TEXMF}" || abort && (( test++ ))
 135+
 136+au_run grep '^openout_any.*p$' "${TEXMF}" || abort && (( test++ ))
 137+
 138+au_run grep '^openin_any.*p$' "${TEXMF}" || abort && (( test++ ))
 139+
 140+latex --interaction=nonstopmode 'wikitex-audit-shell.tex' | au_run grep -qv 'write18.*enabled' || abort && (( test++ ))
 141+
 142+latex --interaction=nonstopmode 'wikitex-audit-read.tex' &> /dev/null
 143+au_run [ ${?} -ne 0 ] || abort && (( test++ ))
 144+
 145+latex --interaction=nonstopmode 'wikitex-audit-write.tex' &> /dev/null
 146+au_run [ ${?} -ne 0 ] || abort && (( test++ ))
 147+
 148+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" dvipng -help || abort && (( test++ ))
 149+
 150+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" mogrify -help || abort && (( test++ ))
 151+
 152+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" convert -v || abort && (( test++ ))
 153+
 154+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" lilypond -v || status=${FAIL} && (( test++ ))
 155+
 156+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" gnuplot -V || status=${FAIL} && (( test++ )) && {
 157+ echo '!cat' | sudo -u "${APACHE}" sudo -u "${WIKITEX}" gnuplot 2>&1 | au_run grep -q 'Permission denied' || abort && (( test++ ))
 158+}
 159+
 160+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" dot -V || status=${FAIL} && (( test++ ))
 161+
 162+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" neato -V || status=${FAIL} && (( test++ ))
 163+
 164+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" fdp -V || status=${FAIL} && (( test++ ))
 165+
 166+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" twopi -V || status=${FAIL} && (( test++ ))
 167+
 168+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" circo -V || status=${FAIL} && (( test++ ))
 169+
 170+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" sgf2dg -v || status=${FAIL} && (( test++ ))
 171+
 172+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" tex -v || status=${FAIL} && (( test++ ))
 173+
 174+au_run sudo -u "${APACHE}" sudo -u "${WIKITEX}" metapost -v || status=${FAIL} && (( test++ ))
 175+
 176+echo "${TERMS[${status}]}"
 177+exit ${status}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex-audit.in.sh
___________________________________________________________________
Added: svn:keywords
1178 + Author Date Id Revision
Added: svn:eol-style
2179 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.in.ini
@@ -0,0 +1,24 @@
 2+; phpDocumentor configuration data.
 3+;
 4+; WikiTeX: expansible LaTeX module for MediaWiki
 5+; Copyright (C) 2004-6 Peter Danenberg
 6+;
 7+; WikiTeX is licensed under the Artistic License 2.0; to
 8+; view a copy of this license, see COPYING or visit:
 9+;
 10+; http://dev.perl.org/perl6/rfc/346.html
 11+;
 12+
 13+[Parse Data]
 14+title = WikiTeX %VERSION% Documentation
 15+hidden = false
 16+parseprivate = on
 17+javadocdesc = off
 18+defaultcategoryname = Documentation
 19+defaultpackagename = Wikitex
 20+target = docs
 21+readmeinstallchangelog = README, COPYING, NEWS, MANIFEST, THANKS, ChangeLog
 22+directory = ./
 23+ignore = *.in.php
 24+output=HTML:Smarty:PHP
 25+sourcecode = on
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.in.ini
___________________________________________________________________
Added: svn:keywords
126 + Author Date Id Revision
Added: svn:eol-style
227 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/COPYING
@@ -0,0 +1,462 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 1.1 BETA 3 LICENSE
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+
 15+
 16+The Artistic License Version 2.0beta4, October 2000
 17+
 18+ Copyright (C) 2000, Larry Wall. Everyone is permitted
 19+to copy and distribute verbatim copies of this license docu-
 20+ment, but changing it is not allowed.
 21+
 22+Preamble
 23+
 24+ This copyright license states the terms under
 25+ which a given free software Package may be copied, mod-
 26+ ified and/or redistributed, while the Originator(s)
 27+ maintain some artistic control over the future develop-
 28+ ment of that Package (at least as much artistic control
 29+ as can be given under copyright law while still making
 30+ the Package open source and free software).
 31+
 32+ This license is bound by copyright law, and thus
 33+ it legally applies only to works which the copyright
 34+ holder has permitted copying, distribution or modifica-
 35+ tion under the terms of the Artistic License, Version
 36+ 2.0.
 37+
 38+ You are reminded that You are always permitted to
 39+ make arrangements wholly outside of a given copyright
 40+ license directly with the copyright holder(s) of a
 41+ given Package. If the terms of this license impede
 42+ your ability to make full use of the Package, You are
 43+ encouraged to contact the copyright holder(s) and seek
 44+ a different licensing arrangement.
 45+
 46+Definitions
 47+
 48+ "Package"
 49+ refers to the collection of files distributed by
 50+ the Originator(s), and derivatives of that collec-
 51+ tion of files created through textual modifica-
 52+ tion.
 53+
 54+ "Standard Version"
 55+ refers to the Package if it has not been modified,
 56+ or has been modified only in ways suggested by the
 57+ Originator(s).
 58+
 59+ "Modified Version"
 60+ refers to the Package, if it has been changed by
 61+ You via textual modification of the source code,
 62+
 63+
 64+
 65+ 18 February 2006
 66+
 67+
 68+
 69+
 70+
 71+ -2-
 72+
 73+
 74+ and such changes were not suggested by the Origi-
 75+ nator(s).
 76+
 77+ "Originator"
 78+ refers to the author(s) and/or copyright holder(s)
 79+ of the Standard Version of the Package.
 80+
 81+ "You" and "Your"
 82+ refers to any person who would like to copy, dis-
 83+ tribute, or modify the Package.
 84+
 85+ "Distribution Fee"
 86+ is any fee that You charge for providing a copy of
 87+ this Package to another party. It does not refer
 88+ to licensing fees.
 89+
 90+ "Freely Available"
 91+ means that:
 92+
 93+ a. no fee is charged for the right to use the
 94+ item (though a Distribution Fee may be
 95+ charged).
 96+
 97+ b. recipients of the item may redistribute it
 98+ under the same conditions they received it.
 99+
 100+ c. If the item is a binary, object code, byte-
 101+ code, the complete corresponding machine-
 102+ readable source code is included with the
 103+ item.
 104+
 105+Permission for Use and Modification Without Redistribution
 106+
 107+ 1. You are permitted to use the Standard Version and
 108+ create and use Modified Versions for any purpose
 109+ without restriction, provided that you do not
 110+ redistribute the Modified Version to others out-
 111+ side of your company or organization.
 112+
 113+Permissions for Redistribution of the Standard Version
 114+
 115+ 2. You may make available verbatim copies of the
 116+ source code of the Standard Version of this Pack-
 117+ age in any medium without restriction, either
 118+ gratis or for a Distribution Fee, provided that
 119+ you duplicate all of the original copyright
 120+ notices and associated disclaimers. At Your dis-
 121+ cretion, such verbatim copies may or may not
 122+ include compiled bytecode, object code or binary
 123+ versions of the corresponding source code in the
 124+ same medium.
 125+
 126+ 3. You may apply any bug fixes, portability changes,
 127+ and other modifications made available from any of
 128+
 129+
 130+
 131+ 18 February 2006
 132+
 133+
 134+
 135+
 136+
 137+ -3-
 138+
 139+
 140+ the Originator(s). The resulting modified Package
 141+ will still be considered the Standard Version, and
 142+ may be copied, modified and redistributed under
 143+ the terms of the original license of the Standard
 144+ Version as if it were the Standard Version.
 145+
 146+Permissions for Redistribution of Modified Versions of the
 147+Package as Source
 148+
 149+ 4. You may modify your copy of the source code of
 150+ this Package in any way and distribute that Modi-
 151+ fied Version (either gratis or for a Distribution
 152+ Fee, and with or without a corresponding binary,
 153+ bytecode or object code version of the Modified
 154+ Version) provided that You clearly indicate what
 155+ changes You made to the Package, and provided that
 156+ You do at least ONE of the following:
 157+
 158+ a. make the Modified Version available to the
 159+ Originator(s) of the Standard Version, under
 160+ the exact license of the Standard Version, so
 161+ that the Originator(s) may include your modi-
 162+ fications into the Standard Version (at their
 163+ discretion).
 164+
 165+ b. modify any installation scripts and proce-
 166+ dures so that installation of the Modified
 167+ Version will never conflict with an installa-
 168+ tion of the Standard Version, include for
 169+ each program installed by the Modified Ver-
 170+ sion clear documentation describing how it
 171+ differs from the Standard Version, and rename
 172+ your Modified Version so that the name is
 173+ substantially different from the Standard
 174+ Version.
 175+
 176+ c. permit and encourage anyone who receives a
 177+ copy of the Modified Version permission to
 178+ make your modifications Freely Available in
 179+ some specific way.
 180+
 181+ If Your Modified Version is in turn derived from a
 182+ Modified Version made by a third party, then You
 183+ are still required to ensure that Your Modified
 184+ Version complies with the requirements of this
 185+ license.
 186+
 187+Permissions for Redistribution of Non-Source Versions of
 188+Package
 189+
 190+ 5. You may distribute binary, object code, bytecode
 191+ or other non-source versions of the Standard Ver-
 192+ sion of the Package, provided that you include
 193+ complete instructions on where to get the source
 194+
 195+
 196+
 197+ 18 February 2006
 198+
 199+
 200+
 201+
 202+
 203+ -4-
 204+
 205+
 206+ code of the Standard Version. Such instructions
 207+ must be valid at the time of Your distribution.
 208+ If these instructions, at any time while You are
 209+ carrying our such distribution, become invalid,
 210+ you must provide new instructions on demand or
 211+ cease further distribution. If You cease distri-
 212+ bution within thirty days after You become aware
 213+ that the instructions are invalid, then You do not
 214+ forfeit any of Your rights under this license.
 215+
 216+ 6. You may distribute binary, object code, bytecode
 217+ or other non-source versions of a Modified Version
 218+ provided that You do at least ONE of the follow-
 219+ ing:
 220+
 221+ a. include a copy of the corresponding source
 222+ code for the Modified Version under the terms
 223+ indicated in (4).
 224+
 225+ b. ensure that the installation of Your non-
 226+ source Modified Version does not conflict in
 227+ any way with an installation of the Standard
 228+ Version, include for each program installed
 229+ by the Modified Version clear documentation
 230+ describing how it differs from the Standard
 231+ Version, and rename your Modified Version so
 232+ that the name is substantially different from
 233+ the Standard Version.
 234+
 235+ c. ensure that the Modified Version includes
 236+ notification of the changes made from the
 237+ Standard Version, and offer to provide
 238+ machine-readable source code (under a license
 239+ that permits making that source code Freely
 240+ Available) of the Modified Version via mail
 241+ order.
 242+
 243+Permissions for Inclusion of the Package in Aggregate Works
 244+
 245+ 7. You may aggregate this Package (either the Stan-
 246+ dard Version or Modified Version) with other pack-
 247+ ages and distribute the resulting aggregation pro-
 248+ vided that You do not charge a licensing fee for
 249+ the Package. Distribution Fees are permitted, and
 250+ licensing fees for other packages in the aggrega-
 251+ tion are permitted. Your permission to distribute
 252+ Standard or Modified Versions of the Package is
 253+ still subject to the other terms set forth in
 254+ other sections of this license.
 255+
 256+ 8. In addition to the permissions given elsewhere by
 257+ this license, You are also permitted to link Modi-
 258+ fied and Standard Versions of this Package with
 259+ other works and distribute the inary program(s)
 260+
 261+
 262+
 263+ 18 February 2006
 264+
 265+
 266+
 267+
 268+
 269+ -5-
 270+
 271+
 272+ that do not overtly expose the interfaces of the
 273+ Package. This includes permission to embed the
 274+ Package in a larger work of your own without
 275+ exposing a direct interface to the Package. This
 276+ also includes permission to build stand-alone
 277+ binary or bytecode versions of your scripts that
 278+ require the Package, but do not otherwise give the
 279+ casual user direct access to the Package itself.
 280+
 281+Items That are Never Considered Part of a Modified Version
 282+Package
 283+
 284+ 9. Works (including, but not limited to, subroutines
 285+ and scripts) that you have linked or aggregated
 286+ with the Package that merely extend or make use of
 287+ the Package, but are not intended to cause the
 288+ Package to operate differently from the Standard
 289+ Version, do not, by themselves, cause the Package
 290+ to be a Modified Version. In addition, such works
 291+ are not considered parts of the Package itself,
 292+ and are not bound by the terms of the Package's
 293+ license.
 294+
 295+Acceptance of License and Disclaimer of Warranty
 296+
 297+ 10. You are not required to accept this License, since
 298+ you have not signed it. However, nothing else
 299+ grants you permission to copy, modify or dis-
 300+ tribute the Standard or Modified Versions of the
 301+ Package. These actions are prohibited by copy-
 302+ right law if you do not accept this License.
 303+ Therefore, by copying, modifying or distributing
 304+ Standard and Modified Versions of the Package, you
 305+ indicate your acceptance of the license of the
 306+ Package.
 307+
 308+ 11. Disclaimer of Warranty:
 309+
 310+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
 311+ AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
 312+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 313+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
 314+ NESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
 315+ NO EVENT UNLESS REQUIRED BY LAW OR AGREED TO IN
 316+ WRITING WILL ANY COPYRIGHT HOLDER OR CONTRIBUTOR
 317+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 318+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 319+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 320+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 321+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 322+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CON-
 323+ TRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLI-
 324+ GENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 325+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 326+
 327+
 328+
 329+ 18 February 2006
 330+
 331+
 332+
 333+
 334+
 335+ -6-
 336+
 337+
 338+ POSSIBILITY OF SUCH DAMAGE.
 339+
 340+
 341+
 342+
 343+
 344+
 345+
 346+
 347+
 348+
 349+
 350+
 351+
 352+
 353+
 354+
 355+
 356+
 357+
 358+
 359+
 360+
 361+
 362+
 363+
 364+
 365+
 366+
 367+
 368+
 369+
 370+
 371+
 372+
 373+
 374+
 375+
 376+
 377+
 378+
 379+
 380+
 381+
 382+
 383+
 384+
 385+
 386+
 387+
 388+
 389+
 390+
 391+
 392+
 393+
 394+
 395+ 18 February 2006
 396+
 397+
 398+
 399+
 400+
 401+ -7-
 402+
 403+
 404+WikiTeX: expansible LaTeX module for MediaWiki
 405+Copyright (C) 2004-6 Peter Danenberg
 406+
 407+ WikiTeX is licensed under the Artistic License 2.0; to
 408+view a copy of this license, see COPYING or visit:
 409+
 410+ http://dev.perl.org/perl6/rfc/346.html
 411+
 412+
 413+
 414+
 415+
 416+
 417+
 418+
 419+
 420+
 421+
 422+
 423+
 424+
 425+
 426+
 427+
 428+
 429+
 430+
 431+
 432+
 433+
 434+
 435+
 436+
 437+
 438+
 439+
 440+
 441+
 442+
 443+
 444+
 445+
 446+
 447+
 448+
 449+
 450+
 451+
 452+
 453+
 454+
 455+
 456+
 457+
 458+
 459+
 460+
 461+ 18 February 2006
 462+
 463+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/COPYING
___________________________________________________________________
Added: svn:keywords
1464 + Author Date Id Revision
Added: svn:eol-style
2465 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/go.sgf
@@ -0,0 +1,2 @@
 2+%VALUE%
 3+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/go.sgf
___________________________________________________________________
Added: svn:keywords
14 + Author Date Id Revision
Added: svn:eol-style
25 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/circo.dot
@@ -0,0 +1 @@
 2+%VALUE%
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/circo.dot
___________________________________________________________________
Added: svn:keywords
13 + Author Date Id Revision
Added: svn:eol-style
24 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/graph.dot
@@ -0,0 +1 @@
 2+%VALUE%
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/graph.dot
___________________________________________________________________
Added: svn:keywords
13 + Author Date Id Revision
Added: svn:eol-style
24 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/twopi.dot
@@ -0,0 +1 @@
 2+%VALUE%
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/twopi.dot
___________________________________________________________________
Added: svn:keywords
13 + Author Date Id Revision
Added: svn:eol-style
24 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/amsmath.tex
@@ -0,0 +1,6 @@
 2+\documentclass[12pt]{article}
 3+\usepackage{amssymb,amsmath,amscd,amstext,amsopn,amscd,amsfonts}
 4+\pagestyle{empty}
 5+\begin{document}
 6+\begin{displaymath}%VALUE%\end{displaymath}
 7+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/amsmath.tex
___________________________________________________________________
Added: svn:keywords
18 + Author Date Id Revision
Added: svn:eol-style
29 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/neato.dot
@@ -0,0 +1 @@
 2+%VALUE%
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/neato.dot
___________________________________________________________________
Added: svn:keywords
13 + Author Date Id Revision
Added: svn:eol-style
24 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/greek.tex
@@ -0,0 +1,8 @@
 2+\documentclass[12pt]{article}
 3+\usepackage{ibycus4}
 4+\pagestyle{empty}
 5+\begin{document}
 6+\greek{
 7+%VALUE%
 8+}
 9+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/greek.tex
___________________________________________________________________
Added: svn:keywords
110 + Author Date Id Revision
Added: svn:eol-style
211 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/teng.tex
@@ -0,0 +1,8 @@
 2+\documentclass[12pt]{article}
 3+\usepackage{tengtex}
 4+\pagestyle{empty}
 5+\begin{document}
 6+\begin{elvish}
 7+%VALUE%
 8+\end{elvish}
 9+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/teng.tex
___________________________________________________________________
Added: svn:keywords
110 + Author Date Id Revision
Added: svn:eol-style
211 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/svg.svg
@@ -0,0 +1,7 @@
 2+<?xml version="1.0" standalone="no"?>
 3+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 4+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 5+<svg width="WIDTH" height="HEIGHT" version="1.1"
 6+ xmlns="http://www.w3.org/2000/svg">
 7+%VALUE%
 8+</svg>
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/svg.svg
___________________________________________________________________
Added: svn:keywords
19 + Author Date Id Revision
Added: svn:eol-style
210 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/fdp.dot
@@ -0,0 +1 @@
 2+%VALUE%
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/fdp.dot
___________________________________________________________________
Added: svn:keywords
13 + Author Date Id Revision
Added: svn:eol-style
24 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/feyn.tex
@@ -0,0 +1,10 @@
 2+\documentclass{article}
 3+\usepackage[nonstop]{feynmp}
 4+\unitlength=1mm
 5+\pagestyle{empty}
 6+\begin{document}
 7+\begin{fmffile}{fmftempl}
 8+%VALUE%
 9+\end{fmffile}
 10+\end{document}
 11+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/feyn.tex
___________________________________________________________________
Added: svn:keywords
112 + Author Date Id Revision
Added: svn:eol-style
213 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/music.ly
@@ -0,0 +1,11 @@
 2+\header {
 3+ tagline = ""
 4+}
 5+\paper {
 6+ printpagenumber = ##f
 7+}
 8+\score {
 9+ %VALUE%
 10+ \midi { \tempo 4 . = %TEMPO% }
 11+ \layout {}
 12+}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/music.ly
___________________________________________________________________
Added: svn:keywords
113 + Author Date Id Revision
Added: svn:eol-style
214 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/chess.tex
@@ -0,0 +1,13 @@
 2+\documentclass[12pt]{article}
 3+\usepackage{skak}
 4+\newcommand{\chessgame}[4]{
 5+ \begin{center}
 6+ \large{\textbf{#1} -- \textbf{#2}}\\
 7+ \textsf{#3}\\
 8+ \small{\textsc{#4}}
 9+ \end{center}
 10+}
 11+\pagestyle{empty}
 12+\begin{document}
 13+%VALUE%
 14+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/chess.tex
___________________________________________________________________
Added: svn:keywords
115 + Author Date Id Revision
Added: svn:eol-style
216 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/ipa.tex
@@ -0,0 +1,9 @@
 2+\documentclass[12pt]{article}
 3+\usepackage[tone,extra]{tipa}
 4+\usepackage{tipx}
 5+\pagestyle{empty}
 6+\begin{document}
 7+\begin{IPA}
 8+%VALUE%
 9+\end{IPA}
 10+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/ipa.tex
___________________________________________________________________
Added: svn:keywords
111 + Author Date Id Revision
Added: svn:eol-style
212 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/chem.tex
@@ -0,0 +1,7 @@
 2+\documentclass{article}
 3+\usepackage{xymtex}
 4+\usepackage{chemist}
 5+\pagestyle{empty}
 6+\begin{document}
 7+%VALUE%
 8+\end{document}
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/chem.tex
___________________________________________________________________
Added: svn:keywords
19 + Author Date Id Revision
Added: svn:eol-style
210 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/template/plot.p
@@ -0,0 +1,3 @@
 2+set terminal png
 3+set output "%OUTPUT%"
 4+%VALUE%
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/template/plot.p
___________________________________________________________________
Added: svn:keywords
15 + Author Date Id Revision
Added: svn:eol-style
26 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/readme.ms
@@ -0,0 +1,393 @@
 2+.RP
 3+.DA
 4+.TL
 5+WikiTeX %VERSION% README
 6+.AU
 7+Peter Danenberg <pcd at wikitex dot org>
 8+.AB
 9+.PP
 10+THIS PRODUCT IS IN BETA, AND AS SUCH SHOULD NOT BE DEPLOYED IN A PRODUCTION ENVIRONMENT.
 11+.PP
 12+Covers installation and expansion of the WikiTeX system.
 13+.PP
 14+NOTICE: Failure to implement all security measures in section 3.2 may expose your system to loss or mischief.
 15+.AE
 16+.XS 1
 17+1. Introduction
 18+.XA 1
 19+2. Acquisition
 20+.XA 1
 21+ 2.1 CVS
 22+.XA 2
 23+ 2.2 FTP
 24+.XA 2
 25+ 2.3 HTTP
 26+.XA 2
 27+ 2.4 Subversion
 28+.XA 2
 29+3. Installation
 30+.XA 2
 31+ 3.1. Prerequisites
 32+.XA 3
 33+ 3.2. Security
 34+.XA 3
 35+ 3.2.1. Makefile
 36+.XA 3
 37+ 3.2.2. Unprivileged User
 38+.XA 3
 39+ 3.2.3. Disk Quota
 40+.XA 4
 41+ 3.2.4. Cron
 42+.XA 4
 43+ 3.2.5. Sudo
 44+.XA 4
 45+ 3.2.6. Per Package
 46+.XA 5
 47+ 3.2.6.1. LaTeX
 48+.XA 5
 49+ 3.2.7. Audit
 50+.XA 5
 51+ 3.3. Installation
 52+.XA 6
 53+4. Hacking
 54+.XA 6
 55+ 4.1. Getting Started
 56+.XA 6
 57+ 4.2. Extending WikiTeX
 58+.XA 6
 59+5. Help
 60+.XA 7
 61+6. Colophon
 62+.XA 8
 63+7. Copyright
 64+.XE
 65+.PX
 66+.NH 1
 67+Introduction
 68+.RS
 69+.PP
 70+WikiTeX extends MediaWiki by allowing authors to manipulate graphical objects directly in their articles; support so far includes: math, music, chess, chemistry, go, plotting, relational diagrams and schematic capture.
 71+.PP
 72+Visit http://wikitex.org to learn more; or to see WikiTeX in action:
 73+.QP
 74+http://wikisophia.org
 75+.RE
 76+.NH 1
 77+Acquisition
 78+.RS
 79+.NH 2
 80+CVS
 81+.RS
 82+.PP
 83+WikiTeX can be CVSed from MediaWiki's facility at SourceForge:*
 84+.FS *
 85+For actual development snapshots see Subversion below.
 86+.FE
 87+.RE
 88+.LD
 89+\%cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/wikipedia \\
 90+co wikitex
 91+.DE
 92+.NH 2
 93+FTP
 94+.RS
 95+.PP
 96+The latest stable releases can be downloaded from:
 97+.QP
 98+ftp://wikitex.org
 99+.RE
 100+.NH 2
 101+HTTP
 102+.RS
 103+.PP
 104+The latest releases can be browsed and downloaded from:
 105+.QP
 106+http://wikitex.org/wikitex
 107+.RE
 108+.NH 2
 109+Subversion
 110+.RS
 111+.PP
 112+Use your Subversion client (http://subversion\:.tigris.org) to get the latest development snapshot:
 113+.LD
 114+svn co http://svn.wikitex.org/wikitex/branches/1.1 \\
 115+wikitex
 116+.DE
 117+or visit http://wikitex.org/viewcvs/wikitex to browse the codebase via web.
 118+.RE
 119+.RE
 120+.NH 1
 121+Installation
 122+.RS
 123+.NH 2
 124+Prerequisites
 125+.RS
 126+.PP
 127+In a nutshell, WikiTeX requires a successful installation of:
 128+.RS
 129+.IP \(bu
 130+PHP 5.1.0+ (php.net)
 131+.IP \(bu
 132+MediaWiki 1.6alpha1+ (wikipedia.sf.net)
 133+.IP \(bu
 134+LaTeX (latex-project.org)
 135+.IP \(bu
 136+ImageMagick (imagemagick.org)
 137+.IP \(bu
 138+dvipng (dvipng.sf.net)
 139+.RE
 140+.PP
 141+As of writing, WikiTeX requires the CVS version of MediaWiki; to get it, issue:
 142+.RE
 143+.KS
 144+.LD
 145+cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/wikipedia\\
 146+co -P phase3
 147+.DE
 148+.KE
 149+.RS
 150+.PP
 151+Lilypond (lilypond.org), Gnuplot (gnuplot.info), and Graphviz (graphviz.org) are required for music, plot, and graph; and as many of the packages under \(sc3.3.5 (see below) whose classes you would like to support.
 152+.RE
 153+.NH 2
 154+Security
 155+.RS
 156+.PP
 157+WikiTeX requires preparation to mitigate risk; failure to prepare in whole or in part may expose your system to loss and mischief.
 158+.NH 3
 159+Makefile
 160+.RS
 161+.PP
 162+We've gathered all the editable parameters into one place; edit \(oqMakefile\(cq and run:
 163+.QP
 164+make
 165+.LP
 166+every time you've made changes.
 167+.RE
 168+.NH 3
 169+Unprivileged User
 170+.RS
 171+.PP
 172+WikiTeX runs as the unprivileged user \(oqwikitex\(cq to restrict access to the local file-system. You must protect sensitive world-writable and -readable resources, however.
 173+.LP
 174+Create the user wikitex:
 175+.QP
 176+useradd -M -s /sbin/nologin wikitex
 177+.RE
 178+.NH 3
 179+Disk Quota
 180+.RS
 181+.PP
 182+To prevent runaway scripts or DoS attacks from usurping storage, institute disk quotas. See:
 183+.QP
 184+\%http://www.tldp.org/HOWTO/Quota.html
 185+.LP
 186+for details.
 187+.nr i 0 1
 188+.IP \n+i.
 189+Edit /etc/fstab and, next to "defaults," add "usrquota" for the partition on which WikiTeX runs (hereafter /part); e.g.:
 190+.LD
 191+/part /home reiserfs defaults,usrquota 1 1
 192+.DE
 193+.IP \n+i.
 194+Remount /part:
 195+.IP
 196+.RS
 197+mount -o remount /part
 198+.RE
 199+.IP \n+i.
 200+Update quota data:
 201+.IP
 202+.RS
 203+quotacheck -vguma
 204+.RE
 205+.IP \n+i.
 206+Turn on quotas:
 207+.IP
 208+.RS
 209+quotaon -av
 210+.RE
 211+.IP \n+i.
 212+Implement quotas for user wikitex:
 213+.IP
 214+.RS
 215+edquota -u wikitex
 216+.RE
 217+.IP
 218+The following values will give WikiTeX one hundred megabytes and ten thousand files to play with (edit the values with asterisks):
 219+.RE
 220+.LD
 221+Filesystem blocks soft hard* inodes soft hard*
 222+/part 186 0 100000 30 0 10000
 223+.DE
 224+.NH 3
 225+Cron
 226+.RS
 227+.PP
 228+To prevent legitimate files from exceeding the disk quota, set up a crontab to purge unused files.
 229+.PP
 230+Determine your webserver's user (consult \(oqhttpd.conf\(cq for Apache), and execute:
 231+.RS
 232+.LD
 233+crontab -u <apache-user> wikitex.cron
 234+.DE
 235+.RE
 236+from extensions/wikitex.
 237+.RE
 238+.NH 3
 239+Sudo
 240+.RS
 241+.PP
 242+You will need sudo version 1.6.8 or above (verify by \(oqsudo -V\(cq), with support for NOEXEC compiled in. Remove any WikiTeX cruft from /etc/sudoers, and issue:
 243+.QP
 244+cat wikitex.sudoers >> /etc/sudoers
 245+.LP
 246+and then:
 247+.QP
 248+visudo -c
 249+.LP
 250+If there are parse errors, run \(oqvisudo\(cq and correct any mistakes.
 251+.RE
 252+.NH 3
 253+Per Package
 254+.RS
 255+.PP
 256+Following are package-specific security measures.
 257+.NH 4
 258+LaTeX
 259+.RS
 260+.PP
 261+Edit \(oqtexmf.cnf\(cq, modifying the following variables:
 262+.QP
 263+shell_escape = f
 264+.br
 265+openout_any = p
 266+.br
 267+openin_any = p
 268+.RE
 269+.RE
 270+.NH 3
 271+Audit
 272+.RS
 273+.PP
 274+\(oqwikitex-audit.sh\(cq has been provided to assess the integrity of an installation; as root, run:
 275+.QP
 276+\&./wikitex-audit.sh
 277+.LP
 278+until you satisfy it.
 279+.RE
 280+.RE
 281+.NH 2
 282+Installation
 283+.RS
 284+.PP
 285+NOTE: DON'T CONTINUE UNTIL wikitex-audit.sh EXECUTES SANS FATAL ERRORS.
 286+.PP
 287+Fulfill the security guidelines per \(sc3.2, and install MediaWiki (see 3.1); then, working from MediaWiki's base directory, perform the following:
 288+.nr i 0 1
 289+.IP \n+i.
 290+Create /extensions/wikitex and copy thither the distribution.
 291+.IP \n+i.
 292+Add the following line to /LocalSettings.php before the terminal \(oq?>\(cq:
 293+.QP
 294+include\ \%'./extensions/wikitex/Wikitex.php';
 295+.IP \n+i.
 296+Render /extensions/wikitex/tmp scribable to the web server:*
 297+.FS *
 298+Consult your server config for the appropriate user and group id.
 299+.FE
 300+.QP
 301+chown\ nobody:nobody\ \%/extensions/wikitex/tmp
 302+.IP \n+i.
 303+Disable PHP in /extensions/wikitex/tmp by issuing:
 304+.RS
 305+.QP
 306+php_flag engine off
 307+.LP
 308+from .htaccess in the same directory; disable CGI, if necessary.
 309+.RE
 310+.IP \n+i.
 311+Install as many of the following packages whose classes you would like to support, or add your own (see Expanding WikiTeX):
 312+.RE
 313+.TS
 314+expand;
 315+c c c c
 316+l l l l .
 317+Class Package Author URL
 318+_
 319+amsmath AMS-LaTeX Amer. Math. Soc. ams.org
 320+chem XyMTeX Shinsaku Fujita kit.ac.jp
 321+chess Skak Torben Hoffmann ctan.org
 322+feyn FenyMF Thorsten Ohl ctan.org
 323+go Go Daniel Bump stanford.edu
 324+graph Graphviz Emden Gansner research.att.com
 325+greek Ibycus Pierre MacKay tug.org
 326+music Lilypond Han-Wen Nienhuys lilypond.org
 327+plot Gnuplot Nikos Drakos gnuplot.info
 328+svg SVG lite ImageMagick imagemagick.org
 329+teng Tengwar Ivan Derzhanski quettar.org
 330+ipa TIPA Rei Fukui ctan.org
 331+.TE
 332+.RS
 333+.IP \n+i.
 334+(Optional) If you would like your users to be able to source uploaded files, specify the following in LocalSettings.php:
 335+.RS
 336+.QP
 337+$wgStrictFileExtensions = false;
 338+.RE
 339+.RE
 340+.RE
 341+.NH 1
 342+Hacking WikiTeX
 343+.RS
 344+.NH 2
 345+Getting Started
 346+.RS
 347+.PP
 348+Join the WikiTeX-l mailing list, where you can communicate with other users and developers:
 349+.QP
 350+\%http://lists.wikitex.org/listinfo/wikitex-l
 351+.LP
 352+and familiarize yourself with Subversion (http://subversion.tigris.org), our collaborative development tool.
 353+.RE
 354+.NH 2
 355+Extending WikiTeX
 356+.RS
 357+.PP
 358+Adding novel packages to WikiTeX can be achieved in several discrete steps; after you have downloaded and installed the package:
 359+.nr i 0 1
 360+.IP \n+i.
 361+Devise a class name for the package, and add a template to /extensions/wikitex/template in this form:
 362+.RS
 363+.QP
 364+<classname>.<ext>
 365+.RE
 366+.IP
 367+The template should expose said package to the renderer; see the current templates for examples.
 368+.IP \n+i.
 369+If the class requires non-standard (extra-LaTeX) processing, add a new function in wikitex.sh under <class>.
 370+.IP
 371+Consult wikitex.sh for examples.
 372+.IP \n+i.
 373+Lastly, add a hook to \(oqwikitex.php\(cq and an element\(->hook mapping to \(oqwikitex.inc.php\(cq.
 374+.RE
 375+.RE
 376+.NH 1
 377+Getting Help
 378+.RS
 379+.PP
 380+A great way to meet users and developers is by joining WikiTeX-l (see 4.1 above); alternatively, visit:
 381+.QP
 382+http://archives.wikitex.org/wikitex-l
 383+.LP
 384+to browse the archives.
 385+.RE
 386+.NH 1
 387+Colophon
 388+.RS
 389+.PP
 390+This document was prepared in GNU troff using the ms macro package; preprocessed with tbl, the table formatter; and lastly filtered through col to remove reverse line feeds and tabs:
 391+.QP
 392+groff -ms -t -Tascii SOURCE | col -bx > OUT
 393+.RE
 394+.bp
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/readme.ms
___________________________________________________________________
Added: svn:keywords
1395 + Author Date Id Revision
Added: svn:eol-style
2396 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/WikitexConstants.in.php
@@ -0,0 +1,102 @@
 2+<?php
 3+
 4+ /**
 5+ * WikiTeX: expansible LaTeX module for MediaWiki
 6+ *
 7+ * PHP version 5
 8+ *
 9+ * WikiTeX is licensed under the Artistic License 2.0; to
 10+ * view a copy of this license, see COPYING or visit:
 11+ *
 12+ * http://dev.perl.org/perl6/rfc/346.html
 13+ *
 14+ * @package Wikitex
 15+ * @author Peter Danenberg <pcd@wikitex.org>
 16+ * @copyright Copyright (C) 2004-6 Peter Danenberg
 17+ * @version %VERSION%
 18+ * @link http://wikitex.org
 19+ * @since WikiTeX 1.1-beta2
 20+ */
 21+
 22+ /**
 23+ * WikiTeX Constants.
 24+ *
 25+ * Provides centralized error messages and class to method mapping.
 26+ *
 27+ * @package Wikitex
 28+ * @author Peter Danenberg <pcd@wikitex.org>
 29+ * @copyright Copyright (C) 2004-6 Peter Danenberg
 30+ * @version %VERSION%
 31+ * @link http://wikitex.org
 32+ * @since WikiTeX 1.1-beta2
 33+ */
 34+class Wikitex_Constants
 35+{
 36+ /**
 37+ * Class to function mapping.
 38+ *
 39+ * Ideal topos for tranlation: maps in-article class names to names of functions
 40+ * within class {@link Wikitex}.
 41+ *
 42+ * @access protected
 43+ * @static
 44+ * @var array
 45+ */
 46+ protected static $classHooks = array('amsmath' => 'amsmath',
 47+ 'chem' => 'chem',
 48+ 'chess' => 'chess',
 49+ 'feyn' => 'feyn',
 50+ 'go' => 'go',
 51+ 'greek' => 'greek',
 52+ 'graph' => 'graph',
 53+ 'music' => 'music',
 54+ 'plot' => 'plot',
 55+ 'svg' => 'svg',
 56+ 'teng' => 'teng',
 57+ 'ipa' => 'ipa');
 58+
 59+ /**
 60+ * Error messages.
 61+ *
 62+ * Simulated constant array with error messages.
 63+ *
 64+ * @access protected
 65+ * @static
 66+ * @var array
 67+ */
 68+ protected static $errors = array('temp' => 'no template corresponds to said class.',
 69+ 'cache' => 'unable to change to temp directory.',
 70+ 'dir' => 'unable to create working directory.',
 71+ 'perm' => 'unable to set permissions on working directory.',
 72+ 'work' => 'unable to change to work directory.',
 73+ 'src' => 'unable to write contents in work directory.',
 74+ 'source' => 'source existeth nought or is illegible.',
 75+ 'copy' => 'cannot copy data to the work directory.',
 76+ 'bash' => '<code>wikitex.sh</code> is not executable.');
 77+
 78+ /**
 79+ * Get class to function mapping.
 80+ *
 81+ * Maps in-article class name to methods within {@link Wikitex}.
 82+ * @access public
 83+ * @static
 84+ * @return array array containing class to function mapping.
 85+ */
 86+ public static function getHooks() {
 87+ return self::$classHooks;
 88+ }
 89+
 90+ /**
 91+ * Get error messages.
 92+ *
 93+ * Maps error type to message; simulates constant array.
 94+ * @static
 95+ * @access public
 96+ * @return array containing closs to error mapping.
 97+ */
 98+ public static function getErrors() {
 99+ return self::$errors;
 100+ }
 101+}
 102+
 103+?>
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/WikitexConstants.in.php
___________________________________________________________________
Added: svn:keywords
1104 + Author Date Id Revision
Added: svn:eol-style
2105 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/NEWS
@@ -0,0 +1,264 @@
 2+
 3+
 4+
 5+
 6+
 7+
 8+
 9+
 10+
 11+ WikiTeX 1.1 BETA 3 NEWS
 12+
 13+ Peter Danenberg <pcd at wikitex dot org>
 14+
 15+
 16+Sun Feb 19 17:34:41 PST 2006
 17+
 18+ Added five layout properties for <graph>, corre-
 19+ sponding to the suite of Graphviz utilities: dot
 20+ (default), neato, fdp, twopi and circo.
 21+
 22+ <feyn> has been updated to accomodate Thorsten
 23+ Ohl's powerf feynMF package.
 24+
 25+Sun Feb 12 16:21:57 PST 2006 Peter Danenberg
 26+
 27+ WikiTeX's security model has been reimplemented
 28+ from the ground up: We've doffed our dependence on
 29+ blacklists, and instead rely on a combination of
 30+ ulimit, quotas, sudo; and the native facilites of LaTeX
 31+ and LilyPond for forbidding script execution and direc-
 32+ tory ascent.
 33+
 34+ In addition, the `src' and `data' parameters allow
 35+ you to reference uploads directly in your script; exam-
 36+ ples:
 37+
 38+ <svg src="tiger.svg"></svg>
 39+
 40+ to hide ugly code; or to plot data:
 41+
 42+ <plot data="plot.dat">plot "plot.dat" using 1:3</plot>
 43+
 44+ Files thus sourced forgo processing by the template.
 45+
 46+Thu Mar 10 01:26:39 PST 2005 Peter Danenberg
 47+
 48+ Skak by Torben Hoffmann has replaced Piet Tute-
 49+ laers' package as the <chess> renderer; Skak is back-
 50+ wards compatible and allows, amongst other things:
 51+
 52+ o SAN and PGN notation
 53+
 54+ o large boards (with \largeboard)
 55+
 56+ o move arrows (with \printarrow)
 57+
 58+ see the docs for details.
 59+
 60+
 61+
 62+
 63+
 64+
 65+ 19 February 2006
 66+
 67+
 68+
 69+
 70+
 71+ -2-
 72+
 73+
 74+Tue Mar 8 16:53:39 PST 2005 Peter Danenberg
 75+
 76+ <schem> added; id est, schematic capture with
 77+ gschem (geda.seul.org). PPCH has been deprecated; XyM-
 78+ TeX, meanwhile, has taken its place as the <chem> ren-
 79+ derer.
 80+
 81+ Effort is underway to replace our ad-hoc black-
 82+ lists with chroot-based security; adieu, "directa non
 83+ grata!"
 84+
 85+ Lastly, verbose errors now declare not only the
 86+ whence, but the why of defects.
 87+
 88+Sun Feb 6 14:21:48 PST 2005 Peter Danenberg
 89+
 90+ We've disassociated our versioning from MediaWiki,
 91+ and started with a pristine 1.0; so that, should we
 92+ bundle in the future, our release cycles can be dis-
 93+ tinct.
 94+
 95+Sat Jan 29 00:34:09 PST 2005 Peter Danenberg
 96+
 97+ Changes almost too numerous to enumerate; but some
 98+ of the more exciting:
 99+
 100+ o Gnuplot and Graphviz: <plot> and <graph>, respec-
 101+ tively
 102+
 103+ o Multi-page output for music, go and chess
 104+
 105+ o More detailed, helpful error messages
 106+
 107+ The installation process, to boot, is less error-
 108+ prone; no Python: but the bash interface has been
 109+ refactored.
 110+
 111+Tue Jan 25 11:23:48 PST 2005 Peter Danenberg
 112+
 113+ This candidate both maintains by tightening down
 114+ our blacklist (thanks, Johannes Berg); and innovates by
 115+ introducing Jan-Aoke Larsson's dvipng. dvipng replaces
 116+ dvi2bitmap; resulting in cleaner, faster renders.
 117+
 118+ <math></math> becomes <amsmath></amsmath> in the
 119+ stand-alone version, to avoid conflicting with texvc;
 120+ in pre-packaged WikiTeX, it replaces texvc.
 121+
 122+ I'd also like to un-cobweb that bash interface
 123+ with Python before we go live.
 124+
 125+
 126+
 127+
 128+
 129+
 130+
 131+ 19 February 2006
 132+
 133+
 134+
 135+
 136+
 137+ -3-
 138+
 139+
 140+Mon Oct 4 01:56:23 PDT 2004 Peter Danenberg
 141+
 142+ In order to plumb their several virtues' depth,
 143+ the Batik toolkit ("heavy SVG"), will be available
 144+ alongside ImageMagick; its more efficient kin.
 145+
 146+ Batik may be invoked by <batik></batik>; and
 147+ <svg></svg>, ImageMagick.
 148+
 149+Sun Oct 3 17:38:03 PDT 2004 Peter Danenberg
 150+
 151+ SVG is finally here; and we opted for Batik's SVG
 152+ kit (xml.apache.org/batik) which, though very full-fea-
 153+ tured, suffers from a Java-like retardation. It were
 154+ mere oeconomy that ever importuned us to return to
 155+ ImageMagick's SVG subset.
 156+
 157+Mon Sep 6 03:20:26 PDT 2004 Peter Danenberg
 158+
 159+ With the introduction of XML-like tags, we have
 160+ cleared a major hurdle towards integration with Media-
 161+ Wiki; next on the list, parameters of the form:
 162+
 163+ <music tempo="80"></music>
 164+
 165+ WikiTeX' vulnerability to attack must also be thor-
 166+ oughly sounded.
 167+
 168+Sun May 30 00:00:00 PDT 2004 Peter Danenberg
 169+
 170+ We're refactoring WikiTeX from the ground up to
 171+ implement tags of the form:
 172+
 173+ <class [parm: value]>content</class>
 174+
 175+ and likely of an external parser; where a lex/yacc
 176+ solution might be attractive. (Finite state recogni-
 177+ tion is probably what we're looking for, however,
 178+ rather than look-ahead left-to-right parsing; i.e.
 179+ top-down recursive descent.)
 180+
 181+ If WikiTeX' sum scope, on the other hand, resem-
 182+ bles a glue-script with regular-expression grinding,*
 183+ we might not need to look past Perl; PHP, in any
 184+ case, just passes as lexer/parser: but we'd like some-
 185+ thing more robust and, above all, to separate applica-
 186+ tion from interface.
 187+
 188+
 189+
 190+
 191+-----------
 192+ * Raymond, Eric Steven. The Art of Unix Pro-
 193+gramming (faqs.org/docs/artu).
 194+
 195+
 196+
 197+ 19 February 2006
 198+
 199+
 200+
 201+
 202+
 203+ -4-
 204+
 205+
 206+WikiTeX: expansible LaTeX module for MediaWiki
 207+Copyright (C) 2004-6 Peter Danenberg
 208+
 209+ WikiTeX is licensed under the Artistic License 2.0; to
 210+view a copy of this license, see COPYING or visit:
 211+
 212+ http://dev.perl.org/perl6/rfc/346.html
 213+
 214+
 215+
 216+
 217+
 218+
 219+
 220+
 221+
 222+
 223+
 224+
 225+
 226+
 227+
 228+
 229+
 230+
 231+
 232+
 233+
 234+
 235+
 236+
 237+
 238+
 239+
 240+
 241+
 242+
 243+
 244+
 245+
 246+
 247+
 248+
 249+
 250+
 251+
 252+
 253+
 254+
 255+
 256+
 257+
 258+
 259+
 260+
 261+
 262+
 263+ 19 February 2006
 264+
 265+
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/NEWS
___________________________________________________________________
Added: svn:keywords
1266 + Author Date Id Revision
Added: svn:eol-style
2267 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.in.sudoers
@@ -0,0 +1,31 @@
 2+# WikiTeX commands requiring EXEC
 3+# LilpPond needs to run gs when converting to png
 4+# dvipng needs to interact with kpathsea
 5+Cmnd_Alias WT_EXEC = %LILYPOND%,\
 6+ %DVIPNG%
 7+
 8+# WikiTeX commands requiring NOEXEC
 9+Cmnd_Alias WT_NOEXEC = %TEX%,\
 10+ %LATEX%,\
 11+ %METAPOST%,\
 12+ %DOT%,\
 13+ %NEATO%,\
 14+ %FDP%,\
 15+ %TWOPI%,\
 16+ %CIRCO%,\
 17+ %GNUPLOT%,\
 18+ %MOGRIFY%,\
 19+ %CONVERT%,\
 20+ %SGF2DG%
 21+
 22+# Apache's user
 23+User_Alias WT_HTTPD = %APACHE%
 24+
 25+# WikiTeX host
 26+Host_Alias WT_HOST = %HOST%
 27+
 28+# WikiTeX unprivileged user
 29+Runas_Alias WT_USER = %WIKITEX%
 30+
 31+# WikiTeX rule
 32+WT_HTTPD WT_HOST = (WT_USER) NOPASSWD: WT_EXEC, NOEXEC: WT_NOEXEC
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/wikitex.in.sudoers
___________________________________________________________________
Added: svn:keywords
133 + Author Date Id Revision
Added: svn:eol-style
234 + native
Index: trunk/ATTIC/wikitex/branches/1.1-beta3/Makefile
@@ -0,0 +1,142 @@
 2+# Makefile responsible for token substitutions,
 3+# and localisation of user-mediated edition.
 4+#
 5+# WikiTeX: expansible LaTeX module for MediaWiki
 6+# Copyright (C) 2004-6 Peter Danenberg
 7+#
 8+# WikiTeX is licensed under the Artistic License 2.0; to
 9+# view a copy of this license, see COPYING or visit:
 10+#
 11+# http://dev.perl.org/perl6/rfc/346.html
 12+#
 13+
 14+# Edit the following parameters:
 15+
 16+# Required programs
 17+# Full path to LaTeX:
 18+LATEX = /usr/bin/latex
 19+# Full path to dvipng:
 20+DVIPNG = /usr/local/bin/dvipng
 21+# Full path to ImageMagick's mogrify:
 22+MOGRIFY = /usr/local/bin/mogrify
 23+# Full path to ImageMagick's convert:
 24+CONVERT = /usr/local/bin/convert
 25+
 26+# Optional programs
 27+# Full path to LilyPond (music):
 28+LILYPOND = /usr/local/bin/lilypond
 29+# Full path to Gnuplot (graph):
 30+GNUPLOT = /usr/local/bin/gnuplot
 31+# Full path to Graphviz' dot (graph):
 32+DOT = /usr/local/bin/dot
 33+# Full path to Graphviz' neato (graph):
 34+NEATO = /usr/local/bin/neato
 35+# Full path to Graphviz' fdp (graph):
 36+FDP = /usr/local/bin/fdp
 37+# Full path to Graphviz' twopi (graph):
 38+TWOPI = /usr/local/bin/twopi
 39+# Full path to Graphviz' circo (graph):
 40+CIRCO = /usr/local/bin/circo
 41+# Full path to sgf2dg (go):
 42+SGF2DG = /usr/bin/sgf2dg
 43+# Full path to TeX (go):
 44+TEX = /usr/bin/tex
 45+# Full path to MetaPost (feyn):
 46+METAPOST = /usr/bin/mpost
 47+
 48+# Quota
 49+# Partition on which disk quota resides
 50+PARTITION = /dev/hda3
 51+
 52+# Cron
 53+# Full path to wikitex-decruft.sh:
 54+DECRUFT = /path/to/mediawiki/extensions/wikitex/wikitex-decruft.sh
 55+# Database:
 56+DATABASE = wikidb
 57+# Database user:
 58+DBUSER = wikiuser
 59+# Database password (escape any @'s as \@):
 60+DBPASS = password
 61+# Who should receive cron's results (can be blank)
 62+MAILTO = root
 63+
 64+# Sudo
 65+# Web server's user:
 66+APACHE = nobody
 67+# WikiTeX's user:
 68+WIKITEX = wikitex
 69+# WikiTeX's host:
 70+HOST = localhost
 71+
 72+# End of editable parameters
 73+
 74+VERSION = 1.1 BETA 3
 75+SED = sed -e "s@\%VERSION\%@${VERSION}@g;"
 76+GROFF = copying.inc.ms | groff -t -ms -Tascii - | col -bx >
 77+SUDO = -e "s@\%APACHE\%@${APACHE}@g; s@\%WIKITEX\%@${WIKITEX}@g; s@\%HOST\%@${HOST}@g;s@\%LATEX\%@${LATEX}@g; s@\%DVIPNG\%@${DVIPNG}@g; s@\%MOGRIFY\%@${MOGRIFY}@g; s@\%CONVERT\%@${CONVERT}@g; s@\%LILYPOND\%@${LILYPOND}@g; s@\%GNUPLOT\%@${GNUPLOT}@g; s@\%DOT\%@${DOT}@g; s@\%NEATO\%@${NEATO}@g; s@\%FDP\%@${FDP}@g; s@\%TWOPI\%@${TWOPI}@g; s@\%CIRCO\%@${CIRCO}@g; s@\%SGF2DG\%@${SGF2DG}@g; s@\%TEX\%@${TEX}@g; s@\%METAPOST\%@${METAPOST}@g;"
 78+CRON = -e "s@\%DECRUFT\%@${DECRUFT}@g; s@\%DATABASE\%@${DATABASE}@g; s@\%DBUSER\%@${DBUSER}@g; s@\%DBPASS\%@${DBPASS}@g;"
 79+QUOTA = -e "s@\%PARTITION\%@${PARTITION}@g;"
 80+AUDIT = ${SUDO} ${CRON} ${QUOTA}
 81+EXEC = chmod a+x
 82+DOCS = README NEWS COPYING MANIFEST THANKS Wikitex.php WikitexConstants.php main.php wikitex.ini
 83+PROGS = wikitex.sudoers wikitex.cron wikitex-decruft.sh wikitex-audit.sh
 84+
 85+all: ${DOCS} ${PROGS}
 86+
 87+README: readme.ms
 88+ ${SED} ${?} ${GROFF} ${@}
 89+
 90+NEWS: news.ms
 91+ ${SED} ${?} ${GROFF} ${@}
 92+
 93+COPYING: copying.ms
 94+ ${SED} ${?} ${GROFF} ${@}
 95+
 96+MANIFEST: manifest.ms
 97+ ${SED} ${?} ${GROFF} ${@}
 98+
 99+THANKS: thanks.ms
 100+ ${SED} ${?} ${GROFF} ${@}
 101+
 102+Wikitex.php: Wikitex.in.php
 103+ ${SED} ${?} > ${@}
 104+
 105+WikitexConstants.php: WikitexConstants.in.php
 106+ ${SED} ${?} > ${@}
 107+
 108+main.php: main.in.php
 109+ ${SED} ${?} > ${@}
 110+
 111+wikitex.ini: wikitex.in.ini
 112+ ${SED} ${?} > ${@}
 113+
 114+docs:
 115+ phpdoc -c wikitex
 116+
 117+# Forced to forgo ${?} in the following,
 118+# as a change in Makefile can trigger
 119+# recompilation.
 120+
 121+${PROGS}: Makefile
 122+
 123+wikitex.sudoers: wikitex.in.sudoers
 124+ ${SED} ${SUDO} wikitex.in.sudoers > ${@}
 125+
 126+wikitex.cron: wikitex.in.cron
 127+ ${SED} ${CRON} wikitex.in.cron > ${@}
 128+
 129+wikitex-decruft.sh: wikitex-decruft.in.sh
 130+ ${SED} ${CRON} wikitex-decruft.in.sh > ${@}; \
 131+ ${EXEC} ${@}
 132+
 133+wikitex-audit.sh: wikitex-audit.in.sh
 134+ ${SED} ${AUDIT} wikitex-audit.in.sh > ${@}; \
 135+ ${EXEC} ${@}
 136+
 137+clean-docs:
 138+ rm -frv ${DOCS}
 139+
 140+clean-progs:
 141+ rm -frv ${PROGS}
 142+
 143+clean: clean-progs
Property changes on: trunk/ATTIC/wikitex/branches/1.1-beta3/Makefile
___________________________________________________________________
Added: svn:keywords
1144 + Author Date Id Revision
Added: svn:eol-style
2145 + native
Added: svn:executable
3146 + *

Status & tagging log