Skip to content
Snippets Groups Projects
Commit 95f75e19 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge tag 'v0.5.4' of https://github.com/tmm1/pygments.rb

parents 5358576d ddf8e122
No related branches found
No related tags found
No related merge requests found
Showing
with 380 additions and 39 deletions
Loading
Loading
@@ -83,6 +83,58 @@ If no rule matches at the current position, the current char is emitted as an
1.
 
 
Adding and testing a new lexer
==============================
To make pygments aware of your new lexer, you have to perform the following
steps:
First, change to the current directory containing the pygments source code:
.. sourcecode:: console
$ cd .../pygments-main
Next, make sure the lexer is known from outside of the module. All modules in
the ``pygments.lexers`` specify ``__all__``. For example, ``other.py`` sets:
.. sourcecode:: python
__all__ = ['BrainfuckLexer', 'BefungeLexer', ...]
Simply add the name of your lexer class to this list.
Finally the lexer can be made publically known by rebuilding the lexer
mapping:
.. sourcecode:: console
$ make mapfiles
To test the new lexer, store an example file with the proper extension in
``tests/examplefiles``. For example, to test your ``DiffLexer``, add a
``tests/examplefiles/example.diff`` containing a sample diff output.
Now you can use pygmentize to render your example to HTML:
.. sourcecode:: console
$ ./pygmentize -O full -f html -o /tmp/example.html tests/examplefiles/example.diff
Note that this explicitely calls the ``pygmentize`` in the current directory
by preceding it with ``./``. This ensures your modifications are used.
Otherwise a possibly already installed, unmodified version without your new
lexer would have been called from the system search path (``$PATH``).
To view the result, open ``/tmp/example.html`` in your browser.
Once the example renders as expected, you should run the complete test suite:
.. sourcecode:: console
$ make test
Regex Flags
===========
 
