Coder Social home page Coder Social logo

starcitizentools / mediawiki-extensions-shortdescription Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 2.0 560 KB

A MediaWiki extension that provides local short description support

Home Page: https://mediawiki.org/wiki/Extension:ShortDescription

License: GNU General Public License v3.0

PHP 96.09% Shell 0.99% JavaScript 2.16% Less 0.76%
mediawiki-extension mediawiki-api

mediawiki-extensions-shortdescription's Introduction

ShortDescription

The ShortDescription extension allows wikis to add short descriptions to wikitext pages, simliar to the implementation on Wikipedia and Wikibase. On top of that, it replaces the site tagline with short description on pages with short description.

Extension:ShortDescription on MediaWiki.

Features

  • Define short description on the page with the magic word {{SHORTDESC}}, same as the implementation on Wikipedia
  • Retrieve short description on any wiki pages with the magic word {{GETSHORTDESC}}
  • Add short description underneath the page title on most skins, if the skin supports site tagline (#siteSub)
    • Note that the short description with replace the default site tagline message on pages with short description
    • Does not apply to Skin:Citizen and Skin:Minerva Neue, as they have native support
  • Allow short description to be accessed through the Action API
  • Provide description to the REST API search endpoint
  • Add short description to page information (&action=info)
  • Provide description for extensions such as MobileFrontend, RelatedArticles

Requirements

Installation

You can get the extension via Git (specifying ShortDescription as the destination directory):

git clone https://github.com/StarCitizenTools/mediawiki-extensions-ShortDescription.git ShortDescription

Or download it as zip archive.

In either case, the "ShortDescription" extension should end up in the "extensions" directory of your MediaWiki installation. If you got the zip archive, you will need to put it into a directory called ShortDescription.

Configurations

The extension works out of the box without any configurations. The config flags allow more customization on the specific features in the extension.

Name Description Values Default
$wgShortDescriptionEnableTagline Enables short descritption in site tagline true - enable; false - disable true
$wgShortDescriptionExtendOpenSearchXml Provide short description to the Opensearch API module true - enable; false - disable false

Usage

Add short description

To add Bacon ipsum dolor amet turkey as short description, simply add {{SHORTDESC:Bacon ipsum dolor amet turkey}} on the page.

Retrive short description on wikipage

To retrive the short description on the page Bacon, simply add {{GETSHORTDESC:Bacon}} on the page. If you are retrieving the short description on the same page (e.g. getting the short description of Bacon on the Bacon page), simply add {{GETSHORTDESC:}}.

Retrieve short description through Action API

The short description can be called through the description property in query action in the Action API (e.g.api.php?action=query&prop=description). It is also accessible through the shortdesc property inside pageprops.

Retrieve short description through REST API

The short description can be accessed through the description property in the search endpoint in the REST API.

mediawiki-extensions-shortdescription's People

Contributors

alistair3149 avatar dependabot[bot] avatar paladox avatar somechris avatar translatewiki avatar umherirrender avatar universal-omega avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mediawiki-extensions-shortdescription's Issues

MWException from line 129 of /srv/mediawiki/w/includes/MagicWord.php: Error: invalid magic word 'getshortdesc'

Getting this when trying to run a maintenance script with a wiki that has ShortDescription enabled:

#0 /srv/mediawiki/w/includes/MagicWordFactory.php(230): MagicWord->load('getshortdesc') #1 /srv/mediawiki/w/includes/parser/Parser.php(4869): MagicWordFactory->get('getshortdesc') #2 /srv/mediawiki/w/extensions/ShortDescription/includes/Hooks/ParserHooks.php(55): Parser->setFunctionHook('getshortdesc', Array, 1) #3 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(154): MediaWiki\Extension\ShortDescription\Hooks\ParserHooks->onParserFirstCallInit(Object(Parser)) #4 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(2959): MediaWiki\HookContainer\HookContainer->run('ParserFirstCall...', Array) #5 /srv/mediawiki/w/includes/parser/Parser.php(532): MediaWiki\HookContainer\HookRunner->onParserFirstCallInit(Object(Parser)) #6 /srv/mediawiki/w/includes/parser/Parser.php(477): Parser->firstCallInit() #7 /srv/mediawiki/w/includes/parser/ParserFactory.php(142): Parser->__construct(Object(MediaWiki\Config\ServiceOptions), Object(MagicWordFactory), Object(LanguageEn), Object(ParserFactory), 'bitcoin\\:|ftp\\:...', Object(MediaWiki\SpecialPage\SpecialPageFactory), Object(MediaWiki\Linker\LinkRendererFactory), Object(NamespaceInfo), Object(Monolog\Logger), Object(MediaWiki\BadFileLookup), Object(MediaWiki\Languages\LanguageConverterFactory), Object(MediaWiki\HookContainer\HookContainer)) #8 /srv/mediawiki/w/includes/ServiceWiring.php(817): ParserFactory->create() #9 /srv/mediawiki/w/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer->{closure}(Object(MediaWiki\MediaWikiServices)) #10 /srv/mediawiki/w/vendor/wikimedia/services/src/ServiceContainer.php(416): Wikimedia\Services\ServiceContainer->createService('Parser') #11 /srv/mediawiki/w/includes/MediaWikiServices.php(1000): Wikimedia\Services\ServiceContainer->getService('Parser') #12 /srv/mediawiki/w/includes/content/WikitextContent.php(373): MediaWiki\MediaWikiServices->getParser() #13 /srv/mediawiki/w/includes/content/AbstractContent.php(590): WikitextContent->fillParserOutput(Object(Title), 27, Object(ParserOptions), true, Object(ParserOutput)) #14 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(263): AbstractContent->getParserOutput(Object(Title), 27, Object(ParserOptions), true) #15 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(Object(WikitextContent), true) #16 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(215): MediaWiki\Revision\RenderedRevision->getSlotParserOutput('main') #17 /srv/mediawiki/w/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(Object(MediaWiki\Revision\RenderedRevision), Array) #18 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(Object(MediaWiki\Revision\RenderedRevision), Array) #19 /srv/mediawiki/w/includes/Revision/RenderedRevision.php(197): call_user_func(Object(Closure), Object(MediaWiki\Revision\RenderedRevision), Array) #20 /srv/mediawiki/w/includes/Storage/DerivedPageDataUpdater.php(1315): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput() #21 /srv/mediawiki/w/includes/Storage/DerivedPageDataUpdater.php(1665): MediaWiki\Storage\DerivedPageDataUpdater->getCanonicalParserOutput() #22 /srv/mediawiki/w/includes/Storage/DerivedPageDataUpdater.php(1452): MediaWiki\Storage\DerivedPageDataUpdater->doParserCacheUpdate() #23 /srv/mediawiki/w/includes/page/WikiPage.php(2172): MediaWiki\Storage\DerivedPageDataUpdater->doUpdates() #24 /srv/mediawiki/w/includes/import/ImportableOldRevisionImporter.php(218): WikiPage->doEditUpdates(Object(MediaWiki\Revision\RevisionStoreRecord), Object(User), Array) #25 /srv/mediawiki/w/includes/import/WikiRevision.php(669): ImportableOldRevisionImporter->import(Object(WikiRevision)) #26 /srv/mediawiki/w/includes/import/WikiImporter.php(371): WikiRevision->importOldRevision() #27 /srv/mediawiki/w/maintenance/importDump.php(201): WikiImporter->importRevision(Object(WikiRevision)) #28 /srv/mediawiki/w/includes/import/WikiImporter.php(507): BackupReader->handleRevision(Object(WikiRevision), Object(WikiImporter)) #29 /srv/mediawiki/w/includes/import/WikiImporter.php(999): WikiImporter->revisionCallback(Object(WikiRevision)) #30 /srv/mediawiki/w/includes/import/WikiImporter.php(864): WikiImporter->processRevision(Array, Array) #31 /srv/mediawiki/w/includes/import/WikiImporter.php(802): WikiImporter->handleRevision(Array) #32 /srv/mediawiki/w/includes/import/WikiImporter.php(612): WikiImporter->handlePage() #33 /srv/mediawiki/w/maintenance/importDump.php(353): WikiImporter->doImport() #34 /srv/mediawiki/w/maintenance/importDump.php(286): BackupReader->importFromHandle(Resource id #1090) #35 /srv/mediawiki/w/maintenance/importDump.php(130): BackupReader->importFromFile('/home/reception...') #36 /srv/mediawiki/w/maintenance/doMaintenance.php(107): BackupReader->execute() #37 /srv/mediawiki/w/maintenance/importDump.php(358): require_once('/srv/mediawiki/...') #38 {main}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.