Skip to content

Commit

Permalink
[hotfix][config][docs] Allow word-break for semicolon lists
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Apr 24, 2018
1 parent 3425488 commit 0321eb3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
11 changes: 8 additions & 3 deletions docs/_includes/generated/core_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
</thead>
<tbody>
<tr>
<td><h5>classloader.parent-first-patterns</h5></td>
<td style="word-wrap: break-word;">"java.;scala.;org.apache.flink.;com.esotericsoftware.kryo;org.apache.hadoop.;javax.annotation.;org.slf4j;org.apache.log4j;org.apache.logging.log4j;ch.qos.logback"</td>
<td>A (semicolon-separated) list of patterns that specifies which classes should always be resolved through the parent ClassLoader first. A pattern is a simple prefix that is checked against the fully qualified class name.</td>
<td><h5>classloader.parent-first-patterns.additional</h5></td>
<td style="word-wrap: break-word;">(none)</td>
<td>A (semicolon-separated) list of patterns that specifies which classes should always be resolved through the parent ClassLoader first. A pattern is a simple prefix that is checked against the fully qualified class name. These patterns are appended to "classloader.parent-first-patterns.default".</td>
</tr>
<tr>
<td><h5>classloader.parent-first-patterns.default</h5></td>
<td style="word-wrap: break-word;">"java.;<wbr>scala.;<wbr>org.apache.flink.;<wbr>com.esotericsoftware.kryo;<wbr>org.apache.hadoop.;<wbr>javax.annotation.;<wbr>org.slf4j;<wbr>org.apache.log4j;<wbr>org.apache.logging;<wbr>org.apache.commons.logging;<wbr>ch.qos.logback"</td>
<td>A (semicolon-separated) list of patterns that specifies which classes should always be resolved through the parent ClassLoader first. A pattern is a simple prefix that is checked against the fully qualified class name. This setting should generally not be modified. To add another pattern we recommend to use "classloader.parent-first-patterns.additional" instead.</td>
</tr>
<tr>
<td><h5>classloader.resolve-order</h5></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public class ConfigOptionsDocGenerator {
private static final String CLASS_PREFIX_GROUP = "classPrefix";
private static final Pattern CLASS_NAME_PATTERN = Pattern.compile("(?<" + CLASS_NAME_GROUP + ">(?<" + CLASS_PREFIX_GROUP + ">[a-zA-Z]*)(?:Options|Config|Parameters))(?:\\.java)?");

/**
* Placeholder that is used to prevent certain sections from being escaped. We don't need a sophisticated value
* but only something that won't show up in config options.
*/
private static final String TEMPORARY_PLACEHOLDER = "superRandomTemporaryPlaceholder";

/**
* This method generates html tables from set of classes containing {@link ConfigOption ConfigOptions}.
*
Expand Down Expand Up @@ -204,7 +210,7 @@ private static String toHtmlString(final ConfigOption<?> option) {
return "" +
" <tr>\n" +
" <td><h5>" + escapeCharacters(option.key()) + "</h5></td>\n" +
" <td style=\"word-wrap: break-word;\">" + escapeCharacters(defaultValueToHtml(defaultValue)) + "</td>\n" +
" <td style=\"word-wrap: break-word;\">" + escapeCharacters(addWordBreakOpportunities(defaultValueToHtml(defaultValue))) + "</td>\n" +
" <td>" + escapeCharacters(option.description()) + "</td>\n" +
" </tr>\n";
}
Expand All @@ -222,8 +228,16 @@ private static String defaultValueToHtml(Object value) {

private static String escapeCharacters(String value) {
return value
.replaceAll("<wbr>", TEMPORARY_PLACEHOLDER)
.replaceAll("<", "&#60;")
.replaceAll(">", "&#62;");
.replaceAll(">", "&#62;")
.replaceAll(TEMPORARY_PLACEHOLDER, "<wbr>");
}

private static String addWordBreakOpportunities(String value) {
return value
// allow breaking of semicolon separated lists
.replace(";", ";<wbr>");
}

private static void sortOptions(List<ConfigOption<?>> configOptions) {
Expand Down

0 comments on commit 0321eb3

Please sign in to comment.