Loading
Loading
#!/bin/sh
# Best effort auto-pygmentization with transparent decompression
# (c) Reuben Thomas 2012-2013
# This program is in the public domain.
# Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail
# Set the environment variable PYGMENTIZE_OPTS to configure pygments.
# This program can be used as a .lessfilter for the less pager to auto-color less's output
lexer=`pygmentize -N "$1"`
if [ "$lexer" = "text" ]; then
file_common_opts="--brief --dereference --uncompress"
unset lexer
case `file --mime-type $file_common_opts "$1"` in
application/xml|image/svg+xml) lexer=xml;;
text/html) lexer=html;;
text/troff) lexer=nroff;;
text/x-asm) lexer=nasm;;
text/x-awk) lexer=awk;;
text/x-c) lexer=c;;
text/x-c++) lexer=cpp;;
text/x-diff) lexer=diff;;
text/x-fortran) lexer=fortran;;
text/x-gawk) lexer=gawk;;
text/x-java) lexer=java;;
text/x-lisp) lexer=common-lisp;;
text/x-lua) lexer=lua;;
text/x-makefile) lexer=make;;
text/x-msdos-batch) lexer=bat;;
text/x-nawk) lexer=nawk;;
text/x-pascal) lexer=pascal;;
text/x-perl) lexer=perl;;
text/x-php) lexer=php;;
text/x-po) lexer=po;;
text/x-python) lexer=python;;
text/x-ruby) lexer=ruby;;
text/x-shellscript) lexer=sh;;
text/x-tcl) lexer=tcl;;
text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer
# Types that file outputs which pygmentize didn't support as of file 5.11, pygments 1.6rc1
# text/calendar
# text/PGP
# text/rtf
# text/texmacs
# text/x-bcpl
# text/x-info
# text/x-m4
# text/x-vcard
# text/x-xmcd
esac
fi
encoding=`file --brief --mime-encoding $file_common_opts "$1"`
if [ -n "$lexer" ]; then
# FIXME: Specify input encoding rather than output encoding https://bitbucket.org/birkenfeld/pygments-main/issue/800
zcat "$1" | pygmentize -O encoding=$encoding,outencoding=UTF-8 $PYGMENTIZE_OPTS -l $lexer
exit 0
fi
exit 1
#!/usr/bin/lasso9
/*
Builtins Generator for Lasso 9
This is the shell script that was used to extract Lasso 9's built-in keywords
and generate most of the _lassobuiltins.py file. When run, it creates a file
named "lassobuiltins-9.py" containing the types, traits, methods, and members
of the currently-installed version of Lasso 9.
A list of tags in Lasso 8 can be generated with this code:
<?LassoScript
local('l8tags' = list,
'l8libs' = array('Cache','ChartFX','Client','Database','File','HTTP',
'iCal','Lasso','Link','List','PDF','Response','Stock','String',
'Thread','Valid','WAP','XML'));
iterate(#l8libs, local('library'));
local('result' = namespace_load(#library));
/iterate;
iterate(tags_list, local('i'));
#l8tags->insert(string_removeleading(#i, -pattern='_global_'));
/iterate;
#l8tags->sort;
iterate(#l8tags, local('i'));
string_lowercase(#i)+"<br>";
/iterate;
*/
output("This output statement is required for a complete list of methods.")
local(f) = file("lassobuiltins-9.py")
#f->doWithClose => {
#f->openWrite
#f->writeString('# -*- coding: utf-8 -*-
"""
pygments.lexers._lassobuiltins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Built-in Lasso types, traits, methods, and members.
:copyright: Copyright 2006-'+date->year+' by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
')
lcapi_loadModules
// Load all of the libraries from builtins and lassoserver
// This forces all possible available types and methods to be registered
local(srcs =
tie(
dir(sys_masterHomePath + 'LassoLibraries/builtins/')->eachFilePath,
dir(sys_masterHomePath + 'LassoLibraries/lassoserver/')->eachFilePath
)
)
with topLevelDir in #srcs
where not #topLevelDir->lastComponent->beginsWith('.')
do protect => {
handle_error => {
stdoutnl('Unable to load: ' + #topLevelDir + ' ' + error_msg)
}
library_thread_loader->loadLibrary(#topLevelDir)
stdoutnl('Loaded: ' + #topLevelDir)
}
local(
typesList = list(),
traitsList = list(),
unboundMethodsList = list(),
memberMethodsList = list()
)
// types
with type in sys_listTypes
where #typesList !>> #type
do {
#typesList->insert(#type)
with method in #type->getType->listMethods
let name = #method->methodName
where not #name->asString->endsWith('=') // skip setter methods
where #name->asString->isAlpha(1) // skip unpublished methods
where #memberMethodsList !>> #name
do #memberMethodsList->insert(#name)
}
// traits
with trait in sys_listTraits
where not #trait->asString->beginsWith('$') // skip combined traits
where #traitsList !>> #trait
do {
#traitsList->insert(#trait)
with method in tie(#trait->getType->provides, #trait->getType->requires)
let name = #method->methodName
where not #name->asString->endsWith('=') // skip setter methods
where #name->asString->isAlpha(1) // skip unpublished methods
where #memberMethodsList !>> #name
do #memberMethodsList->insert(#name)
}
// unbound methods
with method in sys_listUnboundMethods
let name = #method->methodName
where not #name->asString->endsWith('=') // skip setter methods
where #name->asString->isAlpha(1) // skip unpublished methods
where #typesList !>> #name
where #traitsList !>> #name
where #unboundMethodsList !>> #name
do #unboundMethodsList->insert(#name)
#f->writeString("BUILTINS = {
'Types': [
")
with t in #typesList
do !#t->asString->endsWith('$') ? #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
#f->writeString(" ],
'Traits': [
")
with t in #traitsList
do #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
#f->writeString(" ],
'Unbound Methods': [
")
with t in #unboundMethodsList
do #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
#f->writeString(" ]
}
MEMBERS = {
'Member Methods': [
")
with t in #memberMethodsList
do #f->writeString(" '"+string_lowercase(#t->asString)+"',\n")
#f->writeString(" ]
}
")
}
Loading
Loading
@@ -27,7 +27,7 @@
 
.. _Markdown: http://www.freewisdom.org/projects/python-markdown/
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
@@ -64,4 +64,4 @@ class CodeBlockPreprocessor(TextPreprocessor):
code = code.replace('\n\n', '\n&nbsp;\n').replace('\n', '<br />')
return '\n\n<div class="code">%s</div>\n\n' % code
return self.pattern.sub(
repl, lines)
\ No newline at end of file
repl, lines)
Loading
Loading
@@ -31,7 +31,7 @@
If you do not want to do that and are willing to accept larger HTML
output, you can set the INLINESTYLES option below to True.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
Loading
Loading
@@ -31,7 +31,7 @@
.. _directive documentation:
http://docutils.sourceforge.net/docs/howto/rst-directives.html
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
Loading
Loading
@@ -31,7 +31,7 @@
.. _directive documentation:
http://docutils.sourceforge.net/docs/howto/rst-directives.html
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
#!/usr/bin/env python
#!/usr/bin/env python2
 
import sys, pygments.cmdline
try:
Loading
Loading
Loading
Loading
@@ -22,11 +22,11 @@
.. _Pygments tip:
http://bitbucket.org/birkenfeld/pygments-main/get/tip.zip#egg=Pygments-dev
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
__version__ = '1.5'
__version__ = '1.6'
__docformat__ = 'restructuredtext'
 
__all__ = ['lex', 'format', 'highlight']
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
Command line interface.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
Loading
Loading
@@ -192,6 +192,14 @@ def main(args=sys.argv):
 
usage = USAGE % ((args[0],) * 6)
 
if sys.platform in ['win32', 'cygwin']:
try:
# Provide coloring under Windows, if possible
import colorama
colorama.init()
except ImportError:
pass
try:
popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:hVHg")
except getopt.GetoptError, err:
Loading
Loading
@@ -219,7 +227,7 @@ def main(args=sys.argv):
return 0
 
if opts.pop('-V', None) is not None:
print 'Pygments version %s, (c) 2006-2011 by Georg Brandl.' % __version__
print 'Pygments version %s, (c) 2006-2013 by Georg Brandl.' % __version__
return 0
 
# handle ``pygmentize -L``
Loading
Loading
@@ -370,9 +378,9 @@ def main(args=sys.argv):
except ClassNotFound, err:
if '-g' in opts:
try:
lexer = guess_lexer(code)
lexer = guess_lexer(code, **parsed_opts)
except ClassNotFound:
lexer = TextLexer()
lexer = TextLexer(**parsed_opts)
else:
print >>sys.stderr, 'Error:', err
return 1
Loading
Loading
@@ -384,9 +392,9 @@ def main(args=sys.argv):
if '-g' in opts:
code = sys.stdin.read()
try:
lexer = guess_lexer(code)
lexer = guess_lexer(code, **parsed_opts)
except ClassNotFound:
lexer = TextLexer()
lexer = TextLexer(**parsed_opts)
elif not lexer:
print >>sys.stderr, 'Error: no lexer name given and reading ' + \
'from stdin (try using -g or -l <lexer>)'
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
Format colored console output.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
Module that implements the default filter.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@
Module containing filter lookup functions and default
filters.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
@@ -129,7 +129,7 @@ class KeywordCaseFilter(Filter):
 
class NameHighlightFilter(Filter):
"""
Highlight a normal Name token with a different token type.
Highlight a normal Name (and Name.*) token with a different token type.
 
