Template talk:Xsign
This is the discussion/talk page for: Template:Xsign.
Created
editThe auto-signature Template:Xsign was created by long-term user Xeno on 15:13, 8 June 2010, to set the posting signature from the timestamp/username data displayed on a history-tab page of revision history. -Wikid77 (talk) 22:53, 30 July 2010 (UTC)
Specifying the offset of username substring
editThe template needs to be modified and checked, for each possible 3-letter month-name string, to exactly align the username parameter (the {str_right} parameter) for each use of {{unsigned}}, by resetting to specify the correct offset (as 18, 19, 20, etc.) when using {{str right}}. For example, when the month-string is "Jul" then use offset 20, but for month "uly" then use offset 19 in {str_right}. In general, the offset (in {str_right} for username) will be 1 less when the month-string omits the first letter of the month name. To test alignment, use edit-preview with a line to test each month name, putting default data in parameter {1}, as follows:
- : {{{{{|safesubst:}}}unsigned|{{{{{|safesubst:}}}str right|{{{1|22:58, 14 July 2010 Xyz7}}}|20}}|{{{{{|safesubst:}}}str left|{{{1|22:58, 14 July 2010 Xyz7}}}|19}} (UTC)}}
The default data in parameter 1, for timestamp and username, should be set for each of 24 cases: specifically, for each of 12 month names, with either 1-digit or 2-digit days (such as "4" or "14"). Then adjust each case for the offset in {str_right} as 19, 20, 22, or 23, etc. Note, when finished, the offset for September as "ept" will differ from "Sep" by being 1 less. -Wikid77 (talk) 22:53, 30 July 2010 (UTC)
Examples of testcases
editThe following are testcases for {xsign}:
- {{xsign|22:58, 14 July 2010 Xyz7}}
- — Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 July 2010 (UTC)
- {{xsign|04:30, 4 August 2010 Xxxzzz}}
- — Preceding unsigned comment added by Xxxzzz (talk • contribs) 04:30, 4 August 2010 (UTC)
- {{xsign|13:33, 14 August 2010 Xxxmon}}
- — Preceding unsigned comment added by Xxxmon (talk • contribs) 13:33, 14 August 2010 (UTC)
- {{xsign|16:45, 4 September 2010 ZZ}}
- — Preceding unsigned comment added by ZZ (talk • contribs) 16:45, 4 September 2010 (UTC)
- {{xsign|11:13, 4 Sepbadmon 2010 BAD}}
- {{xsign|10:35, 22 Nosuchmonth 2010 Xbad}}
Other testcases should be added, as needed. -Wikid77 (talk) 23:50, 30 July 2010 (UTC)
Full test, after finishing the modification of the template:
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 January 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 January 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 February 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 February 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 March 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 March 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 April 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 April 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 May 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 May 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 June 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 June 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 July 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 July 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 August 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 August 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 September 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 September 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 October 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 October 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 November 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 November 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 4 December 2010 (UTC)
—Preceding unsigned comment added by Xyz7 (talk • contribs) 22:58, 14 December 2010 (UTC)
Failed testcases
edit- {{subst:xsign|2006-11-21T16:04:16 Larry laptop}}
- —Preceding unsigned comment added by an unknown user
Mirokado (talk) 21:03, 28 November 2010 (UTC)
- I added the supported formats to the documentation.--Patrick (talk) 21:53, 28 November 2010 (UTC)
- Thanks for the quick response. Mirokado (talk) 22:13, 28 November 2010 (UTC)
Tests for December 2010
editThe following are test cases to see if   is being stored, in usernames, by {unsign} or {xsign} when used at this time. Test cases:
- TRY: {{subst:unsigned|{{subst:str right|22:58, 14 AugTry 2010 UserX of Blanks|22 }}|{{subst:str left|22:58, 14 AugTry 2010 UserX of Blanks|21}} (UTC)}}
RESULT: —Preceding unsigned comment added by UserX of Blanks (talk • contribs) 22:58, 14 AugTry 2010 (UTC)
- TRY: {{subst:xsign|22:58, 27 AugTry 2010 UserX of Blanks}}
RESULT: —Preceding unsigned comment added by UserX of Blanks (talk • contribs) 22:58, 27 AugTry 2010 (UTC)
By looking at the contents of this area, in edit-preview, the text will reveal if any   have been coded within the results. On 3 December 2010, {str_right} was inserting   for spaces in a username. -Wikid77 (talk) 02:26, 3 December 2010 (UTC)
- m:Template:Xsign gives ordinary spaces, using versions of the string templates that allow the handling of spaces as ordinary characters. These could be copied to here.--Patrick (talk) 10:33, 3 December 2010 (UTC)
Get real spaces in usernames
edit04-Dec-2010: I have changed Template:Xsign/sandbox to use {{strr}} to extract the right-end string for a username with real spaces. {Xsign/sandbox} can still run within the MediaWiki 1.6 Expansion depth limit of 40 levels, as increased to 28 from being 22 levels deep in nested templates with if-else logic. Some examples with spaces in usernames:
- {Xsign/sandbox |07:55, 4 December 2010 UserX Blank} → — Preceding unsigned comment added by UserX Blank (talk • contribs) 07:55, 4 December 2010 (UTC)
- {Xsign/sandbox |08:35, 4 December 2010 Uncle G} → — Preceding unsigned comment added by Uncle G (talk • contribs) 08:35, 4 December 2010 (UTC)
The total length (of a "Preceding-unsigned" message) decreases by 16 characters, when using 1 real space (in name "Uncle G"):
- {str len|{Xsign |08:30, 4 December 2010 Uncle G}} → 233
- {str len|{Xsign/sandbox|08:30, 4 December 2010 Uncle G}} → 233
With the expansion-depth usage increased by 6 levels, to 28 deep, will there be any depth problems when using Xsign? Also, I am working to reduce the level to only 23 deep. -Wikid77 (talk) 12:57, 4 December 2010 (UTC)
Updated Xsign for spaces and Xsign/testcases
edit11-Dec-2010: After checking results for a week, I updated Template:Xsign to put real spaces in usernames, from the version in Template:Xsign/sandbox. Examples in Template:Xsign/testcases, now showing usernames with spaces, confirm that the string length is reduced by 16 for each real space in a username. The 16 come from reducing the 5-character " " to " " in 4 repetitions of the username (in wikilinks for user, talk & contribs).
In late July 2010, template Xsign had been changed to omit the lead blank in every username, such as for days with 1-digit day numbers. However, spaces within a username were still treated as " " by {{str_right}}, which is now avoided by using new template {{strr}}, to maintain real spaces in usernames. Because Xsign is used by {subst:Xsign}, most prior uses (before 11Dec2010) will still have " " in usernames with spaces. -Wikid77 (talk) 12:02, 11 December 2010 (UTC)
Spaces in usernames
editTemplate is broken for usernames with spaces. I haven't read the sections above, but the sandbox version doesn't work either. If nobody is planning to fix this I'm going to restore version 373344711, where this used to work -- even if only for the standard date format.
Amalthea 14:37, 22 June 2011 (UTC)
- Possibly someone messed up one of the string templates? –xenotalk 14:55, 22 June 2011 (UTC)
- You're right. All green now. Amalthea 16:34, 22 June 2011 (UTC)
- Cool =) –xenotalk 16:38, 22 June 2011 (UTC)
- You're right. All green now. Amalthea 16:34, 22 June 2011 (UTC)
Using {{Unsigned IP}} for IP addresses
edit@Xeno: I've modified Template:Xsign/sandbox to detect IPv4 and IPv6 addresses and use {{Unsigned IP}} instead of {{Unsigned}} in those cases. Does anyone have any objections to these changes before I copy them over to the live template? --Ahecht (TALK
PAGE) 23:11, 22 December 2014 (UTC)
- Done There were no objections, so I copied the sandbox over to the live template. --Ahecht (TALK
PAGE) 03:19, 5 January 2015 (UTC)
Convert timestamp formats
editHi, I use the ISO 8601 date format, for example because it is the only available format that displays seconds. It does not seem to work with {{Xsign}}, however. To work around this problem, I open the history in a private tab to be able to copy the numbers in the expected format. Maybe {{Xsign}} should be able to convert the date format automatically.
- Example history entry on my screen: 2016-01-26T12:21:11 Example
- Example {{subst:Xsign}} output: — Preceding unsigned comment added by an unknown user 2016-01-26T12:21:11 Example
- Expected {{subst:Xsign}} output: — Preceding unsigned comment added by Example (talk • contribs) 12:21, 26 January 2016 (UTC)
~ ToBeFree (talk) 17:15, 26 May 2019 (UTC)
- Special:Diff/898907462 ~ ToBeFree (talk) 17:56, 26 May 2019 (UTC)
- I didn't sign it because it was a revert, not a new post. --Redrose64 🌹 (talk) 19:17, 26 May 2019 (UTC)
- Oh – Redrose64, I just took the last edit from the history as an example. This section has nothing to do with you personally. I'm replacing the name by "Example". ~ ToBeFree (talk) 02:45, 27 May 2019 (UTC)
- I didn't sign it because it was a revert, not a new post. --Redrose64 🌹 (talk) 19:17, 26 May 2019 (UTC)
Time-zones other than UTC set in prefs.
editHow hard would it be to interpret the date-time in the user's designated timezone rather than in UTC? Zerotalk 06:19, 17 March 2020 (UTC)