Commits

sharky93 committed cd78c85 Merge

Merged

Comments (0)

Files changed (17)

MoinMoin/_tests/test_wikiutil.py

     def test_anchor_name_encoding(self):
         tests = [
             # text, expected output
-            (u'\xf6\xf6ll\xdf\xdf', 'A_APYA9g-ll_AN8A3w-'),
+            # note: recent werkzeug encodes a "+" to %2B, giving .2B in the end
+            (u'\xf6\xf6ll\xdf\xdf', 'A.2BAPYA9g-ll.2BAN8A3w-'),
             (u'level 2', 'level_2'),
             (u'level_2', 'level_2'),
             (u'', 'A'),

MoinMoin/apps/frontend/_tests/test_frontend.py

     def test_index(self):
         self._test_view('frontend.index', status='200 OK', viewopts=dict(item_name='DoesntExist'))
 
+    def test_refs(self):
+        self._test_view('frontend.refs', status='200 OK', viewopts=dict(item_name='DoesntExist'))
+
+    def test_forwardrefs(self):
+        self._test_view('frontend.forwardrefs', status='200 OK', viewopts=dict(item_name='DoesntExist'))
+
     def test_backrefs(self):
         self._test_view('frontend.backrefs', status='200 OK', viewopts=dict(item_name='DoesntExist'))
 

MoinMoin/apps/frontend/views.py

 Disallow: /+similar_names/
 Disallow: /+quicklink/
 Disallow: /+subscribe/
+Disallow: /+refs/
+Disallow: /+forwardrefs/
 Disallow: /+backrefs/
 Disallow: /+wanteds/
 Disallow: /+orphans/
     """
     Returns the list of all items the current user has contributed to.
 
-    :returns: a page with all the items which link or transclude item_name
+    :returns: a page with all the items the current user has contributed to
     """
     my_changes = _mychanges(flaskg.user.itemid)
     return render_template('link_list_no_item_panel.html',
     return [rev.name for rev in revs]
 
 
+@frontend.route('/+refs/<itemname:item_name>')
+def refs(item_name):
+    """
+    Returns the list of all incoming/outgoing links or transclusions of item item_name
+
+    :param item_name: the name of the current item
+    :type item_name: unicode
+    :returns: a page with all incoming/outgoing item links of this item
+    """
+    refs = _forwardrefs(item_name)
+    backrefs = _backrefs(item_name)
+    return render_template('refs.html',
+                           item_name=item_name,
+                           refs=refs,
+                           backrefs=backrefs
+    )
+
+
+@frontend.route('/+forwardrefs/<itemname:item_name>')
+def forwardrefs(item_name):
+    """
+    Returns the list of all links or transclusions of item item_name
+
+    :param item_name: the name of the current item
+    :type item_name: unicode
+    :returns: a page with all the items linked from this item
+    """
+    refs = _forwardrefs(item_name)
+    return render_template('link_list_item_panel.html',
+                           item_name=item_name,
+                           headline=_(u"Items that are referred by '%(item_name)s'", item_name=item_name),
+                           item_names=refs
+    )
+
+
+def _forwardrefs(item_name):
+    """
+    Returns a list with all names of items that get referenced from item_name
+
+    :param item_name: the name of the current item
+    :type item_name: unicode
+    :returns: the list of all items which are referenced from this item
+    """
+    q = {WIKINAME: app.cfg.interwikiname,
+         NAME_EXACT: item_name,
+        }
+    rev = flaskg.storage.document(**q)
+    if rev is None:
+        refs = []
+    else:
+        refs = rev.meta.get(ITEMLINKS, []) + rev.meta.get(ITEMTRANSCLUSIONS, [])
+    return refs
+
+
 @frontend.route('/+backrefs/<itemname:item_name>')
 def backrefs(item_name):
     """

MoinMoin/config/default.py

             except (KeyError, ValueError):
                 raise error.ConfigurationError(
                     "You must set a (at least {0} chars long) secret string for secrets['{1}']!".format(
-                    secret_min_length, secret_key_name))
+                        secret_min_length, secret_key_name))
 
         from passlib.context import CryptContext
         try:
             ('frontend.rename_item', L_('Rename'), L_('Rename this item'), True, ),
             ('frontend.delete_item', L_('Delete'), L_('Delete this item'), True, ),
             ('frontend.destroy_item', L_('Destroy'), L_('Completely destroy this item'), True, ),
-            ('frontend.backrefs', L_('Referrers'), L_('What refers here?'), False, ),
+            ('frontend.refs', L_('References'), L_('Show incoming and outgoing references'), False, ),
             ('frontend.sitemap', L_('Site Map'), L_('Local Site Map of this item'), True, ),
             ('frontend.similar_names', L_('Similar'), L_('Items with similar names'), False, ),
         ], 'list of edit bar entries (list of tuples (endpoint, label))'),
     )),
 
     'ns': ('Storage Namespaces',
-    "Storage namespaces can be defined for all sorts of data. All items sharing a common namespace as prefix" +
-    "are then stored within the same backend. The common prefix for all data is ''.",
-    (
+           "Storage namespaces can be defined for all sorts of data. "
+           "All items sharing a common namespace as prefix are then stored within the same backend. "
+           "The common prefix for all data is ''.", (
         ('content', '/', "All content is by default stored below /, hence the prefix is ''."),  # Not really necessary. Just for completeness.
         ('user_profile', 'UserProfile/', 'User profiles (i.e. user data, not their homepage) are stored in this namespace.'),
         ('user_homepage', 'User/', 'All user homepages are stored below this namespace.'),

MoinMoin/converter/_tests/test_docbook_in.py

                 '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
             # ORDERED LIST with upperalpha numeration --> ordered list with upper-alpha list-style-type
             ('<article><orderedlist numeration="upperalpha"><listitem>Ordered Item 1</listitem><listitem>Ordered Item 2</listitem></orderedlist></article>',
-            # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="upper-alpha"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
+             # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="upper-alpha"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
                 '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="upper-alpha"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
             # ORDERED LIST with loweralpha numeration --> ordered list with lower-alpha list-style-type
             ('<article><orderedlist numeration="loweralpha"><listitem>Ordered Item 1</listitem><listitem>Ordered Item 2</listitem></orderedlist></article>',

MoinMoin/converter/_tests/test_mediawiki_in.py

 |test
 |}
 """, u'<page><body><table style="border-width: 1px;"><table-body><table-row><table-cell number-columns-spanned="2" style="border-style: solid; border-width: 1px">Orange\nApple</table-cell></table-row><table-row><table-cell number-rows-spanned="2">Bread</table-cell><table-cell>Pie</table-cell></table-row><table-row><table-cell>test</table-cell></table-row></table-body></table></body></page>'),
-("""{|
+            ("""{|
 |class="test"|text||style="border:1px"|test
 |}
 """, u'<page><body><table><table-body><table-row><table-cell class="test">text</table-cell><table-cell style="border:1px">test</table-cell></table-row></table-body></table></body></page>'),

MoinMoin/items/__init__.py

     def modify(self, meta, data, comment=u'', contenttype_guessed=None, **update_meta):
         meta = dict(meta)  # we may get a read-only dict-like, copy it
         # get rid of None values
-        update_meta = {key:value for key, value in update_meta.items() if value is not None}
+        update_meta = {key: value for key, value in update_meta.items() if value is not None}
         meta.update(update_meta)
         return self._save(meta, data, contenttype_guessed=contenttype_guessed, comment=comment)
 

MoinMoin/macro/_tests/test_Date.py

         expected = 1312695491.0
         assert result == expected
         result = format_datetime(datetime.utcfromtimestamp(result))
-        expected = u'Aug 7, 2011 5:38:11 AM'
+        expected = u'Aug 7, 2011, 5:38:11 AM'  # comma after year was added in recent CLDR
         assert result == expected
         with pytest.raises(ValueError):
             # things after next 10,000 years can't be predicted

MoinMoin/macro/_tests/test_DateTime.py

 
     arguments = ['2011-08-07T11:11:11', 'argument2']
     result = macro_obj.macro('content', arguments, 'page_url', 'alternative')
-    expected = u'Aug 7, 2011 11:11:11 AM'
+    expected = u'Aug 7, 2011, 11:11:11 AM'  # comma after year was added in recent CLDR
     assert result == expected
 
     arguments = ['incorrect_argument']

MoinMoin/templates/base.html

     {% block head_links %}
 
     {% block bootstrap_stylesheet %}
-    <link rel="stylesheet" href="{{ url_for('serve.files', name='bootstrap', filename='bootstrap/css/bootstrap.css') }}" />
+    <link rel="stylesheet" href="{{ url_for('serve.files', name='bootstrap', filename='css/bootstrap.css') }}" />
+    {% endblock %}
+
+    {% block icons_stylesheet %}
+    <link rel="stylesheet" href="{{ url_for('serve.files', name='font_awesome', filename='css/font-awesome.css') }}" />
     {% endblock %}
 
     <link rel="shortcut icon" href="{{ url_for('static', filename='logos/favicon.ico') }}" />
     <script src="{{ url_for('serve.files', name='jquery', filename='jquery.min.js') }}"></script>
     <script src="{{ url_for('static', filename='js/jquery.i18n.min.js') }}"></script>
     <script src="{{ url_for('frontend.template', filename='dictionary.js') }}"></script>
+    <script src="{{ url_for('serve.files', name='bootstrap', filename='js/bootstrap.min.js') }}"></script>
     <script src="{{ url_for('static', filename='js/common.js') }}"></script>
     {{ scripts }}
     <!--[if lt IE 9]>

MoinMoin/templates/itemviews.html

             {%- if endpoint in [
                 'frontend.show_item', 'frontend.index', 'frontend.highlight_item',
                 'frontend.show_item_meta', 'frontend.download_item',
-                'frontend.history', 'frontend.backrefs', 'frontend.sitemap',
+                'frontend.history', 'frontend.refs', 'frontend.sitemap',
                 'frontend.similar_names', 'frontend.copy_item',
             ] %}
                 <li>

MoinMoin/templates/refs.html

+{% extends theme("show.html") %}
+{% block content %}
+<h1>{{ _('Outgoing Item References') }}</h1>
+<ul>
+    {% for item_name in refs|sort %}
+    <li><a href="{{ url_for('frontend.show_item', item_name=item_name) }}">{{ item_name }}</a></li>
+    {% endfor %}
+</ul>
+<h1>{{ _('Incoming Item References') }}</h1>
+<ul>
+    {% for item_name in backrefs|sort %}
+    <li><a href="{{ url_for('frontend.show_item', item_name=item_name) }}">{{ item_name }}</a></li>
+    {% endfor %}
+</ul>
+{% endblock %}

MoinMoin/translations/pt_BR/LC_MESSAGES/messages.po

 #: MoinMoin/templates/destroy.html:20
 #, fuzzy, python-format
 msgid "DESTROY REVISION '%(item_name)s' (rev %(rev_id)s)"
-msgstr "Reverter '%(item_name)s' (rev %(rev_no)d)"
+msgstr "Reverter '%(item_name)s' (rev %(rev_id)s)"
 
 #: MoinMoin/templates/diff.html:4
 #, fuzzy, python-format
 #: MoinMoin/templates/revert.html:4
 #, fuzzy, python-format
 msgid "Revert '%(item_name)s' (rev %(rev_id)s)"
-msgstr "Reverter '%(item_name)s' (rev %(rev_no)d)"
+msgstr "Reverter '%(item_name)s' (rev %(rev_id)s)"
 
 #: MoinMoin/templates/search.html:16
 #, python-format
 #: MoinMoin/templates/search.html:59
 #, fuzzy, python-format
 msgid "Revision: %(revid)s Last Change: %(mtime)s"
-msgstr "Revisão %(revno)d em %(date_time)s"
+msgstr "Revisão %(revid)s em %(mtime)s"
 
 #: MoinMoin/templates/search.html:67
 msgid "You don't have read permission for this item."
 #: MoinMoin/templates/show_nonexistent.html:5
 #, fuzzy, python-format
 msgid "Item '%(name)s' does not exist."
-msgstr "%(item_name)s não existe. Criar?"
+msgstr "%(name)s não existe. Criar?"
 
 #: MoinMoin/templates/sitemap.html:3
 #, fuzzy, python-format

MoinMoin/translations/ru/LC_MESSAGES/messages.po

 #: MoinMoin/templates/destroy.html:20
 #, fuzzy, python-format
 msgid "DESTROY REVISION '%(item_name)s' (rev %(rev_id)s)"
-msgstr "Вернуть «%(item_name)s» (вер. %(rev_no)d)"
+msgstr "Вернуть «%(item_name)s» (вер. %(rev_id)s)"
 
 #: MoinMoin/templates/diff.html:4
 #, fuzzy, python-format
 #: MoinMoin/templates/revert.html:4
 #, fuzzy, python-format
 msgid "Revert '%(item_name)s' (rev %(rev_id)s)"
-msgstr "Вернуть «%(item_name)s» (вер. %(rev_no)d)"
+msgstr "Вернуть «%(item_name)s» (вер. %(rev_id)s)"
 
 #: MoinMoin/templates/search.html:16
 #, python-format
 #: MoinMoin/templates/search.html:59
 #, fuzzy, python-format
 msgid "Revision: %(revid)s Last Change: %(mtime)s"
-msgstr "Версия: %(revno)d на момент %(date_time)s"
+msgstr "Версия: %(revid)s на момент %(mtime)s"
 
 #: MoinMoin/templates/search.html:67
 msgid "You don't have read permission for this item."
 #: MoinMoin/templates/show_nonexistent.html:5
 #, fuzzy, python-format
 msgid "Item '%(name)s' does not exist."
-msgstr "Объект %(item_name)s не существет. Создать его?"
+msgstr "Объект %(name)s не существет. Создать его?"
 
 #: MoinMoin/templates/sitemap.html:3
 #, fuzzy, python-format
  *.py E125  # continuation line does not distinguish itself from next logical line (difficult to avoid!)
  *.py E501  # maximum line length (see also pep8maxlinelength)
  MoinMoin/config/default.py E501  # maximum line length (long lines expected there)
+ MoinMoin/config/default.py E122  # continuation line missing indentation or outdented
  MoinMoin/constants/chartypes.py E501  # auto-generated, long lines
  wikiconfig_*.py ALL  # local stuff, not in the repo
  MoinMoin/script/migration/moin19/_logfile19.py ALL  # legacy code "as is"
     dependency_links=[
         #'https://github.com/mitsuhiko/werkzeug/tarball/master#egg=Werkzeug-0.9.2-dev',
         #'https://github.com/mitsuhiko/flask/tarball/master#egg=Flask-0.11-dev',
-        'https://bitbucket.org/thomaswaldmann/whoosh/get/default.tar.gz#egg=Whoosh-2.5.99dev',
+        #'https://bitbucket.org/thomaswaldmann/whoosh/get/default.tar.gz#egg=Whoosh-2.5.99dev',
         # use a pre-release and fixed flask-themes 0.2.0 as 0.1.3 does not work for flask 0.8.x:
         'https://bitbucket.org/thomaswaldmann/flask-themes/get/a87399231886.tar.gz#egg=Flask-Themes-0.2.0',
         # use a pre-release emeraldtree (port to 2.6/2.7/3.3):
                               # likely due to the fixtures changes.
         'pytest-pep8<1.0.3',  # coding style checker
                               # note: pytest-pep8 1.0.3 needs pytest 2.3
-        # 'whoosh>=2.4.0',  # needed for indexed search
         'whoosh>=2.5.0',  # needed for indexed search
         'sphinx>=1.1',  # needed to build the docs
         'pdfminer',  # pdf -> text/plain conversion
         'passlib>=1.6.0',  # strong password hashing (1.6 needed for consteq)
         'XStatic>=0.0.2',  # support for static file pypi packages
-        'XStatic-Bootstrap>=2.1.0.1',
+        'XStatic-Bootstrap>=3.0.0.1',
+        'XStatic-Font-Awesome>=3.2.1.1',
         'XStatic-CKEditor>=3.6.1.2',
         'XStatic-jQuery>=1.8.2',
         'XStatic-jQuery-File-Upload>=4.4.2',
         'jquery', 'jquery_file_upload',
         'json_js',
         'bootstrap',
+        'font_awesome',
         'ckeditor',
         'svgweb',
         'svgedit_moin', 'twikidraw_moin', 'anywikidraw',