Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
initial commit
  • Loading branch information
julianhocker authored Jun 28, 2020
0 parents commit 99a6deb
Show file tree
Hide file tree
Showing 9 changed files with 553 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 julianhocker

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Wikidata Show
This extension for mediawiki allows you to integrate data from the German national libary into your wiki. German national library has information about all books published in Germany, so this makes it easy for you to add library information to your wiki.

The extension adds the following magic words to your mediawiki:
* gndshowlite: takes in the p-value you want to show and only shows this information (fits great if you want to display local data from semantic mediawiki together with data from wikidata)

Example:

![alt text](https://raw.githubusercontent.com/julianhocker/wikidatashow/master/example.png "Example of extension")

## Installation
1. Add "freearhey/wikidata": "3.2" to your composer.json of the wiki in the section "require"
2. Run composer update --no-dev
3. Clone this repo via git clone https://github.com/julianhocker/wikidatashow.git into extensions
4. Add wfLoadExtension('WikidataShow'); to your LocalSettings.php

## Usage
### Wikidatashow
This way you get a box with all the data defined above directly from wikidata
* type the magic work {{#wikidatashow:}} into a page and it will get the corresponding information based on the smw-attribute 'Wikidata ID'
* you can also provide the wikidata-id directly, e.g. {{#wikidatashow:Q1533809}}

###Wikidatashotlite
This way you only get single items from wikidata. This function is provided for links to wikipedia, image, adress, website, link to GND
* type the magic word {{#wikidatashowlite:}} to a page, giving the p-value of the information you need or 'wikipedia', e.g. {{#wikidatashowlite:P18}} to get the corresponding image.
* if you do not have Semantic Mediawiki running, just provide the wikidata ID as second paramenter to get the data:
{{#wikidatashowlite:P227|Q1533809}}

## Dependencies
The extension was tested on Semantic MediaWiki 3.1.5. and MediaWiki 1.34.0. You do not need Semantic MediaWiki to make it running, but then you have to provide the wikidata-ID directly. Translation is right now done in English and German, please feel free to add more translation ;).

## Known issues
* Please open issues if you encounter problems
* connection to wikidata should be done more nicely in the code
* I also added the magic word wikidatashoweasy, that just returns the value from wikidata. It seemed handy at first, but I did not see great usage since many values are not proper formatted/usefull in wikidata
21 changes: 21 additions & 0 deletions SMWShow.i18n.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* @license GPL-2.0-or-later
* @author Julian Hocker
*/

$magicWords = [];

/** English
* @author Julian Hocker
*/
$magicWords['en'] = [
'smwshow' => [ 0, 'smwshow' ],
];

/** German
* @author Julian Hocker
*/
$magicWords['de'] = [
'smwshow' => [ 0, 'smwshow' ],
];
9 changes: 9 additions & 0 deletions WikidataShow.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
24 changes: 24 additions & 0 deletions extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "SMWShow",
"author": "Julian Hocker",
"version": "0.2",
"url": "https://github.com/julianhocker/WikidataShow",
"descriptionmsg": "desc",
"license-name": "MIT License",
"type": "parserhook",
"MessagesDirs": {
"SMWShow": [
"i18n"
]
},
"AutoloadClasses": {
"SMWShowHooks": "src/SMWShowHooks.php"
},
"ExtensionMessagesFiles": {
"SMWShowMagic": "SMWShow.i18n.php"
},
"Hooks": {
"ParserFirstCallInit": "GNDShowHooks::onParserFirstCallInit"
},
"manifest_version": 1
}
18 changes: 18 additions & 0 deletions i18n/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ "@metadata": {
"authors": [
"Julian Hocker"
]
},
"desc": "Diese Extension erlaubt das Anzeigen von Informationen aus Wikidata",
"website": "Webseite",
"adress": "Adresse",
"gndlink": "DNB-Link",
"image": "Bild",
"instance": "Ist ein",
"founded": "Gegründet",
"names": "Namen",
"wikipedia": "Wikipedia-Seite",
"map": "Karte",
"language": "de",
"operator": "Betreiber"
}
18 changes: 18 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ "@metadata": {
"authors": [
"Julian Hocker"
]
},
"desc": "This extension shows data from wikidata",
"website": "Website",
"adress": "Adress",
"gndlink": "GND link",
"image": "Image",
"instance": "Instance",
"founded": "Founded",
"names": "Names",
"wikipedia": "Wikipedia page",
"map": "Map",
"language": "en",
"operator": "operator"
}
Loading

0 comments on commit 99a6deb

Please sign in to comment.