summaryrefslogtreecommitdiff
path: root/pygments/util.py
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2006-10-30 10:52:36 +0100
committergbrandl <devnull@localhost>2006-10-30 10:52:36 +0100
commit5555cc89b14f0d30438d04eb535ca8c61fa6bd8a (patch)
tree152353a7fc55194412e5f871ea85451e0873e1f9 /pygments/util.py
parent2c0b1bae7a5f3416b75ca76fc93cad8bf422a08d (diff)
downloadpygments-5555cc89b14f0d30438d04eb535ca8c61fa6bd8a.tar.gz
[svn] More pylint fixes, update BBcode formatter to new style API.
Diffstat (limited to 'pygments/util.py')
-rw-r--r--pygments/util.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pygments/util.py b/pygments/util.py
index 9c84e8dc..94b1bd21 100644
--- a/pygments/util.py
+++ b/pygments/util.py
@@ -106,8 +106,9 @@ def shebang_matches(text, regex):
Note that this method automatically searches the whole string (eg:
the regular expression is wrapped in ``'^$'``)
"""
- if '\n' in text:
- first_line = text[:text.index('\n')].lower()
+ index = text.find('\n')
+ if index >= 0:
+ first_line = text[:index].lower()
else:
first_line = text.lower()
if first_line.startswith('#!'):