(converter) JavadocSpecialization should truncate its summary if it gets too long

This commit is contained in:
Viktor Lofgren 2023-09-17 16:25:33 +02:00
parent 98bcdf6028
commit f6b9e8c5eb

View File

@ -3,6 +3,7 @@ package nu.marginalia.converting.processor.plugin.specialization;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import nu.marginalia.summary.SummaryExtractor;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.nodes.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -32,8 +33,9 @@ public class JavadocSpecialization extends DefaultSpecialization {
Set<String> importantWords) {
var block = doc.getElementsByClass("block").first();
if (block != null)
return block.text();
if (block != null) {
return StringUtils.truncate(block.text(), 255);
}
return super.getSummary(doc, importantWords);
}