Attachment 'client_xslt.py'
Download 1 # -*- coding: utf-8 -*-
2 """
3 Client XSLT parser
4
5 This makes an XML document transformed on the client(i.e. browser) using snXSLT.js
6
7 @copyright: 2006 Yoon, Sang-Min <sixmen@gmail.com>
8 @license: GNU GPL, see COPYING for details.
9 """
10
11 import re
12
13 from MoinMoin import config
14
15 class Parser:
16
17 def __init__(self, raw, request, **kw):
18 self.raw = raw.encode(config.charset)
19 self.request = request
20 self._ = request.getText
21
22 def format(self, formatter):
23 raw = self.raw
24 raw = re.sub(r"href=(?P<hmarker>['\"])wiki://Self/(.*)(?P=hmarker)", r"href=\1\2?action=raw\1", raw)
25 self.request.write('<textarea style="display:none;" id="xml" rows="10" cols="80">')
26 self.request.write(raw.replace('>', '>').replace('<', '<'))
27 self.request.write('</textarea>')
28 self.request.write('<div id="result"></div>')
29 self.request.write("""
30 <script language="JavaScript" src="http://sixmen.pe.kr/index.cgi/snXSLT.js?action=AttachFile&do=get&target=snXSLT.js"></script>
31 <script language="JavaScript">
32 var xml = document.getElementById('xml').value;
33 var div = document.getElementById('result');
34 var params = [];
35 """)
36 for i in self.request.form:
37 if i=='savetext':
38 continue
39 self.request.write("params.push('%s');params.push('%s');" % (i, self.request.form[i][0]))
40 self.request.write("""
41 var mysnXSLT = new snXSLT();
42 mysnXSLT.transform(xml,null,params,div);
43 </script>
44 """)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.