[wiki] on arrete de balancer du HTML
Ces macros sont appel'ees par getpagelinks. Si elles balancent n'importe quoi lorsqu'on cherche a obtenir leurs liens, CategoriePagePublique n'apparait pas... darcs-hash:20090427142002-bd074-46977e63783af21b013023b46ee7e289020f28a7.gz
This commit is contained in:
parent
d91a411300
commit
6b0022645d
8 changed files with 25 additions and 23 deletions
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
def execute(macro, text):
|
def execute(macro, text):
|
||||||
import md5
|
import md5
|
||||||
|
|
||||||
parseargs = text.split(',')
|
parseargs = text.split(',')
|
||||||
if len(parseargs)<2:
|
if len(parseargs)<2:
|
||||||
return '<small><strong class="error">MailTo macro must have at least two arguments</strong></small>'
|
return '<small><strong class="error">MailTo macro must have at least two arguments</strong></small>'
|
||||||
|
@ -19,4 +18,4 @@ def execute(macro, text):
|
||||||
user_id = md5.md5( email.strip() ).hexdigest()
|
user_id = md5.md5( email.strip() ).hexdigest()
|
||||||
url = 'http://www.gravatar.com/avatar.php?gravatar_id=%s&size=80' % user_id
|
url = 'http://www.gravatar.com/avatar.php?gravatar_id=%s&size=80' % user_id
|
||||||
html = "<img src=\"%s\" alt=\"Gravatar\" />" % url
|
html = "<img src=\"%s\" alt=\"Gravatar\" />" % url
|
||||||
return html
|
return macro.formatter.rawHTML(html)
|
||||||
|
|
|
@ -101,4 +101,4 @@ def execute(macro, args):
|
||||||
index = makeIndex(letter_list)
|
index = makeIndex(letter_list)
|
||||||
html = index + html
|
html = index + html
|
||||||
html += u'<br style="clear: both">'
|
html += u'<br style="clear: both">'
|
||||||
return html
|
return macro.formatter.rawHTML(html)
|
||||||
|
|
|
@ -110,11 +110,11 @@ def execute (macro, text, args_re=None):
|
||||||
|
|
||||||
try: res = _execute (macro, text)
|
try: res = _execute (macro, text)
|
||||||
except Exception, msg:
|
except Exception, msg:
|
||||||
return """
|
return macro.formatter.rawHTML("""
|
||||||
<p><strong class="error">
|
<p><strong class="error">
|
||||||
Error: macro ProgressBar: %s</strong> </p>
|
Error: macro ProgressBar: %s</strong> </p>
|
||||||
""" % escape ("%s" % msg)
|
""" % escape ("%s" % msg))
|
||||||
return res
|
return macro.formatter.rawHTML(res)
|
||||||
|
|
||||||
|
|
||||||
def _execute (macro, text):
|
def _execute (macro, text):
|
||||||
|
@ -167,15 +167,15 @@ def _execute (macro, text):
|
||||||
if len (fmt): t = "<%s> ||" % fmt
|
if len (fmt): t = "<%s> ||" % fmt
|
||||||
else: t = " ||"
|
else: t = " ||"
|
||||||
return txt + t
|
return txt + t
|
||||||
|
|
||||||
# Progress
|
# Progress
|
||||||
if text.endswith ('%'):
|
if text.endswith ('%'):
|
||||||
# correction du bug des 0%
|
# correction du bug des 0%
|
||||||
if text == "0%":
|
if text == "0%":
|
||||||
for f in [fmt [1]] :
|
for f in [fmt [1]] :
|
||||||
res = cell (res, f)
|
res = cell (res, f)
|
||||||
else:
|
else:
|
||||||
for f in fmt [0] + ' %s' % text, fmt [1] :
|
for f in fmt [0] + ' %s' % text, fmt [1] :
|
||||||
res = cell (res, f)
|
res = cell (res, f)
|
||||||
|
|
||||||
# Current/Steps
|
# Current/Steps
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
http://purl.net/wiki/moinmaster/HelpOnMacros/Include
|
http://purl.net/wiki/moinmaster/HelpOnMacros/Include
|
||||||
|
|
||||||
for detailed docs.
|
for detailed docs.
|
||||||
|
|
||||||
@copyright: 2000-2004 by Jürgen Hermann <jh@web.de>
|
@copyright: 2000-2004 by Jürgen Hermann <jh@web.de>
|
||||||
@copyright: 2000-2001 by Richard Jones <richard@bizarsoftware.com.au>
|
@copyright: 2000-2001 by Richard Jones <richard@bizarsoftware.com.au>
|
||||||
@license: GNU GPL, see COPYING for details.
|
@license: GNU GPL, see COPYING for details.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
@copyright: 2002-2004 by Jürgen Hermann <jh@web.de>
|
@copyright: 2002-2004 by Jürgen Hermann <jh@web.de>
|
||||||
@license: GNU GPL, see COPYING for details.
|
@license: GNU GPL, see COPYING for details.
|
||||||
|
|
||||||
Originally written by Thomas Waldmann.
|
Originally written by Thomas Waldmann.
|
||||||
Gustavo Niemeyer added wiki markup parsing of the quotes.
|
Gustavo Niemeyer added wiki markup parsing of the quotes.
|
||||||
"""
|
"""
|
||||||
|
@ -39,12 +39,12 @@ def execute(macro, args):
|
||||||
quotes = raw.splitlines()
|
quotes = raw.splitlines()
|
||||||
quotes = [quote.strip() for quote in quotes]
|
quotes = [quote.strip() for quote in quotes]
|
||||||
quotes = [quote[2:] for quote in quotes if quote.startswith('1. ')]
|
quotes = [quote[2:] for quote in quotes if quote.startswith('1. ')]
|
||||||
|
|
||||||
if not quotes:
|
if not quotes:
|
||||||
return (macro.formatter.highlight(1) +
|
return (macro.formatter.highlight(1) +
|
||||||
_('No quotes on %(pagename)s.') % {'pagename': pagename} +
|
_('No quotes on %(pagename)s.') % {'pagename': pagename} +
|
||||||
macro.formatter.highlight(0))
|
macro.formatter.highlight(0))
|
||||||
|
|
||||||
quote = random.choice(quotes)
|
quote = random.choice(quotes)
|
||||||
page.set_raw_body(quote, 1)
|
page.set_raw_body(quote, 1)
|
||||||
out = StringIO.StringIO()
|
out = StringIO.StringIO()
|
||||||
|
@ -52,6 +52,6 @@ def execute(macro, args):
|
||||||
page.send_page(macro.request, content_only=1, content_id="RandomQuote_%s" % wikiutil.quoteWikinameFS(page.page_name) )
|
page.send_page(macro.request, content_only=1, content_id="RandomQuote_%s" % wikiutil.quoteWikinameFS(page.page_name) )
|
||||||
quote = out.getvalue()
|
quote = out.getvalue()
|
||||||
macro.request.redirect()
|
macro.request.redirect()
|
||||||
|
|
||||||
return quote
|
return quote
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@ import re
|
||||||
|
|
||||||
def execute (macro, args):
|
def execute (macro, args):
|
||||||
_ = macro.request.getText
|
_ = macro.request.getText
|
||||||
|
|
||||||
|
# return immediately if getting links for the current page
|
||||||
|
if request.mode_getpagelinks:
|
||||||
|
return ''
|
||||||
|
|
||||||
unknownuname = {}
|
unknownuname = {}
|
||||||
missingemail = {}
|
missingemail = {}
|
||||||
outofdateversion = 0
|
outofdateversion = 0
|
||||||
|
|
|
@ -13,7 +13,7 @@ def image_url_for_channel(channel_name, channel_ip, small=0 ):
|
||||||
return BASE_IMAGE_URL + str(channel_ip) + IMAGE_SUFFIX
|
return BASE_IMAGE_URL + str(channel_ip) + IMAGE_SUFFIX
|
||||||
else:
|
else:
|
||||||
return BASE_IMAGE_URL + str(channel_ip) + SMALL_IMAGE_SUFFIX
|
return BASE_IMAGE_URL + str(channel_ip) + SMALL_IMAGE_SUFFIX
|
||||||
|
|
||||||
def get_channel_list():
|
def get_channel_list():
|
||||||
import urllib
|
import urllib
|
||||||
# Getsap file from web sever.
|
# Getsap file from web sever.
|
||||||
|
@ -21,9 +21,9 @@ def get_channel_list():
|
||||||
# Read it.
|
# Read it.
|
||||||
s = f.read()
|
s = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
s = s.split("\n")
|
s = s.split("\n")
|
||||||
|
|
||||||
channel_list = []
|
channel_list = []
|
||||||
for a_line in s:
|
for a_line in s:
|
||||||
try:
|
try:
|
||||||
|
@ -39,7 +39,7 @@ def get_channel_list():
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return channel_list
|
return channel_list
|
||||||
|
|
||||||
|
|
||||||
def execute(macro, args):
|
def execute(macro, args):
|
||||||
opt = {"col":4,"cat":False,"ch":False, "width":"10em"}
|
opt = {"col":4,"cat":False,"ch":False, "width":"10em"}
|
||||||
|
@ -50,7 +50,7 @@ def execute(macro, args):
|
||||||
opt[name] = value
|
opt[name] = value
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
IMAGES_PER_LINE = int(opt["col"])
|
IMAGES_PER_LINE = int(opt["col"])
|
||||||
CATHEGORY = opt["cat"]
|
CATHEGORY = opt["cat"]
|
||||||
CHANNEL = opt["ch"]
|
CHANNEL = opt["ch"]
|
||||||
|
@ -67,7 +67,7 @@ def execute(macro, args):
|
||||||
if a_channel["name"].find(CHANNEL)<0:
|
if a_channel["name"].find(CHANNEL)<0:
|
||||||
continue
|
continue
|
||||||
if i == 0:
|
if i == 0:
|
||||||
text+= macro.formatter.table_row(1)
|
text+= macro.formatter.table_row(1)
|
||||||
text+= macro.formatter.table_cell(1, {'style':'text-align:center;'})
|
text+= macro.formatter.table_cell(1, {'style':'text-align:center;'})
|
||||||
text+= macro.formatter.strong( 1 )
|
text+= macro.formatter.strong( 1 )
|
||||||
text+= macro.formatter.text( a_channel["name"] )
|
text+= macro.formatter.text( a_channel["name"] )
|
||||||
|
@ -89,5 +89,3 @@ def execute(macro, args):
|
||||||
i += 1
|
i += 1
|
||||||
text+= macro.formatter.table(0)
|
text+= macro.formatter.table(0)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,4 @@ def execute(macro, text):
|
||||||
<embed src="%(youtubelink)s" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
|
<embed src="%(youtubelink)s" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
|
||||||
</object>
|
</object>
|
||||||
''' % {"youtubelink": url}
|
''' % {"youtubelink": url}
|
||||||
return html
|
return macro.formatter.rawHTML(html)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue