Jump to content

User:Davidgothberg/Test79

From Wikipedia, the free encyclopedia

Testing stuff for Template:IP-user other

[edit]

Link to IPv4 and IPv6 user pages, so I can test there:

User talk:201.83.25.59

User:2001:470:FD:3:0:0:0:80

User:2001:B011:7009:18A0:FC2F:9F5F:5B46:306E

User:2601:192:C180:322F:4C04:641C:A3C3:BDC7

Or even better: Test at Special:ExpandTemplates and set the IP-user pagenames above as "Context title".


((#titleparts:((PAGENAME))|1)))) makes it so for instance "User talk:201.83.25.59/Subpage" becomes: 201.83.25.59


Testing padleft to check the ":" positions in an IPv6 user pagename:

1: David

2: Davi:

3: Davidgothb

4: Davidgoth:

5: Not IPv6

6: +OTHER!+


25: {{IP-user other/core|page=201.83.25.59 }}
Below does not work on IPv4 pages since the magic word is sent instead of its value:
25b: {{IP-user other/core|page={{pagename}} }}
But with titleparts the value is sent, so works on IPv4 pages:
25c: {{IP-user other/core|page={{#titleparts:{{PAGENAME}}|1}} }}

25: IPv4

Below does not work on IPv4 pages since the magic word is sent instead of its value:

25b: other

But with titleparts the value is sent, so works on IPv4 pages:

25c: other


20: +{{IP-user other|IP text|Other text}}+
21: +{{IP-user other|IP=IP text|other=Other text}}+
22: +{{IP-user other|IPv4=IPv4 text|IPv6=IPv6 text|other=Other text}}+

20: +Other text+

21: +Other text+

22: +Other text+

23: +{{IP-user other/sandbox|IP text|Other text}}+
24: +{{IP-user other/sandbox|IP=IP text|other=Other text}}+
25: +{{IP-user other/sandbox|IPv4=IPv4 text|IPv6=IPv6 text|other=Other text}}+

23: +Other text+

24: +Other text+

25: +Other text+


30: +{{IP-user other| IP text | Other text | page = Talk:Sompage/subpage }}+
31: +{{IP-user other| IP = IP text | other = Other text | page = User talk:12.34.56.78/subpage }}+
32: +{{IP-user other| IPv4 = IPv4 text | IPv6 = IPv6 text | other = Other text | page = User:2001:B011:7009:18A0:FC2F:9F5F:5B46:306E }}+
33: +{{IP-user other| IPv4 = IPv4 text | IPv6 = IPv6 text | other = Other text | page = User:2001:470:FD:3:0:0:0:80 }}+

30: +Other text+

31: +IP text+

32: +IPv6 text+

33: +IPv6 text+


23: +{{#invoke:IPAddress|isIp|{{PAGENAME}}}}+
23: +{{#invoke:IPAddress|isIpV4|{{PAGENAME}}}}+
23: +{{#invoke:IPAddress|isIpV6|{{PAGENAME}}}}+

23: ++

23: +0+

23: +0+

NOTE! Module:IPAddress is white space sensitive. So leave no blanks around the pagename parameter above. Thus, the below code is wrong:

24: +{{#invoke:IPAddress|isIpV6| {{PAGENAME}} }}+

24: +0+

See {{IsIPAddress}}, Module:IPAddress and doc at Module talk:IPAddress.


MediaWiki:Anontalkpagetext

[edit]

MediaWiki:Anontalkpagetext is loaded when editing IPv4 users talk pages, but not when editing IPv6 users talk pages. It is loaded above MediaWiki:Talkpagetext. Then the editnotices load.

If I use the namespace editnotice Template:Editnotices/Namespace/User talk to load MediaWiki:Anontalkpagetext for IPv6 users it will end up below MediaWiki:Talkpagetext, thus not looking the same as for IPv4 users. So I have to load it from MediaWiki:Talkpagetext.

My entire code for MediaWiki:Talkpagetext :

{{#ifeq:{{NAMESPACE}}|{{ns:User talk}}
| {{#ifeq:{{ROOTPAGENAME}}|{{PAGENAME}}
  | {{IP-user other 
    | IPv6 = {{MediaWiki:Anontalkpagetext}}
    }}
  }}
}}{{fmbox
|type  = editnotice
|id    = talkpagetext
|image = none
|text  = This is a '''[[Help:Using talk pages|talk page]]'''. Please respect the [[Wikipedia:Talk page guidelines|talk page guidelines]], and remember to [[Wikipedia:Signatures|sign your posts]] by typing four tildes (<kbd>~~~~</kbd>).
}}


Alternative calling Module:IPAddress directly. But is messy:

{{#ifeq:{{NAMESPACE}}|{{ns:User talk}}
| {{#ifeq:{{ROOTPAGENAME}}|{{PAGENAME}}
  | {{#ifeq: {{#invoke:IPAddress|isIpV6|{{ROOTPAGENAME}}}} | 1
    | {{MediaWiki:Anontalkpagetext}}
    }}
  }}
}}{{fmbox
|type  = editnotice
|id    = talkpagetext
|image = none
|text  = This is a '''[[Help:Using talk pages|talk page]]'''. Please respect the [[Wikipedia:Talk page guidelines|talk page guidelines]], and remember to [[Wikipedia:Signatures|sign your posts]] by typing four tildes (<kbd>~~~~</kbd>).
}}

Oh, I found where MediaWiki:Anontalkpagetext actually is loaded. It is from MediaWiki:Newarticletext. So I should update that one to detect IPv6 pages instead. Where MediaWiki:Newarticletext currently has this code:

  }}<!--The below two ifeq-cases detects if it is an IP-user page 
        and then shows the MediaWiki:Anontalkpagetext.
-->{{#ifeq: {{#expr:{{PAGENAME}}}} | {{PAGENAME}}
  | 
  | {{#ifeq: {{#expr: {{PAGENAME}}}} | {{#expr: {{PAGENAME}}+deliberatesyntaxerror }}
    | 
    | {{MediaWiki:Anontalkpagetext|caller=MediaWiki:Newarticletext}}
    }}
  }}

Change to this code:

  }}<!--If on an IP-user talk page (both IPv4 and IPv6 works),
        then show the MediaWiki:Anontalkpagetext.
-->{{#ifeq:{{ROOTPAGENAME}}|{{PAGENAME}}
  | {{IP-user other | {{MediaWiki:Anontalkpagetext|caller=MediaWiki:Newarticletext}} }}
  }}

Alternative calling Module:IPAddress directly. But is messy:

  }}<!--If on an IP-user talk page (both IPv4 and IPv6 works),
        then show the MediaWiki:Anontalkpagetext.
-->{{#ifeq:{{ROOTPAGENAME}}|{{PAGENAME}}
  | {{#if: {{#invoke:IPAddress|isIp|{{ROOTPAGENAME}}}}
    | {{MediaWiki:Anontalkpagetext|caller=MediaWiki:Newarticletext}} 
    }}
  }}