Zim

Merge lp:~earl.chew/zim/pyzim-refactor-plugin into lp:~jaap.karssenberg/zim/pyzim-refactor

Proposed by Earl Chew
Status: Needs review
Proposed branch: lp:~earl.chew/zim/pyzim-refactor-plugin
Merge into: lp:~jaap.karssenberg/zim/pyzim-refactor
Diff against target: 90 lines (+2/-12)
7 files modified
zim/plugins/base/imagegenerator.py (+2/-0)
zim/plugins/diagrameditor.py (+0/-2)
zim/plugins/ditaaeditor.py (+0/-2)
zim/plugins/equationeditor.py (+0/-2)
zim/plugins/gnu_r_ploteditor.py (+0/-2)
zim/plugins/gnuplot_ploteditor.py (+0/-2)
zim/plugins/scoreeditor.py (+0/-2)
To merge this branch: bzr merge lp:~earl.chew/zim/pyzim-refactor-plugin
Reviewer Review Type Date Requested Status
Jaap Karssenberg Pending
Review via email: mp+197977@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

683. By Earl Chew

[plugins] Refactor use of text.splitlines() for ImageGeneratorPlugin

Have the base class call text.splitlines() rather than requiring
each plugin perform this independently.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'zim/plugins/base/imagegenerator.py'
2--- zim/plugins/base/imagegenerator.py 2013-10-04 19:27:18 +0000
3+++ zim/plugins/base/imagegenerator.py 2013-12-06 00:24:35 +0000
4@@ -331,6 +331,8 @@
5 self.logfile = None
6
7 text = self.get_text()
8+ if isinstance(text, basestring):
9+ text = text.splitlines(True)
10 text = self.generator.process_input(text)
11 try:
12 imagefile, logfile = self.generator.generate_image(text)
13
14=== modified file 'zim/plugins/diagrameditor.py'
15--- zim/plugins/diagrameditor.py 2013-08-17 22:45:02 +0000
16+++ zim/plugins/diagrameditor.py 2013-12-06 00:24:35 +0000
17@@ -52,8 +52,6 @@
18 self.pngfile = File(self.dotfile.path[:-4] + '.png') # len('.dot') == 4
19
20 def generate_image(self, text):
21- if isinstance(text, basestring):
22- text = text.splitlines(True)
23
24 # Write to tmp file
25 self.dotfile.writelines(text)
26
27=== modified file 'zim/plugins/ditaaeditor.py'
28--- zim/plugins/ditaaeditor.py 2013-08-17 22:45:02 +0000
29+++ zim/plugins/ditaaeditor.py 2013-12-06 00:24:35 +0000
30@@ -62,8 +62,6 @@
31 self.pngfile = File(self.dotfile.path[:-4] + '.png') # len('.dot') == 4
32
33 def generate_image(self, text):
34- if isinstance(text, basestring):
35- text = text.splitlines(True)
36
37 # Write to tmp file
38 self.dotfile.writelines(text)
39
40=== modified file 'zim/plugins/equationeditor.py'
41--- zim/plugins/equationeditor.py 2013-08-17 22:45:02 +0000
42+++ zim/plugins/equationeditor.py 2013-12-06 00:24:35 +0000
43@@ -56,8 +56,6 @@
44 self.texfile = TmpFile(self.scriptname)
45
46 def generate_image(self, text):
47- if isinstance(text, basestring):
48- text = text.splitlines(True)
49
50 # Filter out empty lines, not allowed in latex equation blocks
51 text = (line for line in text if line and not line.isspace())
52
53=== modified file 'zim/plugins/gnu_r_ploteditor.py'
54--- zim/plugins/gnu_r_ploteditor.py 2013-08-17 22:45:02 +0000
55+++ zim/plugins/gnu_r_ploteditor.py 2013-12-06 00:24:35 +0000
56@@ -65,8 +65,6 @@
57 self.plotscriptfile = TmpFile(self.scriptname)
58
59 def generate_image(self, text):
60- if isinstance(text, basestring):
61- text = text.splitlines(True)
62
63 plotscriptfile = self.plotscriptfile
64 pngfile = File(plotscriptfile.path[:-2] + '.png')
65
66=== modified file 'zim/plugins/gnuplot_ploteditor.py'
67--- zim/plugins/gnuplot_ploteditor.py 2013-10-04 19:27:18 +0000
68+++ zim/plugins/gnuplot_ploteditor.py 2013-12-06 00:24:35 +0000
69@@ -75,8 +75,6 @@
70 self.plotscriptfile = TmpFile(self.scriptname)
71
72 def generate_image(self, text):
73- if isinstance(text, basestring):
74- text = text.splitlines(True)
75
76 plotscriptfile = self.plotscriptfile
77 pngfile = File(plotscriptfile.path[:-4] + '.png')
78
79=== modified file 'zim/plugins/scoreeditor.py'
80--- zim/plugins/scoreeditor.py 2013-08-17 22:45:02 +0000
81+++ zim/plugins/scoreeditor.py 2013-12-06 00:24:35 +0000
82@@ -108,8 +108,6 @@
83 return (version, outtext)
84
85 def generate_image(self, text):
86- if isinstance(text, basestring):
87- text = text.splitlines(True)
88
89 (version, text) = self.extract_version(text)
90 text = ''.join(text)

Subscribers

People subscribed via source and target branches