matej_suchanek added a comment.

Broken test:

self.assertEqual('text [[title]] text',
                 self.cct.cleanUpLinks('text[[ title ]]text'))
self.assertEqual('text [[title|name]] text',
                 self.cct.cleanUpLinks('text[[ title | name ]]text'))
self.assertEqual('text[[title|name]]text',
                 self.cct.cleanUpLinks('text[[ title |name]]text'))
self.assertEqual('text [[title|name]]text',
                 self.cct.cleanUpLinks('text[[title| name]]text'))

Live code:

if not trailingChars:
    labelLength = len(label)
    label = label.rstrip()
    hadTrailingSpaces = len(label) != labelLength

The results are instead:

  1. text [[title ]]text - the space cannot be moved outside because of if not trailingChars:
  2. text [[title|name ]]text - same bug
  3. text[[title|nametext]] - linktrail goes inside the text
  4. text [[title|nametext]] - same bug

Fix for the last two is trivial, but the first two require some brainstorming because MediaWiki parses [[title ]]text to [[title|title text]], not [[title]] text which is the inteded result.


TASK DETAIL
https://phabricator.wikimedia.org/T130918

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: matej_suchanek
Cc: matej_suchanek, Aklapper, Xqt, pywikibot-bugs-list, Magul, Tbscho, MayS, Mdupont, JJMC89, jayvdb, Wesalius, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to