Template:Add-punc
From Pittsburgh Streets
The {{add-punc}} template adds a terminal punctuation character to the end of a string, but only if it does not collide with punctuation already there. If the string ends with a quotation mark (double or single), and the terminal punctuation is a period or comma, it is added before the quotation mark (again, only if it does not collide with punctuation already there).
For something like the title of a newspaper article, the {{add-punc}} template can simply be surrounded in quotation marks. However, for something like a book title, the interaction with italics is more complicated: the terminal punctuation should not be italicized, unless the title ends with a quotation mark and the terminal punctuation must be added before it. So the {{add-punc}} template also includes an optional ital=on
parameter which will italicize the string in the appropriate way.
Usage examples and test cases
{{add-punc|Miller, Annie Clark|.}}
→ Miller, Annie Clark.{{add-punc|Fleming, George T.|.}}
→ Fleming, George T.{{add-punc|Killikelly, Sarah H.|,}}
→ Killikelly, Sarah H.,{{add-punc|Craig, Neville B.|:}}
→ Craig, Neville B.:{{add-punc|Which way did Forbes march into downtown?|.}}
→ Which way did Forbes march into downtown?{{add-punc|Hippo, Tumbo, Fortitude!|.}}
→ Hippo, Tumbo, Fortitude!{{add-punc|Tokio St. to Tokay St.?|.}}
→ Tokio St. to Tokay St.?
With quotation marks
{{add-punc|"Stringtown on the Pike"|.}}
→ "Stringtown on the Pike."{{add-punc|"The Head of Iron"|,}}
→ "The Head of Iron,"{{add-punc|Street names 'pennants of tribute'|.}}
→ Street names 'pennants of tribute.'{{add-punc|Council OKs 'Forbes Ave.'|.}}
→ Council OKs 'Forbes Ave.'{{add-punc|"What's in a name?"|.}}
→ "What's in a name?"{{add-punc|Canada's 'housey-housey' introduced here as 'bingo'|:}}
→ Canada's 'housey-housey' introduced here as 'bingo':"{{add-punc|Rialto is 'Pig's Hill'|.}}"
→ "Rialto is 'Pig's Hill.'"
With parentheses
{{add-punc|[vol. 5] (biographical)|.}}
→ [vol. 5] (biographical).{{add-punc|In the good ol' days, Pittsburgh Council had 108 guys. (OK, not so good.)|.}}
→ In the good ol' days, Pittsburgh Council had 108 guys. (OK, not so good.){{add-punc|Is there any significance to the street names in the Oakland/hospital area (McKee, Meyran, etc.)?|.}}
→ Is there any significance to the street names in the Oakland/hospital area (McKee, Meyran, etc.)?
With italics
{{add-punc|Allegheny City|.|ital=on}}
→ Allegheny City.{{add-punc|Atlas of Pittsburgh, Penna.|.|ital=on}}
→ Atlas of Pittsburgh, Penna.{{add-punc|"Stringtown on the Pike"|.|ital=on}}
→ "Stringtown on the Pike."{{add-punc|"The Head of Iron"|,|ital=on}}
→ "The Head of Iron,"{{add-punc|"What's in a name?"|.|ital=on}}
→ "What's in a name?"
With an empty first parameter
{{add-punc||.}}
→
With an empty second parameter
{{add-punc|Doherty, Donald}}
→ Doherty, Donald{{add-punc|The Fort Pitt Block House||ital=on}}
→ The Fort Pitt Block House