aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/google/safehtml/init.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-02-22 22:16:50 +0100
committerTaras Madan <tarasmadan@google.com>2023-02-24 12:47:23 +0100
commit4165372ec8fd142475a4e35fd0cf4f8042132208 (patch)
tree21cd62211b4dd80bee469054c5b65db77342333c /vendor/github.com/google/safehtml/init.go
parent2b3ed821a493b8936c8bacfa6f8b4f1c90a00855 (diff)
dependencies: update
set go min requirements to 1.19 update dependencies update vendor
Diffstat (limited to 'vendor/github.com/google/safehtml/init.go')
-rw-r--r--vendor/github.com/google/safehtml/init.go58
1 files changed, 58 insertions, 0 deletions
diff --git a/vendor/github.com/google/safehtml/init.go b/vendor/github.com/google/safehtml/init.go
new file mode 100644
index 000000000..d37547d72
--- /dev/null
+++ b/vendor/github.com/google/safehtml/init.go
@@ -0,0 +1,58 @@
+// Copyright (c) 2017 The Go Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
+package safehtml
+
+import (
+ "github.com/google/safehtml/internal/raw"
+)
+
+// stringConstant is an unexported string type. Users of this package cannot
+// create values of this type except by passing an untyped string constant to
+// functions which expect a stringConstant. This type should only be used in
+// function and method parameters.
+type stringConstant string
+
+// The following functions are used by package uncheckedconversions
+// (via package raw) to create safe HTML types from plain strings.
+
+func htmlRaw(s string) HTML {
+ return HTML{s}
+}
+
+func scriptRaw(s string) Script {
+ return Script{s}
+}
+
+func style(s string) Style {
+ return Style{s}
+}
+
+func styleSheetRaw(s string) StyleSheet {
+ return StyleSheet{s}
+}
+
+func urlRaw(s string) URL {
+ return URL{s}
+}
+
+func trustedResourceURLRaw(s string) TrustedResourceURL {
+ return TrustedResourceURL{s}
+}
+
+func identifierRaw(s string) Identifier {
+ return Identifier{s}
+}
+
+func init() {
+ raw.HTML = htmlRaw
+ raw.Script = scriptRaw
+ raw.Style = style
+ raw.StyleSheet = styleSheetRaw
+ raw.URL = urlRaw
+ raw.TrustedResourceURL = trustedResourceURLRaw
+ raw.Identifier = identifierRaw
+}