Commit 9dab3006 authored by Christophe Dumez's avatar Christophe Dumez

- should now be XHTML compliant


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7477 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 849534d5
...@@ -148,14 +148,14 @@ def colorizeTag(tag): ...@@ -148,14 +148,14 @@ def colorizeTag(tag):
elif 'dictionary' in text: elif 'dictionary' in text:
color = 'brown' color = 'brown'
elif 'item' in text: elif 'item' in text:
color = '#A1559A' #light purple color = '#a1559a' #light purple
elif 'value' in text: elif 'value' in text:
color = 'purple' color = 'purple'
elif 'key' in text: elif 'key' in text:
color = '#0C4F0C'#dark green color = '#0c4f0c'#dark green
else: else:
color = 'blue' color = 'blue'
return "<font color='%s'>%s</font>" % (color, text, ) return '<font color="%s">%s</font>' % (color, text, )
def colorize(text): def colorize(text):
"""Return HTML Code with syntax hightlighting """Return HTML Code with syntax hightlighting
...@@ -264,7 +264,7 @@ class DiffFile: ...@@ -264,7 +264,7 @@ class DiffFile:
new_line_tuple[1], new_line_tuple[1],
escape(new_line).replace(' ', NBSP).replace('\t', NBSP_TAB)) escape(new_line).replace(' ', NBSP).replace('\t', NBSP_TAB))
) )
html_list.append(''' </tbody></table><br/><br/>''') html_list.append('''</tbody></table><br/><br/>''')
return '\n'.join(html_list) return '\n'.join(html_list)
...@@ -562,12 +562,12 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -562,12 +562,12 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
def getHeader(self, business_template, file_path): def getHeader(self, business_template, file_path):
file_path = self.relativeToAbsolute(file_path, business_template) file_path = self.relativeToAbsolute(file_path, business_template)
header = "<b><a href='BusinessTemplate_viewSvnShowFile?file=" + \ header = '<b><a href="BusinessTemplate_viewSvnShowFile?file=' + \
file_path + "'>" + file_path + "</a></b>" file_path + '">' + file_path + '</a></b>'
edit_path = self.editPath(business_template, file_path) edit_path = self.editPath(business_template, file_path)
if edit_path != '#': if edit_path != '#':
header += "&nbsp;&nbsp;<a href='"+self.editPath(business_template, \ header += '&nbsp;&nbsp;<a href="'+self.editPath(business_template, \
file_path) + "'><img src='imgs/edit.png' border='0'></a>" file_path) + '"><img src="imgs/edit.png" border="0"></a>'
return header return header
def _encodeSSLTrust(self, trust_dict, permanent=False): def _encodeSSLTrust(self, trust_dict, permanent=False):
...@@ -605,13 +605,13 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -605,13 +605,13 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
file_path = self.relativeToAbsolute(file_path, business_template) file_path = self.relativeToAbsolute(file_path, business_template)
if os.path.exists(file_path): if os.path.exists(file_path):
if os.path.isdir(file_path): if os.path.isdir(file_path):
text = "<b>"+file_path+"</b><hr>" text = "<b>"+file_path+"</b><hr/>"
text += file_path +" is a folder!" text += file_path +" is a folder!"
else: else:
input_file = open(file_path, 'r') input_file = open(file_path, 'r')
head = "<b>"+file_path+"</b> <a href='" + \ head = '<b>'+file_path+'</b> <a href="' + \
self.editPath(business_template, file_path) + \ self.editPath(business_template, file_path) + \
"'><img src='imgs/edit.png' border='0'></a><hr>" '"><img src="imgs/edit.png" border="0"></a><hr/>'
text = head + colorize(input_file.read()) text = head + colorize(input_file.read())
input_file.close() input_file.close()
else: else:
...@@ -624,11 +624,11 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -624,11 +624,11 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
filename+'.svn-base') filename+'.svn-base')
if os.path.exists(tmp_path): if os.path.exists(tmp_path):
input_file = open(tmp_path, 'r') input_file = open(tmp_path, 'r')
head = "<b>"+tmp_path+"</b> (svn temporary file)<hr>" head = "<b>"+tmp_path+"</b> (svn temporary file)<hr/>"
text = head + colorize(input_file.read()) text = head + colorize(input_file.read())
input_file.close() input_file.close()
else : # does not exist else : # does not exist
text = "<b>"+file_path+"</b><hr>" text = "<b>"+file_path+"</b><hr/>"
text += file_path +" does not exist!" text += file_path +" does not exist!"
return text return text
...@@ -1200,10 +1200,10 @@ class SubversionTool(BaseTool, UniqueObject, Folder): ...@@ -1200,10 +1200,10 @@ class SubversionTool(BaseTool, UniqueObject, Folder):
def treeToXML(self, item, business_template) : def treeToXML(self, item, business_template) :
""" Convert tree in memory to XML """ Convert tree in memory to XML
""" """
output = "<?xml version='1.0' encoding='iso-8859-1'?>"+ os.linesep output = '<?xml version="1.0" encoding="UTF-8"?>'+ os.linesep
output += "<tree id='0'>" + os.linesep output += "<tree id='0'>" + os.linesep
output = self._treeToXML(item, output, business_template.getTitle(), True) output = self._treeToXML(item, output, business_template.getTitle(), True)
output += "</tree>" + os.linesep output += '</tree>' + os.linesep
return output return output
def _treeToXML(self, item, output, relative_path, first) : def _treeToXML(self, item, output, relative_path, first) :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment