##// END OF EJS Templates
Remove 5s wait on inactivity on GUI inputhook loops...
Remove 5s wait on inactivity on GUI inputhook loops The 5s (and 1s) waits were originally added in commit 5074878, but the 5 second wait meant if you left the console for 5+ minutes idle, it would take up to 5 seconds for a response to a keypress. This tradeoff of CPU cycles for battery life seems too far. Note that commit 5074878 was originally for wx, glut and pyglet are based on the wx version and came into existence after commit 5074878.

File last commit:

r12864:ba77f89f
r13125:f9e20986
Show More
latex.py
63 lines | 1.8 KiB | text/x-python | PythonLexer
Jonathan Frederic
Cleanup and refactor of filters
r10676 """Latex filters.
Jonathan Frederic
Created filters namespace
r10478
Jonathan Frederic
Cleanup and refactor of filters
r10676 Module of useful filters for processing Latex within Jinja latex templates.
Jonathan Frederic
Created filters namespace
r10478 """
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
Jonathan Frederic
Post code-review, extended refactor.
r10485 import re
#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------
MinRK
put back a couple of regexp subs in escape_latex
r12064 LATEX_RE_SUBS = (
(re.compile(r'\.\.\.+'), r'\\ldots'),
)
Jonathan Frederic
FIX, don't use regex
r12062 # Latex substitutions for escaping latex.
# see: http://stackoverflow.com/questions/16259923/how-can-i-escape-latex-special-characters-inside-django-templates
MinRK
update LATEX_SUBS table
r12063
Jonathan Frederic
FIX, don't use regex
r12062 LATEX_SUBS = {
'&': r'\&',
MinRK
update LATEX_SUBS table
r12063 '%': r'\%',
'$': r'\$',
'#': r'\#',
'_': r'\_',
'{': r'\{',
'}': r'\}',
'~': r'\textasciitilde{}',
'^': r'\^{}',
'\\': r'\textbackslash{}',
}
Jonathan Frederic
FIX, don't use regex
r12062
Jonathan Frederic
Created filters namespace
r10478
#-----------------------------------------------------------------------------
# Functions
#-----------------------------------------------------------------------------
Jonathan Frederic
Cleanup and refactor of filters
r10676
MinRK
remove strip_math_space...
r12864 __all__ = ['escape_latex']
Brian E. Granger
Fixing import logic.
r11088
Jonathan Frederic
Cleanup and refactor of filters
r10676 def escape_latex(text):
"""
Jonathan Frederic
Revert "Better comment"...
r12080 Escape characters that may conflict with latex.
Jonathan Frederic
FIX, don't use regex
r12062
Jonathan Frederic
Cleanup and refactor of filters
r10676 Parameters
----------
text : str
Text containing characters that may conflict with Latex
"""
Jonathan Frederic
remove sq brackets
r12075 text = ''.join(LATEX_SUBS.get(c, c) for c in text)
MinRK
put back a couple of regexp subs in escape_latex
r12064 for pattern, replacement in LATEX_RE_SUBS:
text = pattern.sub(replacement, text)
Jonathan Frederic
FIX, don't use regex
r12062
MinRK
put back a couple of regexp subs in escape_latex
r12064 return text
Jonathan Frederic
Created filters namespace
r10478