Template:SocialMediaPost/doc
This is a documentation subpage for
Template documentation[edit source]Template:Terminate sentence ensures a sentence ends with a specified terminator (default: a period). It avoids adding duplicate terminators and can optionally trim trailing spaces. It attempts to ignore trailing closing quotes or brackets when deciding whether a terminator is already present. Usage[edit source]Basic: {{Terminate sentence|This is a sentence}}
→ This is a sentence.
Named parameters: {{Terminate sentence
|text=He said "Hello"
|term=.
}}
→ He said "Hello".
Custom terminator: {{Terminate sentence|text=Warning|term=!}}
→ Warning!
Avoid duplicate terminator: {{Terminate sentence|text=Already done.|term=.}}
→ Already done.
Trim trailing spaces: {{Terminate sentence|text=Ends with space |trim=yes}}
→ Ends with space.
Skip processing: {{Terminate sentence|text=No changes here|skip=yes}}
→ No changes here
Append a note: {{Terminate sentence|text=Complete|note=(source: 2025)}}
→ Complete. (source: 2025)
Parameters[edit source]
Behavior details[edit source]
Examples[edit source]
{{Terminate sentence|text=He whispered "hush"|term=.}}
→ He whispered "hush".
{{Terminate sentence|text=Complete (verified)|term=.}}
→ Complete (verified).
{{Terminate sentence|text=Alert|term=!}}
→ Alert!
{{Terminate sentence|text=Wait...|term=.|allowdup=yes}}
→ Wait.... Best practices[edit source]
Lua-powered variant (optional)[edit source]For more robust detection (including multilingual quotes and punctuation), create -- Module:TerminateUtil
local M = {}
local closing = {
[")"] = true, ["]"] = true, ["}"] = true,
['"'] = true, ["'"] = true, ["”"] = true, ["’"] = true, ["»"] = true, ["›"] = true
}
local function trimRight(s)
return (s:gsub("%s+$",""))
end
function M.lastVisibleChar(args)
local s = args.s or ""
s = trimRight(s)
local i = #s
while i > 0 do
local c = s:sub(i,i)
if closing[c] then
i = i - 1
else
return c
end
end
return ""
end
return M
Then update the template to call: {{#invoke:TerminateUtil|lastVisibleChar|s=text}}
This improves detection for closing quotes and brackets. See also[edit source]It may contain usage information, categories and other content that is not part of the original template page. |
User:Tantomile/SocialMediaPostTemplate
This template allows posts from social media sites other than Twitter, to be easily quoted within articles. This is an alternative to (and fork of) Template:Tweet. It is more appropriate to use this template than a screenshot of a tweet or post, because the text it contains will be accessible to screen readers.
To select what image it displays for the social media network, put the name of the SVG logo file in the "sitelogo" parameter.
Usage
[edit source]User:Tantomile/SocialMediaPostTemplate
Full blank syntax
[edit source]{{NotYetNamed
| name =
| username =
| replyto =
| lang =
| text =
| translation =
| date =
| sitelogo=
| ID =
| reference =
| archive-url =
| archive-date =
| url-status =
| image =
| block =
| left =
| width =
| style =
}}
Parameters
[edit source]|name=user's name as it appears at the top of the tweet|username=user's @ handle (without the @)|replyto=optional: username tweet is replying to|lang=optional: language code of the tweet if non-English|text=content of the post|sitelogo=Logo of the social media site|translation=optional: English translation of tweet if original tweet non-English|date=required: date of the tweet formatted according to MOS:DATE; should be used with tweets posted before November 4, 2010. If the date is after 23 July 2023 the template will mark it as an X post.|ID=number at the end of the tweet URL|reference=optional: the template automatically creates a reference, but one can be provided to use instead. See second example.|archive-url=optional: URL of an archived copy of the tweet. Ignored if|reference=is used.|archive-date=optional: date of the archived copy. Ignored if|reference=is used.|url-status=optional: if set to 'live', the title displays as the live link; if set to 'dead', the title displays as the archive link. Ignored if|reference=is used.|image=optional: image or logo associated with Twitter account|block=optional: any value displays tweet as block with 500px width as default (text above and below, doesn't flow around).|left=optional: any value makes tweet aligned left|width=optional: custom tweet width, default is 220px|style=optional: custom style
Examples
[edit source]TBD
Helpful Hints
[edit source]| Site | Logo File Location |
|---|---|
| Twitter (Pre 23 July 2023) | Logo_of_Twitter.svg |
| X | X_logo_2023.svg |
| 2023_Facebook_icon.svg | |
| Instagram_logo_2022.svg | |
| Mastodon | Mastodon_logotype_(simple)_new_hue.svg |
| TruthSocial | Truth_Social_logo_2022.svg |
| Bluesky | Bluesky_Logo.svg |
| Reddit_logo_2023.svg | |
| Tumblr | Tumblr_Wordmark.svg |
TemplateData
[edit source]See also
[edit source]- {{Cite tweet}} – for citing tweets
- {{Quote tweet}} – for tweets that quote another tweet