[wiki-lenny] Débuggage du portail (les liens sont parsés après) + pimpage
darcs-hash:20081211174112-bd074-5d5f6992aae94438a7333d53f2b55a5e00cbbc17.gz
This commit is contained in:
parent
4b169a49e9
commit
7e755aa879
4 changed files with 83 additions and 10 deletions
|
@ -62,8 +62,8 @@ class Parser:
|
||||||
## self.request.write('<!-- error, wrong number of parameters -->')
|
## self.request.write('<!-- error, wrong number of parameters -->')
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# On récupère l'url de l'image
|
# On récupère le nom de l'image
|
||||||
pic = AttachFile.getAttachUrl(current_pagename, items[0].strip(), self.request).replace('& ','&')
|
pic = items[0].strip()
|
||||||
|
|
||||||
# On va formatter le titre et la légende
|
# On va formatter le titre et la légende
|
||||||
tit_buf = StringIO.StringIO()
|
tit_buf = StringIO.StringIO()
|
||||||
|
|
31
wiki-lenny/share/formatter.pagelinks.orig.py
Normal file
31
wiki-lenny/share/formatter.pagelinks.orig.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# -*- coding: iso-8859-1 -*-
|
||||||
|
"""
|
||||||
|
MoinMoin - pagelinks Formatter
|
||||||
|
|
||||||
|
@copyright: 2005 Nir Soffer <nirs@freeshell.org>
|
||||||
|
@license: GNU GPL, see COPYING for details.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from MoinMoin.formatter import FormatterBase
|
||||||
|
|
||||||
|
class Formatter(FormatterBase):
|
||||||
|
""" Collect pagelinks and format nothing :-) """
|
||||||
|
|
||||||
|
def pagelink(self, on, pagename='', page=None, **kw):
|
||||||
|
FormatterBase.pagelink(self, on, pagename, page, **kw)
|
||||||
|
return self.null()
|
||||||
|
|
||||||
|
def null(self, *args, **kw):
|
||||||
|
return ''
|
||||||
|
|
||||||
|
# All these must be overriden here because they raise
|
||||||
|
# NotImplementedError!@#! or return html?! in the base class.
|
||||||
|
set_highlight_re = rawHTML = url = image = smiley = text = null
|
||||||
|
strong = emphasis = underline = highlight = sup = sub = strike = null
|
||||||
|
code = preformatted = small = big = code_area = code_line = null
|
||||||
|
code_token = linebreak = paragraph = rule = icon = null
|
||||||
|
number_list = bullet_list = listitem = definition_list = null
|
||||||
|
definition_term = definition_desc = heading = table = null
|
||||||
|
table_row = table_cell = attachment_link = attachment_image = attachment_drawing = null
|
||||||
|
transclusion = transclusion_param = null
|
||||||
|
|
33
wiki-lenny/share/formatter.pagelinks.py
Normal file
33
wiki-lenny/share/formatter.pagelinks.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# -*- coding: iso-8859-1 -*-
|
||||||
|
"""
|
||||||
|
MoinMoin - pagelinks Formatter
|
||||||
|
|
||||||
|
@copyright: 2005 Nir Soffer <nirs@freeshell.org>
|
||||||
|
@license: GNU GPL, see COPYING for details.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from MoinMoin.formatter import FormatterBase
|
||||||
|
|
||||||
|
class Formatter(FormatterBase):
|
||||||
|
""" Collect pagelinks and format nothing :-) """
|
||||||
|
|
||||||
|
def pagelink(self, on, pagename='', page=None, **kw):
|
||||||
|
FormatterBase.pagelink(self, on, pagename, page, **kw)
|
||||||
|
return self.null()
|
||||||
|
|
||||||
|
def null(self, *args, **kw):
|
||||||
|
return ''
|
||||||
|
|
||||||
|
# All these must be overriden here because they raise
|
||||||
|
# NotImplementedError!@#! or return html?! in the base class.
|
||||||
|
set_highlight_re = rawHTML = url = image = smiley = text = null
|
||||||
|
strong = emphasis = underline = highlight = sup = sub = strike = null
|
||||||
|
code = preformatted = small = big = code_area = code_line = null
|
||||||
|
code_token = linebreak = paragraph = rule = icon = null
|
||||||
|
number_list = bullet_list = listitem = definition_list = null
|
||||||
|
definition_term = definition_desc = heading = table = null
|
||||||
|
table_row = table_cell = attachment_link = attachment_image = attachment_drawing = null
|
||||||
|
transclusion = transclusion_param = null
|
||||||
|
### HACK SAUVAGE 1/1
|
||||||
|
crans_box = crans_portal = null
|
||||||
|
### FIN HACK 1/1
|
|
@ -1009,7 +1009,7 @@ document.write('<a href="#" onclick="return togglenumber(\'%s\', %d, %d);" \
|
||||||
|
|
||||||
format_pe = '''
|
format_pe = '''
|
||||||
<div style="background:transparent url('%s') center left no-repeat;
|
<div style="background:transparent url('%s') center left no-repeat;
|
||||||
width: 38%%; height: 5em; padding: 0 20px 0 60px; float:left;">
|
width: 38%%; height: 5em; padding: 1.5em 20px 0 60px; float:left;">
|
||||||
<ul style="list-style: none;">
|
<ul style="list-style: none;">
|
||||||
<li>%s</li>
|
<li>%s</li>
|
||||||
<li>%s</li>
|
<li>%s</li>
|
||||||
|
@ -1019,9 +1019,9 @@ document.write('<a href="#" onclick="return togglenumber(\'%s\', %d, %d);" \
|
||||||
format_pne = '''
|
format_pne = '''
|
||||||
<div style="width: 38%%; height: 5em; padding: 10px 20px 0 0px; float:left;">
|
<div style="width: 38%%; height: 5em; padding: 10px 20px 0 0px; float:left;">
|
||||||
<div style="float: left; padding-top: 1.5em; width: 20%%;">
|
<div style="float: left; padding-top: 1.5em; width: 20%%;">
|
||||||
<a href="%s" style="font-size: 5pt" alt="cliquez ici pour envoyer l'image">%s</a>
|
<a href="%s" style="font-size: 5pt" alt="envoyer l'image">envoyer<br>%s</a>
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left; width: 80%%;">
|
<div style="float: left; width: 75%%; padding: 0; margin: 0;">
|
||||||
<ul style="list-style: none;">
|
<ul style="list-style: none;">
|
||||||
<li>%s</li>
|
<li>%s</li>
|
||||||
<li>%s</li>
|
<li>%s</li>
|
||||||
|
@ -1029,25 +1029,34 @@ document.write('<a href="#" onclick="return togglenumber(\'%s\', %d, %d);" \
|
||||||
</div>
|
</div>
|
||||||
</div>'''
|
</div>'''
|
||||||
|
|
||||||
|
pn = self.page.page_name
|
||||||
|
|
||||||
while len(entries) != 0:
|
while len(entries) != 0:
|
||||||
pic0, tit0, bod0 = entries[0]
|
pic0, tit0, bod0 = entries[0]
|
||||||
|
|
||||||
fname= urllib.url2pathname(pic0.split('=')[-1])
|
fname = urllib.url2pathname(pic0)
|
||||||
if AttachFile.exists(self.request, self.page.page_name, fname):
|
if AttachFile.exists(self.request, pn, fname):
|
||||||
|
pic0 = AttachFile.getAttachUrl(pn, pic0, self.request)
|
||||||
|
pic0 = pic0.replace('& ','&')
|
||||||
html += [ format_pe % (pic0, tit0, bod0) ]
|
html += [ format_pe % (pic0, tit0, bod0) ]
|
||||||
else:
|
else:
|
||||||
html += [ format_pne % (pic0, pic0.split('=')[-1], tit0, bod0) ]
|
pic0 = AttachFile.getAttachUrl(pn, pic0, self.request, upload=True)
|
||||||
|
pic0 = pic0.replace('& ','&')
|
||||||
|
html += [ format_pne % (pic0, fname, tit0, bod0) ]
|
||||||
|
|
||||||
if len(entries) >= 2:
|
if len(entries) >= 2:
|
||||||
pic1, tit1, bod1 = entries[1]
|
pic1, tit1, bod1 = entries[1]
|
||||||
entries = entries[2:]
|
entries = entries[2:]
|
||||||
|
|
||||||
fname = urllib.url2pathname(pic1.split('=')[-1])
|
fname = urllib.url2pathname(pic1)
|
||||||
if AttachFile.exists(self.request, self.page.page_name, fname):
|
if AttachFile.exists(self.request, self.page.page_name, fname):
|
||||||
|
pic1 = AttachFile.getAttachUrl(pn, pic1, self.request)
|
||||||
|
# pic1 = pic1.replace('& ','&')
|
||||||
html += [ format_pe % (pic1, tit1, bod1) ]
|
html += [ format_pe % (pic1, tit1, bod1) ]
|
||||||
else:
|
else:
|
||||||
html += [ format_pne % (pic1, pic1.split('=')[-1], tit1, bod1) ]
|
pic1 = AttachFile.getAttachUrl(pn, pic1, self.request, upload=True)
|
||||||
|
# pic1 = pic.replace('& ','&')
|
||||||
|
html += [ format_pne % (pic1, fname, tit1, bod1) ]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
entries = [] # plus propre que {{{ break() }}}
|
entries = [] # plus propre que {{{ break() }}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue