| Ligne 50 : | Ligne 50 : | ||
version_added = '2.19.1' | version_added = '2.19.1' | ||
}} | }} | ||
}} | |||
* Mettre à jour pygments avec le nouveau "lexer" | |||
*: {{syntaxhighlight |lang=bash|code= | |||
python scripts/gen_mapfiles.py | |||
}} | |||
* On peut ensuite soit générer un executable | |||
*: {{syntaxhighlight |lang=bash|code= | |||
pyinstaller --onefile __main__.py | |||
}} | |||
* On peut aussi utiliser un lanceur python ex: | |||
*: {{syntaxhighlight |lang=python|code={{#!: | |||
#!/usr/bin/python3 | |||
# -*- coding: utf-8 -*- | |||
import re | |||
import sys | |||
from pygments.cmdline import main | |||
if __name__ == '__main__': | |||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) | |||
sys.exit(main()) | |||
}} | |||
}} | }} | ||
<br> | <br> | ||
<br> | <br> | ||
| MediaWiki/Mes Extensions/SyntaxHighlight | |
|---|---|
| Nom | SyntaxHighlight |
| Lien | |
| Github | |
Mise en forme de code
MediaWiki/Mes_Extensions
La nouvelle version utilise la librairie Pygments .
Elle permet d'ajouter un langage.
Pour cela il faut modifier la librarie utilisée écrite en python et disponible sur github.
J'ai ajouté le langage Clearcase
Je l'utilise au travers du modèle Modèle:Syntaxhighlight
{{syntaxhighlight | lang=php|wfLoadExtension("SyntaxHighlight_GeSHi" );}}
wfLoadExtension("SyntaxHighlight_GeSHi" );
Voir
https://pygments.org/docs/lexerdevelopment/
git clone https://github.com/pygments/pygments.gitclass ClearcaseLexer(RegexLexer):
"""
Lexer for (ba|k|z|)sh shell scripts.
"""
name = 'Clearcase'
mimetypes = ['application/text']
filenames = ['*.clr']
aliases = ['clearcase']
url = 'https://fr.wikipedia.org/wiki/Rational_ClearCase'
version_added = '2.19.1'
python scripts/gen_mapfiles.py
pyinstaller --onefile __main__.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from pygments.cmdline import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())