Example::
 
Loading
Loading
@@ -163,7 +163,7 @@ class NameHighlightFilter(Filter):
 
def filter(self, lexer, stream):
for ttype, value in stream:
if ttype is Name and value in self.names:
if ttype in Name and value in self.names:
yield self.tokentype, value
else:
yield ttype, value
Loading
Loading
@@ -331,7 +331,6 @@ class TokenMergeFilter(Filter):
Filter.__init__(self, **options)
 
def filter(self, lexer, stream):
output = []
current_type = None
current_value = None
for ttype, value in stream:
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
Base formatter class.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
@@ -68,6 +68,9 @@ class Formatter(object):
self.full = get_bool_opt(options, 'full', False)
self.title = options.get('title', '')
self.encoding = options.get('encoding', None) or None
if self.encoding == 'guess':
# can happen for pygmentize -O encoding=guess
self.encoding = 'utf-8'
self.encoding = options.get('outencoding', None) or self.encoding
self.options = options
 
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
Pygments formatters.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os.path
Loading
Loading
Loading
Loading
@@ -9,12 +9,10 @@
 
Do not alter the FORMATTERS dictionary by hand.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
from pygments.util import docstring_headline
# start
from pygments.formatters.bbcode import BBCodeFormatter
from pygments.formatters.gitlab import GitlabFormatter
Loading
Loading
@@ -56,6 +54,8 @@ if __name__ == '__main__':
found_formatters = []
imports = []
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from pygments.util import docstring_headline
for filename in os.listdir('.'):
if filename.endswith('.py') and not filename.startswith('_'):
module_name = 'pygments.formatters.%s' % filename[:-3]
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
BBcode formatter.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
Loading
Loading
@@ -5,18 +5,23 @@
 
