changeset 3786:17ec10ccdae2

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 24 Jun 2008 12:47:10 +0200
parents 651f505bd9f1 (current diff) 951ed1df8ec3 (diff)
children f07963fce93a
files
diffstat 7 files changed, 76 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Tue Jun 24 12:46:36 2008 +0200
+++ b/MoinMoin/PageEditor.py	Tue Jun 24 12:47:10 2008 +0200
@@ -483,7 +483,8 @@
 
         # QuickHelp originally by Georg Mischler <schorsch@lightingwiki.com>
         markup = self.pi['format'] or request.cfg.default_markup
-        quickhelp = request.cfg.editor_quickhelp.get(markup, "")
+        parser = wikiutil.searchAndImportPlugin(self.request.cfg, "parser", markup)
+        quickhelp = getattr(parser, 'quickhelp', None)
         if quickhelp:
             request.write(request.formatter.div(1, id="editor-help"))
             request.write(_(quickhelp, wiki=True))
--- a/MoinMoin/config/multiconfig.py	Tue Jun 24 12:46:36 2008 +0200
+++ b/MoinMoin/config/multiconfig.py	Tue Jun 24 12:47:10 2008 +0200
@@ -4,6 +4,7 @@
 
     @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
                 2005-2008 MoinMoin:ThomasWaldmann.
+                2008      MoinMoin:JohannesBerg
     @license: GNU GPL, see COPYING for details.
 """
 
@@ -209,19 +210,27 @@
         This class contains the functionality for the DefaultConfig
         class for the benefit of the WikiConfig macro.
     """
+
+    # attributes of this class that should not be shown
+    # in the WikiConfig() macro.
+    cfg_mtime = None
+    siteid = None
+    cache = None
+    mail_enabled = None
+    jabber_enabled = None
+    auth_can_logout = None
+    auth_have_login = None
+    auth_login_inputs = None
+    _site_plugin_lists = None
+    _iwid = None
+    _iwid_full = None
+    xapian_searchers = None
+    moinmoin_dir = None
+    # will be lazily loaded by interwiki code when needed (?)
+    shared_intermap_files = None
+
     def __init__(self, siteid):
         """ Init Config instance """
-        # keep first!
-        settings = {}
-        for k in self.__dict__:
-            settings[k] = True
-
-        # will be assigned in by loader code (see above, _makeConfig)
-        self.cfg_mtime = None
-
-        # will be lazily loaded by interwiki code when needed (?)
-        self.shared_intermap_files = None
-
         self.siteid = siteid
         self.cache = CacheClass()
 
@@ -362,14 +371,6 @@
         if self.url_prefix_local is None:
             self.url_prefix_local = self.url_prefix_static
 
-        # keep last!!
-        self.computed_settings = {}
-        for k in self.__dict__:
-            if k in settings:
-                continue
-            self.computed_settings[k] = True
-
-
     _meta_dict = None
     def load_meta_dict(self):
         """ The meta_dict contains meta data about the wiki instance. """
@@ -827,58 +828,18 @@
     ('editor_force', False, "if True, force using the default editor"),
     ('editor_ui', 'freechoice', "Editor choice shown on the user interface, 'freechoice' or 'theonepreferred'"),
     ('page_license_enabled', False, 'if True, show a license hint in page editor.'),
