|
|
## general info
|
|
|
# Useful Documentation
|
|
|
* class API reference: https://doc.wikimedia.org/mediawiki-core/master/php/index.html
|
|
|
|
|
|
## how to add a parser function
|
|
|
# how to add a parser function
|
|
|
|
|
|
### write the hook
|
|
|
## write the hook
|
|
|
in `MathWikiAnnotationTags.class.php`:
|
|
|
```
|
|
|
public static function onParserSetup( &$parser ) {
|
... | ... | @@ -13,7 +13,7 @@ public static function onParserSetup( &$parser ) { |
|
|
}
|
|
|
```
|
|
|
|
|
|
### register the magic words: {{#annot}} and {{#annotend}}
|
|
|
## register the magic words: {{#annot}} and {{#annotend}}
|
|
|
in `MathWikiAnnotationTags.i18n.php`:
|
|
|
```
|
|
|
$magicWords = array();
|
... | ... | @@ -23,7 +23,7 @@ $magicWords['en'] = array( |
|
|
);
|
|
|
```
|
|
|
|
|
|
### register the hook
|
|
|
## register the hook
|
|
|
|
|
|
in `extension.json`:
|
|
|
```
|
... | ... | @@ -35,7 +35,7 @@ in `extension.json`: |
|
|
}
|
|
|
```
|
|
|
|
|
|
### register the extension in MediaWiki
|
|
|
## register the extension in MediaWiki
|
|
|
- place Folder of MyExtension into `/var/www/w/extensions`
|
|
|
- or create a symbolic link: `ln -s /vagrant/MathWikiAnnotationTags/ MathWikiAnnotationTags`
|
|
|
- edit `LocalSettings.php`
|
... | ... | @@ -45,9 +45,8 @@ in `extension.json`: |
|
|
- `<?php`
|
|
|
- `wfLoadExtension( 'MathWikiAnnotationTags' );`
|
|
|
|
|
|
## how to create new tables in MediaWiki
|
|
|
|
|
|
### create SQL file
|
|
|
# custom tables in MediaWiki
|
|
|
## create SQL file
|
|
|
|
|
|
content of `MyExtension/sql/yata_annotation.sql`
|
|
|
|
... | ... | @@ -90,7 +89,7 @@ CREATE INDEX /*i*/yata_annot_category ON /*_*/yata_annotation (category_id); |
|
|
COMMIT;
|
|
|
```
|
|
|
|
|
|
### create function which invokes the SQL file
|
|
|
## create function which invokes the SQL file
|
|
|
|
|
|
in `MyExtension/Schema.php`:
|
|
|
|
... | ... | @@ -118,7 +117,7 @@ in `extension.json`: |
|
|
]
|
|
|
```
|
|
|
|
|
|
### update the Schema
|
|
|
## update the Schema
|
|
|
|
|
|
- inside the Vagrant machine (`vagrant ssh`): `mwscript update.php`
|
|
|
- in production:
|
... | ... | |