View source for Module:Type in location
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
local p = {}
local plaintext = require("Module:Plain text")._main
--Cleanup/format location for use in short descriptions
function p.prepareLoc (frame)
return p._prepareLoc (frame.args[1])
end
function p._prepareLoc (text)
text = plaintext(text)
text = text..',' --comma at the end makes things convenient
text = text:gsub('%b()', ', ') --remove things in brackets as etxtraneous information
:gsub('[^%s,]*%d[^%s,]*', '') --remove things with digits as generally being unecessary postal codes/road numbers etc
:gsub('(,%s-),', '%1') --fix possible blank seperated commas from previous cleanup
:gsub('%s%s', ' ') --fix possible extra spaces from previous cleanup
:gsub('^[%s,]*', '') --trim commas and spaces from beginning
:gsub('[%s,]*$', '') --trim commas and spaces from end
return text
end
000
1:0
Template used on this page:
Return to Module:Type in location.