commit | 36f54adf268baf44d06724743c75a8f954280f30 | [log] [tgz] |
---|---|---|
author | Translation updater bot <l10n-bot@translatewiki.net> | Wed Sep 13 07:23:19 2023 +0200 |
committer | Translation updater bot <l10n-bot@translatewiki.net> | Wed Sep 13 07:23:19 2023 +0200 |
tree | 16eb49112edbebd2bb2f6520969946ba37fe73a6 | |
parent | 5b009dbd47a3c6b26368d0911f4759ded1cd8257 [diff] |
Localisation updates from https://translatewiki.net. Change-Id: Ie60acc0447f7bc2fde333c8570e183712d176b22
WikiLambda will provide Wikimedia wikis with a wikitext parser function to call evaluation of functions written, managed, and evaluated on a central wiki.
WikiLambda provides the {{#function:…}}
parser function, which lets you embed function calls inside wikitext documents which are then resolved at parse time.
It is currently very limited, allowing only a single direct function call to a function which both takes only strings as its inputs and emits a string as its output.
To use, simply edit any wikitext page. The target function is the zeroth parameter (named by ZID), e.g.:
If your function takes parameters, they can be passed in pipe-delimited, e.g.:
{{#function:Z12345|Hello|world|!}}
Much further functionality is to come.
mediawiki/extensions/
subdirectory, clone the extension as follows:git clone --recurse-submodules --remote-submodules https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiLambda
composer.local.json
file in your mediawiki/
directory:{ "extra": { "merge-plugin": { "include": [ "extensions/WikiLambda/composer.json" ] } } }
docker-compose exec mediawiki composer update
or similar.LocalSettings.php
file:wfLoadExtension( 'WikiLambda' );
php maintenance/update.php
(or docker-compose exec mediawiki php maintenance/update.php
if MediaWiki is setup through Docker) to provision necessary schemas and initial content (this step could take around 20 minutes).Done! Navigate to the newly created Z1
page on your wiki to verify that the extension is successfully installed.
If you would like to use the orchestrator/evaluator (e.g., to run user-defined and built-in functions), please perform the following additional steps:
Copy the contents of the services
block in mediawiki/extensions/WikiLambda/docker-compose.sample.yml
to the analogous services
block in your mediawiki/docker-compose.override.yml
Replace <TAG>
entries in the stanza you just copied with the latest builds from the Docker registry for the orchestrator and the evaluator.
If you would instead like to use a local version of the function orchestrator or evaluator, carry out the following steps.
# First, get Blubber: https://wikitech.wikimedia.org/wiki/Blubber/Download#Blubber_as_a_(micro)Service # Then, from the root of your function-orchestrator installation, run blubber .pipeline/blubber.yaml development | docker build -t local-orchestrator -f - .
After that, in mediawiki/docker-compose.override.yaml
, replace image: docker-registry...
in the function-orchestrator
service stanza to read image: local-orchestrator:latest
. If changing the evaluator, follow the same steps but for the evaluator image.
If you want to use a different port or your checkout of MediaWiki is not in a directory called 'mediawiki', you may need to change the WikiLambdaOrchestratorLocation configuration from the default of mediawiki_function-orchestrator_1:6254
in your LocalSettings file, e.g. to core_function-orchestrator_1:6254
..
You can test your installation by removing @group: Broken
from mediawiki/extensions/WikiLambda/tests/phpunit/integration/API/ApiFunctionCallTest.php
and running the PHPUnit test suite as described in the MediaWiki install instructions: docker-compose exec mediawiki php tests/phpunit/phpunit.php extensions/WikiLambda/tests/phpunit/integration/API/ApiFunctionCallTest.php
.
You can evaluate an arbitrary function call by navigating to localhost:8080/wiki/Special:CreateZObject
, adding a new key/value pair whose value is of type Z7
, and selecting a function.
Note that if you are running the evaluator at a different relative URL than the default, you will have to change the value of WikiLambdaEvaluatorLocation in your local settings appropriately.