[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] RE: IE css png behavior
From: |
Bill Page |
Subject: |
[Axiom-developer] RE: IE css png behavior |
Date: |
Wed, 7 Jul 2004 23:55:58 -0400 |
Bob,
I have made some changes to the AxiomWiki code in response to your
suggestions to worry a little about security (I disabled Axiom's )sys
command) and I also added the ability to compile Axiom Library code. With
these changes I think I am almost ready to announce the availability of
"Axiom on the Web" more widely to the axiom-users list. I'd like to get some
"real" user feedback :). Let me know if you think of anything else I should
worry about first.
There is a diff below and the files are at
http://page.axiom-developer.org/zope/Products/LatexWiki/ReplaceInlineAxiom.p
y
http://page.axiom-developer.org/zope/Products/LatexWiki/axiomWrapper.py
I also spent far too much time tonight trying to figure out the font
problems with LatexWiki inside Plone 2. I am totally frustrated about it and
have decided to wait until I can upgrade to the newer versions of Zwiki and
LatexWiki. I even have problems printing from Plone. The font sizes change
radically, some text is cut-off on the right margin and so are the LaTeX
images. Have you seen this sort of printing problem before?
Regards,
Bill Page.
diff -Naur AxiomWiki-0.2.0/ReplaceInlineAxiom.py
AxiomWiki-0.2.1/ReplaceInlineAxiom.py
--- AxiomWiki-0.2.0/ReplaceInlineAxiom.py 2004-07-07
11:26:42.359375000 -0400
+++ AxiomWiki-0.2.1/ReplaceInlineAxiom.py 2004-07-07
11:56:48.734375000 -0400
@@ -13,8 +13,8 @@
Some or all expressions may not have rendered properly,
because Axiom returned the following error:<br/><pre>%s</pre></font>"""
- axiomPattern = r'^[ \t]*\\begin{axiom}(.*?)\\end{axiom}'
reConsts = re.MULTILINE+re.DOTALL
+ axiomPattern = re.compile(r'^[
\t]*\\begin{axiom}(.*?)\\end{axiom}',reConsts)
def htmlMarkup(code):
newCode = re.compile(r'&', reConsts).sub(r'&',code)
@@ -26,7 +26,7 @@
newCode = re.compile(r'_', reConsts).sub('_', newCode)
return newCode
- axiomCodeList = re.compile(axiomPattern,reConsts).findall(body)
+ axiomCodeList = axiomPattern.findall(body)
(latexCodeList,errors) = renderAxiom(axiomCodeList)
@@ -60,7 +60,7 @@
newCode = re.compile(r'\n', reConsts).sub(r'\r\n',newCode)
newCode =
'<pre>\r\n'+htmlMarkup(strip(newCode,'\r\n'))+'\r\n</pre>\r\n'
newCodeList.append(newCode)
- body = re.compile(axiomPattern,reConsts).sub(lambda
x:newCodeList.pop(0),body)
+ body = axiomPattern.sub(lambda x:newCodeList.pop(0),body)
else:
body = "<pre>" + body + "</pre>" + errorMessage %(errors)
diff -Naur AxiomWiki-0.2.0/axiomWrapper.py AxiomWiki-0.2.1/axiomWrapper.py
--- AxiomWiki-0.2.0/axiomWrapper.py 2004-07-07 11:27:38.609375000 -0400
+++ AxiomWiki-0.2.1/axiomWrapper.py 2004-07-07 20:05:30.750000000 -0400
@@ -22,15 +22,31 @@
outputPattern = r'(.*?)\n\(\d+\) -> '
reConsts = re.MULTILINE+re.DOTALL
-def renderAxiom(axiomCodeList):
+def renderAxiom(axiomCodeList):
+ def securityCheck(code):
+ newCode = re.compile(r'^[ \t]*\)sys([^\n]*)',reConsts).sub(r'-- not
allowed: )sys\1\n)sys',code)
+ return newCode
+
n = 1
unifiedCode = ''
- for axiomCode in axiomCodeList:
- axiomFileName = fileNameFor(axiomCode, 25, '.%3.3d.input'%n)
- n = n + 1
- unifiedCode = unifiedCode + ')read %s\n'%axiomFileName
+ for axiomCode in axiomCodeList:
+ newAxiomCode = securityCheck(axiomCode)
+ n = n + 1
+ if re.match(r'^\s*\)abbrev',newAxiomCode):
+ # Starts like a package so compile as library code
+ axiomFileName = fileNameFor(newAxiomCode, 25, '.%3.3d.spad'%n)
+ # This is just for appearances
+ newAxiomCode = newAxiomCode +
'------------------------------------------------------------------------\n'
+ unifiedCode = unifiedCode + ')set message prompt none\n'
+ unifiedCode = unifiedCode + ')sys cat %s\n'%axiomFileName
+ unifiedCode = unifiedCode + ')compile %s\n'%axiomFileName
+ unifiedCode = unifiedCode + ')set message prompt step\n'
+ else:
+ # otherwise it is just an input file
+ axiomFileName = fileNameFor(newAxiomCode, 25, '.%3.3d.input'%n)
+ unifiedCode = unifiedCode + ')read %s\n'%axiomFileName
axiomFile = open(axiomFileName, 'w')
- axiomFile.write(axiomCode)
+ axiomFile.write(newAxiomCode)
axiomFile.close()
try:
latexCode=runAxiom(unifiedCode,axiomTemplate)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Axiom-developer] RE: IE css png behavior,
Bill Page <=