Login
Sign Up
Homepage
Games
News
News βΎ
All
Transfers
Drama
Business
Sponsors
Mergers
Investors
Hires
Companies
More News
People
Tournaments
Brands
Brands βΎ
Companies
Organizations
Sponsors
Other
Locations
Search
Login
Sign Up
Read
Edit
Editing
Module:TruncDesc
From TwogPedia
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.generate(frame) local manual = frame.args.seo_description or "" local content = frame.args.content or "" local text = (manual ~= "") and manual or content text = mw.ustring.gsub(text, "%s+", " ") text = mw.text.trim(text) local max = 160 if mw.ustring.len(text) <= max then return text end local truncated = mw.ustring.sub(text, 1, max) local lastPunct = mw.ustring.find(truncated, "[%.%?!][%s]") or mw.ustring.find(truncated, "[%.%?!]$") if lastPunct then truncated = mw.ustring.sub(truncated, 1, lastPunct) else local lastSpace = mw.ustring.find(truncated, " ", -1, true) if lastSpace then truncated = mw.ustring.sub(truncated, 1, lastSpace - 1) end end truncated = mw.text.trim(truncated) local endsWithPunct = mw.ustring.find(truncated, "[%.%?!]$") if mw.ustring.len(text) > max and not endsWithPunct then truncated = truncated .. "..." end return truncated end return p
Summary:
Please note that all contributions to TwogPedia 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
TwogPedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:TruncDesc/doc
(
edit
)
No categories