summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2007-01-14 10:27:04 +0100
committergbrandl <devnull@localhost>2007-01-14 10:27:04 +0100
commitb0f8f009b7987f3003819612b2d614322c46bede (patch)
tree0cc266008565f56191116ad6017b3284ad5d337e
parent1d2da667901525d0aa6e708e98e595ab8e739548 (diff)
downloadpygments-b0f8f009b7987f3003819612b2d614322c46bede.tar.gz
[svn] Fix #185, fix JspLexer so that test suite passes.
-rw-r--r--CHANGES10
-rw-r--r--pygments/__init__.py8
-rw-r--r--pygments/formatters/latex.py10
-rw-r--r--pygments/lexers/templates.py3
4 files changed, 21 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index 8137b8d5..ad979ef8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,7 +5,11 @@ Version 0.7
-----------
(codename to be selected, released Feb XX, 2007)
+- Added a `commandprefix` option to the `LatexFormatter` which allows to
+ control how the command names are constructed.
+
- Added quite a few new lexers, thanks to Tim Hatch:
+
* Java Server Pages
* Windows batch files
* Trac Wiki markup
@@ -18,11 +22,11 @@ Version 0.7
- Added sources.list lexer by Dennis Kaarsemaker.
-- Fixed tickets #167, #178, #179, #180.
-
- Added token stream filters.
-- Changed behavior of `in` Operator for tokens.
+- Changed behavior of `in` Operator for tokens.
+
+- Fixed tickets: #167, #178, #179, #180, #185.
Version 0.6
diff --git a/pygments/__init__.py b/pygments/__init__.py
index eafa867f..6f3fdebc 100644
--- a/pygments/__init__.py
+++ b/pygments/__init__.py
@@ -5,9 +5,9 @@
Pygments is a syntax highlighting package written in Python.
- It aims to be a generic syntax highlighter for general use in all
- kinds of software such as forum systems, wikis or other applications
- that need to prettify source code. Highlights are:
+ It is a generic syntax highlighter for general use in all kinds of software
+ such as forum systems, wikis or other applications that need to prettify
+ source code. Highlights are:
* a wide range of common languages and markup formats is supported
* special attention is paid to details, increasing quality by a fair amount
@@ -19,7 +19,7 @@
The `Pygments trunk <http://trac.pocoo.org/repos/pygments/trunk#egg=Pygments-dev>`__
is installable via *easy_install* with ``easy_install Pygments==dev``.
- :copyright: 2006 by Georg Brandl, Armin Ronacher, Lukas Meuser and others.
+ :copyright: 2006 by Georg Brandl, Armin Ronacher and others.
:license: BSD, see LICENSE for more details.
"""
diff --git a/pygments/formatters/latex.py b/pygments/formatters/latex.py
index 69b67a9d..a288fe51 100644
--- a/pygments/formatters/latex.py
+++ b/pygments/formatters/latex.py
@@ -85,6 +85,10 @@ class LatexFormatter(Formatter):
Additional options given to the Verbatim environment (see the *fancyvrb*
docs for possible values) (default: ``''``).
+ `commandprefix`
+ The LaTeX commands used to produce colored output are constructed
+ using this prefix and some letters (default: ``'C'``).
+ *New in Pygments 0.7.*
"""
def __init__(self, **options):
@@ -96,6 +100,7 @@ class LatexFormatter(Formatter):
self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
self.verboptions = options.get('verboptions', '')
self.nobackground = get_bool_opt(options, 'nobackground', False)
+ self.commandprefix = options.get('commandprefix', 'C')
self._create_stylecmds()
@@ -103,6 +108,7 @@ class LatexFormatter(Formatter):
def _create_stylecmds(self):
t2c = self.ttype2cmd = {Token: ''}
c2d = self.cmd2def = {}
+ cp = self.commandprefix
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
first = iter(letters)
@@ -143,11 +149,11 @@ class LatexFormatter(Formatter):
if cmndef == '#1':
continue
try:
- alias = 'C' + firstl + second.next()
+ alias = cp + firstl + second.next()
except StopIteration:
firstl = first.next()
second = iter(letters)
- alias = 'C' + firstl + second.next()
+ alias = cp + firstl + second.next()
t2c[ttype] = alias
c2d[alias] = cmndef
diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py
index e6d991fb..419b7123 100644
--- a/pygments/lexers/templates.py
+++ b/pygments/lexers/templates.py
@@ -1003,7 +1003,8 @@ class JspRootLexer(RegexLexer):
],
'sec': [
(r'%>', Keyword, '#pop'),
- (r'.+?(?=%>|\Z)', using(JavaLexer)),
+ # note: '\w\W' != '.' without DOTALL.
+ (r'[\w\W]+?(?=%>|\Z)', using(JavaLexer)),
],
}