1
# -*- coding: iso-8859-1 -*-
5
print a list of pages whose title matches the search term
7
@copyright: @copyright: 2001-2003 Juergen Hermann <jh@web.de>,
8
2003-2008 MoinMoin:ThomasWaldmann
9
2008 MoinMoin:ReimarBauer
10
@license: GNU GPL, see COPYING for details.
13
Dependencies = ["namespace"]
14
from MoinMoin import search, wikiutil
16
def execute(macro, args):
20
# If called with empty or no argument, default to regex search for .+, the full page list.
21
needle = wikiutil.get_unicode(macro.request, args, 'needle', u'regex:.+')
23
# With whitespace argument, return same error message as FullSearch
24
if not needle.strip():
25
err = _('Please use a more selective search term instead of {{{"%s"}}}', wiki=True) % needle
26
return '<span class="error">%s</span>' % err
28
# Return a title search for needle, sorted by name.
30
results = search.searchPages(macro.request, needle,
31
titlesearch=1, case=case,
33
ret = results.pageList(macro.request, macro.formatter, paging=False)
35
# same error as in MoinMoin/action/fullsearch.py, keep it that way!
36
ret = ''.join([macro.formatter.text('<<PageList('),
37
_('Your search query {{{"%s"}}} is invalid. Please refer to '
38
'HelpOnSearching for more information.', wiki=True,
39
percent=True) % wikiutil.escape(needle),
40
macro.formatter.text(')>>')])