本文整理汇总了Python中MoinMoin.Page.Page.link_to_raw方法的典型用法代码示例。如果您正苦于以下问题:Python Page.link_to_raw方法的具体用法?Python Page.link_to_raw怎么用?Python Page.link_to_raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.Page.Page
的用法示例。
在下文中一共展示了Page.link_to_raw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_iconlink
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import link_to_raw [as 别名]
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
示例2: formatMetaSelection
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import link_to_raw [as 别名]
def formatMetaSelection(request, pages, keys, styles, addpagename=False):
f = request.formatter
divfmt = {'class': 'metaselection_area'}
listfmt = {'class': 'metaselection_list'}
entryfmt = {'class': 'metaselection_entry'}
result = ''
result = f.div(1, **divfmt)
result += f.bullet_list(1, **listfmt)
tmp_page = request.page
for page in pages:
pageobj = Page(request, page)
request.page = pageobj
request.formatter.page = pageobj
metas = get_metas(request, page, keys,
checkAccess=True, formatLinks=True)
result += f.listitem(1, **entryfmt)
args = {'class': 'metaselection_link'}
for key in keys:
for val in metas[key]:
text = format_wikitext(request, val)
result += pageobj.link_to_raw(request, text=text, **args)
if addpagename:
result += pageobj.link_to_raw(request,
text=pageobj.page_name, **args)
result += f.listitem(0)
request.page = tmp_page
request.formatter.page = tmp_page
result += f.bullet_list(0)
result += f.div(0)
return result
示例3: format_page_edits
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import link_to_raw [as 别名]
def format_page_edits(macro, line):
request = macro.request
_ = request.getText
pagename = line.pagename
rev = int(line.rev)
page = Page(request, pagename)
html_link = u''
if not page.exists():
revbefore = rev - 1
if revbefore and page.exists(rev=revbefore, domain='standard'):
# indicate page was deleted and show diff to last existing revision of it
html_link = page.link_to_raw(request, u'(削除) %s' % pagename,
querystr={'action': 'diff'}, rel='nofollow')
else:
html_link = pagename
else:
html_link = page.link_to(request, pagename, rel='nofollow')
return u'<li>%s</li>' % html_link
示例4: format_page_edits
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import link_to_raw [as 别名]
def format_page_edits(macro, lines, bookmark_usecs):
request = macro.request
_ = request.getText
d = {} # dict for passing stuff to theme
line = lines[0]
pagename = line.pagename
rev = int(line.rev)
tnow = time.time()
is_new = lines[-1].action == "SAVENEW"
is_renamed = lines[-1].action == "SAVE/RENAME"
# check whether this page is newer than the user's bookmark
hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs)
page = Page(request, pagename)
html_link = ""
if not page.exists():
img = request.theme.make_icon("deleted")
revbefore = rev - 1
if revbefore and page.exists(rev=revbefore, domain="standard"):
# indicate page was deleted and show diff to last existing revision of it
html_link = page.link_to_raw(request, img, querystr={"action": "diff"}, rel="nofollow")
else:
# just indicate page was deleted
html_link = img
elif page.isConflict():
img = request.theme.make_icon("conflict")
html_link = page.link_to_raw(request, img, querystr={"action": "edit"}, rel="nofollow")
elif hilite:
# show special icons if change was after the user's bookmark
if is_new:
img = "new"
elif is_renamed:
img = "renamed"
else:
img = "updated"
img = request.theme.make_icon(img)
html_link = page.link_to_raw(
request, img, querystr={"action": "diff", "date": "%d" % bookmark_usecs}, rel="nofollow"
)
else:
# show "DIFF" icon else
img = request.theme.make_icon("diffrc")
html_link = page.link_to_raw(request, img, querystr={"action": "diff"}, rel="nofollow")
# print name of page, with a link to it
force_split = len(page.page_name) > _MAX_PAGENAME_LENGTH
d["icon_html"] = html_link
d["pagelink_html"] = page.link_to(request, text=page.split_title(force=force_split))
# print time of change
d["time_html"] = None
if request.cfg.changed_time_fmt:
tdiff = long(tnow - wikiutil.version2timestamp(long(line.ed_time_usecs))) / 60 # has to be long for py 2.2.x
if tdiff < 100:
d["time_html"] = _("%(mins)dm ago") % {"mins": tdiff}
else:
d["time_html"] = time.strftime(request.cfg.changed_time_fmt, line.time_tuple)
# print editor name or IP
d["editors"] = None
if request.cfg.show_names:
if len(lines) > 1:
counters = {}
editorcache = {}
for idx in range(len(lines)):
editorkey = lines[idx].addr, lines[idx].hostname, lines[idx].userid
if editorkey not in editorcache:
editorcache[editorkey] = lines[idx].getEditor(request)
name = editorcache[editorkey]
if not name in counters:
counters[name] = []
counters[name].append(idx + 1)
poslist = [(v, k) for k, v in counters.items()]
poslist.sort()
d["editors"] = []
for positions, name in poslist:
d["editors"].append("%s [%s]" % (name, util.rangelist(positions)))
else:
d["editors"] = [line.getEditor(request)]
comments = []
for idx in range(len(lines)):
comment = format_comment(request, lines[idx])
if comment:
comments.append((idx + 1, wikiutil.escape(comment)))
d["changecount"] = len(lines)
d["comments"] = comments
img = request.theme.make_icon("info")
d["info_html"] = page.link_to_raw(request, img, querystr={"action": "info"}, rel="nofollow")
return request.theme.recentchanges_entry(d)
示例5: format_page_edits
# 需要导入模块: from MoinMoin.Page import Page [as 别名]
# 或者: from MoinMoin.Page.Page import link_to_raw [as 别名]
def format_page_edits(macro, lines, bookmark_usecs):
request = macro.request
_ = request.getText
d = {} # dict for passing stuff to theme
line = lines[0]
pagename = line.pagename
rev = int(line.rev)
tnow = time.time()
is_new = lines[-1].action == 'SAVENEW'
is_renamed = lines[-1].action == 'SAVE/RENAME'
# check whether this page is newer than the user's bookmark
hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs)
page = Page(request, pagename)
html_link = ''
if not page.exists():
img = request.theme.make_icon('deleted')
revbefore = rev - 1
if revbefore and page.exists(rev=revbefore, domain='standard'):
# indicate page was deleted and show diff to last existing revision of it
html_link = page.link_to_raw(request, img, querystr={'action': 'diff'}, rel='nofollow')
else:
# just indicate page was deleted
html_link = img
elif page.isConflict():
img = request.theme.make_icon('conflict')
html_link = page.link_to_raw(request, img, querystr={'action': 'edit'}, rel='nofollow')
elif hilite:
# show special icons if change was after the user's bookmark
if is_new:
img = 'new'
elif is_renamed:
img = 'renamed'
else:
img = 'updated'
img = request.theme.make_icon(img)
html_link = page.link_to_raw(request, img, querystr={'action': 'diff', 'date': '%d' % bookmark_usecs}, rel='nofollow')
else:
# show "DIFF" icon else
img = request.theme.make_icon('diffrc')
html_link = page.link_to_raw(request, img, querystr={'action': 'diff'}, rel='nofollow')
# print name of page, with a link to it
force_split = len(page.page_name) > _MAX_PAGENAME_LENGTH
d['icon_html'] = html_link
d['pagelink_html'] = page.link_to(request, text=page.split_title(force=force_split))
# print time of change
d['time_html'] = None
if request.cfg.changed_time_fmt:
tdiff = long(tnow - wikiutil.version2timestamp(long(line.ed_time_usecs))) / 60 # has to be long for py 2.2.x
if tdiff < 100:
d['time_html'] = _("%(mins)dm ago") % {
'mins': tdiff}
else:
d['time_html'] = time.strftime(request.cfg.changed_time_fmt, line.time_tuple)
# print editor name or IP
d['editors'] = None
if request.cfg.show_names:
if len(lines) > 1:
counters = {}
for idx in range(len(lines)):
name = lines[idx].getEditor(request)
if not name in counters:
counters[name] = []
counters[name].append(idx+1)
poslist = [(v, k) for k, v in counters.items()]
poslist.sort()
d['editors'] = []
for positions, name in poslist:
d['editors'].append("%s [%s]" % (
name, util.rangelist(positions)))
else:
d['editors'] = [line.getEditor(request)]
comments = []
for idx in range(len(lines)):
comment = format_comment(request, lines[idx])
if comment:
comments.append((idx+1, wikiutil.escape(comment)))
d['changecount'] = len(lines)
d['comments'] = comments
img = request.theme.make_icon('info')
d['info_html'] = page.link_to_raw(request, img, querystr={'action': 'info'}, rel='nofollow')
return request.theme.recentchanges_entry(d)