From 57efc716efb54768f42f1c12b864556378a7eb61 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sat, 18 Mar 2017 22:33:40 -0700 Subject: [PATCH] neaten a report's style XML file, and add the new description --- gramps/gen/plug/docgen/stylesheet.py | 45 +++++++++++++++------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/gramps/gen/plug/docgen/stylesheet.py b/gramps/gen/plug/docgen/stylesheet.py index 4c08e6cef..0e1502034 100644 --- a/gramps/gen/plug/docgen/stylesheet.py +++ b/gramps/gen/plug/docgen/stylesheet.py @@ -147,25 +147,25 @@ class StyleSheetList: xml_file.write('\n') xml_file.write('\n') - for name in sorted(self.map.keys()): # enable diff of archived copies + for name in sorted(self.map.keys()): # enable diff of archived ones if name == "default": continue sheet = self.map[name] - xml_file.write('\n' % escxml(name)) + xml_file.write(' \n' % escxml(name)) - for p_name in sheet.get_paragraph_style_names(): + for p_name in sorted(sheet.get_paragraph_style_names()): self.write_paragraph_style(xml_file, sheet, p_name) - for t_name in sheet.get_table_style_names(): + for t_name in sorted(sheet.get_table_style_names()): self.write_table_style(xml_file, sheet, t_name) - for c_name in sheet.get_cell_style_names(): + for c_name in sorted(sheet.get_cell_style_names()): self.write_cell_style(xml_file, sheet, c_name) - for g_name in sheet.get_draw_style_names(): + for g_name in sorted(sheet.get_draw_style_names()): self.write_graphics_style(xml_file, sheet, g_name) - xml_file.write('\n') + xml_file.write(' \n') xml_file.write('\n') def write_paragraph_style(self, xml_file, sheet, p_name): @@ -184,15 +184,15 @@ class StyleSheetList: # Write out style definition xml_file.write( - '\n' + ' \n' ) def write_table_style(self, xml_file, sheet, t_name): @@ -217,8 +217,8 @@ class StyleSheetList: # Write out style definition xml_file.write( - '\n') + xml_file.write(' \n') + xml_file.write(' \n') def write_cell_style(self, xml_file, sheet, c_name): @@ -235,14 +235,14 @@ class StyleSheetList: # Write out style definition xml_file.write( - '\n' + ' \n' ) def write_graphics_style(self, xml_file, sheet, g_name): @@ -251,8 +251,9 @@ class StyleSheetList: # Write out style definition xml_file.write( - '\n' + ' \n' ) def parse(self): @@ -507,6 +508,8 @@ class SheetParser(handler.ContentHandler): self.c.set_padding(float(attrs['pad'])) elif tag == "draw": self.g = GraphicsStyle() + if 'description' in attrs: + self.g.set_description(attrs['description']) self.g.set_paragraph_style(attrs['para']) self.g.set_line_width(float(attrs['width'])) self.g.set_line_style(int(attrs['style']))