mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
@@ -84,10 +84,12 @@ var htmlNormReplacementTable = []string{
|
||||
// <script>(function () {
|
||||
// var a = [], d = document.getElementById("d"), i, c, s;
|
||||
// for (i = 0; i < 0x10000; ++i) {
|
||||
// c = String.fromCharCode(i);
|
||||
// d.innerHTML = "<span title=" + c + "lt" + c + "></span>"
|
||||
// s = d.getElementsByTagName("SPAN")[0];
|
||||
// if (!s || s.title !== c + "lt" + c) { a.push(i.toString(16)); }
|
||||
//
|
||||
// c = String.fromCharCode(i);
|
||||
// d.innerHTML = "<span title=" + c + "lt" + c + "></span>"
|
||||
// s = d.getElementsByTagName("SPAN")[0];
|
||||
// if (!s || s.title !== c + "lt" + c) { a.push(i.toString(16)); }
|
||||
//
|
||||
// }
|
||||
// document.write(a.join(", "));
|
||||
// })()</script>
|
||||
@@ -174,7 +176,7 @@ func htmlReplacer(s string, replacementTable []string, badRunes bool) string {
|
||||
// stripTags takes a snippet of HTML and returns only the text content.
|
||||
// For example, `<b>¡Hi!</b> <script>...</script>` -> `¡Hi! `.
|
||||
func stripTags(html string) string {
|
||||
var b bytes.Buffer
|
||||
var b strings.Builder
|
||||
s, c, i, allText := []byte(html), context{}, 0, true
|
||||
// Using the transition funcs helps us avoid mangling
|
||||
// `<div title="1>2">` or `I <3 Ponies!`.
|
||||
|
Reference in New Issue
Block a user