Formatter for HTML output.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
import os
import sys
import os.path
import StringIO
 
from pygments.formatter import Formatter
from pygments.token import Token, Text, STANDARD_TYPES
from pygments.util import get_bool_opt, get_int_opt, get_list_opt, bytes
 
try:
import ctags
except ImportError:
ctags = None
 
__all__ = ['HtmlFormatter']
 
Loading
Loading
@@ -141,6 +146,12 @@ class HtmlFormatter(Formatter):
the style definitions inside a ``<style>`` tag, or in a separate file if
the `cssfile` option is given.
 
When `tagsfile` is set to the path of a ctags index file, it is used to
generate hyperlinks from names to their definition. You must enable
`anchorlines` and run ctags with the `-n` option for this to work. The
`python-ctags` module from PyPI must be installed to use this feature;
otherwise a `RuntimeError` will be raised.
The `get_style_defs(arg='')` method of a `HtmlFormatter` returns a string
containing CSS rules for the CSS classes used by the formatter. The
argument `arg` can be used to specify additional CSS selectors that
Loading
Loading
@@ -282,10 +293,27 @@ class HtmlFormatter(Formatter):
output line in an anchor tag with a ``name`` of ``foo-linenumber``.
This allows easy linking to certain lines. *New in Pygments 0.9.*
 
`linespans`
If set to a nonempty string, e.g. ``foo``, the formatter will wrap each
output line in a span tag with an ``id`` of ``foo-linenumber``.
This allows easy access to lines via javascript. *New in Pygments 1.6.*
`anchorlinenos`
If set to `True`, will wrap line numbers in <a> tags. Used in
combination with `linenos` and `lineanchors`.
 
`tagsfile`
If set to the path of a ctags file, wrap names in anchor tags that
link to their definitions. `lineanchors` should be used, and the
tags file should specify line numbers (see the `-n` option to ctags).
*New in Pygments 1.6.*
`tagurlformat`
A string formatting pattern used to generate links to ctags definitions.
Available variables are `%(path)s`, `%(fname)s` and `%(fext)s`.
Defaults to an empty string, resulting in just `#prefix-number` links.
*New in Pygments 1.6.*
 
**Subclassing the HTML formatter**
 
Loading
Loading
@@ -351,6 +379,14 @@ class HtmlFormatter(Formatter):
self.prestyles = self._decodeifneeded(options.get('prestyles', ''))
self.cssfile = self._decodeifneeded(options.get('cssfile', ''))
self.noclobber_cssfile = get_bool_opt(options, 'noclobber_cssfile', False)
self.tagsfile = self._decodeifneeded(options.get('tagsfile', ''))
self.tagurlformat = self._decodeifneeded(options.get('tagurlformat', ''))
if self.tagsfile:
if not ctags:
raise RuntimeError('The "ctags" package must to be installed '
'to be able to use the "tagsfile" feature.')
self._ctags = ctags.CTags(self.tagsfile)
 
linenos = options.get('linenos', False)
if linenos == 'inline':
Loading
Loading
@@ -366,6 +402,7 @@ class HtmlFormatter(Formatter):
self.nobackground = get_bool_opt(options, 'nobackground', False)
self.lineseparator = options.get('lineseparator', '\n')
self.lineanchors = options.get('lineanchors', '')
self.linespans = options.get('linespans', '')
self.anchorlinenos = options.get('anchorlinenos', False)
self.hl_lines = set()
for lineno in get_list_opt(options, 'hl_lines', []):
Loading
Loading
@@ -596,7 +633,8 @@ class HtmlFormatter(Formatter):
 
def _wrap_lineanchors(self, inner):
s = self.lineanchors
i = self.linenostart - 1 # subtract 1 since we have to increment i *before* yielding
i = self.linenostart - 1 # subtract 1 since we have to increment i
# *before* yielding
for t, line in inner:
if t:
i += 1
Loading
Loading
@@ -604,6 +642,16 @@ class HtmlFormatter(Formatter):
else:
yield 0, line
 
