This commit is contained in:
iska
2018-07-16 21:44:56 +02:00
parent c13abcb833
commit 8038ec9654
18 changed files with 211 additions and 34 deletions
@@ -0,0 +1,29 @@
import HTMLKit
HTMLSanitizingPolicy { (builder) in
builder
.allowCommonBlockElements()
.allowCommonInlineFormattingElements()
.allowElements(["p", "div"])
.allow(HTMLElementPolicy.identity(), onElements: ["b", "p"])
.allow(HTMLAttributePolicy.init(), onElements: [])
.disallowText(inElements: ["a"])
}
HTMLElementPolicy { (str) -> String in
return str
}
HTMLSanitizer { (builder) in
builder
.allowCommonBlockElements()
.allowCommonInlineFormattingElements()
.allowElements(["p", "div"])
.allow(HTMLElementPolicy.identity() , onElements: ["b", "p"])
.allow(HTMLAttributePolicy.init(), onElements: [])
.disallowText(inElements: ["a"])
}
+2 -1
View File
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='6.0' target-platform='macos' display-mode='rendered' last-migration='0800'>
<playground version='6.0' target-platform='macos' display-mode='raw' last-migration='0800'>
<pages>
<page name='Intro'/>
<page name='Parsing Documents'/>
<page name='Parsing Fragments'/>
<page name='The DOM'/>
<page name='CSS Selectors'/>
<page name='Sanitizing HTML'/>
</pages>
</playground>