# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - localnames action

    This action generates a LocalNames description file.

    You need to define wiki_url_prefix in your moin_config.py
    file, in order for this to work. For example, if your
    wiki's URLs all began with "http://wiki.taoriver.net/moin.cgi/",
    then you would add the following line to moin_config.py:

      wiki_url_prefix = "http://wiki.taoriver.net/moin.cgi/"

    You could then access the LocalNames description at:

      http://wiki.taoriver.net/moin.cgi/?action=localnames

    ...provided that this file is named localnames.py

    @copyright: (c) 2004 by Lion Kimbro <lion@speakeasy.org>
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin import config


output = """Content-Type: text/plain

                       Local Names Description
                       -----------------------

        automatically generated by MoinMoin localnames plug-in

This page is:  %(WIKI_URL_PREFIX)s?action=localnames

Description follows:
----------------------------------------------------------------------

  http://purl.net/net/localnames/

  NamesTable
    this %(WIKI_URL_PREFIX)s?action=localnames

  NamesListPattern %(WIKI_URL_PREFIX)s$NAME
  NamesList %(WIKI_URL_PREFIX)sTitleIndex?action=titleindex

  LastResortNamePattern %(WIKI_URL_PREFIX)s$NAME

  KeyValue ACCEPT-ADDITION-BY-FORM %(WIKI_URL_PREFIX)s$NAME

""" % { "WIKI_URL_PREFIX": config.wiki_url_prefix }

def execute(pagename, request):
    request.write( output )
    request.no_closing_html_code = True