-    ('editor_quickhelp', {
-        # editor markup hints quickhelp
-        # MUST be in wiki markup, even if the help is not for the wiki parser!
-        'wiki': _(u"""\
- Emphasis:: <<Verbatim('')>>''italics''<<Verbatim('')>>; <<Verbatim(''')>>'''bold'''<<Verbatim(''')>>; <<Verbatim(''''')>>'''''bold italics'''''<<Verbatim(''''')>>; <<Verbatim('')>>''mixed ''<<Verbatim(''')>>'''''bold'''<<Verbatim(''')>> and italics''<<Verbatim('')>>; <<Verbatim(----)>> horizontal rule.
- Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
- Lists:: space and one of: * bullets; 1., a., A., i., I. numbered items; 1.#n start numbering at n; space alone indents.
- Links:: <<Verbatim(JoinCapitalizedWords)>>; <<Verbatim([[target|linktext]])>>.
- Tables:: || cell text |||| cell text spanning 2 columns ||;    no trailing white space allowed after tables or titles.
-
-(!) For more help, see HelpOnEditing or SyntaxReference.
-"""),
-        'rst': _("""\
-{{{
-Emphasis: *italic* **bold** ``monospace``
-
-Headings: Heading 1  Heading 2  Heading 3
-          =========  ---------  ~~~~~~~~~
-
-Horizontal rule: ----
-
-Links: TrailingUnderscore_ `multi word with backticks`_ external_
-
-.. _external: http://external-site.example.org/foo/
-
-Lists: * bullets; 1., a. numbered items.
-}}}
-(!) For more help, see the
-[[http://docutils.sourceforge.net/docs/user/rst/quickref.html|reStructuredText Quick Reference]].
-"""),
-        'creole': _(u"""\
- Emphasis:: <<Verbatim(//)>>''italics''<<Verbatim(//)>>; <<Verbatim(**)>>'''bold'''<<Verbatim(**)>>; <<Verbatim(**//)>>'''''bold italics'''''<<Verbatim(//**)>>; <<Verbatim(//)>>''mixed ''<<Verbatim(**)>>'''''bold'''<<Verbatim(**)>> and italics''<<Verbatim(//)>>;
- Horizontal Rule:: <<Verbatim(----)>>
- Force Linebreak:: <<Verbatim(\\\\)>>
- Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
- Lists:: * bullets; ** sub-bullets; # numbered items; ## numbered sub items.
- Links:: <<Verbatim([[target]])>>; <<Verbatim([[target|linktext]])>>.
- Tables:: |= header text | cell text | more cell text |;
-
-(!) For more help, see HelpOnEditing or HelpOnCreoleSyntax.
-"""),
-    },
-    "Quickhelp provided at the bottom of edit pages.  To customize, specify a dictionary with key matching default_markup (e.g. 'wiki') and give a string value containing wiki markup."),
     ('edit_locking', 'warn 10', "Editor locking policy: `None`, `'warn <timeout in minutes>'`, or `'lock <timeout in minutes>'`"),
     ('edit_ticketing', True, None),
     ('edit_rows', 20, "Default height of the edit box"),
 
   )),
   # ==========================================================================
