Extension talk:TextExtracts

Jump to navigation Jump to search

About this board

No Extract with Lingo installed

Bearglass72 (talkcontribs)

No text extract is returned ("extract": "...") when there is an abbreviation/definition in the text that has terminology that is translated by Lingo. If Lingo is disabled, text extract works as prescribed. Is this a bug? is

MaxSem (talkcontribs)

I'm not familiar with Lingo and it doesn't even work with recent MediaWiki. You should probably discuss this with its developers, sorry.

Reply to "No Extract with Lingo installed"

Remove Particular Data obtained from API extract response

3 (talkcontribs) (talkcontribs)
Proactive programming (talkcontribs)

If you are using your own wiki, this is controlled through an extension variable. If you are using another person's wiki, if you just want the intro, add in "exintro".

Reply to "Remove Particular Data obtained from API extract response"

text extracts and unicode characters

Zzmonty (talkcontribs)
Tacsipacsi (talkcontribs)

\" isn’t valid HTML, either. Both should be decoded when decoding the JSON into a JavaScript object, a PHP array etc.

Proactive programming (talkcontribs)

In mw 1.31.x, unicode characters are working as expected.

Reply to "text extracts and unicode characters"
Psychoslave (talkcontribs)

Is it possible to call this API from the Wiki itself, with wikicode or lua code?

Proactive programming (talkcontribs)

Anywhere you can call a regular API, you can call this. I modified Mediawiki:Gadget-popups.js to call TextExtracts.

Reply to "Call from within the wiki"

Getting links, spans, and divs to appear

Proactive programming (talkcontribs)

If you to get links to appear in the TextExtract with limited HTML, change the code in "ExtractFormatting.php" --> function "__construct": comment out the section about flatten [ 'a'].

If you want to get divs and spans to appear, change the code in "ExtractFormatter.php" --> function "filterContent": comment out the section about removeAttribute('class') and removeAttibute('style').

The removal of those three items was annoying me. ~~~~~

Reply to "Getting links, spans, and divs to appear"

Inconsistent/broken explaintext formatting

Summary by Lord Belbury

moved to Phabricator

Lord Belbury (talkcontribs)

Has there been a change to how explaintext=1 is processed on an API call? It looks like it's not putting a line feed "\n" at the ends of paragraphs which end with a ref tag, or any spacing at all.

The first three paragraphs on the Wikipedia "Human" article return as follows (when queried as https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&titles=Human&exsentences=20&explaintext=1):

  • "...more complex brains and societies.Early hominin..."
  • "...populated most of the world.The spread of humans..."
  • "...other technologies and arts.\nHumans are uniquely adept..."

The first two paragraphs end with ref tags in the article, the third does not. Testing this on other articles with a mix of ref and non-ref paragraph ends, I see the same result. I've been using the API and explaintext for a while and haven't noticed this behaviour before.

Lord Belbury (talkcontribs)

Have just found the Phabricator site, I'll raise this bug over there if it's not getting any attention here.

How to get a page section using javascript?

Johnywhy (talkcontribs)

How to get a page section using javascript?

Reply to "How to get a page section using javascript?"

Fatal error: Class 'HtmlFormatter\HtmlFormatter' not found in /public_html/wiki/extensions/TextExtracts/includes/ExtractFormatter.php on line 27

493Titanollante (talkcontribs)
MaxSem (talkcontribs)

Sounds like you're using it with a MW version it's not intended for.

493Titanollante (talkcontribs)

Would you kindly point me to a place where I could upgrade the MW version that's easy to understand?

It's on shared Linux hosting with cPanel. Don't have a WHM or whatever that is. Have not even the remotest clue of how to use Composer or Phabricator or any of that. I can use PuTTy (SSH) and can clone the wiki to potentially try stuff out on it.

MaxSem (talkcontribs)

Which MediaWiki are you using and which branch of TextExtracts? (i.e. did you get it from Special:ExtensionDistributor? If not, from where?)

493Titanollante (talkcontribs)

Yeah I got it from ExtensionDistributor a while ago. It's probably version 1.27, while the MW is 1.26.4.

Reply to "Fatal error: Class 'HtmlFormatter\HtmlFormatter' not found in /public_html/wiki/extensions/TextExtracts/includes/ExtractFormatter.php on line 27"

Extract annotation starting specific section

Stas (talkcontribs)

Please, lets add extracting annotation starting specific section. We need it for patching "Popup" extension (show popup with annotation, when link points to some specific section like [[article#section]].

I have look at code of the extension, and I am not sure, what API should be used to point to specific section (may be separate parameter "exsection", but then we will lost possibility to get several extractions…

       $titles = $this->getPageSet()->getGoodTitles();

Please, add this feature anyway how... you should know how to do it better.

Reply to "Extract annotation starting specific section"

"explaintext" parameter doesn't work in POST requests.

MarioFinale (talkcontribs)


When i use the "explaintext" parameter in a long query on eswiki and enwiki it always returns an extract in HTML format regardless of the inclusion of the parameter, this problem doesn't happen in GET requests, only in POST requests.

Query (GET):

Some screenshots with POSTMAN (this problem happens regardless of the client).

GET request:

POST request:

Tacsipacsi (talkcontribs)

When I POSTed the above query with the query parameters in the URL (just like a GET request), it worked as expected. When I put the query parameters in the POST body, it returned HTML. I have no idea why.

Reply to ""explaintext" parameter doesn't work in POST requests."