various: enhance indexing with IndexMark

svn: r6850
This commit is contained in:
Brian Matherly
2006-06-03 03:32:26 +00:00
parent 20aa297a21
commit 0c008ceb78
23 changed files with 142 additions and 101 deletions

View File

@@ -727,17 +727,19 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.write_text(line)
self.end_paragraph()
def write_text(self,text,key=""):
def write_text(self,text,mark=None):
"""
Uses the xml.sax.saxutils.escape function to convert XML
entities. The _esc_map dictionary allows us to add our own
mappings.
"""
if key != "":
key = escape(key,_esc_map)
if mark:
key = escape(mark.key,_esc_map)
key = key.replace('"','"')
self.cntnt.write('<text:alphabetical-index-mark ')
if mark.type == BaseDoc.INDEX_TYPE_ALP:
self.cntnt.write('<text:alphabetical-index-mark ')
elif mark.type == BaseDoc.INDEX_TYPE_TOC:
self.cntnt.write('<text:toc-mark ')
self.cntnt.write('text:string-value="%s" />' % key)
self.cntnt.write(escape(text,_esc_map))