User:Wikid77/Test lua
Perhaps putsep function to avoid double-dot
When a trailing-dot item has the dot embedded inside a wikilink, then perhaps there could be a status switch, "hasdot=true" where a special function, putsep(hasdot, sepc), could check the status of the prior data item's dot. The embedded trailing dot (detected as ".]]" in x:sub(-3,-1) substring) would suppress the double-dot cases. The following are some special cases:
| Wikitext | {{cite book
|
|---|---|
| Live | John Doe (1 June 2000). The Rise of Dotcom, Inc. London: Acme Inc. {{cite book}}: Unknown parameter |sandbox= ignored (help)
|
| Sandbox | John Doe (1 June 2000). The Rise of Dotcom, Inc. London: Acme Inc. {{cite book}}: Unknown parameter |sandbox= ignored (help)
|
| Wikitext | {{cite book
|
|---|---|
| Live | Doe, John Q. The Rise of Dotcom, Inc. Acme Inc. {{cite book}}: Unknown parameter |Series= ignored (|series= suggested) (help); Unknown parameter |sandbox= ignored (help)
|
| Sandbox | Doe, John Q. The Rise of Dotcom, Inc. Acme Inc. {{cite book}}: Unknown parameter |Series= ignored (|series= suggested) (help); Unknown parameter |sandbox= ignored (help)
|
| Wikitext | {{cite book
|
|---|---|
| Live | Doe, John Q. The Rise of Dotcom, Inc. Acme Inc. {{cite book}}: Unknown parameter |Series= ignored (|series= suggested) (help)
|
| Sandbox | Doe, John Q. The Rise of Dotcom, Inc. Acme Inc. {{cite book}}: Unknown parameter |Series= ignored (|series= suggested) (help)
|
The embedded trailing dots are rare, but the use of putsep(hasdot, sepc) could provide a simple method to track the pending double-dot error, omit the sepc separator when also a dot (not sepc=','), then reset as hasdot=false so the next item would continue to put the typical sepc separator character. Any data item which has a trailing dot, would again set hasdot=true, while parameters shown in "(___)" would set hasdot=false, and the remainder of the data items would use the function putsep() to avoid double-dot cases, no matter where the extra dot was embedded. This simple, almost error-proof tactic was not practical in markup due to the lack of local status variables to remember whether the prior data item had a trailing dot.
However, for now, we can just check the title for a wikilink ending in ".]]" as a common case of an embedded trailing dot. -Wikid77 (talk) 00:01, 3 April 2013 (UTC)
- Updated function safejoin() in Lua script: I see the whole logic had been changed to use function safejoin() to check for duplicate characters everywhere, and so, I added a quick extra comparison to detect a trailing dot in either a wikilink "[[xx.]]" or in an external link "[http__xx.]". The added check, with wikilinks or external links, will fix the double-dot problem for almost every case. -Wikid77 (talk) 01:36, 3 April 2013 (UTC)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.