Skip to content

Commit

Permalink
#106: Added @deprecate annotations, removed unused ATTR_USE_TOC_TEXT_…
Browse files Browse the repository at this point in the history
…RESUMED, improved description in toc-text test files.
  • Loading branch information
PaulRambags committed Oct 14, 2019
1 parent 6493bfc commit 4a48895
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">toc-text</dc:title>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests toc-text.</dc:description>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests toc-text with mixed content.</dc:description>
<dc:format xmlns:dc="http://purl.org/dc/elements/1.1/">application/x-pef+xml</dc:format>
</meta>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<obfl xmlns="http://www.daisy.org/ns/2011/obfl" version="2011-1" xml:lang="und" hyphenate="false">
<meta>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">toc-text</dc:title>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests toc-text.</dc:description>
<dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">Tests toc-text with mixed content.</dc:description>
</meta>
<layout-master name="main" duplex="false" page-width="15" page-height="6">
<default-template>
Expand Down
23 changes: 20 additions & 3 deletions src/org/daisy/dotify/formatter/impl/obfl/ObflParserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1193,13 +1193,12 @@ 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);
tocEntryAddChars(toc, event, 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)) {
} else if (tocEntryProcessAsBlockContents(toc, event, input, tp)) {
// TODO: deprecated (#106) - remove this if clause in a future version
//done!
}
Expand All @@ -1212,6 +1211,24 @@ else if (equalsEnd(event, ObflQName.TOC_ENTRY)) {
}
}

/**
* Adds characters from a toc-entry to the toc
* @deprecated the characters should be placed inside the toc-text element, see #106
*/
@Deprecated
private void tocEntryAddChars(TableOfContents toc, XMLEvent event, TextProperties tp) {
toc.addChars(event.asCharacters().getData(), tp);
}

/**
* Adds block contents from a toc-entry to the toc
* @deprecated the block contents should be placed inside the toc-text element, see #106
*/
@Deprecated
private boolean tocEntryProcessAsBlockContents(TableOfContents toc, XMLEvent event, XMLEventIterator input, TextProperties tp) throws XMLStreamException {
return processAsBlockContents(toc, event, input, tp);
}

private void parseTocText(XMLEvent event, XMLEventIterator input, TableOfContents toc, TextProperties tp) throws XMLStreamException {
tp = getTextProperties(event, tp);
while (input.hasNext()) {
Expand Down
1 change: 0 additions & 1 deletion src/org/daisy/dotify/formatter/impl/obfl/ObflQName.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ 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");
Expand Down

0 comments on commit 4a48895

Please sign in to comment.