in src/main/java/org/apache/sling/jcr/repoinit/impl/RepoinitTextProvider.java [140:159]
private String extractFromModel(String sourceInfo, String rawText, String modelSection) throws IOException {
final StringReader reader = new StringReader(rawText);
final Model model = ModelReader.read(reader, sourceInfo);
final StringBuilder sb = new StringBuilder();
if (modelSection == null) {
throw new IllegalStateException("Model section name is null, cannot read model");
}
for (final Feature feature : model.getFeatures()) {
for (final Section section : feature.getAdditionalSections(modelSection)) {
sb.append("# ")
.append(modelSection)
.append(" from ")
.append(feature.getName())
.append("\n");
sb.append("# ").append(section.getComment()).append("\n");
sb.append(section.getContents()).append("\n");
}
}
return sb.toString();
}