Skip to content

Commit

Permalink
output funding statement in the back of the TEI output
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Oct 13, 2022
1 parent 06a526f commit b1c0cfd
Showing 1 changed file with 33 additions and 2 deletions.
Expand Up @@ -2475,7 +2475,7 @@ private void toTEI(Document doc,
List<LayoutToken> headerAvailabilityStatementTokens = resHeader.getLayoutTokens(TaggingLabels.HEADER_AVAILABILITY);
Pair<String, List<LayoutToken>> headerAvailabilityProcessed = processShort(headerAvailabilityStatementTokens, doc);
if (headerAvailabilityProcessed != null) {
availabilityStmt = teiFormatter.processTEIDivSection("availability",
availabilityStmt = teiFormatter.processTEIDivSection("availability",
"\t\t\t",
headerAvailabilityProcessed.getLeft(),
headerAvailabilityProcessed.getRight(),
Expand All @@ -2488,7 +2488,7 @@ private void toTEI(Document doc,
}

// availability statements in non-header part
availabilityStmt = getSectionAsTEI("availability",
availabilityStmt = getSectionAsTEI("availability",
"\t\t\t",
doc,
SegmentationLabels.AVAILABILITY,
Expand All @@ -2499,6 +2499,37 @@ private void toTEI(Document doc,
tei.append(availabilityStmt.toString());
}

// funding in header
StringBuilder fundingStmt = new StringBuilder();
if (StringUtils.isNotBlank(resHeader.getFunding())) {
List<LayoutToken> headerFundingTokens = resHeader.getLayoutTokens(TaggingLabels.HEADER_FUNDING);
Pair<String, List<LayoutToken>> headerFundingProcessed = processShort(headerFundingTokens, doc);
if (headerFundingProcessed != null) {
fundingStmt = teiFormatter.processTEIDivSection("funding",
"\t\t\t",
headerFundingProcessed.getLeft(),
headerFundingProcessed.getRight(),
resCitations,
config);
}
if (fundingStmt.length() > 0) {
tei.append(fundingStmt.toString());
}
}

// funding statements in non-header part
fundingStmt = getSectionAsTEI("funding",
"\t\t\t",
doc,
SegmentationLabels.FUNDING,
teiFormatter,
resCitations,
config);

if (fundingStmt.length() > 0) {
tei.append(fundingStmt);
}

tei = teiFormatter.toTEIAnnex(tei, reseAnnex, resHeader, resCitations,
tokenizationsAnnex, markerTypes, doc, config);

Expand Down

0 comments on commit b1c0cfd

Please sign in to comment.