diff --git a/src/gen/plug/docgen/__init__.py b/src/gen/plug/docgen/__init__.py index e1960fde3..b1f99467a 100644 --- a/src/gen/plug/docgen/__init__.py +++ b/src/gen/plug/docgen/__init__.py @@ -35,6 +35,7 @@ from paragraphstyle import ParagraphStyle, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,\ from tablestyle import TableStyle, TableCellStyle from stylesheet import StyleSheetList, StyleSheet, SheetParser from graphicstyle import GraphicsStyle, SOLID, DASHED, DOTTED -from textdoc import TextDoc, IndexMark,INDEX_TYPE_ALP, INDEX_TYPE_TOC, URL_PATTERN +from textdoc import TextDoc, IndexMark,INDEX_TYPE_ALP, INDEX_TYPE_TOC,\ + URL_PATTERN, LOCAL_HYPERLINK, LOCAL_TARGET from drawdoc import DrawDoc from graphdoc import GVDoc diff --git a/src/gen/plug/docgen/textdoc.py b/src/gen/plug/docgen/textdoc.py index 90f8a8814..9c8a525be 100644 --- a/src/gen/plug/docgen/textdoc.py +++ b/src/gen/plug/docgen/textdoc.py @@ -62,6 +62,8 @@ URL_PATTERN = r'''(((https?|mailto):)(//([^ /?#"]*))?([^ ?#"]*)(\?([^ #"]*))?(#( #------------------------------------------------------------------------- INDEX_TYPE_ALP = 0 INDEX_TYPE_TOC = 1 +LOCAL_HYPERLINK = 2 +LOCAL_TARGET = 3 #------------------------------------------------------------------------ # diff --git a/src/plugins/docgen/ODFDoc.py b/src/plugins/docgen/ODFDoc.py index 93a2fda61..200e661e9 100644 --- a/src/plugins/docgen/ODFDoc.py +++ b/src/plugins/docgen/ODFDoc.py @@ -82,7 +82,8 @@ from xml.sax.saxutils import escape from gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc, graphicstyle, FONT_SANS_SERIF, SOLID, PAPER_PORTRAIT, INDEX_TYPE_TOC, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT, - INDEX_TYPE_ALP, PARA_ALIGN_RIGHT, URL_PATTERN) + INDEX_TYPE_ALP, PARA_ALIGN_RIGHT, URL_PATTERN, + LOCAL_HYPERLINK, LOCAL_TARGET) from gen.plug.docgen.fontscale import string_width from libodfbackend import OdfBackend import const @@ -1596,6 +1597,16 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc): 'text:string-value="%s" ' % key + 'text:outline-level="%d" />' % mark.level ) + elif mark.type == LOCAL_HYPERLINK: + self.cntnt.write( + '' % key) + self.cntnt.write(text) + self.cntnt.write('') + return + elif mark.type == LOCAL_TARGET: + self.cntnt.write( + '' % key) + self.cntnt.write(text) def _write_manifest(self):