Attachment 'FullSearchWithoutSelf.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - FullSearchWithoutSelf Macro
   4 
   5     [[FullSearchWithoutSelf]]
   6         does the same as clicking on the page title, only that
   7         the result is embedded into the page and the page itself isn't listed.
   8 
   9 """
  10 
  11 import re
  12 from MoinMoin import config, wikiutil, search
  13 
  14 Dependencies = ["pages"]
  15 
  16 def execute(macro, needle):
  17     request = macro.request
  18     _ = request.getText
  19 
  20     needle = '"%s" -title:regex:"^%s$"' % (macro.formatter.page.page_name, macro.formatter.page.page_name)
  21     needle = needle.strip()
  22 
  23     # Search the pages and return the results
  24     query = search.QueryParser().parse_query(needle)
  25     results = search.searchPages(request, query)
  26     results.sortByPagename()
  27 
  28     return results.pageList(request, macro.formatter)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2006-03-24 13:37:45, 0.8 KB) [[attachment:FullSearchWithoutSelf.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.