in extscript-doccompiler/src/main/java/org/apache/myfaces/extension/scripting/doccompiler/XSLTDocCompiler.java [199:251]
static String formatter(String in)
{
StringBuilder target = new StringBuilder();
target.append("<!--\n" +
" Licensed to the Apache Software Foundation (ASF) under one\n" +
" or more contributor license agreements. See the NOTICE file\n" +
" distributed with this work for additional information\n" +
" regarding copyright ownership. The ASF licenses this file\n" +
" to you under the Apache License, Version 2.0 (the\n" +
" \"License\"); you may not use this file except in compliance\n" +
" with the License. You may obtain a copy of the License at\n" +
"\n" +
" http://www.apache.org/licenses/LICENSE-2.0\n" +
"\n" +
" Unless required by applicable law or agreed to in writing,\n" +
" software distributed under the License is distributed on an\n" +
" \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" +
" KIND, either express or implied. See the License for the\n" +
" specific language governing permissions and limitations\n" +
" under the License.\n" +
"-->");
String[] lines = in.split("\n+");
for (int cnt = 0; cnt < lines.length; cnt++)
{
String line = lines[cnt];
//no inline xml/html formatting
if (line.contains("<code>"))
{
cnt = handleCode(target, cnt, lines);
} else if (line.contains("<table>"))
{
cnt = handleTable(target, cnt, lines, 0);
} else if (line.contains("<ul>"))
{
cnt = handleUL(target, cnt, lines, 0);
} else if (line.matches("\\s+[^#]+"))
{
line = line.replaceAll("\\s+", " ");
} else if (line.matches("\\s+#.+"))
{
line = line.replaceAll("^\\s+", "");
}
if (!line.contains("<code>") && !line.contains("<table>") && !line.contains("<ul>"))
{
target.append(line);
target.append("\n");
}
}
return target.toString();
}