[go: up one dir, main page]

Localisation updates from https://translatewiki.net.

Change-Id: Ie60acc0447f7bc2fde333c8570e183712d176b22
4 files changed
tree: 16eb49112edbebd2bb2f6520969946ba37fe73a6
  1. .phan/
  2. bin/
  3. i18n/
  4. includes/
  5. maintenance/
  6. resources/
  7. tests/
  8. .eslintignore
  9. .eslintrc.json
  10. .gitignore
  11. .gitmodules
  12. .gitreview
  13. .mailmap
  14. .phpcs.xml
  15. .stylelintignore
  16. .stylelintrc.json
  17. AUTHORS.txt
  18. CODE_OF_CONDUCT.md
  19. composer.json
  20. docker-compose.sample.yml
  21. extension.json
  22. Gruntfile.js
  23. jest.config.js
  24. jest.setup.js
  25. LICENSE.txt
  26. package-lock.json
  27. package.json
  28. README.md
  29. WikiLambda.alias.php
  30. WikiLambda.i18n.magic.php
README.md

WikiLambda extension for MediaWiki

WikiLambda will provide Wikimedia wikis with a wikitext parser function to call evaluation of functions written, managed, and evaluated on a central wiki.

Using the wikitext parser function

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.

Development instructions

  • Bring up a development environment for MediaWiki (e.g. Docker or Vagrant). Be sure to install docker-compose v2 instead of v1.
  • In your mediawiki/extensions/ subdirectory, clone the extension as follows:
    git clone --recurse-submodules --remote-submodules https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiLambda
    
  • Extend MediaWiki's composer dependencies to use ours by adding a composer.local.json file in your mediawiki/ directory:
    {
      "extra": {
        "merge-plugin": {
          "include": [
            "extensions/WikiLambda/composer.json"
          ]
        }
      }
    }
    
  • Run docker-compose exec mediawiki composer update or similar.
  • Add the following to your LocalSettings.php file:
    wfLoadExtension( 'WikiLambda' );
    
  • Run 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.

Orchestration and evaluation

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.

See also

https://www.mediawiki.org/wiki/Extension:WikiLambda