blob: 9370d1fae54da9788474b776004b122490a1a4d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# Extension:Code
A MediaWiki extension that builds on [SyntaxHighlight]
to provide the following (all in a configurable manner):
* shorter tags
e.g. `<query>` instead of `<syntaxhighlight lang=sparql>`
* code actions
e.g. automatically link the [WDQS] for SPARQL code blocks[^1]
* code linkification
e.g. automatically link Wikidata identifiers in code blocks
* code pages
e.g. automatically higlight pages with names ending in `.rq`
as SPARQL (and also display the code actions for them)
Note that code actions are also linkable from other pages via the
`Special:CodeAction` special page, e.g. `Special:CodeAction/run/Example.rq`
attempts to execute the `run` action for the `Example.rq` code page
and redirect the user accordingly.
## Installation
1. Place the extension in your extensions directory.
2. Add `wfLoadExtension('Code');` to your `LocalSettings.php`.
3. Visit `Special:CodeAction` it will tell you what other configuration you need.
(If you want syntax highlighting via [SyntaxHighlight], additionally add
`wfLoadExtension('SyntaxHighlight_GeSHi');` to your `LocalSettings.php`).
[^1]: While this can also be achieved just via MediaWiki templates,
this bears the problem that `|` has to be escaped as `{{!}}`, which can
be quite annoying for languages like SPARQL that use `|` as an operator.
[SyntaxHighlight]: https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:SyntaxHighlight
[WDQS]: https://query.wikidata.org/
|