Sn1per has uploaded a new change for review.
https://gerrit.wikimedia.org/r/262668
Change subject: Add docstring for
cosmetic_changes.CosmeticChangesToolkit.cleanUpLinks
......................................................................
Add docstring for cosmetic_changes.CosmeticChangesToolkit.cleanUpLinks
Bug: T118423
Change-Id: I1b655412a4dfaf4c287658d5a012d3bbb46de7e7
---
M pywikibot/cosmetic_changes.py
1 file changed, 14 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/68/262668/1
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 8aabc09..365a4db 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -467,6 +467,20 @@
return text
def cleanUpLinks(self, text):
+ """Tidy up wikilinks found in a string.
+
+ This function will:
+ * Replace underscores with spaces
+ * Move leading and trailing spaces out of the wikilink and into the
surrounding text
+ * Convert URL-encoded characters into Unicode-encoded characters
+ * Move trailing characters out of the link and make the link without
using a pipe, if possible
+ * Capitalize the article title of the link, if appropriate
+
+ @param text: string to perform the clean-up on
+ @type text: str
+ @return: text with tidied wikilinks
+ @rtype: str
+ """
# helper function which works on one link and either returns it
# unmodified, or returns a replacement.
def handleOneLink(match):
--
To view, visit https://gerrit.wikimedia.org/r/262668
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b655412a4dfaf4c287658d5a012d3bbb46de7e7
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Sn1per <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits