本文整理汇总了Python中MoinMoin.wikiutil.getFrontPage函数的典型用法代码示例。如果您正苦于以下问题:Python getFrontPage函数的具体用法?Python getFrontPage怎么用?Python getFrontPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFrontPage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: logo
def logo(self):
html = u''
if self.cfg.logo_string:
page = wikiutil.getFrontPage(self.request)
logo = page.link_to_raw(self.request, self.cfg.logo_string)
html = u'<h1>%s</h1>' %logo
return html
开发者ID:AnishShah,项目名称:roundup,代码行数:7,代码来源:roundup.py
示例3: bs_breadcrumb
def bs_breadcrumb(self, d):
html = [u'<ul class="breadcrumb">']
try:
_var = self.cfg.bs_breadcrumb
for text, url in self.cfg.bs_breadcrumb:
markup = u'<li><a href="%s">%s</a> <span class="divider">»</span></li>' % (url, text)
html.append(markup)
except AttributeError:
pass
if self.request.action not in [u'show', u'', u'refresh']:
action = self.request.action
else:
action = False
page = wikiutil.getFrontPage(self.request)
frontpage = page.link_to_raw(self.request, text=self.request.cfg.sitename)
html.append(u'<li>%s <span class="divider">»</span></li>' % frontpage)
segments = d['page_name'].split('/')
if action:
segments.append(action)
curpage = ''
for s in segments[:-1]:
curpage += s
html.append(u'<li>%s <span class="divider">»</span></li>' % Page(self.request, curpage).link_to(self.request, s))
curpage += '/'
html.append(u'<li class="active">%s</li>' % segments[-1])
html.append(u'<li class="pull-right">%s</li>' % self.username(d))
html.append(u'</ul>')
return '\n'.join(html)
开发者ID:dmiyakawa,项目名称:moinmoin-bootstrap,代码行数:31,代码来源:bootstrap.py
示例4: logo
def logo(self):
""" Assemble logo with link to front page
The logo contain an image and or text or any html markup the
admin inserted in the config file. Everything it enclosed inside
a div with id="logo".
@rtype: unicode
@return: logo html
"""
html = u''
page = wikiutil.getFrontPage(self.request)
html = page.link_to_raw(self.request, '<img src="%s/FrontPage?action=AttachFile&do=get&target=logo.png" valign="bottom" alt="MoinMoin Logo">' % self.request.script_root)
# page = wikiutil.getFrontPage(self.request)
# #text = random.choice(['#','|','+','-','~','`','^','*','=','_',';',':',',','.'])#self.request.cfg.interwikiname or 'Self'
# text = "%02d" % datetime.today().day
# link = page.link_to(self.request, text=text, rel='nofollow')
# #randomcolor
# a = map(str, range(0,9))
# a.extend(list('abcdef'))
# color_str = []
# for i in range(0,6):
# color_str.append(random.choice(a))
# html = u'<span id="logo" style="background-color:#%s;">%s</span>' % (''.join(color_str), link)
return html
开发者ID:happytk,项目名称:moin,代码行数:29,代码来源:c2wiki.py
示例5: 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
示例6: username
def username(self, d):
""" Assemble the username / userprefs link
@param d: parameter dictionary
@rtype: unicode
@return: username html
"""
if not self.is_mobile:
return ThemeBase.username(self, d)
request = self.request
_ = request.getText
if self.request.cfg.show_interwiki:
page = wikiutil.getFrontPage(self.request)
text = self.request.cfg.interwikiname or 'Self'
link = page.link_to(self.request, text=text, rel='nofollow')
# html = u'<span id="interwiki">%s<span class="sep">: </span></span>' % link
userlinks = [link]
else:
userlinks = []
# Add username/homepage link for registered users. We don't care
# if it exists, the user can create it.
if request.user.valid and request.user.name:
interwiki = wikiutil.getInterwikiHomePage(request)
name = request.user.name
aliasname = request.user.aliasname
if not aliasname:
aliasname = name
title = "%s @ %s" % (aliasname, interwiki[0])
# link to (interwiki) user homepage
homelink = (request.formatter.interwikilink(1, title=title, id="userhome", generated=True, *interwiki) +
request.formatter.text(name) +
request.formatter.interwikilink(0, title=title, id="userhome", *interwiki))
userlinks.append(homelink)
# link to userprefs action
if 'userprefs' not in self.request.cfg.actions_excluded:
userlinks.append(d['page'].link_to(request, text=_('Settings'),
querystr={'action': 'userprefs'}, id='userprefs', rel='nofollow'))
if request.user.valid:
if request.user.auth_method in request.cfg.auth_can_logout:
userlinks.append(d['page'].link_to(request, text=_('Logout'),
querystr={'action': 'logout', 'logout': 'logout'}, id='logout', rel='nofollow'))
else:
query = {'action': 'login'}
# special direct-login link if the auth methods want no input
if request.cfg.auth_login_inputs == ['special_no_input']:
query['login'] = '1'
if request.cfg.auth_have_login:
userlinks.append(d['page'].link_to(request, text=_("Login"),
querystr=query, id='login', rel='nofollow'))
userlinks_html = u'<span class="sep"> | </span>'.join(userlinks)
html = u'<div id="username">%s</div>' % userlinks_html
return html
开发者ID:happytk,项目名称:moin,代码行数:58,代码来源:modernized_mobile.py
示例7: handle_action
def handle_action(context, pagename, action_name='show'):
""" Actual dispatcher function for non-XMLRPC actions.
Also sets up the Page object for this request, normalizes and
redirects to canonical pagenames and checks for non-allowed
actions.
"""
_ = context.getText
cfg = context.cfg
# pagename could be empty after normalization e.g. '///' -> ''
# Use localized FrontPage if pagename is empty
if not pagename:
context.page = wikiutil.getFrontPage(context)
else:
context.page = Page(context, pagename)
if '_' in pagename and not context.page.exists():
pagename = pagename.replace('_', ' ')
page = Page(context, pagename)
if page.exists():
url = page.url(context)
return context.http_redirect(url)
msg = None
# Complain about unknown actions
if not action_name in get_names(cfg):
msg = _("Unknown action %(action_name)s.") % {
'action_name': wikiutil.escape(action_name), }
# Disallow non available actions
elif action_name[0].isupper() and not action_name in \
get_available_actions(cfg, context.page, context.user):
msg = _("You are not allowed to do %(action_name)s on this page.") % {
'action_name': wikiutil.escape(action_name), }
if not context.user.valid:
# Suggest non valid user to login
msg += " " + _("Login and try again.")
if msg:
context.theme.add_msg(msg, "error")
context.page.send_page()
# Try action
else:
from MoinMoin import action
handler = action.getHandler(context, action_name)
if handler is None:
msg = _("You are not allowed to do %(action_name)s on this page.") % {
'action_name': wikiutil.escape(action_name), }
if not context.user.valid:
# Suggest non valid user to login
msg += " " + _("Login and try again.")
context.theme.add_msg(msg, "error")
context.page.send_page()
else:
handler(context.page.page_name, context)
return context
开发者ID:happytk,项目名称:moin,代码行数:57,代码来源:wsgiapp.py
示例8: interwiki
def interwiki(self, d):
""" Assemble the interwiki name display, linking to page_front_page
@param d: parameter dictionary
@rtype: string
@return: interwiki html
"""
html = u''
if self.request.cfg.show_interwiki:
# Show our interwikiname or Self (and link to page_front_page)
pagename = wikiutil.getFrontPage(self.request).page_name
pagename = wikiutil.quoteWikinameURL(pagename)
link = wikiutil.link_tag(self.request, pagename, self.request.cfg.interwikiname or 'Self')
html = u'<div id="interwiki"><span>%s</span></div>' % link
return html
开发者ID:imosts,项目名称:flume,代码行数:15,代码来源:__init__.py
示例9: interwiki
def interwiki(self, d):
""" Assemble the interwiki name display, linking to page_front_page
@param d: parameter dictionary
@rtype: string
@return: interwiki html
"""
if self.request.cfg.show_interwiki:
page = wikiutil.getFrontPage(self.request)
text = self.request.cfg.interwikiname or 'Self'
link = page.link_to(self.request, text=text, rel='nofollow')
html = u'<span id="interwiki">%s<span class="sep">:</span></span>' % link
else:
html = u''
return html
开发者ID:Kartstig,项目名称:engineering-inventions-wiki,代码行数:15,代码来源:memodump.py
示例10: redirect_last_visited
def redirect_last_visited(request):
pagetrail = request.user.getTrail()
if pagetrail:
# Redirect to last page visited
last_visited = pagetrail[-1]
wikiname, pagename = wikiutil.split_interwiki(last_visited)
if wikiname != request.cfg.interwikiname and wikiname != 'Self':
wikitag, wikiurl, wikitail, error = wikiutil.resolve_interwiki(request, wikiname, pagename)
url = wikiurl + wikiutil.quoteWikinameURL(wikitail)
else:
url = Page(request, pagename).url(request)
else:
# Or to localized FrontPage
url = wikiutil.getFrontPage(request).url(request)
url = request.getQualifiedURL(url)
return abort(redirect(url))
开发者ID:happyxgang,项目名称:hd-moin,代码行数:16,代码来源:utils.py
示例11: logo
def logo(self):
""" Assemble logo with link to front page
The logo contain an image and or text or any html markup the
admin inserted in the config file. Everything it enclosed inside
a div with id="logo".
@rtype: unicode
@return: logo html
"""
html = 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)
html = u'''<div id="logo">%s</div>''' % logo
return html
开发者ID:imosts,项目名称:flume,代码行数:17,代码来源:__init__.py
示例12: _verify_endpoint_identity
def _verify_endpoint_identity(self, identity):
"""
Verify that the given identity matches the current endpoint.
We always serve out /UserName?action=... for the UserName
OpenID and this is pure paranoia to make sure it is that way
on incoming data.
Also verify that the given identity is allowed to have an OpenID.
"""
request = self.request
cfg = request.cfg
# we can very well split on the last slash since usernames
# must not contain slashes
base, received_name = rsplit(identity, '/', 1)
check_name = received_name
if received_name == '':
pg = wikiutil.getFrontPage(request)
if pg:
received_name = pg.page_name
check_name = received_name
if 'openid.user' in pg.pi:
received_name = pg.pi['openid.user']
# some sanity checking
# even if someone goes to http://johannes.sipsolutions.net/
# we'll serve out http://johannes.sipsolutions.net/JohannesBerg?action=serveopenid
# (if JohannesBerg is set as page_front_page)
# For the #OpenIDUser PI, we need to allow the page that includes the PI,
# hence use check_name here (see above for how it is assigned)
fullidentity = '/'.join([base, check_name])
thisurl = request.getQualifiedURL(request.page.url(request))
if not thisurl == fullidentity:
return False
# again, we never put an openid.server link on this page...
# why are they here?
if cfg.openid_server_restricted_users_group:
request.dicts.addgroup(request, cfg.openid_server_restricted_users_group)
if not request.dicts.has_member(cfg.openid_server_restricted_users_group, received_name):
return False
return True
开发者ID:steveyen,项目名称:moingo,代码行数:45,代码来源:serveopenid.py
示例13: logo
def logo(self):
""" Assemble logo with link to front page
Using <a> tag only instead of wrapping with div
The logo may contain an image and or text or any html markup.
Just note that everything is enclosed in <a> tag.
@rtype: unicode
@return: logo html
"""
html = u''
if self.cfg.logo_string:
page = wikiutil.getFrontPage(self.request)
html = page.link_to_raw(self.request, self.cfg.logo_string, css_class="navbar-brand")
html = u'''
<div class="navbar-brand-wrapper">
%s
</div>
''' % html
return html
开发者ID:Kartstig,项目名称:engineering-inventions-wiki,代码行数:20,代码来源:memodump.py
示例14: header
def header(self, d, **kw):
""" Assemble wiki header
@param d: parameter dictionary
@rtype: unicode
@return: page header html
"""
html = [
# Pre header custom html
self.emit_custom_html(self.cfg.page_header1),
self.username(d),
# '<div id="header">%s</div>' % self.logo(),
u'<div id="header"><div id="logo">%s %s</div></div>' % (wikiutil.getFrontPage(self.request).link_to_raw(self.request, 'PineTri'), u'오라클모니터링/튜닝도구'),
# Start of left panels.
u'<div id="sidebar">',
self.menubarpanel(d),
# Rick: rebuild below so we can put a cute little box around it: self.navibar(d),
self.navibarpanel(d),
# Rick: rebuild below so we can put a cute little box around it: self.searchform(d),
self.searchpanel(d),
# Rick: rebuild below so we can put a cute little box around it: self.trail(d),
self.trailpanel(d),
# Rick: rebuild below so we can put a cute little box around it: self.navibar(d),
self.editbarpanel(d),
u'</div>',
# Post header custom html (not recommended)
self.emit_custom_html(self.cfg.page_header2),
# Start of page
self.msg(d),
self.startPage(),
self.title_with_separators(d),
]
return u'\n'.join(html)
开发者ID:happytk,项目名称:moin,代码行数:41,代码来源:moniker19.py
示例15: menu
def menu(self, d):
"""
Build dropdown menu html. Incompatible with original actionsMenu() method.
Menu can be customized by adding a config variable 'memodump_menuoverride'.
The variable will override the default menu set.
Additional menu definitions are given via config method 'memodump_menu_def(request)'.
See the code below or project wiki for details.
@param d: parameter dictionary
@rtype: string
@return: menu html
"""
request = self.request
_ = request.getText
rev = request.rev
page = d['page']
page_recent_changes = wikiutil.getLocalizedPage(request, u'RecentChanges')
page_find_page = wikiutil.getLocalizedPage(request, u'FindPage')
page_help_contents = wikiutil.getLocalizedPage(request, u'HelpContents')
page_help_formatting = wikiutil.getLocalizedPage(request, u'HelpOnFormatting')
page_help_wikisyntax = wikiutil.getLocalizedPage(request, u'HelpOnMoinWikiSyntax')
page_title_index = wikiutil.getLocalizedPage(request, u'TitleIndex')
page_word_index = wikiutil.getLocalizedPage(request, u'WordIndex')
page_front_page = wikiutil.getFrontPage(request)
page_sidebar = Page(request, request.getPragma('sidebar', u'SideBar'))
quicklink = self.menuQuickLink(page)
subscribe = self.menuSubscribe(page)
try:
menu = request.cfg.memodump_menuoverride
except AttributeError:
# default list of items in dropdown menu.
# menu items are assembled in this order.
# see wiki for detailed info on customization.
menu = [
'===== Navigation =====',
'RecentChanges',
'FindPage',
'LocalSiteMap',
'__separator__',
'===== Help =====',
'HelpContents',
'HelpOnMoinWikiSyntax',
'__separator__',
'===== Display =====',
'AttachFile',
'info',
'raw',
'print',
'__separator__',
'===== Edit =====',
'RenamePage',
'DeletePage',
'revert',
'CopyPage',
'Load',
'Save',
'Despam',
'editSideBar',
'__separator__',
'===== User =====',
'quicklink',
'subscribe',
]
# menu element definitions
menu_def = {
'raw': {
# Title for this menu entry
'title': _('Raw Text'),
# href and args are for normal entries ('special': False), otherwise ignored.
# 'href': Nonexistent or empty for current page
'href': '',
# 'args': {'query1': 'value1', 'query2': 'value2', }
# Optionally specify this for <a href="href?query1=value1&query2=value2">
# If href and args are both nonexistent or empty, key is automatically interpreted to be an action name
# and href and args are automatically set.
'args': '',
# 'special' can be:
# 'disabled', 'removed', 'separator' or 'header' for whatever they say,
# False, None or nonexistent for normal menu display.
# 'separator' and 'header' are automatically removed when there are no entries to show among them.
'special': False,
},
'print': {'title': _('Print View'), },
'refresh': {
'title': _('Delete Cache'),
'special': not (self.memodumpIsAvailableAction(page, 'refresh') and page.canUseCache()) and 'removed',
},
'SpellCheck': {'title': _('Check Spelling'), },
'RenamePage': {'title': _('Rename Page'), },
'CopyPage': {'title': _('Copy Page'), },
'DeletePage': {'title': _('Delete Page'), },
'LikePages': {'title': _('Like Pages'), },
'LocalSiteMap': {'title': _('Local Site Map'), },
'MyPages': {'title': _('My Pages'), },
'SubscribeUser': {
'title': _('Subscribe User'),
#.........这里部分代码省略.........
开发者ID:Kartstig,项目名称:engineering-inventions-wiki,代码行数:101,代码来源:memodump.py
示例16: send_title
def send_title(self, text, **keywords):
""" Override
Output the page header (and title).
@param text: the title text
@keyword page: the page instance that called us - using this is more efficient than using pagename..
@keyword pagename: 'PageName'
@keyword print_mode: 1 (or 0)
@keyword editor_mode: 1 (or 0)
@keyword media: css media type, defaults to 'screen'
@keyword allow_doubleclick: 1 (or 0)
@keyword html_head: additional <head> code
@keyword body_attr: additional <body> attributes
@keyword body_onload: additional "onload" JavaScript code
"""
request = self.request
_ = request.getText
rev = request.rev
if keywords.has_key('page'):
page = keywords['page']
pagename = page.page_name
else:
pagename = keywords.get('pagename', '')
page = Page(request, pagename)
if keywords.get('msg', ''):
raise DeprecationWarning("Using send_page(msg=) is deprecated! Use theme.add_msg() instead!")
scriptname = request.script_root
# get name of system pages
page_front_page = wikiutil.getFrontPage(request).page_name
page_help_contents = wikiutil.getLocalizedPage(request, 'HelpContents').page_name
page_title_index = wikiutil.getLocalizedPage(request, 'TitleIndex').page_name
page_site_navigation = wikiutil.getLocalizedPage(request, 'SiteNavigation').page_name
page_word_index = wikiutil.getLocalizedPage(request, 'WordIndex').page_name
page_help_formatting = wikiutil.getLocalizedPage(request, 'HelpOnFormatting').page_name
page_find_page = wikiutil.getLocalizedPage(request, 'FindPage').page_name
home_page = wikiutil.getInterwikiHomePage(request) # sorry theme API change!!! Either None or tuple (wikiname,pagename) now.
page_parent_page = getattr(page.getParentPage(), 'page_name', None)
# set content_type, including charset, so web server doesn't touch it:
request.content_type = "text/html; charset=%s" % (config.charset, )
# Prepare the HTML <head> element
user_head = [request.cfg.html_head]
# include charset information - needed for moin_dump or any other case
# when reading the html without a web server
user_head.append('''<meta charset="%s">\n''' % (page.output_charset))
meta_keywords = request.getPragma('keywords')
meta_desc = request.getPragma('description')
if meta_keywords:
user_head.append('<meta name="keywords" content="%s">\n' % wikiutil.escape(meta_keywords, 1))
if meta_desc:
user_head.append('<meta name="description" content="%s">\n' % wikiutil.escape(meta_desc, 1))
# add meta statement if user has doubleclick on edit turned on or it is default
if (pagename and keywords.get('allow_doubleclick', 0) and
not keywords.get('print_mode', 0) and
request.user.edit_on_doubleclick):
if request.user.may.write(pagename): # separating this gains speed
user_head.append('<meta name="edit_on_doubleclick" content="%s">\n' % (request.script_root or '/'))
# search engine precautions / optimization:
# if it is an action or edit/search, send query headers (noindex,nofollow):
if request.query_string:
user_head.append(request.cfg.html_head_queries)
elif request.method == 'POST':
user_head.append(request.cfg.html_head_posts)
# we don't want to have BadContent stuff indexed:
elif pagename in ['BadContent', 'LocalBadContent', ]:
user_head.append(request.cfg.html_head_posts)
# if it is a special page, index it and follow the links - we do it
# for the original, English pages as well as for (the possibly
# modified) frontpage:
elif pagename in [page_front_page, request.cfg.page_front_page,
page_title_index, 'TitleIndex',
page_find_page, 'FindPage',
page_site_navigation, 'SiteNavigation',
'RecentChanges', ]:
user_head.append(request.cfg.html_head_index)
# if it is a normal page, index it, but do not follow the links, because
# there are a lot of illegal links (like actions) or duplicates:
else:
user_head.append(request.cfg.html_head_normal)
if 'pi_refresh' in keywords and keywords['pi_refresh']:
user_head.append('<meta http-equiv="refresh" content="%d;URL=%s">' % keywords['pi_refresh'])
# output buffering increases latency but increases throughput as well
output = []
output.append("""\
<!DOCTYPE html>
<html lang="%s">
<head>
%s
<meta name="viewport" content="width=device-width, initial-scale=1.0">
%s
%s
#.........这里部分代码省略.........
开发者ID:dmiyakawa,项目名称:moinmoin-bootstrap,代码行数:101,代码来源:bootstrap.py
示例17: navibar
def navibar(self, d):
""" Assemble the navibar
Changed: * textlogo added as first entry of the navibar
* name attrib added for accesskeys
"""
request = self.request
_ = request.getText
found = {} # pages we found. prevent duplicates
items = [] # navibar items
item = u'<li class="%s">%s</li>'
current = d['page_name']
# Add textlogo as first entry
items.append(item % ('wikilink', self.logo()))
found[wikiutil.getFrontPage(self.request).page_name] = 1
found[_('FrontPage', formatted=False)] = 1
# Process config navi_bar, eliminating dublicate to the FrontPage
if request.cfg.navi_bar:
for text in request.cfg.navi_bar:
pagename, link = self.splitNavilink(text)
if not pagename in found:
if pagename == current:
cls = 'wikilink current'
else:
cls = 'wikilink'
items.append(item % (cls, link))
found[pagename] = 1
# Add user links to wiki links, eliminating duplicates.
userlinks = request.user.getQuickLinks()
for text in userlinks:
# Split text without localization, user knows what he wants
pagename, link = self.splitNavilink(text, localize=0)
if not pagename in found:
if pagename == current:
cls = 'userlink current'
else:
cls = 'userlink'
items.append(item % (cls, link))
found[pagename] = 1
# Add current page at end
if not current in found:
# Try..except for backwards compatibility of Moin versions only
try:
title = d['page'].split_title()
except:
title = d['page'].split_title(request)
title = self.shortenPagename(title)
link = d['page'].link_to(request, title, name="navbar_current_page")
cls = 'current'
items.append(item % (cls, link))
# Assemble html
items = u''.join(items)
html = u'''
<ul id="navibar">
%s
</ul>
''' % items
return html
开发者ID:Glottotopia,项目名称:aagd,代码行数:63,代码来源:simplemente.py
示例18: title
def title(self, d):
""" Assemble breadcrumbs
Changed: - ImmutablePage added to the end of page name if page is not writeable
- Virtual page of an action causes a new crumb and is appended to the
end (i.e. to the underlying current wikipage)
@param d: parameter dictionary
@rtype: string
@return: title html
"""
_ = self.request.getText
content = []
curpage = ''
segments = d['page_name'].split('/')
for s in segments[:-1]:
curpage += s
if curpage == s:
content.append("%s" % Page(self.request, curpage).link_to(self.request, s))
else:
content.append(" / %s" % Page(self.request, curpage).link_to(self.request, s))
curpage += '/'
link_text = segments[-1]
# Check whether an action has created a virtual page. No backlinking in this case.
if d['title_text'] == d['page_name']:
link_title = _('Click to do a full-text search for this title')
link_query = {
'action': 'fullsearch',
'value': 'linkto:"%s"' % d['page_name'],
'context': '180', }
link = d['page'].link_to(self.request, link_text, querystr=link_query, title=link_title, css_class='backlink', rel='nofollow')
else:
curpage += link_text
link = Page(self.request, curpage).link_to(self.request, link_text)
# Show interwiki?
if self.cfg.interwikiname and self.cfg.show_interwiki:
page = wikiutil.getFrontPage(self.request)
text = self.request.cfg.interwikiname or 'Self'
interwiki = page.link_to(self.request, text=text, rel='nofollow')
content.insert(1, '%s : ' % interwiki)
if len(segments) > 1:
content.append(' / %s' % link)
else:
content.append('%s' % link)
# Check whether page ist writeable. If not: add a note on that
if not (d['page'].isWritable() and self.request.user.may.write(d['page'].page_name)):
content.append(' (%s)' % _('Immutable Page', formatted=False))
# Check whether an action has created a virtual page e.g. "Diff for..". Add this virtual page to the end of the breadcrumb navigation.
if d['title_text'] != d['page_name']:
content.append(' / %s' % wikiutil.escape(d['title_text']))
html = '''
<p id="pagelocation">
%s
</p>
''' % "".join(content)
return html
开发者ID:Glottotopia,项目名称:aagd,代码行数:62,代码来源:simplemente.py
示例19: credits
def credits(self, d, **keywords):
""" Create credits html from credits list
Changed: If no credits are set, the default Moin credits are disabled and replaced by
a Creative Common License hint for the wiki content.
"""
# Try..except for backwards compatibility of Moin versions only
try:
from MoinMoin.config.multiconfig import DefaultConfig
except:
from MoinMoin.multiconfig import DefaultConfig
page_credits = self.cfg.page_credits
cc_img = self.getImageURI('cc-wiki.png')
page = wikiutil.getFrontPage(self.request)
# Try..except for backwards compatibility of Moin versions only
try:
cc_src = page.link_to_raw(self.request, self.request.cfg.sitename)
except:
pagename = wikiutil.getFrontPage(self.request).page_name
pagename = wikiutil.quoteWikinameURL(pagename)
cc_src = wikiutil.link_tag(self.request, pagename, self.request.cfg.sitename)
_credits = u'''<div id="creditos">
<!--Creative Commons License-->
%s is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>
<br>
<img alt="Creative Commons License" style="border-width: 0" src="%s"/>.
<!--/Creative Commons License-->
</div>
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<requires rdf:resource="http://web.resource.org/cc/Notice"/>
<requires rdf:resource="http://web.resource.org/cc/Attribution"/>
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
<requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>
</License>
</rdf:RDF> -->''' % (cc_src, cc_img)
if self.cfg.page_credits != DefaultConfig.page_credits:
# Admin has set in wikiconfig.py new credits. Disable simplemente credits.
_credits = ''
else:
# Admin hasn't set new credits. Throw away the default credits and display simplemente credits only.
page_credits = []
if isinstance(page_credits, (list, tuple)):
if page_credits != []:
items = ['<li>%s</li>' % i for i in page_credits]
html = '<ul id="credits">\n%s\n</ul>%s\n' % (''.join(items), _credits)
else:
html = _credits
else:
# Old config using string, output as is
html = page_credits + _credits
return html
开发者ID:Glottotopia,项目名称:aagd,代码行数:63,代码来源:simplemente.py
示例20: print
return name not in page_filter
filter = name_filter
# get list of all pages in wiki
# hide underlay dir temporarily
underlay_dir = request.rootpage.cfg.data_underlay_dir
print(underlay_dir)
request.rootpage.cfg.data_underlay_dir = None
pages = request.rootpage.getPageList(user = '', exists = not convert_attic, filter = filter)
pages = dict(zip(pages, pages))
# restore
request.rootpage.cfg.data_underlay_dir = underlay_dir
# insert frontpage,
# so that MoinMoin frontpage gets saved as DokuWiki frontpage based on their configs
frontpage = wikiutil.getFrontPage(request)
if pages.has_key(frontpage.page_name):
del pages[frontpage.page_name]
pages[dw.getId()] = frontpage.page_name
converted = 0
for output, pagename in pages.items():
page = Page(request, pagename)
res = convertfile(page, output = output, overwrite = overwrite)
if res != None:
converted += 1
print "Processed %d files, converted %d" % (len(pages), converted)
if redirect_conf:
print "Writing %s: %d items" % (redirect_conf, len(redirect_map))
content = [u"\t".join(pair) for pair in redirect_map.items()]
开发者ID:mir3k,项目名称:moin2doku,代码行数:31,代码来源:moin2doku.py
注:本文中的MoinMoin.wikiutil.getFrontPage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论