Template:Transclude selected current events/sandbox
This is the template sandbox page for Template:Transclude selected current events (diff). See also the companion subpage for test cases. |
This template uses Lua: |
This templates transcludes current events on specified topics from the daily subpages of Portal:Current events. It is intended for use in the "In the news" sections of Portals.
Usage
[edit]{{Transclude selected current events | <search pattern 1> | ... | <search pattern n> | not1= | ... | notn= | days= | max= | none= | dates= | more= |header= |footer= }}
- Basic
{{Transclude selected current events| search pattern }}
- Multiple search patterns
{{Transclude selected current events| search pattern | second search pattern | third search pattern }}
- Add as many search patterns as needed
- With patterns to exclude items
{{Transclude selected current events| search pattern | not=search pattern to exclude from results }}
- Add additional search patterns to exclude items from results using
|not2=
,|not3=
, etc. - As a portal component which only displays when news items are found
{{Transclude selected current events| header= header template | footer= footer template | other parameters }}
- As a suggestion generator, e.g. on the portal talk page
{{Transclude selected current events| wikitext=yes | other parameters }}
Parameters
[edit]|1=
,|2=
,|3=
...- Search patterns for items
|not1=
,|not2=
,|not3=
...- Search patterns for excluding items
|days=
- Number of days to search through for current events (counting backwards from the current day); default is
30
(nb. you may find large numbers equal to several years won't work for technical reasons). |max=
- Maximum number of items to display; default is
6
|wikitext=
- Set to
yes
to display the wikitext of the items, e.g. when using this template just to generate suggestions |none=
- Wikitext to display if no matching items are found; default is "No recent news"
|dates=
- Set to
mdy
to use MDY-formatted dates (e.g. Nov 2, 2024 rather than 2 Nov 2024) |more=
- Wikitext to show at the bottom of the list; OR
- Set to
yes
to show More current events... link at the bottom of the list |header=
- Wikitext to show above the items; typically
{{Box-header}}
or{{Box-header colour}}
or similar (with appropriate parameters filled in) - If set, this template only displays output when items are found (overriding
|more=
if set) |footer=
- Wikitext to show below the items; defaults to
{{Box-footer}}
- Can only be used in conjunction with
|header=
Search patterns
[edit]Search patterns are Lua patterns, which are similar to regular expressions. This means that ^$()%.[]*+-?
characters have special meaning, such as .
matching any character. To search for those characters themselves, they need to be escaped by prefixing a %
For piped links, both the target article name as well as the displayed text are searched for matches. External links are not searched for matches.
Tip: To make a letter in a search pattern case-insensitive, put both the upper-case and lowercase letter inside square-brackets, i.e. [Aa]pple
will match both An apple is... and Apples are....
Examples
[edit]Europe
{{Transclude selected current events|Europe}}
- 1 November 2024 – 2024 European floods
- October 2024 Spain floods
- The death toll from the floods in Spain, primarily in the Valencian Community, increases to 205, with several others still missing. (BBC News) (AP)
- 31 October 2024 – Russian invasion of Ukraine
- Ukrainian President Volodymyr Zelenskyy strongly condemns the United States and European nations for making "zero response" to the Russian deployment of North Korean soldiers against Ukraine. (Reuters)
- 31 October 2024 –
- The European Commission opens an investigation into Chinese e-commerce company Temu for its sale of illegal and counterfeit products and its addictive design, which violate the EU's Digital Services Act. (DW)
- 31 October 2024 – 2024 European floods
- October 2024 Spain floods
- The death toll from the floods in Spain, primarily in the Valencian Community, increases to 161, with dozens of others still missing. (Infobae) (BBC News)
Europe (as portal component that is only displayed when there is news; limited to a maximum of 4 items)
{{Transclude selected current events|Europe|header={{Box-header color|In the news}}|max=4}}
- 1 November 2024 – 2024 European floods
- October 2024 Spain floods
- The death toll from the floods in Spain, primarily in the Valencian Community, increases to 205, with several others still missing. (BBC News) (AP)
- 31 October 2024 – Russian invasion of Ukraine
- Ukrainian President Volodymyr Zelenskyy strongly condemns the United States and European nations for making "zero response" to the Russian deployment of North Korean soldiers against Ukraine. (Reuters)
- 31 October 2024 –
- The European Commission opens an investigation into Chinese e-commerce company Temu for its sale of illegal and counterfeit products and its addictive design, which violate the EU's Digital Services Act. (DW)
United Kingdom
{{Transclude selected current events|United Kingdom}}
|
---|
|
Europe OR United Kingdom
{{Transclude selected current events|Europe|United Kingdom}}
|
---|
|
Europe AND United Kingdom
{{Transclude selected current events|Europe.*United Kingdom|United Kingdom.*Europe|days=10}}
|
---|
No recent news |
United Kingdom AND NOT Australia
{{Transclude selected current events|United Kingdom|not=Australia}}
|
---|
|
SomethingWithNoMatches
{{Transclude selected current events|SomethingWithNoMatches}}
|
---|
No recent news |
TemplateData
[edit]TemplateData
| ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Transclude selected current events in articles based on its TemplateData.
TemplateData for Transclude selected current events This templates transcludes current events on specified topics from the daily subpages of Portal:Current Events. Can use Lua search patterns.
|
See also
[edit]- {{Template cache}} – companion template