-  'pathes': ('Pathes', None, (
+  'paths': ('Paths', None, (
     ('data_dir', './data/', "Path to the data directory containing your (locally made) wiki pages."),
     ('data_underlay_dir', './underlay/', "Path to the underlay directory containing distribution system and help pages."),
+    ('cache_dir', None, "Directory for caching, by default computed from `data_dir`/cache."),
+    ('user_dir', None, "Directory for user storage, by default computed to be `data_dir`/user."),
+    ('plugin_dir', None, "Plugin directory, by default computed to be `data_dir`/user."),
 
     ('docbook_html_dir', r"/usr/share/xml/docbook/stylesheet/nwalsh/html/",
      'Path to the directory with the Docbook to HTML XSLT files (optional, used by the docbook parser). The default value is correct for Debian Etch.'),
--- a/MoinMoin/i18n/__init__.py	Tue Jun 24 12:46:36 2008 +0200
+++ b/MoinMoin/i18n/__init__.py	Tue Jun 24 12:47:10 2008 +0200
@@ -290,7 +290,7 @@
             # do not simply return trans with str, but recursively call
             # to get english translation, maybe formatted.
             # if we don't find an english "translation", we just format it
-            # on the fly (this is needed for cfg.editor_quickhelp).
+            # on the fly (this is needed for quickhelp).
             if lang != 'en':
                 logging.debug("falling back to english, requested string not in %r translation: %r" % (lang, original))
                 translated = getText(original, request, 'en', wiki=formatted, percent=percent)
--- a/MoinMoin/macro/WikiConfig.py	Tue Jun 24 12:46:36 2008 +0200
+++ b/MoinMoin/macro/WikiConfig.py	Tue Jun 24 12:47:10 2008 +0200
@@ -68,8 +68,6 @@
     for vname, value in iter_vnames(request.cfg):
         if hasattr(multiconfig.ConfigFunctionality, vname):
             continue
-        if vname in request.cfg.computed_settings:
-            continue
         if vname in settings and settings[vname] == value:
             continue
         found.append((vname, value))
--- a/MoinMoin/parser/text_creole.py	Tue Jun 24 12:46:36 2008 +0200
+++ b/MoinMoin/parser/text_creole.py	Tue Jun 24 12:47:10 2008 +0200
@@ -30,6 +30,8 @@
 
 Dependencies = []
 
+_ = lambda x: x
+
 class Parser:
     """
     Glue the DocParser and DocEmitter with the
@@ -39,6 +41,17 @@
     # Enable caching
     caching = 1
     Dependencies = Dependencies
+    quickhelp = _(u"""\
+ Emphasis:: <<Verbatim(//)>>''italics''<<Verbatim(//)>>; <<Verbatim(**)>>'''bold'''<<Verbatim(**)>>; <<Verbatim(**//)>>'''''bold italics'''''<<Verbatim(//**)>>; <<Verbatim(//)>>''mixed ''<<Verbatim(**)>>'''''bold'''<<Verbatim(**)>> and italics''<<Verbatim(//)>>;
+ Horizontal Rule:: <<Verbatim(----)>>
+ Force Linebreak:: <<Verbatim(\\\\)>>
+ Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
+ Lists:: * bullets; ** sub-bullets; # numbered items; ## numbered sub items.
+ Links:: <<Verbatim([[target]])>>; <<Verbatim([[target|linktext]])>>.
+ Tables:: |= header text | cell text | more cell text |;
+
+(!) For more help, see HelpOnEditing or HelpOnCreoleSyntax.
+""")
 
     def __init__(self, raw, request, **kw):
         """Create a minimal Parser object with required attributes."""
@@ -455,3 +468,5 @@
         # restore 'smart' formatting if it was set
         self.formatter.no_magic = magic_save
         return output
+
+del _
--- a/MoinMoin/parser/text_moin_wiki.py	Tue Jun 24 12:46:36 2008 +0200
+++ b/MoinMoin/parser/text_moin_wiki.py	Tue Jun 24 12:47:10 2008 +0200
@@ -20,6 +20,8 @@
 Dependencies = ['user'] # {{{#!wiki comment ... }}} has different output depending on the user's profile settings
 
 
+_ = lambda x: x
+
 class Parser:
     """
         Parse wiki format markup (and call the formatter to generate output).
@@ -33,6 +35,15 @@
     # allow caching
     caching = 1
     Dependencies = Dependencies
+    quickhelp = _(u"""\
+ Emphasis:: <<Verbatim('')>>''italics''<<Verbatim('')>>; <<Verbatim(''')>>'''bold'''<<Verbatim(''')>>; <<Verbatim(''''')>>'''''bold italics'''''<<Verbatim(''''')>>; <<Verbatim('')>>''mixed ''<<Verbatim(''')>>'''''bold'''<<Verbatim(''')>> and italics''<<Verbatim('')>>; <<Verbatim(----)>> horizontal rule.
+ Headings:: = Title 1 =; == Title 2 ==; === Title 3 ===; ==== Title 4 ====; ===== Title 5 =====.
+ Lists:: space and one of: * bullets; 1., a., A., i., I. numbered items; 1.#n start numbering at n; space alone indents.
+ Links:: <<Verbatim(JoinCapitalizedWords)>>; <<Verbatim([[target|linktext]])>>.
+ Tables:: || cell text |||| cell text spanning 2 columns ||;    no trailing white space allowed after tables or titles.
+
+(!) For more help, see HelpOnEditing or SyntaxReference.
+""")
 
     # some common strings
     CHILD_PREFIX = wikiutil.CHILD_PREFIX
@@ -1550,3 +1561,4 @@
         except wikiutil.PluginMissingError:
             self.parser = None
 
+del _
--- a/MoinMoin/parser/text_rst.py	Tue Jun 24 12:46:36 2008 +0200
+++ b/MoinMoin/parser/text_rst.py	Tue Jun 24 12:47:10 2008 +0200
@@ -170,9 +170,30 @@
                 setattr(self, attr, getattr(visitor, attr))
         self.output = html_escape_unicode(visitor.astext())
 
+# mark quickhelp as translatable
+_ = lambda x: x
+
 class Parser:
     caching = 1
     Dependencies = Dependencies # copy dependencies from module-scope
+    quickhelp = _("""\
+{{{
+Emphasis: *italic* **bold** ``monospace``
+
+Headings: Heading 1  Heading 2  Heading 3
+          =========  ---------  ~~~~~~~~~
+
+Horizontal rule: ----
+
+Links: TrailingUnderscore_ `multi word with backticks`_ external_
+
+.. _external: http://external-site.example.org/foo/
+
+Lists: * bullets; 1., a. numbered items.
+}}}
+(!) For more help, see the
+[[http://docutils.sourceforge.net/docs/user/rst/quickref.html|reStructuredText Quick Reference]].
+""")
 
     def __init__(self, raw, request, **kw):
         self.raw = raw
@@ -612,3 +633,4 @@
 if ErrorParser: # fixup in case of missing docutils
     Parser = ErrorParser
 
+del _