Ricordisamoa has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179443

Change subject: Only capitalize titles if the namespace requires it
......................................................................

Only capitalize titles if the namespace requires it

Change-Id: Ibe06b004fc116bb19b77affdddf23e95141908e8
---
M scripts/cosmetic_changes.py
M scripts/image.py
M scripts/template.py
3 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/43/179443/1

diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index f1f1c2c..1fc958e 100755
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -646,7 +646,8 @@
                     new = ''
                 else:
                     new = '{{%s}}' % new
-                if not self.site.nocapitalize:
+                if getattr(self.site.namespaces[self.namespace],
+                           'case', None) == 'first-letter':
                     old = '[' + old[0].upper() + old[0].lower() + ']' + old[1:]
                 text = textlib.replaceExcept(
                     text,
diff --git a/scripts/image.py b/scripts/image.py
index 009478d..5132da7 100644
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -137,7 +137,7 @@
 
         replacements = []
 
-        if not self.site.nocapitalize:
+        if getattr(self.site.namespaces[6], 'case', None) == 'first-letter':
             case = re.escape(self.old_image[0].upper() +
                              self.old_image[0].lower())
             escaped = '[' + case + ']' + re.escape(self.old_image[1:])
diff --git a/scripts/template.py b/scripts/template.py
index de98b32..15903fd 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -177,7 +177,7 @@
         templatePatterns = []
         for template in self.templates:
             templatePattern = template.title(withNamespace=False)
-            if not pywikibot.Site().nocapitalize:
+            if getattr(mysite.namespaces[10], 'case', None) == 'first-letter':
                 templatePattern = '[%s%s]%s' % (templatePattern[0].upper(),
                                                 templatePattern[0].lower(),
                                                 templatePattern[1:])

-- 
To view, visit https://gerrit.wikimedia.org/r/179443
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe06b004fc116bb19b77affdddf23e95141908e8
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisa...@openmailbox.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to