Template:Normalize volume and edition
| This template uses Lua: |
This module normalizes unformatted text input for |volume= and |edition= parameters. It can, for example, allow templates to reliably route citation data using `#switch` statements.
Example: values that normalize as 1 (not exhaustive):
1, 1st, one, first, I, i, uno, un, una, primer, primera, 1ª, premier, première, ein, eine, eins, erste, een, eerste, primo, prima, primus, 初版, 第1巻, (1), [1], "1", 1., -1-, Volume 1, Vol 1, Vol. 1, Book 1, Part 1, 1 (Print), v. 1, v 1, v. I, ed. 1, first edition, edition 1
Usage
To use this module, invoke it with either the `volume` or `edition` function, followed by the raw parameter data.
Normalizing |edition=Uno
{{#switch:{{#invoke:Normalize volume and edition|edition|{{{edition|}}}}}
| 1 = {{#invoke:IA Citation|BOOK_NAME_FIRST}}
| 2 | #default = {{#invoke:IA Citation|BOOK_NAME_SECOND}}
}}
Normalizing |volume=Vol 1
{{#switch:{{#invoke:Normalize volume and edition|volume|{{{volume|}}}}}
| 1 = {{#invoke:IA Citation|MULTI_VOL_BOOK_V1}}
| 2 = {{#invoke:IA Citation|MULTI_VOL_BOOK_V2}}
| 3 = {{#invoke:IA Citation|MULTI_VOL_BOOK_V3}}
| #default = {{#invoke:IA Citation|MULTI_VOL_BOOK_V1}}
}}
Supported Inputs
This template accepts raw, unformatted text added by editors in the |volume= and |edition= fields and normalizes it into a single-character digit or letter for use in `#switch` statements in templates that need to route based on vol. and ed. It is case-insensitive and ignores punctuation.
| Raw User Input Example | Type Passed | Normalized Output | Explanation |
|---|---|---|---|
1 |
Volume or Edition | 1 | Pure digits pass through. |
Vol. 2 |
Volume | 2 | "Vol." is ignored; digit is extracted. |
Volume 3 of 5 |
Volume | 3 | Stops at the first recognized digit. |
v. 4 |
Volume | 4 | Ignores "v." abbreviation. |
First |
Volume or Edition | 1 | Spelled words (1-10) map to digits. |
2nd ed. |
Edition | 2 | Ordinals map to digits; "ed." is ignored. |
Second Edition |
Edition | 2 | Words map to digits; "edition" is ignored. |
Part III |
Volume | 3 | Roman numerals (I-X) map to digits. |
Book iv |
Volume | 4 | Case-insensitive Roman numerals. |
Part A |
Volume | A | Isolated letters pass through as uppercase. |
Section b |
Volume | B | Lowercase letters converted to uppercase. |
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.