/** Returns the Information of a ParsedPage which are selected by the actual configuration */ public String getSelectedText(ParsedPage pp) { if (pp == null) return null; StringBuilder sb = new StringBuilder(); levelModifier = pp.getSection(0).getLevel() - 1; if (pageHandling == null) { if (firstParagraphHandling != null) { handleContent(pp.getFirstParagraph(), firstParagraphHandling, sb); deleteParagraph(pp.getFirstParagraphNr(), pp.getSections()); } for (Section s : pp.getSections()) handleSection(s, sb); } else { if (pageHandling.get(CIT.TEXT)) { sb.append(pp.getText()); } else { if (pageHandling.get(CIT.BOLD)) { handleSpans(pp.getFormatSpans(FormatType.BOLD), pp.getText(), sb); } if (pageHandling.get(CIT.ITALIC)) { handleSpans(pp.getFormatSpans(FormatType.ITALIC), pp.getText(), sb); } } if (pageHandling.get(CIT.LINK)) handleLinks(pp.getLinks(), !pageHandling.get(CIT.TEXT), sb); } return sb.toString().trim(); }
@Override public void writeRevision(final Revision rev) throws IOException { final ParsedPage pp = parser.parse(rev.Text); if (pp == null) { LOGGER.warn("Could not parse page with title {}", pageTitle); } else if (pp.getSections() != null) { final Set<String> declinations = getDeclinations(pp.getTemplates()); if (!declinations.isEmpty()) { nounTitles.addAll(declinations); } for (final Section section : pp.getSections()) { final List<Template> partOfSpeechTemplates = getPartOfSpeechTemplates(section); if (!partOfSpeechTemplates.isEmpty()) { for (final Template template : partOfSpeechTemplates) { if (isNoun.f(getFirstParameter.f(template))) { nounTitles.add(pageTitle); if (declinations.isEmpty() && LOGGER.isDebugEnabled()) { LOGGER.debug("Found no declinations for page {}", pageTitle); } } } return; } } if (LOGGER.isDebugEnabled() && rev.Text.contains("Substantiv")) { LOGGER.debug( "No part-of-speech found for {} (which indeed contains 'Substantiv')", pageTitle); } } }