You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2024/05/16 21:03:43 UTC
(maven-doxia) 01/01: [DOXIA-737] [REGRESSION] Making EmitAnchorsForIndexableEntries by default does not extract document titles anymore
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch DOXIA-737
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git
commit c6e8229f6c117b93c95e063565226afe63a4002b
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu May 16 23:03:30 2024 +0200
[DOXIA-737] [REGRESSION] Making EmitAnchorsForIndexableEntries by default does not extract document titles anymore
This closes #214
---
.../org/apache/maven/doxia/index/IndexingSink.java | 48 +++++++++++-----------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java
index 2a3acebd..9554de75 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java
@@ -143,30 +143,30 @@ public class IndexingSink extends org.apache.maven.doxia.sink.impl.SinkWrapper {
public void text(String text, SinkEventAttributes attributes) {
if (isTitle) {
rootEntry.setTitle(text);
- return;
- }
- switch (this.type) {
- case SECTION_1:
- case SECTION_2:
- case SECTION_3:
- case SECTION_4:
- case SECTION_5:
- // -----------------------------------------------------------------------
- // Sanitize the id. The most important step is to remove any blanks
- // -----------------------------------------------------------------------
-
- // append text to current entry
- IndexEntry entry = stack.lastElement();
-
- String title = entry.getTitle() + text;
- title = title.replaceAll("[\\r\\n]+", "");
- entry.setTitle(title);
-
- setEntryId(entry, title);
- break;
- // Dunno how to handle others yet
- default:
- break;
+ } else {
+ switch (this.type) {
+ case SECTION_1:
+ case SECTION_2:
+ case SECTION_3:
+ case SECTION_4:
+ case SECTION_5:
+ // -----------------------------------------------------------------------
+ // Sanitize the id. The most important step is to remove any blanks
+ // -----------------------------------------------------------------------
+
+ // append text to current entry
+ IndexEntry entry = stack.lastElement();
+
+ String title = entry.getTitle() + text;
+ title = title.replaceAll("[\\r\\n]+", "");
+ entry.setTitle(title);
+
+ setEntryId(entry, title);
+ break;
+ // Dunno how to handle others yet
+ default:
+ break;
+ }
}
super.text(text, attributes);
}