本文整理汇总了Python中MoinMoin.wikiutil.quoteWikinameURL函数的典型用法代码示例。如果您正苦于以下问题:Python quoteWikinameURL函数的具体用法?Python quoteWikinameURL怎么用?Python quoteWikinameURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quoteWikinameURL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: execute
def execute(self, args):
#TODO - check that template is valid
result = wikiutil.link_tag(self.request, "%s?action=edit&template=%s" % (
wikiutil.quoteWikinameURL(self.formatter.page.page_name),
wikiutil.quoteWikinameURL(args)), args)
return result
开发者ID:130s,项目名称:roswiki,代码行数:7,代码来源:CreatePageFromTemplate.py
示例2: _macro_WordIndex
def _macro_WordIndex(self, args):
_ = self._
allpages = int(self.form.get('allpages', [0])[0]) != 0
# Get page list readable by current user
# Filter by isSystemPage if needed
if allpages:
# TODO: make this fast by caching full page list
pages = self.request.rootpage.getPageList()
else:
def filter(name):
return not wikiutil.isSystemPage(self.request, name)
pages = self.request.rootpage.getPageList(filter=filter)
map = {}
word_re = re.compile(u'[%s][%s]+' % (config.chars_upper, config.chars_lower), re.UNICODE)
for name in pages:
for word in word_re.findall(name):
try:
if not map[word].count(name):
map[word].append(name)
except KeyError:
map[word] = [name]
all_words = map.keys()
all_words.sort()
index_letters = []
current_letter = None
html = []
for word in all_words:
letter = wikiutil.getUnicodeIndexGroup(word)
if letter != current_letter:
#html.append(self.formatter.anchordef()) # XXX no text param available!
html.append(u'<a name="%s"><h3>%s</h3></a>' % (
wikiutil.quoteWikinameURL(letter), letter.replace('~', 'Others')))
current_letter = letter
if letter not in index_letters:
index_letters.append(letter)
html.append(self.formatter.strong(1))
html.append(word)
html.append(self.formatter.strong(0))
html.append(self.formatter.bullet_list(1))
links = map[word]
links.sort()
last_page = None
for name in links:
if name == last_page:
continue
html.append(self.formatter.listitem(1))
html.append(Page(self.request, name).link_to(self.request))
html.append(self.formatter.listitem(0))
html.append(self.formatter.bullet_list(0))
qpagename = wikiutil.quoteWikinameURL(self.formatter.page.page_name)
index = _make_index_key(index_letters, u"""<br>
<a href="%s?allpages=%d">%s</a>
""" % (qpagename, not allpages, (_('Include system pages'), _('Exclude system pages'))[allpages]) )
return u'%s%s' % (index, u''.join(html))
开发者ID:imosts,项目名称:flume,代码行数:57,代码来源:wikimacro.py
示例3: _macro_TitleIndex
def _macro_TitleIndex(self, args):
_ = self._
html = []
index_letters = []
allpages = int(self.form.get('allpages', [0])[0]) != 0
# Get page list readable by current user
# Filter by isSystemPage if needed
if allpages:
# TODO: make this fast by caching full page list
pages = self.request.rootpage.getPageList()
else:
def filter(name):
return not wikiutil.isSystemPage(self.request, name)
pages = self.request.rootpage.getPageList(filter=filter)
# Sort ignoring case
tmp = [(name.upper(), name) for name in pages]
tmp.sort()
pages = [item[1] for item in tmp]
current_letter = None
for name in pages:
letter = name[0].upper()
letter = wikiutil.getUnicodeIndexGroup(name)
if letter not in index_letters:
index_letters.append(letter)
if letter != current_letter:
html.append(u'<a name="%s"><h3>%s</h3></a>' % (
wikiutil.quoteWikinameURL(letter), letter.replace('~', 'Others')))
current_letter = letter
else:
html.append(u'<br>')
html.append(u'%s\n' % Page(self.request, name).link_to(self.request, attachment_indicator=1))
# add rss link
index = ''
if 0: # if wikixml.ok: # XXX currently switched off (not implemented)
from MoinMoin import wikixml
index = (index + self.formatter.url(1,
wikiutil.quoteWikinameURL(self.formatter.page.page_name) + "?action=rss_ti", unescaped=1) +
self.formatter.icon("rss") +
self.formatter.url(0))
qpagename = wikiutil.quoteWikinameURL(self.formatter.page.page_name)
index = index + _make_index_key(index_letters, u"""<br>
<a href="%s?allpages=%d">%s</a> |
<a href="%s?action=titleindex">%s</a> |
<a href="%s?action=titleindex&mimetype=text/xml">%s</a>
""" % (qpagename, not allpages, (_('Include system pages'), _('Exclude system pages'))[allpages],
qpagename, _('Plain title index'),
qpagename, _('XML title index')) )
return u'%s%s' % (index, u''.join(html))
开发者ID:moinwiki,项目名称:moin-legacy,代码行数:53,代码来源:wikimacro.py
示例4: macro_NewPage
def macro_NewPage(macro, template=u'', button_label=u'', parent_page=u'',
name_template=u'%s', edit_action=''):
including = False
# Handle includedpage
if parent_page == '@INCLUDINGPAGE':
if hasattr(macro.request, 'includingpage'):
parent_page = macro.request.includingpage[-1].page_name
including = True
else:
parent_page = macro.request.page.page_name
newpage = NewPage(macro, template, button_label,
parent_page, name_template)
macrotext = newpage.renderInPage()
if edit_action:
macrotext = macrotext.replace('<input', actioninput % edit_action, 1)
if including:
text = macrotext.split('\n')
text[0] = text[0].split('action="')[0]
text[0] += 'action="%s/%s"><div>' % \
(macro.request.getScriptname(),
wikiutil.quoteWikinameURL(
macro.request.includingpage[-1].page_name))
macrotext = '\n'.join(text)
return macrotext
开发者ID:graphingwiki,项目名称:graphingwiki,代码行数:28,代码来源:NewPage.py
示例5: prepare_node
def prepare_node(self, node_name, node, orphaned_category):
""" Prepare the wiki tree node
Calculates the totals and the html code for the node.
@param node name:
@param path: list of nodes up to this one
"""
# Sort sub nodes
node['categories'].sort()
node['pages'].sort()
node['attachments'].sort()
# Calculate subnode counts
node['categories_count'] = len(node['categories'])
node['pages_count'] = len(node['pages'])
node['attachments_count'] = len(node['attachments'])
if not node['display_name']:
node['display_name'] = node_name
node['url'] = '%s/%s' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(node_name))
orphaned_category[node['type']].append(node_name)
# Build the html code for the link
title = self.node_description(node)
link_html = u'<a class="node" href="%s" title="%s">%s</a>' % (node['url'], title, node['display_name'])
node['html'] = self.node_icon_html[node['type']] + link_html
return
开发者ID:130s,项目名称:roswiki,代码行数:26,代码来源:explorer.py
示例6: editorLink
def editorLink(self, page):
""" Return a link to the editor
If the user can't edit, return a disabled edit link.
If the user want to show both editors, it will display "Edit
(Text)", otherwise as "Edit".
"""
#if not (page.isWritable() and
# self.request.user.may.write(page.page_name)):
# return self.disabledEdit()
_ = self.request.getText
params = (wikiutil.quoteWikinameURL(page.page_name) +
'?action=edit&editor=')
guiworks = self.guiworks(page)
if self.showBothEditLinks() and guiworks:
text = _('Edit (Text)', formatted=False)
params = params + 'text'
attrs = {'name': "texteditlink"}
else:
text = _('Edit', formatted=False)
if guiworks:
# 'textonly' will be upgraded dynamically to 'guipossible' by JS
params = params + 'textonly'
attrs = {'name': "editlink"}
else:
params = params + 'text'
attrs = {'name': "texteditlink"}
return wikiutil.link_tag(self.request, params, text, **attrs)
开发者ID:imosts,项目名称:flume,代码行数:32,代码来源:__init__.py
示例7: attachUrl
def attachUrl(request, pagename, filename=None, **kw):
# filename is not used yet, but should be used later to make a sub-item url
if kw:
qs = '?%s' % wikiutil.makeQueryString(kw, want_unicode=False)
else:
qs = ''
return "%s/%s%s" % (request.getScriptname(), wikiutil.quoteWikinameURL(pagename), qs)
开发者ID:steveyen,项目名称:moingo,代码行数:7,代码来源:AttachFile.py
示例8: execute
def execute(pagename, request):
_ = request.getText
sub_page_name = request.cfg.supplementation_page_name
sub_page_template = request.cfg.supplementation_page_template
newpagename = "%s/%s" % (pagename, sub_page_name)
errormsg = _("You are not allowed to create the supplementation page.")
if pagename.endswith(sub_page_name): # sub_sub_page redirects to sub_page
query = {}
url = Page(request, pagename).url(request, query)
request.http_redirect(url)
elif request.user.may.read(newpagename):
query = {}
url = Page(request, newpagename).url(request, query)
test = Page(request, newpagename)
if test.exists(): # page is defined -> redirect
request.http_redirect(url)
elif request.user.may.write(newpagename): # page will be created from template
query = {'action': 'edit', 'backto': newpagename, 'template': quoteWikinameURL(sub_page_template)}
url = Page(request, newpagename).url(request, query)
request.http_redirect(url)
else:
request.theme.add_msg(errormsg, "error")
else:
request.theme.add_msg(errormsg, "error")
开发者ID:IvanLogvinov,项目名称:soar,代码行数:25,代码来源:supplementation.py
示例9: logo
def logo(self):
""" Assemble logo with link to front page
Changed: * we don't need a div wrapper for the textlogo
* append text "FrontPage" to the logo string
@rtype: unicode
@return: logo html
"""
_ = self.request.getText
html = u''
if self.cfg.logo_string:
page = wikiutil.getFrontPage(self.request)
logo_string = self.cfg.logo_string
logo_append = '<span class="screenreader_info"> %s</span>' % _('FrontPage', formatted=False)
logo_string = logo_string + logo_append
# Try..except for backwards compatibility of Moin versions only
try:
logo = page.link_to_raw(self.request, logo_string)
except:
pagename = wikiutil.getFrontPage(self.request).page_name
pagename = wikiutil.quoteWikinameURL(pagename)
logo = wikiutil.link_tag(self.request, pagename, logo_string)
html = u'%s' % logo
return html
开发者ID:Glottotopia,项目名称:aagd,代码行数:25,代码来源:simplemente.py
示例10: attachment_link
def attachment_link(self, url, text, **kw):
_ = self.request.getText
pagename = self.page.page_name
target = AttachFile.getAttachUrl(pagename, url, self.request)
return (self.url(1, target, title="attachment:%s" % wikiutil.quoteWikinameURL(url)) +
self.text(text) +
self.url(0))
开发者ID:imosts,项目名称:flume,代码行数:7,代码来源:text_gedit.py
示例11: _make_index_key
def _make_index_key(index_letters, additional_html=""):
index_letters.sort()
links = map(lambda ch:
'<a href="#%s">%s</a>' %
(wikiutil.quoteWikinameURL(ch), ch.replace('~', 'Others')),
index_letters)
return "<p>%s%s</p>" % (' | '.join(links), additional_html)
开发者ID:moinwiki,项目名称:moin-legacy,代码行数:7,代码来源:wikimacro.py
示例12: make_iconlink
def make_iconlink(self, which, d):
"""
Make a link with an icon
@param which: icon id (dictionary key)
@param d: parameter dictionary
@rtype: string
@return: html link tag
"""
page_name, querystr, title, icon = self.button_table[which]
d['title'] = title % d
d['i18ntitle'] = self.request.getText(d['title'], formatted=False)
img_src = self.make_icon(icon, d)
attrs = {'rel': 'nofollow', 'title': d['i18ntitle'], }
if page_name:
page = Page(self.request, page_name % d)
else:
page = d['page']
if self.is_moin_1_5: # Moin 1.5.x
url = wikiutil.quoteWikinameURL(page.page_name)
querystr = wikiutil.makeQueryString(querystr)
if querystr:
url = '%s?%s' % (url, querystr)
html = wikiutil.link_tag(self.request, url, img_src, title="%(i18ntitle)s" % d)
else: # Moin 1.6
rev = d['rev']
if rev and which in ['raw', 'print', ]:
querystr['rev'] = str(rev)
html = page.link_to_raw(self.request, text=img_src, querystr=querystr, **attrs)
return html
开发者ID:130s,项目名称:roswiki,代码行数:30,代码来源:explorer.py
示例13: renderInText
def renderInText(self):
""" Render macro in text context
The parser should decide what to do if this macro is placed in a
paragraph context.
"""
_ = self.request.getText
# Default to show page instead of an error message (too lazy to
# do an error message now).
action = self.args.get('action', 'show')
# Use translated text or action name
text = self.args.get('text', action)
text = _(text, formatted=False)
# Escape user input
action = wikiutil.escape(action, 1)
text = wikiutil.escape(text, 1)
# Create link
formatter = self.macro.formatter
page = wikiutil.quoteWikinameURL(formatter.page.page_name)
url = '%s?action=%s' % (page, action)
link = wikiutil.link_tag(self.request, url, text=text,
formatter=formatter)
return link
开发者ID:imosts,项目名称:flume,代码行数:27,代码来源:Action.py
示例14: sendBackupForm
def sendBackupForm(request, pagename):
_ = request.getText
request.setContentLanguage(request.lang)
title = _('Wiki Backup')
request.theme.send_title(title, pagename=pagename)
request.write(request.formatter.startContent("content"))
request.write(_("""= Downloading a backup =
Please note:
* Store backups in a safe and secure place - they contain sensitive information.
* Make sure your wiki configuration backup_* values are correct and complete.
* Make sure the backup file you get contains everything you need in case of problems.
* Make sure it is downloaded without problems.
To get a backup, just click here:""", wiki=True))
request.write("""
<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="backup">
<input type="hidden" name="do" value="backup">
<input type="submit" value="%(backup_button)s">
</form>
""" % {
'baseurl': request.script_root,
'pagename': wikiutil.quoteWikinameURL(pagename),
'backup_button': _('Backup'),
})
request.write(request.formatter.endContent())
request.theme.send_footer(pagename)
request.theme.send_closing_html()
开发者ID:IvanLogvinov,项目名称:soar,代码行数:32,代码来源:backup.py
示例15: getAttachUrl
def getAttachUrl(pagename, filename, request, addts=0, escaped=0, do='get'):
""" Get URL that points to attachment `filename` of page `pagename`.
If 'addts' is true, a timestamp with the file's modification time
is added, so that browsers reload a changed file.
"""
if htdocs_access(request):
# direct file access via webserver
timestamp = ''
if addts:
try:
timestamp = '?ts=%s' % os.path.getmtime(
getFilename(request, pagename, filename))
except IOError:
pass
url = "%s/%s/attachments/%s%s" % (
request.cfg.attachments['url'], wikiutil.quoteWikinameFS(pagename),
wikiutil.url_quote(filename), timestamp)
else:
# send file via CGI
if do not in ['get', 'view']:
do = 'get'
url = "%s/%s?action=%s&do=%s&target=%s" % (
request.getScriptname(), wikiutil.quoteWikinameURL(pagename),
action_name, do, wikiutil.url_quote_plus(filename))
if escaped:
url = wikiutil.escape(url)
return url
开发者ID:imosts,项目名称:flume,代码行数:30,代码来源:AttachFile.py
示例16: render
def render(self):
""" Redirect to the new page, using edit action and template """
error = self.checkAndCombineArguments() or self.checkPermissions()
if error:
# Send back to the page you came from, with an error msg
page = Page(self.request, self.referrer)
page.send_page(self.request, msg=error)
else:
# Redirect to new page using edit action. No error checking
# is needed because it is done later in new request.
pagename = self.pagename
query = {'action': 'edit', 'backto': self.referrer}
template = self.request.form.get('template', [''])[0]
if template:
from MoinMoin.wikiutil import quoteWikinameURL
query['template'] = quoteWikinameURL(template)
parent = self.request.form.get('parent', [''])[0]
if parent:
pagename = "%s/%s" % (parent, pagename)
url = Page(self.request, pagename).url(self.request, query, 0)
self.request.http_redirect(url)
raise MoinMoinNoFooter
return ''
开发者ID:mikejamesthompson,项目名称:orgsites,代码行数:28,代码来源:newpage.py
示例17: logo
def logo(self):
logo = u''
if self.cfg.logo_string:
pagename = wikiutil.getFrontPage(self.request).page_name
pagename = wikiutil.quoteWikinameURL(pagename)
logo = wikiutil.link_tag(self.request, pagename, self.cfg.logo_string, css_class="logo")
return logo
开发者ID:miguelmarco,项目名称:sage-wiki,代码行数:7,代码来源:solenoid.py
示例18: attachment_drawing
def attachment_drawing(self, url, text, **kw):
_ = self.request.getText
pagename = self.page.page_name
image = url + u'.png'
fname = wikiutil.taintfilename(image)
fpath = AttachFile.getFilename(self.request, pagename, fname)
return self.image(
title="drawing:%s" % wikiutil.quoteWikinameURL(url),
src=AttachFile.getAttachUrl(pagename, image, self.request, addts=1))
开发者ID:imosts,项目名称:flume,代码行数:9,代码来源:text_gedit.py
示例19: revert_link
def revert_link(self, page):
try:
rev = self.request.rev
except AttributeError:
return u''
if not (rev and page.isWritable() and self.request.user.may.revert(page.page_name)):
return u''
params = '%s?action=revert&rev=%d' % (wikiutil.quoteWikinameURL(page.page_name), rev)
return wikiutil.link_tag(self.request, params, self._('Revert'), css_class="revert")
开发者ID:miguelmarco,项目名称:sage-wiki,代码行数:9,代码来源:solenoid.py
示例20: makeform
def makeform(self, error=""):
""" Display a package page form
The form might contain an error that happened when package file was not given.
"""
from MoinMoin.widget.dialog import Dialog
_ = self.request.getText
if error:
error = u'<p class="error">%s</p>\n' % error
d = {
'baseurl': self.request.getScriptname(),
'error': error,
'action': self.__class__.__name__,
'pagename': wikiutil.escape(self.pagename, True),
'pagename_quoted': wikiutil.quoteWikinameURL(self.pagename),
'include_attachments_label': _('Include all attachments?'),
'package': _('Package pages'),
'cancel': _('Cancel'),
'newname_label': _("Package name"),
'list_label': _("List of page names - separated by a comma"),
}
form = '''
%(error)s
<form method="post" action="%(baseurl)s/%(pagename_quoted)s">
<input type="hidden" name="action" value="%(action)s">
<table>
<tr>
<td class="label"><label>%(newname_label)s</label></td>
<td class="content">
<input type="text" name="packagename" value="package.zip" size="80">
</td>
</tr>
<tr>
<td class="label"><label>%(list_label)s</label></td>
<td class="content">
<input type="text" name="pagelist" size="80" maxlength="200" value="%(pagename)s">
</td>
</tr>
<tr>
<td class="label">
%(include_attachments_label)s<input type="checkbox" name="include_attachments" value="0" %(include_attachments_label)s>
</td>
</tr>
<tr>
<td></td>
<td class="buttons">
<input type="submit" name="submit" value="%(package)s">
<input type="submit" name="cancel" value="%(cancel)s">
</td>
</tr>
</table>
</form>''' % d
return Dialog(self.request, content=form)
开发者ID:steveyen,项目名称:moingo,代码行数:56,代码来源:PackagePages.py
注:本文中的MoinMoin.wikiutil.quoteWikinameURL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论