summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2008-09-23 23:05:53 +0200
committergbrandl <devnull@localhost>2008-09-23 23:05:53 +0200
commit420f7fa8594b96d6eed23073f0525a431218bb3e (patch)
treec66bec1f66113e036c3cf37d2f9130170112c3dd
parentd97401fd65164c0d472966d8c20f29d27c4a6055 (diff)
parent179c00fef6ca282a523242a666889d94579cd436 (diff)
downloadpygments-420f7fa8594b96d6eed23073f0525a431218bb3e.tar.gz
Merge with ben-testing.
-rw-r--r--CHANGES8
-rw-r--r--pygments/lexer.py7
-rw-r--r--pygments/lexers/_mapping.py4
-rw-r--r--pygments/lexers/math.py1
-rw-r--r--pygments/lexers/text.py2
5 files changed, 15 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index be6973df..f7523665 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,10 @@ Version 0.12
------------
(codename not selected, release XXX XX, 2008)
+- Don't use join(splitlines()) when converting newlines to ``\n``,
+ because that doesn't keep all newlines at the end when the
+ ``stripnl`` lexer option is False.
+
- Add Tango style, written by Andre Roberge for the Crunchy project.
- Add Python3TracebackLexer and ``python3`` option to
@@ -21,6 +25,10 @@ Version 0.12
- Actually use the `font_size` option of the image formatter.
+- Fixed numpy lexer that it doesn't listen for "*.py" any longer.
+
+- Unified Diff lexer supports the "udiff" alias now.
+
Version 0.11.1
--------------
diff --git a/pygments/lexer.py b/pygments/lexer.py
index 5c41d4a2..cba93e4f 100644
--- a/pygments/lexer.py
+++ b/pygments/lexer.py
@@ -127,10 +127,9 @@ class Lexer(object):
Also preprocess the text, i.e. expand tabs and strip it if
wanted and applies registered filters.
"""
- if isinstance(text, unicode):
- text = u'\n'.join(text.splitlines())
- else:
- text = '\n'.join(text.splitlines())
+ text = text.replace('\r\n', '\n')
+ text = text.replace('\r', '\n')
+ if not isinstance(text, unicode):
if self.encoding == 'guess':
try:
text = text.decode('utf-8')
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 8337eda6..ba255dae 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -46,7 +46,7 @@ LEXERS = {
'DarcsPatchLexer': ('pygments.lexers.text', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()),
'DebianControlLexer': ('pygments.lexers.text', 'Debian Control file', ('control',), ('control',), ()),
'DelphiLexer': ('pygments.lexers.compiled', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas',), ('text/x-pascal',)),
- 'DiffLexer': ('pygments.lexers.text', 'Diff', ('diff',), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')),
+ 'DiffLexer': ('pygments.lexers.text', 'Diff', ('diff', 'udiff'), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')),
'DjangoLexer': ('pygments.lexers.templates', 'Django/Jinja', ('django', 'jinja'), (), ('application/x-django-templating', 'application/x-jinja')),
'DylanLexer': ('pygments.lexers.compiled', 'Dylan', ('dylan',), ('*.dylan',), ('text/x-dylan',)),
'ErbLexer': ('pygments.lexers.templates', 'ERB', ('erb',), (), ('application/x-ruby-templating',)),
@@ -100,7 +100,7 @@ LEXERS = {
'MyghtyXmlLexer': ('pygments.lexers.templates', 'XML+Myghty', ('xml+myghty',), (), ('application/xml+myghty',)),
'NasmLexer': ('pygments.lexers.asm', 'NASM', ('nasm',), ('*.asm', '*.ASM'), ('text/x-nasm',)),
'NginxConfLexer': ('pygments.lexers.text', 'Nginx configuration file', ('nginx',), (), ('text/x-nginx-conf',)),
- 'NumPyLexer': ('pygments.lexers.math', 'NumPy', ('numpy',), ('*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript'), ()),
+ 'NumPyLexer': ('pygments.lexers.math', 'NumPy', ('numpy',), (), ()),
'ObjdumpLexer': ('pygments.lexers.asm', 'objdump', ('objdump',), ('*.objdump',), ('text/x-objdump',)),
'ObjectiveCLexer': ('pygments.lexers.compiled', 'Objective-C', ('objective-c', 'objectivec', 'obj-c', 'objc'), ('*.m',), ('text/x-objective-c',)),
'OcamlLexer': ('pygments.lexers.compiled', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)),
diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py
index 3ba89a7c..aa3b2ad8 100644
--- a/pygments/lexers/math.py
+++ b/pygments/lexers/math.py
@@ -255,6 +255,7 @@ class NumPyLexer(PythonLexer):
# override the mimetypes to not inherit them from python
mimetypes = []
+ filenames = []
EXTRA_KEYWORDS = set([
'abs', 'absolute', 'accumulate', 'add', 'alen', 'all', 'allclose',
diff --git a/pygments/lexers/text.py b/pygments/lexers/text.py
index 5b0688e7..b3c11c1f 100644
--- a/pygments/lexers/text.py
+++ b/pygments/lexers/text.py
@@ -208,7 +208,7 @@ class DiffLexer(RegexLexer):
"""
name = 'Diff'
- aliases = ['diff']
+ aliases = ['diff', 'udiff']
filenames = ['*.diff', '*.patch']
mimetypes = ['text/x-diff', 'text/x-patch']