jenkins-bot has submitted this change and it was merged.

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, 20 insertions(+), 0 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 8aabc09..f466b89 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -467,6 +467,26 @@
         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: merged
Gerrit-Change-Id: I1b655412a4dfaf4c287658d5a012d3bbb46de7e7
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Sn1per <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to