Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Lord Belbury/Add quotemarks
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p._addquotes(s) if s then if s:match([[^(['"]).*%1$]]) or s:match([[^β.*β$]]) or s:match([[^β.*β$]]) then -- If the string starts and ends with a quotemark (or starts and ends with an apostrophe), display it unchanged return s elseif s:match([[(["ββ])]]) or s:match([[(['ββ])%s]]) or s:match([[%s(['ββ])]]) or s:match([[^(['ββ])]]) then -- Otherwise if the string contains any quotemarks at all, or any apostrophes that aren't in the middle of a word (excluding end-of-string, which may be a possessive) , display it unchanged and add a hidden category to flag that the template call is providing something more complex than a single literal translation return s .. "[[:Category:Articles with unusually formatted quotations]]" else -- Otherwise (ie. if the string contains no quotemarks, and any apostrophes are in the middles of words), display it surrounded by additional quotemarks return "\"" .. s .. "\"" end else return "zzz" end end function p.addquotes(frame) local s = (frame.args['s'] or frame.args[1]) or (frame:getParent().args['s'] or frame:getParent().args[1]) return p._addquotes(s) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Lord Belbury/Add quotemarks/doc
(
edit
)