diff --git a/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java b/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java
index 9319d2bb..526bcb05 100644
--- a/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java
+++ b/integrationtest/org/daisy/dotify/formatter/test/TakenFromDP2Test.java
@@ -333,4 +333,14 @@ public void testBreakBeforeSheet() throws LayoutEngineException, IOException, Pa
testPEF("resource-files/dp2/break-before-sheet-input.obfl",
"resource-files/dp2/break-before-sheet-expected.pef", false);
}
+ @Test
+ public void testTocTextDeprecated() throws LayoutEngineException, IOException, PagedMediaWriterConfigurationException {
+ testPEF("resource-files/dp2/toc-text-input-deprecated.obfl",
+ "resource-files/dp2/toc-text-expected.pef", true);
+ }
+ @Test
+ public void testTocText() throws LayoutEngineException, IOException, PagedMediaWriterConfigurationException {
+ testPEF("resource-files/dp2/toc-text-input.obfl",
+ "resource-files/dp2/toc-text-expected.pef", true);
+ }
}
diff --git a/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-expected.pef b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-expected.pef
new file mode 100644
index 00000000..4ebc251a
--- /dev/null
+++ b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-expected.pef
@@ -0,0 +1,47 @@
+
+
+
+
+ toc-text
+ Tests toc-text.
+ application/x-pef+xml
+
+
+
+
+
+
+ ⠼⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠼⠃
+ ⠿⠿⠿⠿⠀⠼⠚⠀⠼⠁
+ ⠿⠿
+ ⠿⠿⠀⠀⠀⠀⠀⠼⠃
+ ⠿⠿⠿⠿
+
+
+
+
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ ⠿⠿
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+
+
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ ⠿⠿
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+
+
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
+ ⠿⠿⠿
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤⠀⠤⠤⠤⠤⠤
+
+
+
+
+
\ No newline at end of file
diff --git a/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-input-deprecated.obfl b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-input-deprecated.obfl
new file mode 100644
index 00000000..fa34e2a7
--- /dev/null
+++ b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-input-deprecated.obfl
@@ -0,0 +1,52 @@
+
+
+
+ toc-text-input-deprecated
+ Tests toc-entry elements without a toc-text child element (deprecated, #106).
+
+
+
+
+
+
+
+
+
+ ⠿⠿⠿⠿
+
+
+
+
+ ⠿⠿
⠿⠿
+
+
+ ⠿⠿⠿⠿
+
+
+
+
+
+
+
+
+
+ ⠿⠿
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+
+ ⠿⠿
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+ ⠿⠿⠿
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+
+
+
+
diff --git a/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-input.obfl b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-input.obfl
new file mode 100644
index 00000000..8e1fc0cb
--- /dev/null
+++ b/integrationtest/org/daisy/dotify/formatter/test/resource-files/dp2/toc-text-input.obfl
@@ -0,0 +1,58 @@
+
+
+
+ toc-text
+ Tests toc-text.
+
+
+
+
+
+
+
+
+
+
+ ⠿⠿⠿⠿
+
+
+
+
+
+
+ ⠿⠿
⠿⠿
+
+
+
+
+ ⠿⠿⠿⠿
+
+
+
+
+
+
+
+
+
+
+ ⠿⠿
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+
+ ⠿⠿
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+ ⠿⠿⠿
+ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤ ⠤⠤⠤⠤⠤
+
+
+
+
diff --git a/src/org/daisy/dotify/formatter/impl/obfl/OBFLWsNormalizer.java b/src/org/daisy/dotify/formatter/impl/obfl/OBFLWsNormalizer.java
index 4d25adf0..50bc59e8 100644
--- a/src/org/daisy/dotify/formatter/impl/obfl/OBFLWsNormalizer.java
+++ b/src/org/daisy/dotify/formatter/impl/obfl/OBFLWsNormalizer.java
@@ -328,12 +328,14 @@ private static int untilEventIsNotBackward(List events, final int i, Q
}
private boolean beginsMixedContent(XMLEvent event) {
- return equalsStart(event, ObflQName.BLOCK, ObflQName.TOC_ENTRY, ObflQName.ITEM, ObflQName.BEFORE, ObflQName.AFTER, ObflQName.TD);
+ // TODO: ObflQName.TOC_ENTRY is deprecated (#106) - remove in a future version
+ return equalsStart(event, ObflQName.BLOCK, ObflQName.TOC_ENTRY, ObflQName.TOC_TEXT, ObflQName.TOC_TEXT_RESUMED, ObflQName.ITEM, ObflQName.BEFORE, ObflQName.AFTER, ObflQName.TD);
}
private boolean endsMixedContent(XMLEvent event) {
- return equalsEnd(event, ObflQName.BLOCK, ObflQName.TOC_ENTRY, ObflQName.ITEM, ObflQName.BEFORE, ObflQName.AFTER, ObflQName.TD);
+ // TODO: ObflQName.TOC_ENTRY is deprecated (#106) - remove in a future version
+ return equalsEnd(event, ObflQName.BLOCK, ObflQName.TOC_ENTRY, ObflQName.TOC_TEXT, ObflQName.TOC_TEXT_RESUMED, ObflQName.ITEM, ObflQName.BEFORE, ObflQName.AFTER, ObflQName.TD);
}
/**
diff --git a/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java b/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java
index 8eb6734e..9370842a 100644
--- a/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java
+++ b/src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java
@@ -1193,10 +1193,14 @@ private void parseTocEntry(XMLEvent event, XMLEventIterator input, TableOfConten
while (input.hasNext()) {
event=input.nextEvent();
if (event.isCharacters()) {
+ // TODO: deprecated (#106) - remove in a future version
toc.addChars(event.asCharacters().getData(), tp);
+ } else if (equalsStart(event, ObflQName.TOC_TEXT)) {
+ parseTocText(event, input, toc, tp);
} else if (equalsStart(event, ObflQName.TOC_ENTRY)) {
parseTocEntry(event, input, toc, tp);
} else if (processAsBlockContents(toc, event, input, tp)) {
+ // TODO: deprecated (#106) - remove this if clause in a future version
//done!
}
else if (equalsEnd(event, ObflQName.TOC_ENTRY)) {
@@ -1207,6 +1211,23 @@ else if (equalsEnd(event, ObflQName.TOC_ENTRY)) {
}
}
}
+
+ private void parseTocText(XMLEvent event, XMLEventIterator input, TableOfContents toc, TextProperties tp) throws XMLStreamException {
+ tp = getTextProperties(event, tp);
+ while (input.hasNext()) {
+ event=input.nextEvent();
+ if (event.isCharacters()) {
+ toc.addChars(event.asCharacters().getData(), tp);
+ } else if (processAsBlockContents(toc, event, input, tp)) {
+ //done!
+ }
+ else if (equalsEnd(event, ObflQName.TOC_TEXT)) {
+ break;
+ } else {
+ report(event);
+ }
+ }
+ }
private void parseCollectionItem(XMLEvent event, XMLEventIterator input, ContentCollection coll, TextProperties tp) throws XMLStreamException {
tp = getTextProperties(event, tp);
diff --git a/src/org/daisy/dotify/formatter/impl/obfl/ObflQName.java b/src/org/daisy/dotify/formatter/impl/obfl/ObflQName.java
index 784a2a9b..64cff46e 100644
--- a/src/org/daisy/dotify/formatter/impl/obfl/ObflQName.java
+++ b/src/org/daisy/dotify/formatter/impl/obfl/ObflQName.java
@@ -25,6 +25,8 @@ interface ObflQName {
static final QName SPAN = new QName(OBFL_NS, "span");
static final QName STYLE = new QName(OBFL_NS, "style");
static final QName TOC_ENTRY = new QName(OBFL_NS, "toc-entry");
+ static final QName TOC_TEXT = new QName(OBFL_NS, "toc-text");
+ static final QName TOC_TEXT_RESUMED = new QName(OBFL_NS, "toc-text");
static final QName LEADER = new QName(OBFL_NS, "leader");
static final QName MARKER = new QName(OBFL_NS, "marker");
static final QName ANCHOR = new QName(OBFL_NS, "anchor");
@@ -97,6 +99,7 @@ interface ObflQName {
static final QName ATTR_COST = new QName("cost");
static final QName ATTR_URI = new QName("uri");
static final QName ATTR_VALUE = new QName("value");
+ static final QName ATTR_USE_TOC_TEXT_RESUMED = new QName("use-toc-text-resumed");
static final QName TABLE = new QName(OBFL_NS, "table");
static final QName THEAD = new QName(OBFL_NS, "thead");