Edge Rewrite
// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a453c1008e413191

Jump to content

Template:Normalize volume and edition/doc

From Wikipedia, the free encyclopedia

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

[edit]

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

[edit]

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 ExampleType PassedNormalized OutputExplanation
1Volume or Edition1Pure digits pass through.
Vol. 2Volume2"Vol." is ignored; digit is extracted.
Volume 3 of 5Volume3Stops at the first recognized digit.
v. 4Volume4Ignores "v." abbreviation.
FirstVolume or Edition1Spelled words (1-10) map to digits.
2nd ed.Edition2Ordinals map to digits; "ed." is ignored.
Second EditionEdition2Words map to digits; "edition" is ignored.
Part IIIVolume3Roman numerals (I-X) map to digits.
Book ivVolume4Case-insensitive Roman numerals.
Part AVolumeAIsolated letters pass through as uppercase.
Section bVolumeBLowercase letters converted to uppercase.