summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorTanner Prynn <tanner.prynn@nccgroup.trust>2016-02-22 13:37:30 -0600
committerTanner Prynn <tanner.prynn@nccgroup.trust>2016-02-22 13:37:30 -0600
commit3d2e08fc9844f34d80577aa2444a852fb9cdefd7 (patch)
tree1a4f364bfa97e88a32b9e41dfcfb6ec15e3b8bf2 /doc
parent3efc7cfd7504207ae0af632026be030987fde7ad (diff)
downloadpygments-3d2e08fc9844f34d80577aa2444a852fb9cdefd7.tar.gz
Add additional command line option to prevent users from using eval() on untrusted files
Finish custom-formatter loading and fill in some docstrings Add load_?_from_file functions to API documentation pep8 compliance
Diffstat (limited to 'doc')
-rw-r--r--doc/docs/api.rst24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/docs/api.rst b/doc/docs/api.rst
index dd831bd1..1b6ca668 100644
--- a/doc/docs/api.rst
+++ b/doc/docs/api.rst
@@ -62,6 +62,18 @@ Functions from :mod:`pygments.lexers`:
Will raise :exc:`pygments.util.ClassNotFound` if not lexer for that mimetype
is found.
+.. function:: load_lexer_from_file(filename, **options)
+
+ Return a `Lexer` subclass instance loaded from the provided file, relative
+ to the current directory. The file is expected to contain a CustomLexer class
+ which matches Pygments' lexer definitions. Users should be very careful with
+ the input, because this method is equivalent to running eval on the input file.
+ The lexer is given the `options` at its instantiation.
+
+ :exc:`IOError` is raised if the file is not found or unreadable
+ :exc:`ImportError` is raised if the file doesn't have a CustomLexer class
+ :exc:`Exception` for any other error raised when evaluating filename
+
.. function:: guess_lexer(text, **options)
Return a `Lexer` subclass instance that's guessed from the text in
@@ -125,6 +137,18 @@ Functions from :mod:`pygments.formatters`:
Will raise :exc:`pygments.util.ClassNotFound` if no formatter for that filename
is found.
+.. function:: load_formatter_from_file(filename, **options)
+
+ Return a `Formatter` subclass instance loaded from the provided file, relative
+ to the current directory. The file is expected to contain a CustomFormatter class
+ which matches Pygments' formatter definitions. Users should be very careful with
+ the input, because this method is equivalent to running eval on the input file.
+ The formatter is given the `options` at its instantiation.
+
+ :exc:`IOError` is raised if the file is not found or unreadable
+ :exc:`ImportError` is raised if the file doesn't have a CustomFormatter class
+ :exc:`Exception` for any other error raised when evaluating filename
+
.. module:: pygments.styles