- text = text.substring(startMatcher.end());
-
- final String heading = startMatcher.group();
- for (final Selector selector : currentSelectors) {
- if (heading.indexOf("Translingual") != -1) {
- // Find end.
- final int depth = startMatcher.group(1).length();
- final Pattern endPattern = getEndPattern(depth);
-
- final Matcher endMatcher = endPattern.matcher(text);
- if (endMatcher.find()) {
- int end = endMatcher.start();
- translingual = text.substring(0, endMatcher.start());
- text = text.substring(end);
- break;
- }
+ start = headingStart.end();
+
+ final String heading = headingStart.group();
+
+ // For Translingual entries just store the text for later
+ // use in the per-language sections
+ if (heading.contains("Translingual")) {
+ // Find end.
+ final int depth = headingStart.group(1).length();
+ final Matcher endMatcher = getEndPattern(depth).reset(text);
+
+ if (endMatcher.find(start)) {
+ int end = endMatcher.start();
+ translingual = text.substring(start, end);
+ start = end;
+ continue;