====== WikipediaSnippet Plugin ======
---- plugin ----
description: Includes a snippet from a Wikipedia article.
author : Anika Henke
email : anika@selfthinker.org
type : syntax
lastupdate : 2016-04-07
compatible : Lemming, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, Hogfather, Igor, Jack Jackrum
depends :
conflicts :
similar :
tags : wikipedia, include
downloadurl: https://github.com/selfthinker/dokuwiki_plugin_wikipediasnippet/zipball/master
bugtracker : https://github.com/selfthinker/dokuwiki_plugin_wikipediasnippet/issues
sourcerepo : https://github.com/selfthinker/dokuwiki_plugin_wikipediasnippet
donationurl: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=11071728
----
===== Download and Installation =====
Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
===== Syntax and Usage =====
The syntax is very simple:
{{wp>Article_Name}}
It's intentional that it's similar to the [[:interwiki]] link: ''%%[[wp>Article_Name]]%%''
The difference is that
* it includes the first paragraphs of the according Wikipedia page and
* it uses automatically the language of the wiki ([[config:lang]])
If you'd like to use a different language than the language of the wiki page, you can add the according language code as another parameter, e.g. the French article for "DokuWiki" would need:
{{wp:fr>DokuWiki}}
''%%{{wp>DokuWiki}}%%'' will look like this (in the default template with default configuration):
{{:plugin:wikipediasnippet_example2.png}}
===== Configuration =====
* **''snippetLength''** (default: ''0''): Number of sentences to show per snippet; leave empty or '0' to show the whole intro section
* **''useHtml''** (default: ''1''): Display HTML formatting in the snippet? (otherwise display unformatted text only)
* **''includeTables''** (default: ''0'') will include tables, e.g. the usual [[http://en.wikipedia.org/wiki/Help:Infobox|infobox]]. This can make the snippet more interesting, but some infoboxes can also get unproportionately big and will look strange. removed in latest version
* **''includeImages''** (default: ''0'') will include all images that appear within the first few paragraphs and tables. If you enable this, please set your [[config:fetchsize]] config option, so that external images will automatically be cached by DokuWiki. (The HTML will get cached anyway.) removed in latest version
===== Changelog =====
{{rss>https://github.com/selfthinker/dokuwiki_plugin_wikipediasnippet/commits/master.atom date}}
===== Feedback =====
==== Remove disambiguation notice ====
I realize this is the wrong place but Github is throwing a server error @ the above link:
Many topics have disambiguation pages:\\
i.e. [[http://en.wikipedia.org/wiki/Avatar_(computing)]]\\
includes before 1st paragraph:
>This article is about virtual user representations. For other uses, see avatar (disambiguation).
in the source as:
Object id #94
The link from the snippet title still forwards to the correct WP article, however.
--Andrew 2010-10-25
> It's difficult to help without further information. I just released a new version which includes some (hopefully helpful) error message which will help you to debug the problem. --- [[user>ach|Anika Henke]] //2011/05/29 16:24//
==== Usefulness ====
**Is this plugin useful ?**
[[:Interwiki]]
--[[user>chtiland]] 2011-04-24
> I guess, as with any other plugin: To some people it is useful, to others it isn't. This plugin doesn't do the same as [[:interwiki]] links. It doesn't just display the link, but also fetches the first paragraph of the article. --- [[user>ach|Anika Henke]] //2011/05/29 16:24//
> To me, this plugin really is useful. I add it at the end of some of my articles on my website ([[http://www.greguti.com/fort/inventeurprophetebiographies#.UO6b7onm7Nw|check out here for example]]) , as a way to dig further on the topics I dealt with. I could just add a link inside the article itself, but I find this plugin more pleasant to the eyes than a simple link, it's more obvious and more knowledge is instantly accessible to the reader! Only thing I'd like to see in a next release is a way to specify the maximal amount of text to retrieve from the Wikipedia page and to include in the snippet, so that a snippet don't take too much space. --- [[user>greguti|Grégory Gutierez]] //2012/01/10, 11:54//
==== Problem, Language: de-informal ====
... doesn't work with dokuwiki's custom lang-ids: This http://de-informal.wikipedia.org/ does not exist.
I think this plugin should work according to the interwiki entries: "wp" looks up Englisch entries, "wpde" looks up German entries etc. But it does not. Why?
> I just fixed that. It **does** work like the interwiki entries, but "wpde-informal" obviously doesn't exist, so you cannot really compare it. As "de-informal" is not an officially recognised language code, I implemented it so it gets substituted with "de" (and the same is true for some other non-standard language codes). Please update your plugin to make it work. --- [[user>ach|Anika Henke]] //2012/08/19 14:23//
==== Problem with images that start with "//" ====
I've a problem with pages like http://en.wikipedia.org/wiki/Modal_logic that have an image in the snippet: the image is of the form ''
//
It works! On my own system at least ;-).
[[user>bifazio|Fabrizio]]
> I have fixed this in the latest version. However, I also changed the way the articles are retrieved, which (probably) got rid of images altogether. --- [[user>ach|Anika Henke]] //2013/04/06 23:54//
>> Why do you have removed images? I made the example of the page http://en.wikipedia.org/wiki/Modal_logic because here an image (two logic formulas) is an essential part of the info! - [[user>bifazio|Fabrizio]]
>>> I didn't deliberately remove images. But the plugin uses a different [[https://en.wikipedia.org/w/api.php?action=help&modules=query%2Bextracts|API functionality]] which just doesn't support any images. So, it was collateral damage I was willing to take as this new functionality is otherwise much better. I just checked and they still don't support images with it. [[https://github.com/selfthinker/dokuwiki_plugin_wikipediasnippet/commit/de104de6d995aa952398c110a5b64d8f63a7863c|More information regarding this specific change.]] --- [[user>ach|Anika Henke]] //2016-04-07 19:21//
==== A syntax {{wpXX>}} to select a specific Wikipedia site? ====
Another proposal: I like that the syntax {{wp> //page name//}} automatically uses the default wiki language: I have a wiki site in italian language and in 99% of the circumstances I would like to show a snippet from an italian Wikipedia page. But in a few circumstances I would like to show a snippet from an English Wikipedia page too!
So my proposal is to add a second syntax {{wpXX> //page name//}} where ''XX'' stands for the language (it/en/de etc..).
[[user>bifazio|Fabrizio]]
P.S.: good plugin, really! one of my best favorites
> Thanks, I have implemented this, but with a slightly different syntax: ''%%{{wp:it>page name}}%%''. --- [[user>ach|Anika Henke]] //2013/04/06 23:54//
>> Ok! Good :-) --- [[user>bifazio|Fabrizio]]
==== Issues running locally ====
Hello Anika. Really nice plugin. But this plugin doesn't work in local modi. When i'm using it on localhost (127.0.0.1:8800) with apache there is the error: "//Error: Fetching the article from Wikipedia failed. Could not connect to de.wikipedia.org:80 php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist unbekannt (0).//" Internet connection is active. What i have to do? Thanks in advance.
--Marcus 2013/07/02
==== »useHtml-switch not working ====
I always have HTML-wikisnippets. I can uncheck the option in the configuration menu, it also stays unchecked, but it does not have any effect. I always have the HTML-snippets.
Is there anything I could do or try?
--- //[[|Otto]] 2015/01/30 14:10//
> It works for me as intended. Can you give an example syntax which doesn't work? And can you also describe what you expect to see instead? --- [[user>ach|Anika Henke]] //2016-04-07 19:21//