summaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/api.txt23
-rw-r--r--docs/src/cmdline.txt34
2 files changed, 45 insertions, 12 deletions
diff --git a/docs/src/api.txt b/docs/src/api.txt
index c602cb10..8cd7f1f2 100644
--- a/docs/src/api.txt
+++ b/docs/src/api.txt
@@ -34,20 +34,23 @@ def `get_lexer_by_name(alias, **options):`
aliases list. The lexer is given the `options` at its
instantiation.
- Will raise `ValueError` if no lexer with that alias is found.
+ Will raise `pygments.util.ClassNotFound` if no lexer with that alias is
+ found.
def `get_lexer_for_filename(fn, **options):`
Return a `Lexer` subclass instance that has a filename pattern
matching `fn`. The lexer is given the `options` at its
instantiation.
- Will raise `ValueError` if no lexer for that filename is found.
+ Will raise `pygments.util.ClassNotFound` if no lexer for that filename is
+ found.
def `get_lexer_for_mimetype(mime, **options):`
Return a `Lexer` subclass instance that has `mime` in its mimetype
list. The lexer is given the `options` at its instantiation.
- Will raise `ValueError` if not lexer for that mimetype is found.
+ Will raise `pygments.util.ClassNotFound` if not lexer for that mimetype is
+ found.
def `guess_lexer(text, **options):`
Return a `Lexer` subclass instance that's guessed from the text
@@ -55,13 +58,15 @@ def `guess_lexer(text, **options):`
lexer class is called with the text as argument, and the lexer
which returned the highest value will be instantiated and returned.
- `ValueError` is raised if no lexer thinks it can handle the content.
+ `pygments.util.ClassNotFound` is raised if no lexer thinks it can handle the
+ content.
def `guess_lexer_for_filename(text, filename, **options):`
As `guess_lexer()`, but only lexers which have a pattern in `filenames`
or `alias_filenames` that matches `filename` are taken into consideration.
- `ValueError` is raised if no lexer thinks it can handle the content.
+ `pygments.util.ClassNotFound` is raised if no lexer thinks it can handle the
+ content.
def `get_all_lexers():`
Return an iterable over all registered lexers, yielding tuples in the
@@ -79,14 +84,16 @@ def `get_formatter_by_name(alias, **options):`
aliases list. The formatter is given the `options` at its
instantiation.
- Will raise `ValueError` if no formatter with that alias is found.
+ Will raise `pygments.util.ClassNotFound` if no formatter with that alias is
+ found.
def `get_formatter_for_filename(fn, **options):`
Return a `Formatter` subclass instance that has a filename pattern
matching `fn`. The formatter is given the `options` at its
instantiation.
- Will raise `ValueError` if no formatter for that filename is found.
+ Will raise `pygments.util.ClassNotFound` if no formatter for that filename
+ is found.
Functions from `pygments.styles`:
@@ -95,7 +102,7 @@ def `get_style_by_name(name):`
Return a style class by its short name. The names of the builtin styles
are listed in `pygments.styles.STYLE_MAP`.
- Will raise `ValueError` if no style of that name is found.
+ Will raise `pygments.util.ClassNotFound` if no style of that name is found.
def `get_all_styles():`
Return an iterable over all registered styles, yielding their names.
diff --git a/docs/src/cmdline.txt b/docs/src/cmdline.txt
index 461ecb32..bf171fc7 100644
--- a/docs/src/cmdline.txt
+++ b/docs/src/cmdline.txt
@@ -37,8 +37,18 @@ Lexer and formatter options can be given using the ``-O`` option::
$ pygmentize -f html -O style=colorful,linenos=1 -l python test.py
-Be sure to enclose the option string in quotes if it contains any special
-shell characters, such as spaces or expansion wildcards like ``*``.
+Be sure to enclose the option string in quotes if it contains any special shell
+characters, such as spaces or expansion wildcards like ``*``. If an option
+expects a list value, separate the list entries with spaces (you'll have to
+quote the option value in this case too, so that the shell doesn't split it).
+
+Filters are added to the token stream using the ``-F`` option::
+
+ $ pygmentize -f html -l pascal -F keywordcase:case=upper main.pas
+
+As you see, options for the filter are given after a colon. As for ``-O``, the
+filter name and options must be one shell word, so there may not be any spaces
+around the colon.
There's a special ``-S`` option for generating style definitions. Usage is
as follows::
@@ -51,8 +61,24 @@ the "colorful" style prepending a ".syntax" selector to all style rules.
For an explanation what ``-a`` means for `a particular formatter`_, look for
the `arg` argument for the formatter's `get_style_defs()` method.
-The ``-L`` option lists all lexers and formatters, along with their short
-names and supported file name extensions.
+The ``-L`` option lists lexers, formatters, along with their short
+names and supported file name extensions, styles and filters. If you want to see
+only one category, give it as an argument::
+
+ $ pygmentize -L filters
+
+will list only all installed filters.
+
+The ``-H`` option will give you detailed information (the same that can be found
+in this documentation) about a lexer, formatter or filter. Usage is as follows::
+
+ $ pygmentize -H formatter html
+
+will print the help for the HTML formatter, while::
+
+ $ pygmentize -H lexer python
+
+will print the help for the Python lexer, etc.
.. _a particular formatter: formatters.txt