Template:Excerpt sentence
Third sentence.
| This template is rated as alpha. It is ready for limited use and third-party feedback. It may be used on a small number of pages, but should be monitored closely. Suggestions for new features or adjustments to input and output are welcome. |
May be used to extract the Nth sentence from a paragraph.
Usage
{{Excerpt sentence|a paragraph of content|number}}
{{Excerpt sentence|string=a paragraph of content|N=number}}
Parameters
|1=– a string consisting of one or more 'sentences' (see § Notes) alias:|string=,|s=.) Required.|2=– the number of the sentence to be returned (alias:|N=,|n=; optional; default:1)
Examples
{{Excerpt sentence|A is one. B is two. C is three. D is four.|1}}→ A is one.{{Excerpt sentence|A is one. B is two. C is three. D is four.|3}}→ C is three.{{Excerpt sentence|A is one. B is two. C is three. D is four.|4}}→{{Excerpt sentence|A is one. B is two.{sfn... C is three. D is four.|2}}→ B is two.{{Excerpt sentence|A is one. B is two.<ref... C is three. D is four.|2}}→ B is two.
Notes
A 'sentence' is here defined as a string ending with period/full stop and a delimiter: either a blank, an open curly brace ({), or an open angle bracket (<), to allow for sentences followed by references or short citations. A side effect is that short citations and references are returned as a prefix at the beginning of the next sentence.
The template does not recognize question mark or exclamation point as a sentence end. Conversely, abbreviations like Mr. are currently interpreted as the end of a sentence.
See also
- {{Excerpt}}