Skip to content

Commit

Permalink
Correct TEI serialization if list items, thanks @Vitaliy-1 #429
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Jun 9, 2019
1 parent 18f18ed commit ae1ba53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -1185,6 +1185,7 @@ private StringBuilder toTEITextPiece(StringBuilder buffer,
}
divResults.add(curDiv);
Element curParagraph = null;
Element curList = null;
int equationIndex = 0; // current equation index position
for (TaggingTokenCluster cluster : clusters) {
if (cluster == null) {
Expand Down Expand Up @@ -1248,7 +1249,15 @@ private StringBuilder toTEITextPiece(StringBuilder buffer,
}
} else if (clusterLabel.equals(TaggingLabels.ITEM)) {
String clusterContent = LayoutTokensUtil.normalizeText(cluster.concatTokens());
curDiv.appendChild(teiElement("item", clusterContent));
//curDiv.appendChild(teiElement("item", clusterContent));
Element itemNode = teiElement("item", clusterContent);
if (!MARKER_LABELS.contains(lastClusterLabel) && (lastClusterLabel != TaggingLabels.ITEM)) {
curList = teiElement("list");
curDiv.appendChild(curList);
}
if (curList != null) {
curList.appendChild(itemNode);
}
} else if (clusterLabel.equals(TaggingLabels.OTHER)) {
String clusterContent = LayoutTokensUtil.normalizeDehyphenizeText(cluster.concatTokens());
Element note = teiElement("note", clusterContent);
Expand Down
Expand Up @@ -180,6 +180,8 @@ else if (qName.equals("table")) {
else if (qName.equals("item")) {
currentTags.push("<paragraph>");
currentTag = "<paragraph>";
//currentTags.push("<item>");
//currentTag = "<item>";
}
else if (qName.equals("figure")) {
figureBlock = true;
Expand Down

0 comments on commit ae1ba53

Please sign in to comment.