diff options
| author | Tanner Prynn <tanner.prynn@nccgroup.trust> | 2016-02-24 17:46:32 -0600 |
|---|---|---|
| committer | Tanner Prynn <tanner.prynn@nccgroup.trust> | 2016-02-24 17:46:32 -0600 |
| commit | 4a49415561c00e2d235d266ee81cb026982f8e20 (patch) | |
| tree | 6bb3883e3689bdeec35178a9504f8e9ab3f99daf /doc/docs/cmdline.rst | |
| parent | 604256ba5bdd0e7d707201d119db7035f478234d (diff) | |
| download | pygments-git-4a49415561c00e2d235d266ee81cb026982f8e20.tar.gz | |
Update pull request per comments by birkenfeld.
Add optional function parameter for the class name to instantiate, and update cli to support this.
Move error handling to within the loading functions; they now only raise ClassNotFound.
Modify doc with these updates and the version number.
Test case clean up and additions.
Diffstat (limited to 'doc/docs/cmdline.rst')
| -rw-r--r-- | doc/docs/cmdline.rst | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/docs/cmdline.rst b/doc/docs/cmdline.rst index 8fcd3c8c..e4f94ea5 100644 --- a/doc/docs/cmdline.rst +++ b/doc/docs/cmdline.rst @@ -102,13 +102,17 @@ lexer is known for that filename, ``text`` is printed. Custom Lexers and Formatters ---------------------------- -.. versionadded:: ? +.. versionadded:: 2.2 -The ``--load-from-file`` flag enables custom lexers and formatters to be loaded +The ``-x`` flag enables custom lexers and formatters to be loaded from files relative to the current directory. Create a file with a class named CustomLexer or CustomFormatter, then specify it on the command line:: - $ pygmentize -l your_lexer.py -f your_formatter.py --load-from-file + $ pygmentize -l your_lexer.py -f your_formatter.py -x + +You can also specify the name of your class with a colon:: + + $ pygmentize -l your_lexer.py:SomeLexer -x For more information, see :doc:`the Pygments documentation on Lexer development <lexerdevelopment>`. |
