Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 457920 | Differences between
and this patch

Collapse All | Expand All

(-)a/kate/plugins/pate/src/plugins/expand/all.expand (-14 / +26 lines)
Lines 1-25 Link Here
1
#!/usr/bin/python
1
#
2
# ^ for Python syntax highlighting
2
# Expand-functions in this modude mostly for demonstration
3
# than for daily use...
4
#
5
6
try:
7
  import builtins as interpreter
8
except ImportError:
9
  import __builtin__ as interpreter
10
11
try:
12
    from io import StringIO
13
except:
14
    from cStringIO import StringIO
3
15
4
import __builtin__
5
import sys
16
import sys
6
from cStringIO import StringIO
7
17
8
def eval(s):
18
def eval(s):
9
    # get automatic conversion to unicode or (that failing)
19
    # get automatic conversion to unicode or (that failing)
10
    # a string representation
20
    # a string representation
11
    return __builtin__.eval(s)
21
    return interpreter.eval(s)
12
22
13
def python(s):
23
def python(s):
14
	# execute a block. sys.stdout is written to the document
24
    # execute a block. sys.stdout is written to the document
15
	old = sys.stdout
25
    old = sys.stdout
16
	io = StringIO()
26
    io = StringIO()
17
	sys.stdout = io
27
    sys.stdout = io
18
	try:
28
    try:
19
		exec s
29
        exec(s)
20
	finally:
30
    finally:
21
		sys.stdout = old
31
        sys.stdout = old
22
	return io.getvalue().strip() # should we always strip?
32
    return io.getvalue().strip() # should we always strip?
23
33
24
def test(s):
34
def test(s):
25
    raise ValueError(s)
35
    raise ValueError(s)
36
37
# kate: hl python; indent-width 4;
(-)a/kate/plugins/pate/src/plugins/expand/text_x-c++src.expand (-2 / +1 lines)
Lines 275-278 def sw(expr = None, *caseList): Link Here
275
def test(expr):
275
def test(expr):
276
    return '{\n\t%{cursor}' + expr + '\n}'
276
    return '{\n\t%{cursor}' + expr + '\n}'
277
277
278
# kate: hl python;
278
# kate: hl python; indent-width 4;
279
- 

Return to bug 457920