def _wrap_linespans(self, inner):
s = self.linespans
i = self.linenostart - 1
for t, line in inner:
if t:
i += 1
yield 1, '<span id="%s-%d">%s</span>' % (s, i, line)
else:
yield 0, line
def _wrap_div(self, inner):
style = []
if (self.noclasses and not self.nobackground and
Loading
Loading
@@ -643,6 +691,7 @@ class HtmlFormatter(Formatter):
getcls = self.ttype2class.get
c2s = self.class2style
escape_table = _escape_html_table
tagsfile = self.tagsfile
 
lspan = ''
line = ''
Loading
Loading
@@ -659,6 +708,19 @@ class HtmlFormatter(Formatter):
 
parts = value.translate(escape_table).split('\n')
 
if tagsfile and ttype in Token.Name:
filename, linenumber = self._lookup_ctag(value)
if linenumber:
base, filename = os.path.split(filename)
if base:
base += '/'
filename, extension = os.path.splitext(filename)
url = self.tagurlformat % {'path': base, 'fname': filename,
'fext': extension}
parts[0] = "<a href=\"%s#%s-%d\">%s" % \
(url, self.lineanchors, linenumber, parts[0])
parts[-1] = parts[-1] + "</a>"
# for all but the last line
for part in parts[:-1]:
if line:
Loading
Loading
@@ -688,6 +750,13 @@ class HtmlFormatter(Formatter):
if line:
yield 1, line + (lspan and '</span>') + lsep
 
def _lookup_ctag(self, token):
entry = ctags.TagEntry()
if self._ctags.find(entry, token, 0):
return entry['file'], entry['lineNumber']
else:
return None, None
def _highlight_lines(self, tokensource):
"""
Highlighted the lines specified in the `hl_lines` option by
Loading
Loading
@@ -740,6 +809,8 @@ class HtmlFormatter(Formatter):
source = self._wrap_inlinelinenos(source)
if self.lineanchors:
source = self._wrap_lineanchors(source)
if self.linespans:
source = self._wrap_linespans(source)
source = self.wrap(source, outfile)
if self.linenos == 1:
source = self._wrap_tablelinenos(source)
Loading
Loading
Loading
Loading
@@ -5,12 +5,11 @@
 
Formatter for Pixmap output.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
import sys
from commands import getstatusoutput
 
from pygments.formatter import Formatter
from pygments.util import get_bool_opt, get_int_opt, \
Loading
Loading
@@ -73,6 +72,7 @@ class FontManager(object):
self._create_nix()
 
def _get_nix_font_path(self, name, style):
from commands import getstatusoutput
exit, out = getstatusoutput('fc-list "%s:style=%s" file' %
(name, style))
if not exit:
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
Formatter for LaTeX fancyvrb output.
 
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
 
Loading
Loading
@@ -306,17 +306,17 @@ class LatexFormatter(Formatter):
realoutfile = outfile
outfile = StringIO()
 
outfile.write(r'\begin{Verbatim}[commandchars=\\\{\}')
outfile.write(ur'\begin{Verbatim}[commandchars=\\\{\}')
if self.linenos:
start, step = self.linenostart, self.linenostep
outfile.write(',numbers=left' +
(start and ',firstnumber=%d' % start or '') +
(step and ',stepnumber=%d' % step or ''))
outfile.write(u',numbers=left' +
(start and u',firstnumber=%d' % start or u'') +
(step and u',stepnumber=%d' % step or u''))
if self.mathescape or self.texcomments:
outfile.write(r',codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}')
outfile.write(ur',codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8}')
if self.verboptions:
outfile.write(',' + self.verboptions)
outfile.write(']\n')
outfile.write(u',' + self.verboptions)
outfile.write(u']\n')
 
for ttype, value in tokensource:
if ttype in Token.Comment:
Loading
Loading
@@ -366,7 +366,7 @@ class LatexFormatter(Formatter):
else:
outfile.write(value)
 
outfile.write('\\end{Verbatim}\n')
outfile.write(u'\\end{Verbatim}\n')
 
if self.full:
realoutfile.write(DOC_TEMPLATE %
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment