summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO48
-rw-r--r--pygments/formatters/html.py2
-rw-r--r--pygments/formatters/rtf.py3
-rw-r--r--pygments/formatters/terminal.py7
-rw-r--r--pygments/lexers/__init__.py6
-rw-r--r--pygments/lexers/compiled.py2
-rw-r--r--pygments/lexers/other.py2
-rw-r--r--pygments/lexers/text.py2
-rw-r--r--pygments/lexers/web.py4
-rw-r--r--pygments/scanner.py2
-rw-r--r--pygments/util.py4
11 files changed, 32 insertions, 50 deletions
diff --git a/TODO b/TODO
index 8419a247..829f7516 100644
--- a/TODO
+++ b/TODO
@@ -1,46 +1,40 @@
Todo
====
-for 0.6
+for 0.7
-------
-- allow "overlay" token types (e.g. Diff + X)
- - highlight specials: nth line, a word etc.
- - dhtml: overlays toggleable by javascript
-
- lexers:
- * haskell
- * (Q)BASIC
- * lisp
- * python TBs
- * IPython sessions
- * ls -alG
- * HTML with special formatting?
- * latex special formatting?
- * ocaml
- * nemerle
- * windows batch files
- * assembler
- * objective c
- * mysql/postgresql/sqlite
- * tcl
-
-
-for 0.7
--------
+ * Haskell
+ * (Q)BASIC
+ * Lisp
+ * Python TBs
+ * IPython sessions
+ * ls -alG
+ * HTML with special formatting?
+ * LaTeX special formatting?
+ * OCaml
+ * Nemerle
+ * Windows batch files
+ * Assembler
+ * Objective C
+ * MySQL/PostgreSQL/SQLite
+ * Tcl
- automatically get help for lexers/formatters/options from docstrings
-- moin parser
+- a MoinMoin parser
+
+- allow "overlay" token types to highlight specials: nth line, a word etc.
- readd property support for C# lexer? that is, find a regex that doesn't
backtrack to death...
- add support for function name highlighting to c++ lexer
-- pygmentize presets?
+- pygmentize option presets?
-- more unit tests (pygmentize, all formatters comprehensively)
+- more unit tests (test pygmentize, test all formatters comprehensively)
- review perl lexer (numerous bugs, but so far no one had complaints ;)
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index c9118f7f..3a5bafb1 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -8,7 +8,7 @@
:copyright: 2006 by Georg Brandl, Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
-import os
+import sys, os
import cStringIO
from pygments.formatter import Formatter
diff --git a/pygments/formatters/rtf.py b/pygments/formatters/rtf.py
index d679399c..4eaa929b 100644
--- a/pygments/formatters/rtf.py
+++ b/pygments/formatters/rtf.py
@@ -8,11 +8,8 @@
:copyright: 2006 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
-import cStringIO
from pygments.formatter import Formatter
-from pygments.token import Token
-from pygments.util import get_bool_opt, get_int_opt
__all__ = ['RtfFormatter']
diff --git a/pygments/formatters/terminal.py b/pygments/formatters/terminal.py
index fdfb6c2c..b0a134b8 100644
--- a/pygments/formatters/terminal.py
+++ b/pygments/formatters/terminal.py
@@ -67,17 +67,12 @@ class TerminalFormatter(Formatter):
``colorscheme``
``None`` or a dictionary mapping token types to
``(lightbg, darkbg)`` color names.
-
- ``debug``
- If true, output "<<ERROR>>" after each error token.
"""
Formatter.__init__(self, **options)
self.darkbg = options.get('bg', 'light') == 'dark'
self.colorscheme = options.get('colorscheme', None) or TERMINAL_COLORS
- self.debug = get_bool_opt(options, 'debug', False)
def format(self, tokensource, outfile):
- dbg = self.debug
for ttype, value in tokensource:
value = value.encode(self.encoding)
color = self.colorscheme.get(ttype)
@@ -95,5 +90,3 @@ class TerminalFormatter(Formatter):
outfile.write(ansiformat(color, spl[-1]))
else:
outfile.write(value)
- if dbg and ttype is Error:
- outfile.write('<<ERROR>>')
diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py
index 0f2b7093..9a66a534 100644
--- a/pygments/lexers/__init__.py
+++ b/pygments/lexers/__init__.py
@@ -29,7 +29,7 @@ _lexer_cache = {}
def _load_lexers(module_name):
"""
- Loads a lexer (and all others in the module too)
+ Load a lexer (and all others in the module too).
"""
mod = __import__(module_name, None, None, ['__all__'])
for lexer_name in mod.__all__:
@@ -100,7 +100,7 @@ def get_lexer_for_mimetype(_mime, **options):
def _iter_lexerclasses():
"""
- Returns an iterator over all lexer classes.
+ Return an iterator over all lexer classes.
"""
for module_name, name, _, _, _ in LEXERS.itervalues():
if name not in _lexer_cache:
@@ -157,8 +157,6 @@ def guess_lexer(_text, **options):
"""
Guess a lexer by strong distinctions in the text (eg, shebang).
"""
- #XXX: i (mitsuhiko) would like to drop this function in favor of the
- # better guess_lexer_for_filename function.
best_lexer = [0.0, None]
for lexer in _iter_lexerclasses():
rv = lexer.analyse_text(_text)
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py
index 08a5c90d..82997d3d 100644
--- a/pygments/lexers/compiled.py
+++ b/pygments/lexers/compiled.py
@@ -237,7 +237,7 @@ class DelphiLexer(Lexer):
'override', 'assembler'
])
- # XXX: those arn't global. but currently we know no way for defining
+ # XXX: those aren't global. but currently we know no way for defining
# them just for the type context.
DIRECTIVES = set([
'absolute', 'abstract', 'assembler', 'cppdecl', 'default', 'far',
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py
index 707544d8..c1549274 100644
--- a/pygments/lexers/other.py
+++ b/pygments/lexers/other.py
@@ -11,7 +11,7 @@
import re
-from pygments.lexer import RegexLexer, include, bygroups, using
+from pygments.lexer import RegexLexer, include, bygroups
from pygments.token import Error, Punctuation, \
Text, Comment, Operator, Keyword, Name, String, Number
from pygments.util import shebang_matches
diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py
index 525b1bc5..16abed89 100644
--- a/pygments/lexers/text.py
+++ b/pygments/lexers/text.py
@@ -158,7 +158,7 @@ class IrcLogsLexer(RegexLexer):
class BBCodeLexer(RegexLexer):
name = 'BBCode'
aliases = ['bbcode']
-
+
tokens = {
'root' : [
(r'[\s\w]+', Text),
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py
index 10e34cac..83552746 100644
--- a/pygments/lexers/web.py
+++ b/pygments/lexers/web.py
@@ -16,7 +16,7 @@ try:
except NameError:
from sets import Set as set
-from pygments.lexer import Lexer, RegexLexer, bygroups, using, include, this
+from pygments.lexer import RegexLexer, bygroups, using, include, this
from pygments.token import \
Text, Comment, Operator, Keyword, Name, String, Number, Other, Punctuation
from pygments.util import get_bool_opt, get_list_opt, looks_like_xml, \
@@ -313,7 +313,7 @@ class PhpLexer(RegexLexer):
self.disabledmodules = get_list_opt(
options, 'disabledmodules', ['unknown'])
self.startinline = get_bool_opt(options, 'startinline', False)
-
+
# private option argument for the lexer itself
if '_startinline' in options:
self.startinline = options.pop('_startinline')
diff --git a/pygments/scanner.py b/pygments/scanner.py
index 34406cf6..b1837cc8 100644
--- a/pygments/scanner.py
+++ b/pygments/scanner.py
@@ -93,7 +93,7 @@ class Scanner(object):
return True
def get_char(self):
- """Scan exactly one char"""
+ """Scan exactly one char."""
self.scan('.')
def __repr__(self):
diff --git a/pygments/util.py b/pygments/util.py
index 8a1434b4..d66eabd6 100644
--- a/pygments/util.py
+++ b/pygments/util.py
@@ -138,14 +138,14 @@ def doctype_matches(text, regex):
def html_doctype_matches(text):
"""
- Check if the file looks like it has a html doctype
+ Check if the file looks like it has a html doctype.
"""
return doctype_matches(text, r'html\s+PUBLIC\s+"-//W3C//DTD X?HTML.*')
def looks_like_xml(text):
"""
- Check if a doctype exists or if we have some tags
+ Check if a doctype exists or if we have some tags.
"""
m = doctype_lookup_re.match(text)
if m is not None: