diff options
Diffstat (limited to 'pygments/util.py')
-rw-r--r-- | pygments/util.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pygments/util.py b/pygments/util.py index bf9f1a26..79fa250e 100644 --- a/pygments/util.py +++ b/pygments/util.py @@ -23,6 +23,12 @@ doctype_lookup_re = re.compile(r'''(?smx) tag_re = re.compile(r'<(.+?)(\s.*?)?>.*?</\1>(?uism)') +class ClassNotFound(ValueError): + """ + If one of the get_*_by_* functions didn't find a matching class. + """ + + class OptionError(Exception): pass @@ -63,6 +69,18 @@ def get_list_opt(options, optname, default=None): val, optname)) +def docstring_headline(obj): + if not obj.__doc__: + return '' + res = [] + for line in obj.__doc__.strip().splitlines(): + if line.strip(): + res.append(" " + line.strip()) + else: + break + return ''.join(res).lstrip() + + def make_analysator(f): """ Return a static text analysation function that |