From sandysj at juno.com Mon Aug 5 09:53:04 2002 From: sandysj at juno.com (Jeff Sandys) Date: Mon Aug 5 09:53:04 2002 Subject: [Moin-devel] sync two wikis Message-ID: <3D4EAD43.20879E2C@juno.com> How would you sync two wikis? I am working with a group on the other side of the world. While we both have intranets we don't have access to each others intranet. I would like this group to contribute to the Wiki. Any ideas how to syncronize two wikis? My ideas: Assign each Wiki a 12 hour time slot for changes, since our work hours are about 12 hours apart. During active working hours users could change pages, at other times users could only view pages. * Add a time lock security feature. * Add a cron job based on RecentChanges to tar only them and email them to the other server. * Add a deamon to detect the email and untar the changes. Thanks, Jeff Sandys From sandysj at juno.com Tue Aug 6 09:19:03 2002 From: sandysj at juno.com (Jeff Sandys) Date: Tue Aug 6 09:19:03 2002 Subject: [Moin-devel] add space doesn't on sub page wiki name Message-ID: <3D4FF6CF.8451F368@juno.com> When you use the UserPreference "Add spaces to displaed wiki names" it doesn't add a space to "/SubPages" but it does add space to "HelpOnEditing/SubPages". See this for example: http://twistedmatrix.com/users/jh.twistd/moin/moin.cgi/HelpOnEditing Also any comments on why, "Please do all of us a favour and don't create the /ThirdLevel pages!" Thanks, Jeff Sandys From wkpark at chem.skku.ac.kr Wed Aug 7 06:19:03 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Wed Aug 7 06:19:03 2002 Subject: [Moin-devel] gnuplot & latex with moinmoin Message-ID: <20020807133815.GA17173@chem.skku.ac.kr> Hello, I made a moinmoin patch to enable math symbols and graph with the latex and gnuplot. http://chemie.skku.ac.kr/~chemie/wiki/moin.cgi/MoinMoinPatch this is a quick hack, you may regard it as an example source code: http://chemie.skku.ac.kr/~chemie/wiki/lib/ Regards, Won-kyu Park -- From wkpark at chem.skku.ac.kr Wed Aug 7 23:27:02 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Wed Aug 7 23:27:02 2002 Subject: [Moin-devel] Png icons(16x16)repository by Jimmac Message-ID: <20020808064704.GA27120@chem.skku.ac.kr> Hello I found a icon repository by Jimmac(a Gnome designer) http://jimmac.musichall.cz/ikony/ http://jimmac.musichall.cz/ikony/i61 (face) and I also mirror it :-) http://chem.skku.ac.kr/~wkpark/jimmac/ikony/icon16.html (only 16x16 sized icons) http://chem.skku.ac.kr/~wkpark/jimmac/ikony/allicon.html It contains smilies an flags.. Regards, Won-kyu Park -- From pgd-karolinali at algonet.se Fri Aug 9 23:36:01 2002 From: pgd-karolinali at algonet.se (Karolina Lindqvist) Date: Fri Aug 9 23:36:01 2002 Subject: [Moin-devel] Bug in the latest CVS sources Message-ID: <200208100835.15242.pgd-karolinali@algonet.se> There is a bug in the latest CVS, in that MoinMoin gives python errors if there is not a correct user profile setup, or if there is an old-style user profile. I have a patch file, but it contains a few more patches. 1) It internationalises some hard-coded page names, mainly HelpContents, TitleIndex, WordIndex, UserPreferences and HelpOnFormatting. It also internationalises the action footer at the bottom of the page. Finally, it allows international versions of the words "off" and "on". This requires that all these words are added to the i18n/*.py file to get an internationalisation. I assume that if a word is missing from that file, the english word will be kept as it is. Right? (If not, I think that is a good thing) 2) There is a config option to allow national characters in filenames. The full patch file is attached to this letter. It is made against the CVS from 2002-08-09. It is short, so it is easy to extract the bug patch from the feature patches. -- Karolina -------------- next part -------------- A non-text attachment was scrubbed... Name: MoinMoin-patch-20020810.diff Type: text/x-diff Size: 7136 bytes Desc: not available URL: From wkpark at chem.skku.ac.kr Sat Aug 10 06:20:02 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Sat Aug 10 06:20:02 2002 Subject: [Moin-devel] tex Message-ID: <20020810133951.GA24243@chem.skku.ac.kr> Hello, I make a JME(java molecular editor) enabled action/macro. http://chem.skku.ac.kr/~wkpark/wiki-1.1/moin.cgi/Tests (a embeded molecular can be showed with the chemscape) and I made some patch against action/AttachFile.py with this patch, you can attach any input as a text input form. Regards, Won-kyu Park -------------- next part -------------- diff -ur -x '*.pyc' moin-1.1/MoinMoin/action/AttachFile.py wiki-1.1/lib/python/MoinMoin/action/AttachFile.py --- moin-1.1/MoinMoin/action/AttachFile.py Thu Jul 18 17:00:21 2002 +++ wiki-1.1/lib/python/MoinMoin/action/AttachFile.py Sat Aug 10 22:31:29 2002 @@ -310,8 +310,16 @@ def do_upload(pagename, request): # check file & mimetype - fileitem = request.form['file'] - if not fileitem.file: + mode='file' + if request.form.has_key('file') and request.form['file']: + fileitem = request.form['file'] + if not fileitem.file: + return error_msg(pagename, request, + _("Filename of attachment not specified!")) + if request.form.has_key('text') and request.form['text']: + textitem=request.form['text'].value + mode='text' + else: error_msg(pagename, request, _("Filename of attachment not specified!")) return @@ -322,7 +330,11 @@ filesys.makeDirs(attach_dir) # make filename - filename = fileitem.filename + if mode=='file': + filename = fileitem.filename + else: + filename = string.strip(request.form['name'].value) + rename = '' if request.form.has_key('rename'): rename = string.strip(request.form['rename'].value) @@ -355,12 +367,20 @@ if os.path.exists(fpath): msg = _("Attachment '%(target)s' (remote name '%(filename)s') already exists.") % locals() else: - content = fileitem.file.read() - stream = open(fpath, 'wb') - try: - stream.write(content) - finally: - stream.close() + if mode == 'file': + content = fileitem.file.read() + stream = open(fpath, 'wb') + try: + stream.write(content) + finally: + stream.close() + else: + content = string.strip(textitem) + stream = open(fpath, 'w') + try: + stream.write(content) + finally: + stream.close() os.chmod(fpath, 0666 & config.umask) bytes = len(content) From wkpark at chem.skku.ac.kr Sat Aug 10 11:10:03 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Sat Aug 10 11:10:03 2002 Subject: [Moin-devel] text attachment In-Reply-To: <20020810133951.GA24243@chem.skku.ac.kr> References: <20020810133951.GA24243@chem.skku.ac.kr> Message-ID: <20020810183022.GA27327@chem.skku.ac.kr> On Sat, Aug 10, 2002 at 10:39:51PM +0900, Won Kyu Park wrote: > Hello, > > I make a JME(java molecular editor) enabled action/macro. > > http://chem.skku.ac.kr/~wkpark/wiki-1.1/moin.cgi/Tests > (a embeded molecular can be showed with the chemscape) > > and I made some patch against action/AttachFile.py > > with this patch, you can attach any input as a text input form. > > Regards, > > Won-kyu Park Im so sorry. Attached patch is not correct. Here is my new patch Regards, Won-kyu Park -------------- next part -------------- --- AttachFile.py.orig Sun Aug 11 03:22:47 2002 +++ AttachFile.py Sun Aug 11 03:25:50 2002 @@ -310,8 +310,16 @@ def do_upload(pagename, request): # check file & mimetype - fileitem = request.form['file'] - if not fileitem.file: + mode='file' + if request.form.has_key('file') and request.form['file'].file: + fileitem = request.form['file'] + if not fileitem.file: + return error_msg(pagename, request, + _("Filename of attachment not specified!")) + elif request.form.has_key('text') and request.form['text']: + textitem=request.form['text'].value + mode='text' + else: error_msg(pagename, request, _("Filename of attachment not specified!")) return @@ -322,7 +330,11 @@ filesys.makeDirs(attach_dir) # make filename - filename = fileitem.filename + if mode=='file': + filename = fileitem.filename + else: + filename = string.strip(request.form['name'].value) + rename = '' if request.form.has_key('rename'): rename = string.strip(request.form['rename'].value) @@ -355,12 +367,20 @@ if os.path.exists(fpath): msg = _("Attachment '%(target)s' (remote name '%(filename)s') already exists.") % locals() else: - content = fileitem.file.read() - stream = open(fpath, 'wb') - try: - stream.write(content) - finally: - stream.close() + if mode == 'file': + content = fileitem.file.read() + stream = open(fpath, 'wb') + try: + stream.write(content) + finally: + stream.close() + else: + content = string.strip(textitem) + stream = open(fpath, 'w') + try: + stream.write(content) + finally: + stream.close() os.chmod(fpath, 0666 & config.umask) bytes = len(content) From asf at moon.void.at Sun Aug 11 05:51:02 2002 From: asf at moon.void.at (Andreas Fuchs (antifuchs)) Date: Sun Aug 11 05:51:02 2002 Subject: [Moin-devel] gnuplot & latex with moinmoin In-Reply-To: <20020807133815.GA17173@chem.skku.ac.kr> References: <20020807133815.GA17173@chem.skku.ac.kr> Message-ID: <20020811144533.A18884@moon.void.at> According to Won Kyu Park: > Hello, > > I made a moinmoin patch to enable math symbols and graph > with the latex and gnuplot. > > http://chemie.skku.ac.kr/~chemie/wiki/moin.cgi/MoinMoinPatch > > this is a quick hack, you may regard it as an example This looks really nice. I have toyed with the thought of doing something like LaTeXWiki with Moin before, but never managed to get it right. Which version of Moin did you modify? Could you produce a diff? Thanks a lot, Andreas. From pgd-karolinali at algonet.se Sun Aug 11 13:13:03 2002 From: pgd-karolinali at algonet.se (Karolina Lindqvist) Date: Sun Aug 11 13:13:03 2002 Subject: [Moin-devel] Bug? MoinMoin, the Opera web browser and national characters Message-ID: <200208112209.04421.pgd-karolinali@algonet.se> I spent some hours today trying to track down a bug (which turned out to be not a bug, which was why it was so hard to find), where page names that contained national characters got scrambled and strange characters inserted. Finally I tracked down to that Opera handle non-ASCII characters in URL strings differently than the other two web browsers that I use, konqueror and mozilla (/netscape). I could never understand exactly what happened, but sometimes MoinMoin converts non-ASCII characters to the %-convention in URL's and sometimes it does not. It appears to work good with konqueror and Mozilla, but Opera somehow mistakes that for another character set and it gets really strange. The symptom is that you could look at pages with national character in the tiles, type them in as URL's and so on, but could not create such pages with MoinMoin. In such a case, Opera scrambles the URL and MoinMoin gets very confused. -- Karolina From pgd-karolinali at algonet.se Sun Aug 11 13:13:04 2002 From: pgd-karolinali at algonet.se (Karolina Lindqvist) Date: Sun Aug 11 13:13:04 2002 Subject: [Moin-devel] SixSingleQuotes, bug or feature? Message-ID: <200208112154.17973.pgd-karolinali@algonet.se> SigSingleQuotes does not work as described in http://c2.com/cgi/wiki?SixSingleQuotes . I don't know if this is a bug, or if it is supposed to work differently. There is no description in detail of how it is supposed to work in the help files, but just a link in HelpOnLinking to that file, and it works differently on MoinMoin than on that wiki. -- Karolina From tbird20d at yahoo.com Sun Aug 11 20:10:01 2002 From: tbird20d at yahoo.com (Tim Bird) Date: Sun Aug 11 20:10:01 2002 Subject: [Moin-devel] add link feature for AttachFile Message-ID: <20020812030912.63646.qmail@web20802.mail.yahoo.com> Here's a small patch for adding an extra checkbox to the upload form for attachments. If you click the checkbox, it automatically places a reference to the attachment onto the page (at the end of the page). I find this handy so that the correct text is already on the page and I don't have to remember or retype the filename. This is especially nice for long obnoxious filenames. Tim Bird __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -------------- next part -------------- A non-text attachment was scrubbed... Name: addlink.patch Type: application/x-patch Size: 1720 bytes Desc: addlink.patch URL: From wkpark at chem.skku.ac.kr Mon Aug 12 02:57:03 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Mon Aug 12 02:57:03 2002 Subject: [Moin-devel] gnuplot & latex with moinmoin In-Reply-To: <20020811144533.A18884@moon.void.at> References: <20020807133815.GA17173@chem.skku.ac.kr> <20020811144533.A18884@moon.void.at> Message-ID: <20020812101727.GA23681@chem.skku.ac.kr> On Sun, Aug 11, 2002 at 02:45:33PM +0000, Andreas Fuchs (antifuchs) wrote: > According to Won Kyu Park: > > Hello, > > > > I made a moinmoin patch to enable math symbols and graph > > with the latex and gnuplot. > > > > http://chemie.skku.ac.kr/~chemie/wiki/moin.cgi/MoinMoinPatch > > > > this is a quick hack, you may regard it as an example > > This looks really nice. I have toyed with the thought of doing > something like LaTeXWiki with Moin before, but never managed > to get it right. Which version of Moin did you modify? Could > you produce a diff? I make a new patch againt moin-1.1 (cvs ?) syntax is changed as following $$ \sum_{n=1}^{\infty}\frac{(-1)^n} {m} $$ (single line) $\alpha$ $\beta$ [[[latex (multiple lines) wow $$ \alpha \beta \gamma $$ ]]] also you can use the gnuplot like following [[[gnuplot plot x*x ]]] examples http://chem.skku.ac.kr/~wkpark/wiki-1.1/moin.cgi/MoinMoinPatch Regards, Won-kyu Park > > Thanks a lot, > Andreas. > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Moin-devel mailing list > Moin-devel at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/moin-devel -- -------------- next part -------------- diff -ru -x '*.pyc' ../../../moin-1.1/MoinMoin/config.py MoinMoin/config.py --- ../../../moin-1.1/MoinMoin/config.py Thu Jul 18 17:00:20 2002 +++ MoinMoin/config.py Mon Aug 12 18:55:03 2002 @@ -44,6 +44,7 @@ 'allowed_actions': [], 'allow_xslt': 0, 'attachments': None, # {'dir': path, 'url': url-prefix} + 'caches': {'dir':'./pds','url':'%s/pds' % url_prefix}, # {'dir': path, 'url': url-prefix} 'bang_meta': 0, 'backtick_meta': 1, 'changed_time_fmt': ' [%H:%M]', @@ -54,11 +55,21 @@ 'check_i18n': 0, 'css_url': '%s/css/moinmoin.css' % (url_prefix,), 'data_dir': './data/', + 'vartmp_dir': '/var/tmp/', 'date_fmt': '%Y-%m-%d', 'datetime_fmt': '%Y-%m-%d %H:%M:%S', 'default_markup': 'wiki', 'edit_rows': 30, 'external_diff': 'diff', + 'ole_pattern': 'pdb|mdl|mol|xyz|smi|gnuplot|latex', + 'external_latex': 'latex', + 'external_gnuplot': '/usr/bin/gnuplot', + 'gnuplot_terminal': 'png', + 'gnuplot_options': '', + 'external_convert': '/usr/X11R6/bin/convert', + 'external_dvips': 'dvips', + 'convert_options': '', + 'html_head': ''' ''', diff -ru -x '*.pyc' ../../../moin-1.1/MoinMoin/formatter/base.py MoinMoin/formatter/base.py --- ../../../moin-1.1/MoinMoin/formatter/base.py Wed Jul 10 17:00:18 2002 +++ MoinMoin/formatter/base.py Mon Aug 12 18:46:02 2002 @@ -150,3 +150,13 @@ result = result + ' %s="%s"' % (attr, cgi.escape(str(value))) return result + '>' + def embed(self, **kw): + """ Take HTML tag attributes in `attr`. + + Attribute names have to be lowercase! + """ + result = '' + diff -ru -x '*.pyc' ../../../moin-1.1/MoinMoin/parser/wiki.py MoinMoin/parser/wiki.py --- ../../../moin-1.1/MoinMoin/parser/wiki.py Fri Jul 19 17:00:22 2002 +++ MoinMoin/parser/wiki.py Mon Aug 12 18:36:29 2002 @@ -51,6 +51,8 @@ ol_rule = r"^\s+(?:[0-9]+|[aAiI])\.(?:#\d+)?\s" dl_rule = r"^\s+.*?::\s" + ole_pattern = r"pdb|gnuplot|mol|mdl|xyz" + # the big, fat, ugly one ;) formatting_rules = r"""(?:(?P'''''(?=[^']+''')) (?P'''''(?=[^']+'')) @@ -60,6 +62,8 @@ (?P\{\{\{.*?\}\}\}) (?P(\{\{\{#!.*)) (?P
(\{\{\{ ?|\}\}\}))
+(?P(\$\$\s.*?\s\$\$)|\$.*?\$)
+(?P(\[\[\[(%(ole)s) ?|\]\]\]))
 (?P-{4,})
 (?P^\#\#.*$)
 (?P\[\[(%(macronames)s)(?:\(.*?\))?\]\]))
@@ -84,6 +88,7 @@
         'dl_rule': dl_rule,
         'url_rule': url_rule,
         'word_rule': word_rule,
+        'ole': config.ole_pattern,
         'smiley': string.join(map(re.escape, wikiutil.smileys.keys()), '|')}
 
     def __init__(self, raw, request, **kw):
@@ -99,7 +104,10 @@
         self.in_li = 0
         self.in_dd = 0
         self.in_pre = 0
+        self.in_ole = 0
         self.in_table = 0
+        self.in_type = ''
+        self.buffer = ''
 
         # holds the nesting level (in chars) of open lists
         self.list_indents = []
@@ -609,6 +617,32 @@
 
         return word
 
+    def _math_repl(self, word):
+        """Handle LaTeX math."""
+        self._check_p()
+        return wikiutil.getMath(word, self.formatter)
+
+    def _ole_repl(self, word):
+        """Handle a OLE object."""
+        word = string.strip(word)
+        types = string.split(config.ole_pattern, "|")
+#        if string.find(word,"[[[") and self.in_ole == 0:
+        if word[0:3] == "[[[" and self.in_ole == 0:
+            for type in types:
+                if string.find(word[3:],type) != -1:
+                    self.in_type=type
+                    break
+            self.in_ole = 1
+            self.buffer=''
+#            print '$OLE ' + type + 'START'
+            return ''
+        elif word == "]]]" and self.in_ole == -1:
+            self.in_ole = 0
+#            print '$OLEEND'
+            return wikiutil.getOle(self.in_type, self.buffer, self.formatter)
+
+        return ''
+
 
     def _smiley_repl(self, word):
         """Handle smileys."""
@@ -795,7 +829,14 @@
             self.lineno = self.lineno + 1
             self.table_rowstart = 1
 
-            if self.in_pre:
+            if self.in_ole == 1:
+                endpos = string.find(line,']]]')
+                if endpos == -1:
+                    self.buffer +=line + '\n'
+                    continue
+                self.in_ole = -1
+                line = line[endpos:]
+            elif self.in_pre:
                 if self.in_pre == 2:
                     # processing mode
                     endpos = string.find(line, "}}}")
@@ -867,7 +908,8 @@
                 line, count = re.subn(scan_re, self.replace, line + " ")
                 ##if not count: self._check_p()
                 self._check_p()
-                sys.stdout.write(line)
+                if not self.in_ole:
+                    sys.stdout.write(line)
 
             if self.in_pre:
                 sys.stdout.write(self.formatter.linebreak())
diff -ru -x '*.pyc' ../../../moin-1.1/MoinMoin/wikiutil.py MoinMoin/wikiutil.py
--- ../../../moin-1.1/MoinMoin/wikiutil.py	Thu Jul 18 17:00:20 2002
+++ MoinMoin/wikiutil.py	Mon Aug 12 19:06:17 2002
@@ -86,6 +86,13 @@
     "{zh}":  (18, 12, 0, "flag-zh.gif"),
 }
 
+embed = {
+    "mol": ("mol","chemical/x-mdl-molfile"),
+    "mdl": ("mol","chemical/x-mdl-molfile"),
+    "pdb": ("mol","chemical/x-pdb"),
+    "xyz": ("xyz","chemical/xyz"),
+}
+
 
 def getSmiley(text, formatter):
     if formatter.request.user.show_emoticons:
@@ -96,6 +103,142 @@
     else:
         return formatter.text(text)
 
+def getOle(type, text, formatter):
+    olestr = string.strip(text)
+
+    if type == 'gnuplot':
+        return getGnuplot(text,formatter)
+    if type == 'latex':
+        return getMath(text,formatter)
+    elif type in embed.keys():
+        return getEmbed(type,text,formatter)
+
+    sys.stdout.write('
'+type+'\n')
+    sys.stdout.write(olestr)
+    sys.stdout.write('
') + return ''#formatter.text(molstr) + +def getEmbed(type,text,formatter): + import sha + str = string.strip(text) + embedname = sha.new(str).hexdigest() + if type in embed.keys(): + ext = embed[type][0] + mime = embed[type][1] + embedpath = "%s/EmBed/attachments/%s.%s" % (config.caches['dir'],embedname,ext) + embedname = "%s/EmBed/attachments/%s.%s" % (config.caches['url'],embedname,ext) + if not os.path.isdir(config.caches['dir'] + "/EmBed/attachments"): + os.makedirs(config.caches['dir'] + "/EmBed/attachments", 0777 & config.umask) + if not os.path.exists(embedpath): + data = open(embedpath, "w") + data.write(str) + data.close() + + return formatter.embed(src="%s%s" % (config.url_prefix,embedname), + alt=type, + width='300', + height='200', + type=mime) + +def getGnuplot(text,formatter): + import sha + str = string.strip(text) + str = '\n'+str+'\n' + str = re.sub('[ ]+',' ',str) # compress all spaces + str = re.sub('^\s*','',str) # strip out first spaces + str = re.sub('\n\s*','\n',str) + str = re.sub('\nset\s+(t|o|si).*\n', '\n',str) + str = re.sub('\n!.*\n','\n',str) # strip dangerous shell commands + + str = re.sub('\n+','\n',str) + + imgname = sha.new(str).hexdigest() + + if config.gnuplot_terminal=='svg': + term='svg' + ext='svg' + size='set size 0.5,0.5' + mime='image/svg-xml' + else: + term='png' + ext='png' + size='set size 0.5,0.6' + + outpath = "%s/GnuPlot/attachments/%s.%s" % (config.caches['dir'],imgname,ext) + outurl = "%s/GnuPlot/attachments/%s.%s" % (config.caches['url'],imgname,ext) + if not os.path.isdir(config.caches['dir'] + "/GnuPlot/attachments"): + os.makedirs(config.caches['dir'] + "/GnuPlot/attachments", 0777 & config.umask) + + if not os.path.exists(outpath) or not os.path.getsize(outpath): + data = open("%s/%s.plt" % (config.vartmp_dir,imgname), "w") + data.write('set term %s\n' % term) + data.write('%s\n' % size) + data.write('set out "%s"\n' % outpath) + data.write('%s\n' % config.gnuplot_options) + data.write(str) + data.close() + + cmd = "%(gnuplot)s < %(plot)s 2>/dev/stdout" % { + "gnuplot": config.external_gnuplot, + "plot": config.vartmp_dir + '/' + imgname + '.plt' + } + log=os.popen(cmd,"r") + lines = log.read() + log.close() + if lines: + print "
"
+            print lines
+            print 'If there is no fatal error, just reload this page\n'
+            print "
" + term='err' + del lines + os.system("rm -f " + config.vartmp_dir + "/" + imgname + ".plt") + + if term == 'err': + return '' + if term == 'svg': + return formatter.embed( + src="%s%s" % outurl, + width='300', + height='240', + type=mime, + alt='Gnuplot') + else: + return formatter.image(src="%s" % outurl, alt='Gnuplot') + +def getMath(text, formatter): + import sha + texstr = string.strip(text) +# texstr = string.replace(texstr, '$$', '') + imgname = re.sub('\s+', ' ',texstr) + imgname = sha.new(imgname).hexdigest() + + outpath = "%s/LaTex/attachments/%s.png" % (config.caches['dir'],imgname) + outurl = "%s/LaTex/attachments/%s.png" % (config.caches['url'],imgname) + if not os.path.isdir(config.caches['dir'] + "/LaTex/attachments"): + os.makedirs(config.caches['dir'] + "/LaTex/attachments", 0777 & config.umask) + + if not os.path.exists(outpath): + data = open("%s/%s.tex" % (config.vartmp_dir,imgname), "w") + data.write('\\documentclass{article}\n\\thispagestyle{empty}\n') + data.write('\\begin{document}\n%s\n\\end{document}' % texstr) + data.close() + + options='-interaction=batchmode' + cmd = "cd " + config.vartmp_dir + ";%(latex)s %(options)s %(tex)s >/dev/null" % { + "options": options, + "latex": config.external_latex, + "tex": imgname + } + os.system(cmd) + os.system("cd " + config.vartmp_dir + ";dvips " + imgname + ".dvi " + + "-o " + imgname + ".ps") + os.system(config.external_convert + " -crop 0x0 -density 120x120 " + + config.vartmp_dir + "/" + imgname + ".ps " + outpath) + os.system("rm -f " + config.vartmp_dir + "/" + imgname + ".*") + + return formatter.image(src="%s" % outurl, alt=texstr, align='absmiddle') + ############################################################################# ### Quoting From wkpark at chem.skku.ac.kr Fri Aug 16 09:45:01 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Fri Aug 16 09:45:01 2002 Subject: a processor for gnuplot and Latex (Re: [Moin-devel] gnuplot & latex with moinmoin) In-Reply-To: <20020811144533.A18884@moon.void.at> References: <20020807133815.GA17173@chem.skku.ac.kr> <20020811144533.A18884@moon.void.at> Message-ID: <20020816170502.GA4057@chem.skku.ac.kr> On Sun, Aug 11, 2002 at 02:45:33PM +0000, Andreas Fuchs (antifuchs) wrote: > According to Won Kyu Park: > > Hello, > > > > I made a moinmoin patch to enable math symbols and graph > > with the latex and gnuplot. > > > > http://chemie.skku.ac.kr/~chemie/wiki/moin.cgi/MoinMoinPatch > > > > this is a quick hack, you may regard it as an example > > This looks really nice. I have toyed with the thought of doing > something like LaTeXWiki with Moin before, but never managed > to get it right. Which version of Moin did you modify? Could > you produce a diff? > Recently, I saw *HelpOnProcessors* in moin-1.x. and I make a gnuplot & latex processor for it. this two processor can be installed at lib/python/MoinMoin/processor and you can input as following syntax {{{#!latex $$ \alpha \beta \gamma }}} {{{#!gnuplot splot x*x + y*y }}} Regards, Won-kyu Park -- -------------- next part -------------- """ MoinMoin - Processor for Gnuplot Copyright (c) 2002 by Won-kyu Park All rights reserved, see COPYING for details. $Id$ """ import string, sys, os, re, sha from MoinMoin import config def process(request, formatter, lines): text = string.join(lines,'\n') str = string.strip(text) str = '\n'+str+'\n' str = re.sub('\n!.*\n','\n',str) # strip dangerous shell commands str = re.sub('[ ]+',' ',str) # compress all spaces str = re.sub('^\s*','',str) # strip out first spaces str = re.sub('\n\s*','\n',str) str = re.sub('\nset\s+(t|o|si).*\n', '\n',str) str = re.sub('\n+','\n',str) imgname = sha.new(str).hexdigest() if config.gnuplot_terminal=='svg': term='svg' ext='svg' size='set size 0.5,0.5' mime='image/svg-xml' else: term='png' ext='png' size='set size 0.5,0.6' outpath = "%s/GnuPlot/attachments/%s.%s" % (config.caches['dir'],imgname,ext) outurl = "%s/GnuPlot/attachments/%s.%s" % (config.caches['url'],imgname,ext) if not os.path.isdir(config.caches['dir'] + "/GnuPlot/attachments"): os.makedirs(config.caches['dir'] + "/GnuPlot/attachments", 0777 & config.umask) if not os.path.exists(outpath) or not os.path.getsize(outpath): data = open("%s/%s.plt" % (config.vartmp_dir,imgname), "w") data.write('set term %s\n' % term) data.write('%s\n' % size) data.write('set out "%s"\n' % outpath) data.write('%s\n' % config.gnuplot_options) data.write(str) data.close() cmd = "%(gnuplot)s < %(plot)s 2>/dev/stdout" % { "gnuplot": config.external_gnuplot, "plot": config.vartmp_dir + '/' + imgname + '.plt' } log=os.popen(cmd,"r") lines = log.read() log.close() if lines: print "
"
            print lines
            print 'If there is no fatal error, just reload this page\n'
            print "
" term='err' del lines os.system("rm -f " + config.vartmp_dir + "/" + imgname + ".plt") if term == 'err': return '' if term == 'svg': sys.stdout.write(formatter.embed( src="%s%s" % outurl, width='300', height='240', type=mime, alt='Gnuplot')) else: sys.stdout.write(formatter.image(src="%s" % outurl, alt='Gnuplot')) -------------- next part -------------- """ MoinMoin - Processor for LaTeX Highlighting Copyright (c) 2002 by Won-kyu Park All rights reserved, see COPYING for details. $Id $ """ import string, sys, os, re, sha from MoinMoin import config def process(request, formatter, lines): if string.strip(lines[0]) == "#!latex": del lines[0] texstr = string.join(lines, '\n') texstr = string.strip(texstr) imgname = re.sub('\s+', ' ',texstr) imgname = sha.new(imgname).hexdigest() outpath = "%s/LaTex/attachments/%s.png" % (config.caches['dir'],imgname) outurl = "%s/LaTex/attachments/%s.png" % (config.caches['url'],imgname) if not os.path.isdir(config.caches['dir'] + "/LaTex/attachments"): os.makedirs(config.caches['dir'] + "/LaTex/attachments", 0777 & config.umask) if not os.path.exists(outpath): data = open("%s/%s.tex" % (config.vartmp_dir,imgname), "w") data.write('\\documentclass{article}\n\\thispagestyle{empty}\n') data.write('\\begin{document}\n%s\n\\end{document}' % texstr) data.close() options='-interaction=batchmode' cmd = "cd " + config.vartmp_dir + ";%(latex)s %(options)s %(tex)s >/dev/null" % { "options": options, "latex": config.external_latex, "tex": imgname } os.system(cmd) os.system("cd " + config.vartmp_dir + ";dvips " + imgname + ".dvi " + "-o " + imgname + ".ps") os.system(config.external_convert + " -crop 0x0 -density 120x120 " + config.vartmp_dir + "/" + imgname + ".ps " + outpath) os.system("rm -f " + config.vartmp_dir + "/" + imgname + ".*") sys.stdout.write(formatter.image(src="%s" % outurl, alt=texstr, align='absmiddle')) From jaime at robles.nu Wed Aug 21 00:35:01 2002 From: jaime at robles.nu (Jaime Robles) Date: Wed Aug 21 00:35:01 2002 Subject: [Moin-devel] What i have to do with translated files... Message-ID: <200208210933.05310.jaime@robles.nu> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all! A little Spanish team are translating MoinMoin into Spanish... We have some files translated and we would like them to be added to the moinmoin distribution. I would like to know where can i email the files for the inclusion. Many thanks. - -- Un saludo, Jaime Robles, EA4TV jaime at robles.nu Visita http://www.redlibre.net - La Red Libre de todos! http://smsdx.net - El DXCluster en tu movil! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9Y0IwXQbDFdwUn+gRAhcLAKCYyk//MLWt2hsztkrCVzAK++USbQCdEaEG nIKM95953nUSXlAkYkiPlh0= =KhXb -----END PGP SIGNATURE----- From muellerlegi at gmx.de Wed Aug 21 11:48:02 2002 From: muellerlegi at gmx.de (=?us-ascii?Q?Muller?=) Date: Wed Aug 21 11:48:02 2002 Subject: [Moin-devel] Install Problem Message-ID: <000a01c24943$388dd190$d500a8c0@dirkclient> When i finished the Installation step bye step. i get the following error : premature script error in moin.bat server error 500 can someone tell me what to do greets sabine From tbird20d at yahoo.com Fri Aug 23 13:55:07 2002 From: tbird20d at yahoo.com (Tim Bird) Date: Fri Aug 23 13:55:07 2002 Subject: [Moin-devel] FootNote Macro - handling duplicates Message-ID: <20020823205441.47747.qmail@web20806.mail.yahoo.com> Attached is a patch which makes a small modification to FootNote.py so that a single footnote can be referenced multiple times. It's a little awkward for long footnotes, as the entire text for the footnote must be duplicated in every reference. However, it does keep the footnote declarations independent of their numbering, and allows for multiple references to the same footnote. The change is pretty small, but let me know if you have problems with it. Tim Bird __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -------------- next part -------------- A non-text attachment was scrubbed... Name: duplicate-FootNote.patch Type: application/x-patch Size: 773 bytes Desc: duplicate-FootNote.patch URL: From asf at void.at Sun Aug 25 01:37:03 2002 From: asf at void.at (Andreas Fuchs) Date: Sun Aug 25 01:37:03 2002 Subject: a processor for gnuplot and Latex (Re: [Moin-devel] gnuplot & latex with moinmoin) References: <20020807133815.GA17173@chem.skku.ac.kr> <20020811144533.A18884@moon.void.at> <20020816170502.GA4057@chem.skku.ac.kr> Message-ID: On 2002-08-17, Won Kyu Park wrote: > and I make a gnuplot & latex processor for it. > > this two processor can be installed at lib/python/MoinMoin/processor > and you can input as following syntax > > {{{#!latex > $$ > \alpha \beta > \gamma > }}} > > {{{#!gnuplot > splot x*x + y*y > }}} Before succeeding, I had to define these variables in my /etc/moin_config.py: caches = {'dir': '/var/www/wiki-caches/', 'url': '/wiki-caches'} vartmp_dir = '/var/tmp' external_latex = '/usr/bin/latex' external_convert = '/usr/bin/convert' Also, I would suggest you change the line that outputs the LaTeX template to this: data.write(r""" \documentclass[10pt,notitlepage]{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage[all]{xy} \begin{document} \pagestyle{empty} %s \end{document} """ % texstr) Now, all the LaTeXWiki examples (I stole those lines from these guys) work. Hell, Moin is fun (-: -- Andreas Fuchs, , asf at jabber.at, antifuchs Was I helpful? Let others know: http://svcs.affero.net/rm.php?r=antifuchs From jh at web.de Mon Aug 26 15:51:02 2002 From: jh at web.de (Juergen Hermann) Date: Mon Aug 26 15:51:02 2002 Subject: [Moin-devel] Install Problem In-Reply-To: <000a01c24943$388dd190$d500a8c0@dirkclient> Message-ID: On Wed, 21 Aug 2002 20:47:37 +0200, Muller wrote: >When i finished the Installation step bye step. i get the following >error : > > >premature script error in moin.bat > >server error 500 > >can someone tell me what to do Not without further info on your system, especially the webserver and OS. Ciao, J?rgen From jh at web.de Mon Aug 26 15:54:08 2002 From: jh at web.de (Juergen Hermann) Date: Mon Aug 26 15:54:08 2002 Subject: [Moin-devel] What i have to do with translated files... In-Reply-To: <200208210933.05310.jaime@robles.nu> Message-ID: On Wed, 21 Aug 2002 09:33:02 +0200, Jaime Robles wrote: >A little Spanish team are translating MoinMoin into Spanish... >We have some files translated and we would like them to be added to the >moinmoin distribution. If you have an updated es.py, you mail it to me (no diff, but the full file). For system and help pages, I have to find a suitable scheme first how we can integrate >2 languages into the distribution in a workable way (the current way is not practical for more than 2 languages). Ciao, J?rgen From jaime at robles.nu Mon Aug 26 23:58:02 2002 From: jaime at robles.nu (Jaime Robles) Date: Mon Aug 26 23:58:02 2002 Subject: [Moin-devel] What i have to do with translated files... In-Reply-To: References: Message-ID: <200208270855.54314.jaime@robles.nu> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 El Mar 27 Ago 2002 00:54, Juergen Hermann escribi?: > If you have an updated es.py, you mail it to me (no diff, but the full > file). For system and help pages, I have to find a suitable scheme first > how we can integrate >2 languages into the distribution in a workable way > (the current way is not practical for more than 2 languages). Ok, i sent the file and it is included. I was asking for the way to send the "help pages"... we have some translated and it is a pity if they are not included ;-) Thank you. - -- Un saludo, Jaime Robles, EA4TV jaime at robles.nu Visita http://www.redlibre.net - La Red Libre de todos! http://smsdx.net - El DXCluster en tu movil! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9ayJ4XQbDFdwUn+gRAudBAJ9ql8jid5O14OBQa9fcuCnUh54hrwCfXUrz PHRE9g13a2haybFyWj1ylwA= =Bv7i -----END PGP SIGNATURE----- From jeff at corrt.com Tue Aug 27 15:41:06 2002 From: jeff at corrt.com (Jeff Kunce) Date: Tue Aug 27 15:41:06 2002 Subject: [Moin-devel] alternate user identification methods Message-ID: <5.1.0.14.0.20020827172222.00aca200@corrt.com> First, I want to thank Juergen for adding support for user/page access permissions to the CVS version of MoinMoin. However, I don't think the system ever actually checks to see if a user has permission to read a page. The patch Page.py.diff (attached) is a simple way to add that feature. Now, I'd like to request again :), a hook in user.py to allow optional ways of identifying a user (besides the standard cookie procedure). Any way of doing this is fine with me, but I've attached a patch as a suggestion. The patch user.diff.py (attached) does two things: 1) allows plug-in user identification (similar to plugin SecurityPolicy) 2) creates valid user file names from any kind of username I've also attached a sample plugin user identifier (userid.py), which identifies the user from the REMOTE_USER environment variable. Thanks. --Jeff -------------- next part -------------- Index: Page.py =================================================================== RCS file: /cvsroot/moin/MoinMoin/Page.py,v retrieving revision 1.131 diff -r1.131 Page.py 389a390,391 > elif not user.current.may.read(self.page_name): #(JJK) > print "
You are not allowed to read this page
" -------------- next part -------------- Index: user.py =================================================================== RCS file: /cvsroot/moin/MoinMoin/user.py,v retrieving revision 1.62 diff -r1.62 user.py 82a83,86 > # identify user by external means, if specified in moin_config (JJK) > if hasattr(config, 'UserIdentifier'): > config.UserIdentifier(self) > 107c111,119 < return os.path.join(config.user_dir, self.id or "...NONE...") --- > # mungs any username to an acceptable filename (JJK) > safe = string.letters + string.digits + '.' > res = list(self.id or "...NONE...") > for i in range(len(res)): > c = res[i] > if c not in safe: > res[i] = '_%02x' % ord(c) > filename = string.joinfields(res, '') > return os.path.join(config.user_dir, filename) -------------- next part -------------- """ MoinMoin - User Identification determine the user's id $Id: userid.py,v 1.1 2002/08/27 15:30:15 jeff Exp $ """ import os, time, string class BaseUserIdentifier: '''Base class for user Identification - must be subclassed jjk 03/05/02''' def __init__(self, user): if not user.id: self._identifyUser(user) def _identifyUser(self, user): '''set user.id - reimplement in subclass jjk 03/05/02''' raise NotImplementedError, 'must be implemented in subclass' class Remote_UserIdentifier(BaseUserIdentifier): '''user identification with REMOTE_USER environment variable. (includes .htaccess identification) To use, add these lines to moin_config.py: # user identification from MoinMoin.userid import Remote_UserIdentifier UserIdentifier = Remote_UserIdentifier jjk 03/05/02''' envkey = 'REMOTE_USER' def _identifyUser(self, user): '''set user.id - reimplement in subclass jjk 04/12/02''' if os.environ.has_key(self.envkey) and os.environ[self.envkey]!='-': user.id = os.environ[self.envkey] if not user.exists(): user.name = user.id user.valid = 1 From jh at web.de Wed Aug 28 02:55:01 2002 From: jh at web.de (Juergen Hermann) Date: Wed Aug 28 02:55:01 2002 Subject: [Moin-devel] Re: alternate user identification methods In-Reply-To: <5.1.0.14.0.20020827172222.00aca200@corrt.com> Message-ID: On Tue, 27 Aug 2002 17:38:23 -0500, Jeff Kunce wrote: >First, I want to thank Juergen for adding support for user/page >access permissions to the CVS version of MoinMoin. However, I don't >think the system ever actually checks to see if a user has permission >to read a page. I didn't yet add this because there WAY more places where page contents are read than written to. And what happens if you're not allowed to read a page? How does this influence the page title index (does the page disappear from the list)? And so on... :) Ciao, J?rgen -- J?rgen Hermann, Developer (jhe at webde-ag.de) WEB.DE AG, http://webde-ag.de/ From wkpark at chem.skku.ac.kr Wed Aug 28 04:08:05 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Wed Aug 28 04:08:05 2002 Subject: [Moin-devel] TitleIndex patch Message-ID: <20020828104248.GA6844@chem.skku.ac.kr> I attach small patch against wikimacro.py Regards, Won-kyu Park -------------- next part -------------- --- wikimacro.py Fri Aug 2 17:00:21 2002 +++ wikimacro.py.new Wed Aug 28 19:39:18 2002 @@ -167,7 +167,7 @@ current_letter = None for name in pages: letter = name[0] - if wikiutil.isUnicodeName(name): + if wikiutil.isUnicodeName(letter): try: letter = wikiutil.getUnicodeIndexGroup(unicode(name, config.charset)) if letter: letter = letter.encode(config.charset) From wkpark at chem.skku.ac.kr Wed Aug 28 04:08:05 2002 From: wkpark at chem.skku.ac.kr (Won Kyu Park) Date: Wed Aug 28 04:08:05 2002 Subject: [Moin-devel] Line combining and line breaking Message-ID: <20020828103708.GA6553@chem.skku.ac.kr> Hello, I have a small patch against parser/wiki.py like following --- 8X --- # get text and replace TABs rawtext = string.expandtabs(self.raw) + rawtext = re.sub(r'\s\\\n',' ',rawtext) # go through the lines --- 8X --- you can typeset severl line contents like following: bla bla bla bla ....... \ bla bla bla bla ... \ bla bla bla ... \ end .. this feature is useful for the table tag and a LaTeX user, who intend to make a wiki using his literature typesetted with LaTeX. I also suggest a
formatting rule like following: (?P
\\\\ $) ... def _br_repl(self, word): """Break Line.""" self._check_p() return self.formatter.rawHTML('
') ... It maybe slightly faster than the BR macro. Regards, Won-kyu Park From jeff at corrt.com Wed Aug 28 12:46:02 2002 From: jeff at corrt.com (Jeff Kunce) Date: Wed Aug 28 12:46:02 2002 Subject: [Moin-devel] Re: alternate user identification methods In-Reply-To: References: <5.1.0.14.0.20020827172222.00aca200@corrt.com> Message-ID: <5.1.0.14.0.20020828142357.00b1a190@corrt.com> At 11:53 AM 8/28/2002 +0200, you wrote: >On Tue, 27 Aug 2002 17:38:23 -0500, Jeff Kunce wrote: > > >First, I want to thank Juergen for adding support for user/page > >access permissions to the CVS version of MoinMoin. However, I don't > >think the system ever actually checks to see if a user has permission > >to read a page. > >I didn't yet add this because there WAY more places where page contents >are read than written to. And I was hoping you would know where they are! :) My patch blocks the standard *display* of a page (view and print.) I guess the diffs should be blocked as well. I'm not sure about XML and subscribe, since those features don't work on my installations. Where else might a user view page contents? >And what happens if you're not allowed to read a page? How does this >influence the page title index (does the page disappear from the list)? >And so on... :) I see your point, and the "And so on..." part could be really complicated (page-to-page links, etc.) I would say to keep it simple at this point. Just block the users at any point where they might view page content. In a file-system analogy: "let them list the directory contents, but don't let them open the files." --Jeff From tbird20d at yahoo.com Fri Aug 30 14:01:02 2002 From: tbird20d at yahoo.com (Tim Bird) Date: Fri Aug 30 14:01:02 2002 Subject: [Moin-devel] order of macro load... Message-ID: <20020830210057.83065.qmail@web20803.mail.yahoo.com> I was just trying to override a system macro with one in an individual wiki, and found that this isn't supported. The order of loading macros is to check for builtin, and if present run that. Then check for system extension macro, and if present run that. The check for a macro in the individual wiki/data/plugin dir. Wouldn't it be better to run these checks in reverse order, allowing each level to customize the prior one. Hard example - I wanted to extend the functionality of WantedPages in just one of my wikis, but since there's already a WantedPages at the system level I can't do this. I had to replace references in my pages to [[WantedPages]] with [[MyWantedPages]] Please advise. I'll make the patch to reverse the ordering of the checks if you want, and send it in, if you think this is a good idea. The only drawback I can see to this is maybe you want the builtin macros to be non-overridable. But I really think the system extension macros should be overridable by a local-wiki macro. Regards, Tim Bird __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From whisper at oz.net Fri Aug 30 15:56:01 2002 From: whisper at oz.net (David LeBlanc) Date: Fri Aug 30 15:56:01 2002 Subject: [Moin-devel] Duplicate emails Message-ID: Getting everything twice. "To" and "CC" fields are the same, as is the "From" field. David LeBlanc Seattle, WA USA