Skip to content

Commit

Permalink
Remove ussages of the term whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
JordonPhillips committed Jul 13, 2021
1 parent f49352c commit 9b5dde4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion codegen/smithy-go-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ dependencies {
api("software.amazon.smithy:smithy-codegen-core:[1.3.0,2.0.0[")
implementation("software.amazon.smithy:smithy-waiters:[1.4.0,2.0.0[")
compile("com.atlassian.commonmark:commonmark:0.15.2")
api("org.jsoup:jsoup:1.13.1")
api("org.jsoup:jsoup:1.14.1")
implementation("software.amazon.smithy:smithy-protocol-test-traits:[1.3.0,2.0.0[")
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.jsoup.Jsoup;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import org.jsoup.safety.Whitelist;
import org.jsoup.safety.Safelist;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
import software.amazon.smithy.utils.CodeWriter;
Expand All @@ -39,9 +39,9 @@
*/
public final class DocumentationConverter {
// godoc only supports text blocks, root-level non-inline code blocks, headers, and links.
// This whitelist strips out anything we can't reasonably convert, vastly simplifying the
// This allowlist strips out anything we can't reasonably convert, vastly simplifying the
// node tree we end up having to crawl through.
private static final Whitelist GODOC_WHITELIST = new Whitelist()
private static final Safelist GODOC_ALLOWLIST = new Safelist()
.addTags("code", "pre", "ul", "ol", "li", "a", "br", "h1", "h2", "h3", "h4", "h5", "h6")
.addAttributes("a", "href")
.addProtocols("a", "href", "http", "https", "mailto");
Expand Down Expand Up @@ -69,7 +69,7 @@ public static String convert(String docs) {
String htmlDocs = HtmlRenderer.builder().escapeHtml(false).build().render(MARKDOWN_PARSER.parse(docs));

// Strip out tags and attributes we can't reasonably convert to godoc.
htmlDocs = Jsoup.clean(htmlDocs, GODOC_WHITELIST);
htmlDocs = Jsoup.clean(htmlDocs, GODOC_ALLOWLIST);

// Now we parse the html and visit the resultant nodes to render the godoc.
FormattingVisitor formatter = new FormattingVisitor();
Expand Down

0 comments on commit 9b5dde4

Please sign in to comment.