Extension:TextExtracts/pl
For obtaining summaries in production environments, the Page Content Service is recommended and used by Wikimedia products. |
TextExtracts Status wydania: stabilne |
|
---|---|
Realizacja | API |
Opis | Provides API with plain-text or limited HTML extracts of page content |
Autor(zy) | Max Semenik (MaxSemdyskusja) |
Polityka zgodności | Snapshots releases along with MediaWiki. Master nie jest kompatybilny wstecznie. |
MediaWiki | >= 1.43 |
Zmiany w bazie danych | Nie |
Licencja | Licencja GNU General Public License 2.0 lub nowsza |
Pobieranie | |
|
|
Quarterly downloads | 103 (Ranked 51st) |
Public wikis using | 2,046 (Ranked 189th) |
Przetłumacz rozszerzenie TextExtracts jeżeli jest dostępne na translatewiki.net | |
Problemy | Otwarte zadania · Zgłoś błąd |
The TextExtracts extension provides an API which allows retrieval of plain-text or limited HTML (HTML with content for some CSS classes removed) extracts of page content.
Instalacja
- Pobierz i umieść plik(i) w katalogu o nazwie
TextExtracts
w folderzeextensions/
.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TextExtracts - Dodaj poniższy kod na dole twojego pliku LocalSettings.php :
wfLoadExtension( 'TextExtracts' );
- Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.
Ustawienia konfiguracyjne
$wgExtractsRemoveClasses
is an array of <tag>, <tag>.class, .<class>, #<id> which will be excluded from extraction.
- For example,
$wgExtractsRemoveClasses[] = 'dl';
removes indented text, often used for non-templated hatnotes that are not desired in summaries.
- For example,
- extension.json defines the defaults, of which the class "noexcerpt" is one - this may be added to any template to exclude it.
$wgExtractsExtendOpenSearchXml
defines whether TextExtracts should provide its extracts to the Opensearch API module. The default isfalse
.
API
extracts | |
---|---|
Returns plain-text or limited HTML extracts of the given pages Ten moduł nie może być użyty jako generator. | |
Prefiks | ex |
Wymagane uprawnienia | brak |
Tylko POST? | Nie |
Wygenerowana pomoc | Aktualna |
Poniższa dokumentacja jest rezultatem Special: |
prop=extracts (ex)
- This module requires read rights.
- Source: TextExtracts
- License: GPL-2.0-or-later
Returns plain-text or limited HTML extracts of the given pages.
- exchars
How many characters to return. Actual text returned might be slightly longer.
- Type: integer
- The value must be between 1 and 1,200.
- exsentences
How many sentences to return.
- Type: integer
- The value must be between 1 and 10.
- exlimit
How many extracts to return. (Multiple extracts can only be returned if exintro is set to true.)
- Type: integer or max
- The value must be between 1 and 20.
- Default: 20
- exintro
Return only content before the first section.
- Type: boolean (details)
- explaintext
Return extracts as plain text instead of limited HTML.
- Type: boolean (details)
- exsectionformat
How to format sections in plaintext mode:
- plain
- No formatting.
- wiki
- Wikitext-style formatting (== like this ==).
- raw
- This module's internal representation (section titles prefixed with <ASCII 1><ASCII 2><section level><ASCII 2><ASCII 1>).
- One of the following values: plain, raw, wiki
- Default: wiki
- excontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- Type: integer
- Get a 175-character extract
- api.php?action=query&prop=extracts&exchars=175&titles=Therion [open in sandbox]
Wynik |
---|
{
"query": {
"pages": {
"9228": {
"pageid": 9228,
"ns": 0,
"title": "Earth",
"extract": "Earth, also called the world and, less frequently, Gaia, (or Terra in some works of science fiction)..."
}
}
}
}
|
Caveats
There are various things to be aware of when using the API or software that uses the API e.g. Rozszerzenie:Podglądy strony .
- We do not recommend the usage of `exsentences`.
It does not work for HTML extracts and there are many edge cases for which it doesn't exist. For example "Arm. gen. Ing. John Smith was a soldier." will be treated as 4 sentences. We do not plan to fix this.
- Inline images are stripped from the response (even in HTML mode). This means if you are using the Math extension and using formulae in your lead section they may not appear in the summary output.
- In HTML mode we cannot guarantee well formed HTML. Resulting HTML may be invalid or malformed.
- In plaintext mode:
- citations may not be stripped (see phab:T197266)
- if a paragraph ends with an HTML tag e.g. ref tag, new lines may be dropped (see phab:T201946)
- new lines may be dropped after lists phab:T208132
- Articles must begin with the lead paragraph for an extract to be generated. The use of any template, and/or unclosed or empty HTML element may result in no preview for the article. E.g. "<div></div>hello" will give an empty extract.
FAQ
How can I remove content from a page preview/extract?
TextExtracts will strip any element that is marked with the class .noexcerpt
.
This is provided by the $wgExtractsRemoveClasses
configuration variable (which also defines some other excluded elements).
Zobacz też
To rozszerzenie jest wykorzystywane przez jeden lub więcej projektów Wikimedia. Oznacza to prawdopodobnie, że to rozszerzenie jest stabilne i działa wystarczająco dobrze, aby wykorzystywać je na stronach o dużym natężeniu ruchu. Odnajdź nazwę tego rozszerzenia w plikach konfiguracyjnych Wikimedia CommonSettings.php oraz InitialiseSettings.php, aby zobaczyć gdzie są zainstalowane. Pełną listę rozszerzeń zainstalowanych na określonej wiki można znaleźć na stronie Special:Version na danej wiki. |
To rozszerzenie jest dołączone do następujących farm/hostów wiki lub pakietów: To nie jest pełna lista. Niektóre farmy/hosty wiki lub pakiety mogą zawierać to rozszerzenie nawet jeśli nie są one tutaj wymienione. Zawsze sprawdzaj swoje farmy/hosty wiki, aby to potwierdzić. |
- Extensions bundled with MediaWiki 1.34/pl
- Stable extensions/pl
- API extensions/pl
- GPL licensed extensions/pl
- Extensions in Wikimedia version control/pl
- ApiOpenSearchSuggest extensions/pl
- SearchResultProvideDescription extensions/pl
- All extensions/pl
- Extensions used on Wikimedia/pl
- Extensions included in BlueSpice/pl
- Extensions included in Canasta/pl
- Extensions available as Debian packages/pl
- Extensions included in Fandom/pl
- Extensions included in Miraheze/pl
- Extensions included in MyWikis/pl
- Extensions included in ProWiki/pl
- Extensions included in wiki.gg/pl
- Extensions included in WikiForge/pl