Anonymous avatar Anonymous committed 3cd6141

[svn] Some style nits and make check.

Comments (0)

Files changed (11)

 Todo
 ====
 
-for 0.6
--------
-
-- 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
 -------
 
+- 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
+
 - 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 ;)
 

pygments/formatters/html.py

     :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

pygments/formatters/rtf.py

     :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']

pygments/formatters/terminal.py

         ``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)
                     outfile.write(ansiformat(color, spl[-1]))
             else:
                 outfile.write(value)
-            if dbg and ttype is Error:
-                outfile.write('<<ERROR>>')

pygments/lexers/__init__.py

 
 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__:
 
 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:
     """
     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)

pygments/lexers/compiled.py

         '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',

pygments/lexers/other.py

 
 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

pygments/lexers/text.py

 class BBCodeLexer(RegexLexer):
     name = 'BBCode'
     aliases = ['bbcode']
-    
+
     tokens = {
         'root' : [
             (r'[\s\w]+', Text),

pygments/lexers/web.py

 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, \
         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')

pygments/scanner.py

         return True
 
     def get_char(self):
-        """Scan exactly one char"""
+        """Scan exactly one char."""
         self.scan('.')
 
     def __repr__(self):
 
 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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.