Jdlrobson has uploaded a new change for review.

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


Change subject: Bug 31876: Add an html validation test to Makefile
......................................................................

Bug 31876: Add an html validation test to Makefile

This shows we have 3 errors in main namespace and 2 in special
namespace. Both appear to be core issues which would be great to fix.

Bug: 31876

Change-Id: I1414e2fbc71b090e07d4a1073ee3b6f3159f3759
---
M .gitignore
M Makefile
A scripts/w3c-validate.sh
3 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/75/61775/1

diff --git a/.gitignore b/.gitignore
index a564408..fca4c38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@
 .idea/
 node_modules/
 .lessignore
+tmp/
+
diff --git a/Makefile b/Makefile
index 156ead4..e9c50ef 100644
--- a/Makefile
+++ b/Makefile
@@ -26,3 +26,6 @@
        ln -sf ${PWD}/scripts/pre-commit .git/hooks/pre-commit
        ln -sf ${PWD}/scripts/pre-rebase .git/hooks/pre-rebase
        ln -sf ${PWD}/scripts/post-rewrite .git/hooks/post-rewrite
+
+validatehtml: # user must create W3CValidationTest wiki page with text 'Hello 
world' for this to work
+       @scripts/w3c-validate.sh
diff --git a/scripts/w3c-validate.sh b/scripts/w3c-validate.sh
new file mode 100755
index 0000000..df19702
--- /dev/null
+++ b/scripts/w3c-validate.sh
@@ -0,0 +1,17 @@
+wget $MEDIAWIKI_URL/index.php/W3CValidationTest?useformat=mobile -O 
tmp/sample.html
+wget $MEDIAWIKI_URL/index.php/Special:MobileOptions?useformat=mobile -O 
tmp/special_sample.html
+curl -sSF 'uploaded_file=@tmp/sample.html;type=text/html' -F output=json 
http://validator.w3.org/check > tmp/validate_page.json
+curl -sSF 'uploaded_file=@tmp/special_sample.html;type=text/html' -F 
output=json http://validator.w3.org/check > tmp/validate_special_page.json
+
+#check the validation results of a page in the main namespace
+if grep -q '"type": "error"' tmp/validate_page.json
+then
+       num=`grep -c '"type": "error"' tmp/validate_page.json`
+       echo $num validation errors found in main namespace page [see 
tmp/validate_page.json]
+fi
+#check the validation results of a page in the special namespace
+if grep -q '"type": "error"' tmp/validate_special_page.json
+then
+       num=`grep -c '"type": "error"' tmp/validate_special_page.json`
+       echo $num validation errors found in special page html markup [see 
tmp/validate_special_page.json]
+fi

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1414e2fbc71b090e07d4a1073ee3b6f3159f3759
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to