User:Dbenbenn/bad-tags

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

SQL:

select page_namespace, page_title, tl_namespace, tl_title 
from page join templatelinks on tl_from = page_id 
where page_is_redirect = 0 
and tl_namespace not in ( 10, 100 ) 
and ( tl_namespace != 0 or tl_namespace != page_namespace ) 
and  ( tl_namespace != page_namespace or tl_title not like "%/%" ) 
and ( page_namespace != 6 or tl_namespace != 2 or tl_title not like "%/%" ) 
order by page_namespace, page_title

Wikify (sed)

sed -e 's/\([0-9]*\)\t\([^\t]*\)\t\(-\?[0-9]*\)\t\([^\t]*\)/* [[:\1:\2]] - <small>{{[[:\3:\4]]}}<\/small>/'

Namespaces (sed)

sed -e 's/\[\[:0:/\[\[/g' \
    -e 's/\[\[:1:/\[\[:Talk:/g' \
    -e 's/\[\[:2:/\[\[:User:/g' \
    -e 's/\[\[:3:/\[\[:User talk:/g' \
    -e 's/\[\[:4:/\[\[:Commons:/g' \
    -e 's/\[\[:5:/\[\[:Commons talk:/g' \
    -e 's/\[\[:6:/\[\[:Image:/g' \
    -e 's/\[\[:7:/\[\[:Image talk:/g' \
    -e 's/\[\[:8:/\[\[:MediaWiki:/g' \
    -e 's/\[\[:9:/\[\[:MediaWiki talk:/g' \
    -e 's/\[\[:10:/\[\[:Template:/g' \
    -e 's/\[\[:11:/\[\[:Template talk:/g' \
    -e 's/\[\[:14:/\[\[:Category:/g' \
    -e 's/\[\[:15:/\[\[:Category talk:/g'  \

All template inclusions, except:

  • inclusions of pages from the Template: and Creator: namespaces
  • inclusions from the main namespace into the main namespace (articles are often used as sections in other articles)
  • inclusions within the same namespace, if the template's name contains a "/" (subpages used as templates, for i18n stuff, etc)
  • inclusions from then User: namespace into the Image: namespace, if the template's name contains a "/" (custom image tags)

Things included in this listing, to be filtered in future:

  • User signature templates ("User:%/sig", etc)
  • Articles used as category headers (tl_ns = 0, page_ns = 14)
  • User:%/x templates in User: and User_talk: namespaces