id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,800 | google/closure-templates | java/src/com/google/template/soy/passes/PassManager.java | PassManager.runWholeFilesetPasses | public void runWholeFilesetPasses(SoyFileSetNode soyTree, TemplateRegistry templateRegistry) {
ImmutableList<SoyFileNode> sourceFiles = ImmutableList.copyOf(soyTree.getChildren());
IdGenerator idGenerator = soyTree.getNodeIdGenerator();
for (CompilerFileSetPass pass : crossTemplateCheckingPasses) {
Co... | java | public void runWholeFilesetPasses(SoyFileSetNode soyTree, TemplateRegistry templateRegistry) {
ImmutableList<SoyFileNode> sourceFiles = ImmutableList.copyOf(soyTree.getChildren());
IdGenerator idGenerator = soyTree.getNodeIdGenerator();
for (CompilerFileSetPass pass : crossTemplateCheckingPasses) {
Co... | [
"public",
"void",
"runWholeFilesetPasses",
"(",
"SoyFileSetNode",
"soyTree",
",",
"TemplateRegistry",
"templateRegistry",
")",
"{",
"ImmutableList",
"<",
"SoyFileNode",
">",
"sourceFiles",
"=",
"ImmutableList",
".",
"copyOf",
"(",
"soyTree",
".",
"getChildren",
"(",
... | Runs all the fileset passes including the autoescaper and optimization passes if configured. | [
"Runs",
"all",
"the",
"fileset",
"passes",
"including",
"the",
"autoescaper",
"and",
"optimization",
"passes",
"if",
"configured",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/PassManager.java#L98-L107 |
53,801 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateNode.java | TemplateNode.appendHeaderVarDecl | protected void appendHeaderVarDecl(
ImmutableList<? extends TemplateHeaderVarDefn> headerVars, StringBuilder sb) {
for (TemplateHeaderVarDefn headerVar : headerVars) {
sb.append(" {").append(getDeclName(headerVar));
if (!headerVar.isRequired()) {
sb.append("?");
}
sb.append("... | java | protected void appendHeaderVarDecl(
ImmutableList<? extends TemplateHeaderVarDefn> headerVars, StringBuilder sb) {
for (TemplateHeaderVarDefn headerVar : headerVars) {
sb.append(" {").append(getDeclName(headerVar));
if (!headerVar.isRequired()) {
sb.append("?");
}
sb.append("... | [
"protected",
"void",
"appendHeaderVarDecl",
"(",
"ImmutableList",
"<",
"?",
"extends",
"TemplateHeaderVarDefn",
">",
"headerVars",
",",
"StringBuilder",
"sb",
")",
"{",
"for",
"(",
"TemplateHeaderVarDefn",
"headerVar",
":",
"headerVars",
")",
"{",
"sb",
".",
"appe... | Add the Soy template syntax that declares `headerVar` to the string builder. | [
"Add",
"the",
"Soy",
"template",
"syntax",
"that",
"declares",
"headerVar",
"to",
"the",
"string",
"builder",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateNode.java#L566-L584 |
53,802 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateNode.java | TemplateNode.createStackTraceElement | public StackTraceElement createStackTraceElement(SourceLocation srcLocation) {
return new StackTraceElement(
/* declaringClass= */ soyFileHeaderInfo.namespace,
// The partial template name begins with a '.' that causes the stack trace element to
// print "namespace..templateName" otherwise.
... | java | public StackTraceElement createStackTraceElement(SourceLocation srcLocation) {
return new StackTraceElement(
/* declaringClass= */ soyFileHeaderInfo.namespace,
// The partial template name begins with a '.' that causes the stack trace element to
// print "namespace..templateName" otherwise.
... | [
"public",
"StackTraceElement",
"createStackTraceElement",
"(",
"SourceLocation",
"srcLocation",
")",
"{",
"return",
"new",
"StackTraceElement",
"(",
"/* declaringClass= */",
"soyFileHeaderInfo",
".",
"namespace",
",",
"// The partial template name begins with a '.' that causes the ... | Construct a StackTraceElement that will point to the given source location of the current
template. | [
"Construct",
"a",
"StackTraceElement",
"that",
"will",
"point",
"to",
"the",
"given",
"source",
"location",
"of",
"the",
"current",
"template",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateNode.java#L590-L598 |
53,803 | google/closure-templates | java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java | AbstractGenerateSoyEscapingDirectiveCode.configure | protected void configure(String[] args) throws IOException {
for (String arg : args) {
if (arg.startsWith("--input=")) {
FileRef ref = createInput();
ref.setPath(arg.substring(arg.indexOf('=') + 1));
} else if (arg.startsWith("--output=")) {
FileRef ref = createOutput();
... | java | protected void configure(String[] args) throws IOException {
for (String arg : args) {
if (arg.startsWith("--input=")) {
FileRef ref = createInput();
ref.setPath(arg.substring(arg.indexOf('=') + 1));
} else if (arg.startsWith("--output=")) {
FileRef ref = createOutput();
... | [
"protected",
"void",
"configure",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"for",
"(",
"String",
"arg",
":",
"args",
")",
"{",
"if",
"(",
"arg",
".",
"startsWith",
"(",
"\"--input=\"",
")",
")",
"{",
"FileRef",
"ref",
"=",
... | Setup method to read arguments and setup initial configuration.
@param args Main method input arguments. | [
"Setup",
"method",
"to",
"read",
"arguments",
"and",
"setup",
"initial",
"configuration",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java#L151-L167 |
53,804 | google/closure-templates | java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java | AbstractGenerateSoyEscapingDirectiveCode.execute | @Override
public void execute() {
super.execute();
if (output == null) {
System.err.println(
"Please add an <output> for the <" + getTaskName() + "> at " + this.getLocation());
return;
}
// Gather output in a buffer rather than generating a bad file with a valid timestamp.
S... | java | @Override
public void execute() {
super.execute();
if (output == null) {
System.err.println(
"Please add an <output> for the <" + getTaskName() + "> at " + this.getLocation());
return;
}
// Gather output in a buffer rather than generating a bad file with a valid timestamp.
S... | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"{",
"super",
".",
"execute",
"(",
")",
";",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Please add an <output> for the <\"",
"+",
"getTaskName",
"(",
... | Called to actually build the output by Ant. | [
"Called",
"to",
"actually",
"build",
"the",
"output",
"by",
"Ant",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java#L170-L217 |
53,805 | google/closure-templates | java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java | AbstractGenerateSoyEscapingDirectiveCode.writeStringLiteral | protected void writeStringLiteral(String value, StringBuilder out) {
out.append('\'').append(escapeOutputString(value)).append('\'');
} | java | protected void writeStringLiteral(String value, StringBuilder out) {
out.append('\'').append(escapeOutputString(value)).append('\'');
} | [
"protected",
"void",
"writeStringLiteral",
"(",
"String",
"value",
",",
"StringBuilder",
"out",
")",
"{",
"out",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"escapeOutputString",
"(",
"value",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";"... | Appends a string literal with the given value onto the given buffer. | [
"Appends",
"a",
"string",
"literal",
"with",
"the",
"given",
"value",
"onto",
"the",
"given",
"buffer",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java#L455-L457 |
53,806 | google/closure-templates | java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java | AbstractGenerateSoyEscapingDirectiveCode.writeUnsafeStringLiteral | private void writeUnsafeStringLiteral(char value, StringBuilder out) {
if (!isPrintable(value)) {
// Don't emit non-Latin characters or control characters since they don't roundtrip well.
out.append(String.format(value >= 0x100 ? "'\\u%04x'" : "'\\x%02x'", (int) value));
} else {
out.append('\... | java | private void writeUnsafeStringLiteral(char value, StringBuilder out) {
if (!isPrintable(value)) {
// Don't emit non-Latin characters or control characters since they don't roundtrip well.
out.append(String.format(value >= 0x100 ? "'\\u%04x'" : "'\\x%02x'", (int) value));
} else {
out.append('\... | [
"private",
"void",
"writeUnsafeStringLiteral",
"(",
"char",
"value",
",",
"StringBuilder",
"out",
")",
"{",
"if",
"(",
"!",
"isPrintable",
"(",
"value",
")",
")",
"{",
"// Don't emit non-Latin characters or control characters since they don't roundtrip well.",
"out",
".",... | Appends a string literal which may not be printable with the given value onto the given buffer. | [
"Appends",
"a",
"string",
"literal",
"which",
"may",
"not",
"be",
"printable",
"with",
"the",
"given",
"value",
"onto",
"the",
"given",
"buffer",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java#L462-L469 |
53,807 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsRuntime.java | JsRuntime.extensionField | public static Expression extensionField(FieldDescriptor desc) {
String jsExtensionImport = ProtoUtils.getJsExtensionImport(desc);
String jsExtensionName = ProtoUtils.getJsExtensionName(desc);
return symbolWithNamespace(jsExtensionImport, jsExtensionName);
} | java | public static Expression extensionField(FieldDescriptor desc) {
String jsExtensionImport = ProtoUtils.getJsExtensionImport(desc);
String jsExtensionName = ProtoUtils.getJsExtensionName(desc);
return symbolWithNamespace(jsExtensionImport, jsExtensionName);
} | [
"public",
"static",
"Expression",
"extensionField",
"(",
"FieldDescriptor",
"desc",
")",
"{",
"String",
"jsExtensionImport",
"=",
"ProtoUtils",
".",
"getJsExtensionImport",
"(",
"desc",
")",
";",
"String",
"jsExtensionName",
"=",
"ProtoUtils",
".",
"getJsExtensionName... | Returns the field containing the extension object for the given field descriptor. | [
"Returns",
"the",
"field",
"containing",
"the",
"extension",
"object",
"for",
"the",
"given",
"field",
"descriptor",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsRuntime.java#L179-L183 |
53,808 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsRuntime.java | JsRuntime.protoToSanitizedContentConverterFunction | public static Expression protoToSanitizedContentConverterFunction(Descriptor messageType) {
return GoogRequire.create(NodeContentKinds.toJsUnpackFunction(messageType)).reference();
} | java | public static Expression protoToSanitizedContentConverterFunction(Descriptor messageType) {
return GoogRequire.create(NodeContentKinds.toJsUnpackFunction(messageType)).reference();
} | [
"public",
"static",
"Expression",
"protoToSanitizedContentConverterFunction",
"(",
"Descriptor",
"messageType",
")",
"{",
"return",
"GoogRequire",
".",
"create",
"(",
"NodeContentKinds",
".",
"toJsUnpackFunction",
"(",
"messageType",
")",
")",
".",
"reference",
"(",
"... | Returns a function that can 'unpack' safe proto types into sanitized content types.. | [
"Returns",
"a",
"function",
"that",
"can",
"unpack",
"safe",
"proto",
"types",
"into",
"sanitized",
"content",
"types",
".."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsRuntime.java#L186-L188 |
53,809 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsRuntime.java | JsRuntime.protoConstructor | public static Expression protoConstructor(SoyProtoType type) {
return GoogRequire.create(type.getNameForBackend(SoyBackendKind.JS_SRC)).reference();
} | java | public static Expression protoConstructor(SoyProtoType type) {
return GoogRequire.create(type.getNameForBackend(SoyBackendKind.JS_SRC)).reference();
} | [
"public",
"static",
"Expression",
"protoConstructor",
"(",
"SoyProtoType",
"type",
")",
"{",
"return",
"GoogRequire",
".",
"create",
"(",
"type",
".",
"getNameForBackend",
"(",
"SoyBackendKind",
".",
"JS_SRC",
")",
")",
".",
"reference",
"(",
")",
";",
"}"
] | Returns the constructor for the proto. | [
"Returns",
"the",
"constructor",
"for",
"the",
"proto",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsRuntime.java#L212-L214 |
53,810 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsRuntime.java | JsRuntime.sanitizedContentType | public static Expression sanitizedContentType(SanitizedContentKind kind) {
return GoogRequire.create(NodeContentKinds.toJsSanitizedContentCtorName(kind)).reference();
} | java | public static Expression sanitizedContentType(SanitizedContentKind kind) {
return GoogRequire.create(NodeContentKinds.toJsSanitizedContentCtorName(kind)).reference();
} | [
"public",
"static",
"Expression",
"sanitizedContentType",
"(",
"SanitizedContentKind",
"kind",
")",
"{",
"return",
"GoogRequire",
".",
"create",
"(",
"NodeContentKinds",
".",
"toJsSanitizedContentCtorName",
"(",
"kind",
")",
")",
".",
"reference",
"(",
")",
";",
"... | Returns the js type for the sanitized content object corresponding to the given ContentKind. | [
"Returns",
"the",
"js",
"type",
"for",
"the",
"sanitized",
"content",
"object",
"corresponding",
"to",
"the",
"given",
"ContentKind",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsRuntime.java#L219-L221 |
53,811 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsRuntime.java | JsRuntime.symbolWithNamespace | private static Expression symbolWithNamespace(String requireSymbol, String fullyQualifiedSymbol) {
GoogRequire require = GoogRequire.create(requireSymbol);
if (fullyQualifiedSymbol.equals(require.symbol())) {
return require.reference();
}
String ident = fullyQualifiedSymbol.substring(require.symbo... | java | private static Expression symbolWithNamespace(String requireSymbol, String fullyQualifiedSymbol) {
GoogRequire require = GoogRequire.create(requireSymbol);
if (fullyQualifiedSymbol.equals(require.symbol())) {
return require.reference();
}
String ident = fullyQualifiedSymbol.substring(require.symbo... | [
"private",
"static",
"Expression",
"symbolWithNamespace",
"(",
"String",
"requireSymbol",
",",
"String",
"fullyQualifiedSymbol",
")",
"{",
"GoogRequire",
"require",
"=",
"GoogRequire",
".",
"create",
"(",
"requireSymbol",
")",
";",
"if",
"(",
"fullyQualifiedSymbol",
... | Returns a code chunk that accesses the given symbol.
@param requireSymbol The symbol to {@code goog.require}
@param fullyQualifiedSymbol The symbol we want to access. | [
"Returns",
"a",
"code",
"chunk",
"that",
"accesses",
"the",
"given",
"symbol",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsRuntime.java#L229-L236 |
53,812 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/IsComputableAsJsExprsVisitor.java | IsComputableAsJsExprsVisitor.areChildrenComputableAsJsExprs | private boolean areChildrenComputableAsJsExprs(ParentSoyNode<?> node) {
for (SoyNode child : node.getChildren()) {
if (canSkipChild(child)) {
continue;
}
if (!visit(child)) {
return false;
}
}
return true;
} | java | private boolean areChildrenComputableAsJsExprs(ParentSoyNode<?> node) {
for (SoyNode child : node.getChildren()) {
if (canSkipChild(child)) {
continue;
}
if (!visit(child)) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"areChildrenComputableAsJsExprs",
"(",
"ParentSoyNode",
"<",
"?",
">",
"node",
")",
"{",
"for",
"(",
"SoyNode",
"child",
":",
"node",
".",
"getChildren",
"(",
")",
")",
"{",
"if",
"(",
"canSkipChild",
"(",
"child",
")",
")",
"{",
"c... | Private helper to check whether all children of a given parent node satisfy
IsComputableAsJsExprsVisitor.
@param node The parent node whose children to check.
@return True if all children satisfy IsComputableAsJsExprsVisitor. | [
"Private",
"helper",
"to",
"check",
"whether",
"all",
"children",
"of",
"a",
"given",
"parent",
"node",
"satisfy",
"IsComputableAsJsExprsVisitor",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/IsComputableAsJsExprsVisitor.java#L231-L243 |
53,813 | google/closure-templates | java/src/com/google/template/soy/SoyFileSetParser.java | SoyFileSetParser.parseWithVersions | private ParseResult parseWithVersions() throws IOException {
List<TemplateMetadata> templateMetadatas = new ArrayList<>();
for (CompilationUnitAndKind unit : compilationUnits()) {
templateMetadatas.addAll(
TemplateMetadataSerializer.templatesFromCompilationUnit(
unit.compilationUni... | java | private ParseResult parseWithVersions() throws IOException {
List<TemplateMetadata> templateMetadatas = new ArrayList<>();
for (CompilationUnitAndKind unit : compilationUnits()) {
templateMetadatas.addAll(
TemplateMetadataSerializer.templatesFromCompilationUnit(
unit.compilationUni... | [
"private",
"ParseResult",
"parseWithVersions",
"(",
")",
"throws",
"IOException",
"{",
"List",
"<",
"TemplateMetadata",
">",
"templateMetadatas",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"CompilationUnitAndKind",
"unit",
":",
"compilationUnits",
"... | Parses a set of Soy files, returning a structure containing the parse tree and template
registry. | [
"Parses",
"a",
"set",
"of",
"Soy",
"files",
"returning",
"a",
"structure",
"containing",
"the",
"parse",
"tree",
"and",
"template",
"registry",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/SoyFileSetParser.java#L166-L220 |
53,814 | google/closure-templates | java/src/com/google/template/soy/pysrc/internal/IsComputableAsPyExprVisitor.java | IsComputableAsPyExprVisitor.areChildrenComputableAsPyExprs | private boolean areChildrenComputableAsPyExprs(ParentSoyNode<?> node) {
for (SoyNode child : node.getChildren()) {
// Note: Save time by not visiting RawTextNode and PrintNode children.
if (!(child instanceof RawTextNode) && !(child instanceof PrintNode)) {
if (!visit(child)) {
return... | java | private boolean areChildrenComputableAsPyExprs(ParentSoyNode<?> node) {
for (SoyNode child : node.getChildren()) {
// Note: Save time by not visiting RawTextNode and PrintNode children.
if (!(child instanceof RawTextNode) && !(child instanceof PrintNode)) {
if (!visit(child)) {
return... | [
"private",
"boolean",
"areChildrenComputableAsPyExprs",
"(",
"ParentSoyNode",
"<",
"?",
">",
"node",
")",
"{",
"for",
"(",
"SoyNode",
"child",
":",
"node",
".",
"getChildren",
"(",
")",
")",
"{",
"// Note: Save time by not visiting RawTextNode and PrintNode children.",
... | Private helper to check whether all SoyNode children of a given parent node satisfy
IsComputableAsPyExprVisitor. ExprNode children are assumed to be computable as PyExprs.
@param node The parent node whose children to check.
@return True if all children satisfy IsComputableAsPyExprVisitor. | [
"Private",
"helper",
"to",
"check",
"whether",
"all",
"SoyNode",
"children",
"of",
"a",
"given",
"parent",
"node",
"satisfy",
"IsComputableAsPyExprVisitor",
".",
"ExprNode",
"children",
"are",
"assumed",
"to",
"be",
"computable",
"as",
"PyExprs",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/IsComputableAsPyExprVisitor.java#L178-L190 |
53,815 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java | InnerClasses.registerInnerClass | public TypeInfo registerInnerClass(String simpleName, int accessModifiers) {
classNames.claimName(simpleName);
TypeInfo innerClass = outer.innerClass(simpleName);
innerClassesAccessModifiers.put(innerClass, accessModifiers);
return innerClass;
} | java | public TypeInfo registerInnerClass(String simpleName, int accessModifiers) {
classNames.claimName(simpleName);
TypeInfo innerClass = outer.innerClass(simpleName);
innerClassesAccessModifiers.put(innerClass, accessModifiers);
return innerClass;
} | [
"public",
"TypeInfo",
"registerInnerClass",
"(",
"String",
"simpleName",
",",
"int",
"accessModifiers",
")",
"{",
"classNames",
".",
"claimName",
"(",
"simpleName",
")",
";",
"TypeInfo",
"innerClass",
"=",
"outer",
".",
"innerClass",
"(",
"simpleName",
")",
";",... | Register the given name as an inner class with the given access modifiers.
@return A {@link TypeInfo} with the full class name | [
"Register",
"the",
"given",
"name",
"as",
"an",
"inner",
"class",
"with",
"the",
"given",
"access",
"modifiers",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java#L51-L56 |
53,816 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java | InnerClasses.add | public void add(ClassData classData) {
checkRegistered(classData.type());
innerClasses.put(classData.type(), classData);
} | java | public void add(ClassData classData) {
checkRegistered(classData.type());
innerClasses.put(classData.type(), classData);
} | [
"public",
"void",
"add",
"(",
"ClassData",
"classData",
")",
"{",
"checkRegistered",
"(",
"classData",
".",
"type",
"(",
")",
")",
";",
"innerClasses",
".",
"put",
"(",
"classData",
".",
"type",
"(",
")",
",",
"classData",
")",
";",
"}"
] | Adds the data for an inner class.
@throws java.lang.IllegalArgumentException if the class wasn't previous registered via {@link
#registerInnerClass(String, int)} or {@link #registerInnerClassWithGeneratedName(String,
int)}. | [
"Adds",
"the",
"data",
"for",
"an",
"inner",
"class",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java#L78-L81 |
53,817 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java | InnerClasses.registerAsInnerClass | public void registerAsInnerClass(ClassVisitor visitor, TypeInfo innerClass) {
checkRegistered(innerClass);
doRegister(visitor, innerClass);
} | java | public void registerAsInnerClass(ClassVisitor visitor, TypeInfo innerClass) {
checkRegistered(innerClass);
doRegister(visitor, innerClass);
} | [
"public",
"void",
"registerAsInnerClass",
"(",
"ClassVisitor",
"visitor",
",",
"TypeInfo",
"innerClass",
")",
"{",
"checkRegistered",
"(",
"innerClass",
")",
";",
"doRegister",
"(",
"visitor",
",",
"innerClass",
")",
";",
"}"
] | Registers this factory as an inner class on the given class writer.
<p>Registering an inner class is confusing. The inner class needs to call this and so does the
outer class. Confirmed by running ASMIfier. Also, failure to call visitInnerClass on both
classes either breaks reflective apis (like class.getSimpleName()/... | [
"Registers",
"this",
"factory",
"as",
"an",
"inner",
"class",
"on",
"the",
"given",
"class",
"writer",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java#L97-L100 |
53,818 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java | InnerClasses.registerAllInnerClasses | public void registerAllInnerClasses(ClassVisitor visitor) {
for (Map.Entry<TypeInfo, Integer> entry : innerClassesAccessModifiers.entrySet()) {
TypeInfo innerClass = entry.getKey();
doRegister(visitor, innerClass);
}
} | java | public void registerAllInnerClasses(ClassVisitor visitor) {
for (Map.Entry<TypeInfo, Integer> entry : innerClassesAccessModifiers.entrySet()) {
TypeInfo innerClass = entry.getKey();
doRegister(visitor, innerClass);
}
} | [
"public",
"void",
"registerAllInnerClasses",
"(",
"ClassVisitor",
"visitor",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"TypeInfo",
",",
"Integer",
">",
"entry",
":",
"innerClassesAccessModifiers",
".",
"entrySet",
"(",
")",
")",
"{",
"TypeInfo",
"innerCl... | Registers all inner classes to the given outer class. | [
"Registers",
"all",
"inner",
"classes",
"to",
"the",
"given",
"outer",
"class",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/internal/InnerClasses.java#L103-L108 |
53,819 | google/closure-templates | java/src/com/google/template/soy/msgs/restricted/SoyMsgBundleCompactor.java | SoyMsgBundleCompactor.compact | public SoyMsgBundle compact(SoyMsgBundle input) {
ImmutableList.Builder<SoyMsg> builder = ImmutableList.builder();
for (SoyMsg msg : input) {
ImmutableList<SoyMsgPart> parts = compactParts(msg.getParts());
builder.add(
SoyMsg.builder()
.setId(msg.getId())
.setLo... | java | public SoyMsgBundle compact(SoyMsgBundle input) {
ImmutableList.Builder<SoyMsg> builder = ImmutableList.builder();
for (SoyMsg msg : input) {
ImmutableList<SoyMsgPart> parts = compactParts(msg.getParts());
builder.add(
SoyMsg.builder()
.setId(msg.getId())
.setLo... | [
"public",
"SoyMsgBundle",
"compact",
"(",
"SoyMsgBundle",
"input",
")",
"{",
"ImmutableList",
".",
"Builder",
"<",
"SoyMsg",
">",
"builder",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"for",
"(",
"SoyMsg",
"msg",
":",
"input",
")",
"{",
"Immutabl... | Returns a more memory-efficient version of the internal message bundle.
<p>Only enough information is retained for rendering; not enough for message extraction. As a
side effect, this SoyMsgBundleCompactor instance will also retain references to parts of the
messages in order to reuse identical objects. | [
"Returns",
"a",
"more",
"memory",
"-",
"efficient",
"version",
"of",
"the",
"internal",
"message",
"bundle",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/restricted/SoyMsgBundleCompactor.java#L57-L70 |
53,820 | google/closure-templates | java/src/com/google/template/soy/msgs/restricted/SoyMsgBundleCompactor.java | SoyMsgBundleCompactor.compactParts | private ImmutableList<SoyMsgPart> compactParts(ImmutableList<SoyMsgPart> parts) {
ImmutableList.Builder<SoyMsgPart> builder = ImmutableList.builder();
for (SoyMsgPart part : parts) {
builder.add(compactPart(part));
}
return builder.build();
} | java | private ImmutableList<SoyMsgPart> compactParts(ImmutableList<SoyMsgPart> parts) {
ImmutableList.Builder<SoyMsgPart> builder = ImmutableList.builder();
for (SoyMsgPart part : parts) {
builder.add(compactPart(part));
}
return builder.build();
} | [
"private",
"ImmutableList",
"<",
"SoyMsgPart",
">",
"compactParts",
"(",
"ImmutableList",
"<",
"SoyMsgPart",
">",
"parts",
")",
"{",
"ImmutableList",
".",
"Builder",
"<",
"SoyMsgPart",
">",
"builder",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"for",... | Compacts a set of message parts. | [
"Compacts",
"a",
"set",
"of",
"message",
"parts",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/restricted/SoyMsgBundleCompactor.java#L73-L79 |
53,821 | google/closure-templates | java/src/com/google/template/soy/msgs/restricted/SoyMsgBundleCompactor.java | SoyMsgBundleCompactor.compactPart | private SoyMsgPart compactPart(SoyMsgPart part) {
if (part instanceof SoyMsgPluralPart) {
part = compactPlural((SoyMsgPluralPart) part);
} else if (part instanceof SoyMsgSelectPart) {
part = compactSelect((SoyMsgSelectPart) part);
} else if (part instanceof SoyMsgPlaceholderPart) {
part = ... | java | private SoyMsgPart compactPart(SoyMsgPart part) {
if (part instanceof SoyMsgPluralPart) {
part = compactPlural((SoyMsgPluralPart) part);
} else if (part instanceof SoyMsgSelectPart) {
part = compactSelect((SoyMsgSelectPart) part);
} else if (part instanceof SoyMsgPlaceholderPart) {
part = ... | [
"private",
"SoyMsgPart",
"compactPart",
"(",
"SoyMsgPart",
"part",
")",
"{",
"if",
"(",
"part",
"instanceof",
"SoyMsgPluralPart",
")",
"{",
"part",
"=",
"compactPlural",
"(",
"(",
"SoyMsgPluralPart",
")",
"part",
")",
";",
"}",
"else",
"if",
"(",
"part",
"... | Compacts a single message part.
<p>If the part is a plural/select part, it might be expanded into multiple parts. | [
"Compacts",
"a",
"single",
"message",
"part",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/restricted/SoyMsgBundleCompactor.java#L86-L96 |
53,822 | google/closure-templates | java/src/com/google/template/soy/base/internal/UniqueNameGenerator.java | UniqueNameGenerator.claimName | public void claimName(String name) {
checkName(name);
if (names.add(name, 1) != 0) {
names.remove(name);
// give a slightly better error message in this case
if (reserved.contains(name)) {
throw new IllegalArgumentException("Tried to claim a reserved name: " + name);
}
thro... | java | public void claimName(String name) {
checkName(name);
if (names.add(name, 1) != 0) {
names.remove(name);
// give a slightly better error message in this case
if (reserved.contains(name)) {
throw new IllegalArgumentException("Tried to claim a reserved name: " + name);
}
thro... | [
"public",
"void",
"claimName",
"(",
"String",
"name",
")",
"{",
"checkName",
"(",
"name",
")",
";",
"if",
"(",
"names",
".",
"add",
"(",
"name",
",",
"1",
")",
"!=",
"0",
")",
"{",
"names",
".",
"remove",
"(",
"name",
")",
";",
"// give a slightly ... | Registers the name, throwing an IllegalArgumentException if it has already been registered. | [
"Registers",
"the",
"name",
"throwing",
"an",
"IllegalArgumentException",
"if",
"it",
"has",
"already",
"been",
"registered",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/UniqueNameGenerator.java#L47-L57 |
53,823 | google/closure-templates | java/src/com/google/template/soy/base/internal/UniqueNameGenerator.java | UniqueNameGenerator.reserve | public void reserve(String name) {
checkName(name);
// if this is new
if (reserved.add(name)) {
// add it to names, so that generateName will still work for reserved names (they will just
// get suffixes).
if (!names.add(name)) {
names.remove(name);
throw new IllegalArgumen... | java | public void reserve(String name) {
checkName(name);
// if this is new
if (reserved.add(name)) {
// add it to names, so that generateName will still work for reserved names (they will just
// get suffixes).
if (!names.add(name)) {
names.remove(name);
throw new IllegalArgumen... | [
"public",
"void",
"reserve",
"(",
"String",
"name",
")",
"{",
"checkName",
"(",
"name",
")",
";",
"// if this is new",
"if",
"(",
"reserved",
".",
"add",
"(",
"name",
")",
")",
"{",
"// add it to names, so that generateName will still work for reserved names (they wil... | Reserves the name, useful for keywords. | [
"Reserves",
"the",
"name",
"useful",
"for",
"keywords",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/UniqueNameGenerator.java#L67-L78 |
53,824 | google/closure-templates | java/src/com/google/template/soy/base/internal/UniqueNameGenerator.java | UniqueNameGenerator.generateName | public String generateName(String name) {
checkName(name);
names.add(name);
int count = names.count(name);
if (count == 1) {
return name;
}
return name + collisionSeparator + (count - 1);
} | java | public String generateName(String name) {
checkName(name);
names.add(name);
int count = names.count(name);
if (count == 1) {
return name;
}
return name + collisionSeparator + (count - 1);
} | [
"public",
"String",
"generateName",
"(",
"String",
"name",
")",
"{",
"checkName",
"(",
"name",
")",
";",
"names",
".",
"add",
"(",
"name",
")",
";",
"int",
"count",
"=",
"names",
".",
"count",
"(",
"name",
")",
";",
"if",
"(",
"count",
"==",
"1",
... | Returns a name based on the supplied one that is guaranteed to be unique among the names that
have been returned by this method. | [
"Returns",
"a",
"name",
"based",
"on",
"the",
"supplied",
"one",
"that",
"is",
"guaranteed",
"to",
"be",
"unique",
"among",
"the",
"names",
"that",
"have",
"been",
"returned",
"by",
"this",
"method",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/UniqueNameGenerator.java#L84-L92 |
53,825 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java | GenJsCodeVisitor.addCodeToRequireCss | private static void addCodeToRequireCss(JsDoc.Builder header, SoyFileNode soyFile) {
SortedSet<String> requiredCssNamespaces = new TreeSet<>();
requiredCssNamespaces.addAll(soyFile.getRequiredCssNamespaces());
for (TemplateNode template : soyFile.getChildren()) {
requiredCssNamespaces.addAll(template... | java | private static void addCodeToRequireCss(JsDoc.Builder header, SoyFileNode soyFile) {
SortedSet<String> requiredCssNamespaces = new TreeSet<>();
requiredCssNamespaces.addAll(soyFile.getRequiredCssNamespaces());
for (TemplateNode template : soyFile.getChildren()) {
requiredCssNamespaces.addAll(template... | [
"private",
"static",
"void",
"addCodeToRequireCss",
"(",
"JsDoc",
".",
"Builder",
"header",
",",
"SoyFileNode",
"soyFile",
")",
"{",
"SortedSet",
"<",
"String",
">",
"requiredCssNamespaces",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"requiredCssNamespaces",
".... | Appends requirecss jsdoc tags in the file header section.
@param soyFile The file with the templates.. | [
"Appends",
"requirecss",
"jsdoc",
"tags",
"in",
"the",
"file",
"header",
"section",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L487-L500 |
53,826 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java | GenJsCodeVisitor.generateFunctionBody | @CheckReturnValue
protected Statement generateFunctionBody(TemplateNode node, String alias) {
ImmutableList.Builder<Statement> bodyStatements = ImmutableList.builder();
bodyStatements.add(
Statement.assign(
JsRuntime.OPT_IJ_DATA,
id("opt_ijData_deprecated")
.or(... | java | @CheckReturnValue
protected Statement generateFunctionBody(TemplateNode node, String alias) {
ImmutableList.Builder<Statement> bodyStatements = ImmutableList.builder();
bodyStatements.add(
Statement.assign(
JsRuntime.OPT_IJ_DATA,
id("opt_ijData_deprecated")
.or(... | [
"@",
"CheckReturnValue",
"protected",
"Statement",
"generateFunctionBody",
"(",
"TemplateNode",
"node",
",",
"String",
"alias",
")",
"{",
"ImmutableList",
".",
"Builder",
"<",
"Statement",
">",
"bodyStatements",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",... | Generates the function body. | [
"Generates",
"the",
"function",
"body",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L769-L841 |
53,827 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java | GenJsCodeVisitor.coerceTypeForSwitchComparison | private Expression coerceTypeForSwitchComparison(ExprRootNode expr) {
Expression switchOn = translateExpr(expr);
SoyType type = expr.getType();
// If the type is possibly a sanitized content type then we need to toString it.
if (SoyTypes.makeNullable(StringType.getInstance()).isAssignableFrom(type)
... | java | private Expression coerceTypeForSwitchComparison(ExprRootNode expr) {
Expression switchOn = translateExpr(expr);
SoyType type = expr.getType();
// If the type is possibly a sanitized content type then we need to toString it.
if (SoyTypes.makeNullable(StringType.getInstance()).isAssignableFrom(type)
... | [
"private",
"Expression",
"coerceTypeForSwitchComparison",
"(",
"ExprRootNode",
"expr",
")",
"{",
"Expression",
"switchOn",
"=",
"translateExpr",
"(",
"expr",
")",
";",
"SoyType",
"type",
"=",
"expr",
".",
"getType",
"(",
")",
";",
"// If the type is possibly a sanit... | to strings. | [
"to",
"strings",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L1092-L1108 |
53,828 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java | GenJsCodeVisitor.genParamsRecordType | private String genParamsRecordType(TemplateNode node) {
Set<String> paramNames = new HashSet<>();
// Generate members for explicit params.
Map<String, String> record = new LinkedHashMap<>();
for (TemplateParam param : node.getParams()) {
JsType jsType = getJsTypeForParamForDeclaration(param.type(... | java | private String genParamsRecordType(TemplateNode node) {
Set<String> paramNames = new HashSet<>();
// Generate members for explicit params.
Map<String, String> record = new LinkedHashMap<>();
for (TemplateParam param : node.getParams()) {
JsType jsType = getJsTypeForParamForDeclaration(param.type(... | [
"private",
"String",
"genParamsRecordType",
"(",
"TemplateNode",
"node",
")",
"{",
"Set",
"<",
"String",
">",
"paramNames",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"// Generate members for explicit params.",
"Map",
"<",
"String",
",",
"String",
">",
"record"... | Generate the JSDoc for the opt_data parameter. | [
"Generate",
"the",
"JSDoc",
"for",
"the",
"opt_data",
"parameter",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L1442-L1497 |
53,829 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java | GenJsCodeVisitor.genParamTypeChecks | @CheckReturnValue
protected Statement genParamTypeChecks(TemplateNode node, String alias) {
ImmutableList.Builder<Statement> declarations = ImmutableList.builder();
for (TemplateParam param : node.getAllParams()) {
String paramName = param.name();
SoyType paramType = param.type();
CodeChunk.... | java | @CheckReturnValue
protected Statement genParamTypeChecks(TemplateNode node, String alias) {
ImmutableList.Builder<Statement> declarations = ImmutableList.builder();
for (TemplateParam param : node.getAllParams()) {
String paramName = param.name();
SoyType paramType = param.type();
CodeChunk.... | [
"@",
"CheckReturnValue",
"protected",
"Statement",
"genParamTypeChecks",
"(",
"TemplateNode",
"node",
",",
"String",
"alias",
")",
"{",
"ImmutableList",
".",
"Builder",
"<",
"Statement",
">",
"declarations",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
";",
"... | Generate code to verify the runtime types of the input params. Also typecasts the input
parameters and assigns them to local variables for use in the template.
@param node the template node. | [
"Generate",
"code",
"to",
"verify",
"the",
"runtime",
"types",
"of",
"the",
"input",
"params",
".",
"Also",
"typecasts",
"the",
"input",
"parameters",
"and",
"assigns",
"them",
"to",
"local",
"variables",
"for",
"use",
"in",
"the",
"template",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L1557-L1610 |
53,830 | google/closure-templates | java/src/com/google/template/soy/passes/PluginResolver.java | PluginResolver.nullResolver | public static PluginResolver nullResolver(Mode mode, ErrorReporter reporter) {
return new PluginResolver(
mode, ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), reporter);
} | java | public static PluginResolver nullResolver(Mode mode, ErrorReporter reporter) {
return new PluginResolver(
mode, ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of(), reporter);
} | [
"public",
"static",
"PluginResolver",
"nullResolver",
"(",
"Mode",
"mode",
",",
"ErrorReporter",
"reporter",
")",
"{",
"return",
"new",
"PluginResolver",
"(",
"mode",
",",
"ImmutableMap",
".",
"of",
"(",
")",
",",
"ImmutableMap",
".",
"of",
"(",
")",
",",
... | Returns an empty resolver. Useful for tests, or situations where it is known that no plugins
will be needed. | [
"Returns",
"an",
"empty",
"resolver",
".",
"Useful",
"for",
"tests",
"or",
"situations",
"where",
"it",
"is",
"known",
"that",
"no",
"plugins",
"will",
"be",
"needed",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/PluginResolver.java#L48-L51 |
53,831 | google/closure-templates | java/src/com/google/template/soy/passes/PluginResolver.java | PluginResolver.lookupPrintDirective | public SoyPrintDirective lookupPrintDirective(String name, int numArgs, SourceLocation location) {
SoyPrintDirective soyPrintDirective = printDirectives.get(name);
if (soyPrintDirective == null) {
reportMissing(location, "print directive", name, printDirectives.keySet());
soyPrintDirective = createP... | java | public SoyPrintDirective lookupPrintDirective(String name, int numArgs, SourceLocation location) {
SoyPrintDirective soyPrintDirective = printDirectives.get(name);
if (soyPrintDirective == null) {
reportMissing(location, "print directive", name, printDirectives.keySet());
soyPrintDirective = createP... | [
"public",
"SoyPrintDirective",
"lookupPrintDirective",
"(",
"String",
"name",
",",
"int",
"numArgs",
",",
"SourceLocation",
"location",
")",
"{",
"SoyPrintDirective",
"soyPrintDirective",
"=",
"printDirectives",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"soyPr... | Returns a print directive with the given name and arity.
<p>An error will be reported according to the current {@link Mode} and a placeholder function
will be returned if it cannot be found. | [
"Returns",
"a",
"print",
"directive",
"with",
"the",
"given",
"name",
"and",
"arity",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/PluginResolver.java#L177-L186 |
53,832 | google/closure-templates | java/src/com/google/template/soy/passes/PluginResolver.java | PluginResolver.lookupSoyFunction | public Object lookupSoyFunction(String name, int numArgs, SourceLocation location) {
Object soyFunction = functions.get(name);
if (soyFunction == null) {
reportMissing(location, "function", name, functions.keySet());
return ERROR_PLACEHOLDER_FUNCTION;
}
Set<Integer> validArgsSize;
if (so... | java | public Object lookupSoyFunction(String name, int numArgs, SourceLocation location) {
Object soyFunction = functions.get(name);
if (soyFunction == null) {
reportMissing(location, "function", name, functions.keySet());
return ERROR_PLACEHOLDER_FUNCTION;
}
Set<Integer> validArgsSize;
if (so... | [
"public",
"Object",
"lookupSoyFunction",
"(",
"String",
"name",
",",
"int",
"numArgs",
",",
"SourceLocation",
"location",
")",
"{",
"Object",
"soyFunction",
"=",
"functions",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"soyFunction",
"==",
"null",
")",
"... | Returns a function with the given name and arity.
<p>An error will be reported according to the current {@link Mode} and a placeholder function
will be returned if it cannot be found. | [
"Returns",
"a",
"function",
"with",
"the",
"given",
"name",
"and",
"arity",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/PluginResolver.java#L194-L211 |
53,833 | google/closure-templates | java/src/com/google/template/soy/soytree/PrintDirectiveNode.java | PrintDirectiveNode.setPrintDirective | public void setPrintDirective(SoyPrintDirective printDirective) {
checkState(this.printDirective == null, "setPrintDirective has already been called");
checkArgument(name.identifier().equals(printDirective.getName()));
this.printDirective = checkNotNull(printDirective);
} | java | public void setPrintDirective(SoyPrintDirective printDirective) {
checkState(this.printDirective == null, "setPrintDirective has already been called");
checkArgument(name.identifier().equals(printDirective.getName()));
this.printDirective = checkNotNull(printDirective);
} | [
"public",
"void",
"setPrintDirective",
"(",
"SoyPrintDirective",
"printDirective",
")",
"{",
"checkState",
"(",
"this",
".",
"printDirective",
"==",
"null",
",",
"\"setPrintDirective has already been called\"",
")",
";",
"checkArgument",
"(",
"name",
".",
"identifier",
... | Sets the print directive. | [
"Sets",
"the",
"print",
"directive",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/PrintDirectiveNode.java#L142-L146 |
53,834 | google/closure-templates | java/src/com/google/template/soy/pysrc/internal/LocalVariableStack.java | LocalVariableStack.addVariable | LocalVariableStack addVariable(String name, PyExpr varExpression) {
Preconditions.checkState(!localVarExprs.isEmpty());
localVarExprs.peek().put(name, varExpression);
return this;
} | java | LocalVariableStack addVariable(String name, PyExpr varExpression) {
Preconditions.checkState(!localVarExprs.isEmpty());
localVarExprs.peek().put(name, varExpression);
return this;
} | [
"LocalVariableStack",
"addVariable",
"(",
"String",
"name",
",",
"PyExpr",
"varExpression",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"localVarExprs",
".",
"isEmpty",
"(",
")",
")",
";",
"localVarExprs",
".",
"peek",
"(",
")",
".",
"put",
"(",
... | Adds a variable to the current reference frame.
@param name The name of the variable as used by calling expressions.
@param varExpression The underlying expression used to access the variable.
@return A reference to this object. | [
"Adds",
"a",
"variable",
"to",
"the",
"current",
"reference",
"frame",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/LocalVariableStack.java#L56-L60 |
53,835 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.derive | public Context derive(HtmlContext state) {
return state == this.state ? this : toBuilder().withState(state).build();
} | java | public Context derive(HtmlContext state) {
return state == this.state ? this : toBuilder().withState(state).build();
} | [
"public",
"Context",
"derive",
"(",
"HtmlContext",
"state",
")",
"{",
"return",
"state",
"==",
"this",
".",
"state",
"?",
"this",
":",
"toBuilder",
"(",
")",
".",
"withState",
"(",
"state",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns a context that differs only in the state. | [
"Returns",
"a",
"context",
"that",
"differs",
"only",
"in",
"the",
"state",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L210-L212 |
53,836 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.derive | public Context derive(JsFollowingSlash slashType) {
return slashType == this.slashType ? this : toBuilder().withSlashType(slashType).build();
} | java | public Context derive(JsFollowingSlash slashType) {
return slashType == this.slashType ? this : toBuilder().withSlashType(slashType).build();
} | [
"public",
"Context",
"derive",
"(",
"JsFollowingSlash",
"slashType",
")",
"{",
"return",
"slashType",
"==",
"this",
".",
"slashType",
"?",
"this",
":",
"toBuilder",
"(",
")",
".",
"withSlashType",
"(",
"slashType",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns a context that differs only in the following slash. | [
"Returns",
"a",
"context",
"that",
"differs",
"only",
"in",
"the",
"following",
"slash",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L215-L217 |
53,837 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.derive | public Context derive(UriPart uriPart) {
return uriPart == this.uriPart ? this : toBuilder().withUriPart(uriPart).build();
} | java | public Context derive(UriPart uriPart) {
return uriPart == this.uriPart ? this : toBuilder().withUriPart(uriPart).build();
} | [
"public",
"Context",
"derive",
"(",
"UriPart",
"uriPart",
")",
"{",
"return",
"uriPart",
"==",
"this",
".",
"uriPart",
"?",
"this",
":",
"toBuilder",
"(",
")",
".",
"withUriPart",
"(",
"uriPart",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns a context that differs only in the uri part. | [
"Returns",
"a",
"context",
"that",
"differs",
"only",
"in",
"the",
"uri",
"part",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L220-L222 |
53,838 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.derive | public Context derive(HtmlHtmlAttributePosition htmlHtmlAttributePosition) {
return htmlHtmlAttributePosition == this.htmlHtmlAttributePosition
? this
: toBuilder().withHtmlHtmlAttributePosition(htmlHtmlAttributePosition).build();
} | java | public Context derive(HtmlHtmlAttributePosition htmlHtmlAttributePosition) {
return htmlHtmlAttributePosition == this.htmlHtmlAttributePosition
? this
: toBuilder().withHtmlHtmlAttributePosition(htmlHtmlAttributePosition).build();
} | [
"public",
"Context",
"derive",
"(",
"HtmlHtmlAttributePosition",
"htmlHtmlAttributePosition",
")",
"{",
"return",
"htmlHtmlAttributePosition",
"==",
"this",
".",
"htmlHtmlAttributePosition",
"?",
"this",
":",
"toBuilder",
"(",
")",
".",
"withHtmlHtmlAttributePosition",
"(... | Returns a context that differs only in the HTML attribute containing HTML position. | [
"Returns",
"a",
"context",
"that",
"differs",
"only",
"in",
"the",
"HTML",
"attribute",
"containing",
"HTML",
"position",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L225-L229 |
53,839 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.getContextAfterDynamicValue | public Context getContextAfterDynamicValue() {
// TODO: If the context is JS, perhaps this should return JsFollowingSlash.UNKNOWN. Right now
// we assume that the dynamic value is also an expression, but JsFollowingSlash.UNKNOWN would
// account for things that end in semicolons (since the next slash could ... | java | public Context getContextAfterDynamicValue() {
// TODO: If the context is JS, perhaps this should return JsFollowingSlash.UNKNOWN. Right now
// we assume that the dynamic value is also an expression, but JsFollowingSlash.UNKNOWN would
// account for things that end in semicolons (since the next slash could ... | [
"public",
"Context",
"getContextAfterDynamicValue",
"(",
")",
"{",
"// TODO: If the context is JS, perhaps this should return JsFollowingSlash.UNKNOWN. Right now",
"// we assume that the dynamic value is also an expression, but JsFollowingSlash.UNKNOWN would",
"// account for things that end in semi... | The context after printing a correctly-escaped dynamic value in this context.
<p>This makes the optimistic assumption that the escaped string is not empty. This can lead to
correctness behaviors, but the default is to fail closed; for example, printing an empty string
at UriPart.START switches to MAYBE_VARIABLE_SCHEME... | [
"The",
"context",
"after",
"printing",
"a",
"correctly",
"-",
"escaped",
"dynamic",
"value",
"in",
"this",
"context",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L245-L280 |
53,840 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.computeContextAfterAttributeDelimiter | static Context computeContextAfterAttributeDelimiter(
ElementType elType,
AttributeType attrType,
AttributeEndDelimiter delim,
UriType uriType,
int templateNestDepth) {
HtmlContext state;
JsFollowingSlash slash = JsFollowingSlash.NONE;
UriPart uriPart = UriPart.NONE;
switch... | java | static Context computeContextAfterAttributeDelimiter(
ElementType elType,
AttributeType attrType,
AttributeEndDelimiter delim,
UriType uriType,
int templateNestDepth) {
HtmlContext state;
JsFollowingSlash slash = JsFollowingSlash.NONE;
UriPart uriPart = UriPart.NONE;
switch... | [
"static",
"Context",
"computeContextAfterAttributeDelimiter",
"(",
"ElementType",
"elType",
",",
"AttributeType",
"attrType",
",",
"AttributeEndDelimiter",
"delim",
",",
"UriType",
"uriType",
",",
"int",
"templateNestDepth",
")",
"{",
"HtmlContext",
"state",
";",
"JsFol... | Computes the context after an attribute delimiter is seen.
@param elType The type of element whose tag the attribute appears in.
@param attrType The type of attribute whose value the delimiter starts.
@param delim The type of delimiter that will mark the end of the attribute value.
@param templateNestDepth The number ... | [
"Computes",
"the",
"context",
"after",
"an",
"attribute",
"delimiter",
"is",
"seen",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L291-L345 |
53,841 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.getMsgEscapingStrategy | Optional<MsgEscapingStrategy> getMsgEscapingStrategy(SoyNode node) {
switch (state) {
case HTML_PCDATA:
// In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not
// escape the entire message. This allows Soy to support putting anchors and other small
/... | java | Optional<MsgEscapingStrategy> getMsgEscapingStrategy(SoyNode node) {
switch (state) {
case HTML_PCDATA:
// In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not
// escape the entire message. This allows Soy to support putting anchors and other small
/... | [
"Optional",
"<",
"MsgEscapingStrategy",
">",
"getMsgEscapingStrategy",
"(",
"SoyNode",
"node",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"HTML_PCDATA",
":",
"// In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not",
"// escape the en... | Determines the strategy to escape Soy msg tags.
<p>Importantly, this determines the context that the message should be considered in, how the
print nodes will be escaped, and how the entire message will be escaped. We need different
strategies in different contexts because messages in general aren't trusted, but we al... | [
"Determines",
"the",
"strategy",
"to",
"escape",
"Soy",
"msg",
"tags",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L557-L598 |
53,842 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.isCompatibleWith | public boolean isCompatibleWith(EscapingMode mode) {
// TODO: Come up with a compatibility matrix.
if (mode == EscapingMode.ESCAPE_JS_VALUE) {
// Don't introduce quotes inside a string.
switch (state) {
case JS_SQ_STRING:
case JS_DQ_STRING:
case CSS_SQ_STRING:
case CS... | java | public boolean isCompatibleWith(EscapingMode mode) {
// TODO: Come up with a compatibility matrix.
if (mode == EscapingMode.ESCAPE_JS_VALUE) {
// Don't introduce quotes inside a string.
switch (state) {
case JS_SQ_STRING:
case JS_DQ_STRING:
case CSS_SQ_STRING:
case CS... | [
"public",
"boolean",
"isCompatibleWith",
"(",
"EscapingMode",
"mode",
")",
"{",
"// TODO: Come up with a compatibility matrix.",
"if",
"(",
"mode",
"==",
"EscapingMode",
".",
"ESCAPE_JS_VALUE",
")",
"{",
"// Don't introduce quotes inside a string.",
"switch",
"(",
"state",
... | True if the given escaping mode could make sense in this context. | [
"True",
"if",
"the",
"given",
"escaping",
"mode",
"could",
"make",
"sense",
"in",
"this",
"context",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L601-L627 |
53,843 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.packedBits | public int packedBits() {
int bits = templateNestDepth;
bits = (bits << N_URI_TYPE_BITS) | uriType.ordinal();
bits = (bits << N_URI_PART_BITS) | uriPart.ordinal();
bits = (bits << N_JS_SLASH_BITS) | slashType.ordinal();
bits = (bits << N_DELIM_BITS) | delimType.ordinal();
bits = (bits << N_ATTR_... | java | public int packedBits() {
int bits = templateNestDepth;
bits = (bits << N_URI_TYPE_BITS) | uriType.ordinal();
bits = (bits << N_URI_PART_BITS) | uriPart.ordinal();
bits = (bits << N_JS_SLASH_BITS) | slashType.ordinal();
bits = (bits << N_DELIM_BITS) | delimType.ordinal();
bits = (bits << N_ATTR_... | [
"public",
"int",
"packedBits",
"(",
")",
"{",
"int",
"bits",
"=",
"templateNestDepth",
";",
"bits",
"=",
"(",
"bits",
"<<",
"N_URI_TYPE_BITS",
")",
"|",
"uriType",
".",
"ordinal",
"(",
")",
";",
"bits",
"=",
"(",
"bits",
"<<",
"N_URI_PART_BITS",
")",
"... | An integer form that uniquely identifies this context. This form is not guaranteed to be stable
across versions, so do not use as a long-lived serialized form. | [
"An",
"integer",
"form",
"that",
"uniquely",
"identifies",
"this",
"context",
".",
"This",
"form",
"is",
"not",
"guaranteed",
"to",
"be",
"stable",
"across",
"versions",
"so",
"do",
"not",
"use",
"as",
"a",
"long",
"-",
"lived",
"serialized",
"form",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L660-L670 |
53,844 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.unionUriParts | private static UriPart unionUriParts(UriPart a, UriPart b) {
Preconditions.checkArgument(a != b);
if (a == UriPart.DANGEROUS_SCHEME || b == UriPart.DANGEROUS_SCHEME) {
// Dangerous schemes (like javascript:) are poison -- if either side is dangerous, the whole
// thing is.
return UriPart.DANGE... | java | private static UriPart unionUriParts(UriPart a, UriPart b) {
Preconditions.checkArgument(a != b);
if (a == UriPart.DANGEROUS_SCHEME || b == UriPart.DANGEROUS_SCHEME) {
// Dangerous schemes (like javascript:) are poison -- if either side is dangerous, the whole
// thing is.
return UriPart.DANGE... | [
"private",
"static",
"UriPart",
"unionUriParts",
"(",
"UriPart",
"a",
",",
"UriPart",
"b",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"a",
"!=",
"b",
")",
";",
"if",
"(",
"a",
"==",
"UriPart",
".",
"DANGEROUS_SCHEME",
"||",
"b",
"==",
"UriPart... | Determines the correct URI part if two branches are joined. | [
"Determines",
"the",
"correct",
"URI",
"part",
"if",
"two",
"branches",
"are",
"joined",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L725-L771 |
53,845 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.parse | @VisibleForTesting
static Context parse(String text) {
Queue<String> parts = Lists.newLinkedList(Arrays.asList(text.split(" ")));
Context.Builder builder = HTML_PCDATA.toBuilder();
builder.withState(HtmlContext.valueOf(parts.remove()));
if (!parts.isEmpty()) {
try {
builder.withElType(El... | java | @VisibleForTesting
static Context parse(String text) {
Queue<String> parts = Lists.newLinkedList(Arrays.asList(text.split(" ")));
Context.Builder builder = HTML_PCDATA.toBuilder();
builder.withState(HtmlContext.valueOf(parts.remove()));
if (!parts.isEmpty()) {
try {
builder.withElType(El... | [
"@",
"VisibleForTesting",
"static",
"Context",
"parse",
"(",
"String",
"text",
")",
"{",
"Queue",
"<",
"String",
">",
"parts",
"=",
"Lists",
".",
"newLinkedList",
"(",
"Arrays",
".",
"asList",
"(",
"text",
".",
"split",
"(",
"\" \"",
")",
")",
")",
";"... | Parses a condensed string version of a context, for use in tests. | [
"Parses",
"a",
"condensed",
"string",
"version",
"of",
"a",
"context",
"for",
"use",
"in",
"tests",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L902-L985 |
53,846 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.isValidStartContextForContentKind | public boolean isValidStartContextForContentKind(SanitizedContentKind contentKind) {
if (templateNestDepth != 0) {
return false;
}
switch (contentKind) {
case ATTRIBUTES:
// Allow HTML attribute names, regardless of the kind of attribute (e.g. plain text)
// or immediately after ... | java | public boolean isValidStartContextForContentKind(SanitizedContentKind contentKind) {
if (templateNestDepth != 0) {
return false;
}
switch (contentKind) {
case ATTRIBUTES:
// Allow HTML attribute names, regardless of the kind of attribute (e.g. plain text)
// or immediately after ... | [
"public",
"boolean",
"isValidStartContextForContentKind",
"(",
"SanitizedContentKind",
"contentKind",
")",
"{",
"if",
"(",
"templateNestDepth",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"switch",
"(",
"contentKind",
")",
"{",
"case",
"ATTRIBUTES",
":",
"... | Determines whether a particular context is valid at the start of a block of a particular
content kind. | [
"Determines",
"whether",
"a",
"particular",
"context",
"is",
"valid",
"at",
"the",
"start",
"of",
"a",
"block",
"of",
"a",
"particular",
"content",
"kind",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L1004-L1018 |
53,847 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.isValidStartContextForContentKindLoose | public boolean isValidStartContextForContentKindLoose(SanitizedContentKind contentKind) {
switch (contentKind) {
case URI:
// Allow contextual templates directly call URI templates, even if we technically need to
// do HTML-escaping for correct output. Supported browsers recover gracefully wh... | java | public boolean isValidStartContextForContentKindLoose(SanitizedContentKind contentKind) {
switch (contentKind) {
case URI:
// Allow contextual templates directly call URI templates, even if we technically need to
// do HTML-escaping for correct output. Supported browsers recover gracefully wh... | [
"public",
"boolean",
"isValidStartContextForContentKindLoose",
"(",
"SanitizedContentKind",
"contentKind",
")",
"{",
"switch",
"(",
"contentKind",
")",
"{",
"case",
"URI",
":",
"// Allow contextual templates directly call URI templates, even if we technically need to",
"// do HTML-... | Determines whether a particular context is allowed for contextual to strict calls.
<p>This is slightly more relaxed, and used to help piecemeal transition of templates from
contextual to strict. | [
"Determines",
"whether",
"a",
"particular",
"context",
"is",
"allowed",
"for",
"contextual",
"to",
"strict",
"calls",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L1026-L1038 |
53,848 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.getMostAppropriateContentKind | public SanitizedContentKind getMostAppropriateContentKind() {
SanitizedContentKind kind = STATE_TO_CONTENT_KIND.get(state);
if (kind != null && isValidStartContextForContentKindLoose(kind)) {
return kind;
}
return SanitizedContentKind.TEXT;
} | java | public SanitizedContentKind getMostAppropriateContentKind() {
SanitizedContentKind kind = STATE_TO_CONTENT_KIND.get(state);
if (kind != null && isValidStartContextForContentKindLoose(kind)) {
return kind;
}
return SanitizedContentKind.TEXT;
} | [
"public",
"SanitizedContentKind",
"getMostAppropriateContentKind",
"(",
")",
"{",
"SanitizedContentKind",
"kind",
"=",
"STATE_TO_CONTENT_KIND",
".",
"get",
"(",
"state",
")",
";",
"if",
"(",
"kind",
"!=",
"null",
"&&",
"isValidStartContextForContentKindLoose",
"(",
"k... | Returns the most sensible content kind for a context.
<p>This is primarily for error messages, indicating to the user what content kind can be used
to mostly null out the escaping. Returns TEXT if no useful match was detected. | [
"Returns",
"the",
"most",
"sensible",
"content",
"kind",
"for",
"a",
"context",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L1059-L1065 |
53,849 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.isValidEndContextForContentKind | public final boolean isValidEndContextForContentKind(SanitizedContentKind contentKind) {
if (templateNestDepth != 0) {
return false;
}
switch (contentKind) {
case CSS:
return state == HtmlContext.CSS && elType == ElementType.NONE;
case HTML:
return state == HtmlContext.HTML... | java | public final boolean isValidEndContextForContentKind(SanitizedContentKind contentKind) {
if (templateNestDepth != 0) {
return false;
}
switch (contentKind) {
case CSS:
return state == HtmlContext.CSS && elType == ElementType.NONE;
case HTML:
return state == HtmlContext.HTML... | [
"public",
"final",
"boolean",
"isValidEndContextForContentKind",
"(",
"SanitizedContentKind",
"contentKind",
")",
"{",
"if",
"(",
"templateNestDepth",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"switch",
"(",
"contentKind",
")",
"{",
"case",
"CSS",
":",
... | Determines whether a particular context is valid for the end of a block of a particular content
kind. | [
"Determines",
"whether",
"a",
"particular",
"context",
"is",
"valid",
"for",
"the",
"end",
"of",
"a",
"block",
"of",
"a",
"particular",
"content",
"kind",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L1071-L1105 |
53,850 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.getLikelyEndContextMismatchCause | public final String getLikelyEndContextMismatchCause(SanitizedContentKind contentKind) {
Preconditions.checkArgument(!isValidEndContextForContentKind(contentKind));
if (contentKind == SanitizedContentKind.ATTRIBUTES) {
// Special error message for ATTRIBUTES since it has some specific logic.
return ... | java | public final String getLikelyEndContextMismatchCause(SanitizedContentKind contentKind) {
Preconditions.checkArgument(!isValidEndContextForContentKind(contentKind));
if (contentKind == SanitizedContentKind.ATTRIBUTES) {
// Special error message for ATTRIBUTES since it has some specific logic.
return ... | [
"public",
"final",
"String",
"getLikelyEndContextMismatchCause",
"(",
"SanitizedContentKind",
"contentKind",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"!",
"isValidEndContextForContentKind",
"(",
"contentKind",
")",
")",
";",
"if",
"(",
"contentKind",
"==",
... | Returns a plausible human-readable description of a context mismatch;
<p>This assumes that the provided context is an invalid end context for the particular content
kind. | [
"Returns",
"a",
"plausible",
"human",
"-",
"readable",
"description",
"of",
"a",
"context",
"mismatch",
";"
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L1113-L1160 |
53,851 | google/closure-templates | java/src/com/google/template/soy/base/internal/IndentedLinesBuilder.java | IndentedLinesBuilder.increaseIndent | public void increaseIndent(int numStops) {
indentLen += numStops * indentIncrementLen;
Preconditions.checkState(0 <= indentLen && indentLen <= MAX_INDENT_LEN);
indent = SPACES.substring(0, indentLen);
} | java | public void increaseIndent(int numStops) {
indentLen += numStops * indentIncrementLen;
Preconditions.checkState(0 <= indentLen && indentLen <= MAX_INDENT_LEN);
indent = SPACES.substring(0, indentLen);
} | [
"public",
"void",
"increaseIndent",
"(",
"int",
"numStops",
")",
"{",
"indentLen",
"+=",
"numStops",
"*",
"indentIncrementLen",
";",
"Preconditions",
".",
"checkState",
"(",
"0",
"<=",
"indentLen",
"&&",
"indentLen",
"<=",
"MAX_INDENT_LEN",
")",
";",
"indent",
... | Increases the indent by the given number of stops. | [
"Increases",
"the",
"indent",
"by",
"the",
"given",
"number",
"of",
"stops",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/IndentedLinesBuilder.java#L99-L103 |
53,852 | google/closure-templates | java/src/com/google/template/soy/base/internal/IndentedLinesBuilder.java | IndentedLinesBuilder.appendParts | public IndentedLinesBuilder appendParts(Object... parts) {
for (Object part : parts) {
sb.append(part);
}
return this;
} | java | public IndentedLinesBuilder appendParts(Object... parts) {
for (Object part : parts) {
sb.append(part);
}
return this;
} | [
"public",
"IndentedLinesBuilder",
"appendParts",
"(",
"Object",
"...",
"parts",
")",
"{",
"for",
"(",
"Object",
"part",
":",
"parts",
")",
"{",
"sb",
".",
"append",
"(",
"part",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Appends some parts to the current line.
@param parts The parts to append.
@return This object. | [
"Appends",
"some",
"parts",
"to",
"the",
"current",
"line",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/IndentedLinesBuilder.java#L137-L142 |
53,853 | google/closure-templates | java/src/com/google/template/soy/jssrc/internal/AliasUtils.java | AliasUtils.createTemplateAliases | static TemplateAliases createTemplateAliases(SoyFileNode fileNode) {
Map<String, String> aliasMap = new HashMap<>();
Set<String> localTemplates = new HashSet<>();
int counter = 0;
ImmutableList.Builder<TemplateNode> templates = ImmutableList.builder();
templates
.addAll(SoyTreeUtils.getAllN... | java | static TemplateAliases createTemplateAliases(SoyFileNode fileNode) {
Map<String, String> aliasMap = new HashMap<>();
Set<String> localTemplates = new HashSet<>();
int counter = 0;
ImmutableList.Builder<TemplateNode> templates = ImmutableList.builder();
templates
.addAll(SoyTreeUtils.getAllN... | [
"static",
"TemplateAliases",
"createTemplateAliases",
"(",
"SoyFileNode",
"fileNode",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"aliasMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Set",
"<",
"String",
">",
"localTemplates",
"=",
"new",
"HashSe... | Creates a mapping for assigning and looking up the variable alias for templates both within a
file and referenced from external files. For local files, the alias is just the local
template's name. For external templates, the alias is an identifier that is unique for that
template.
<p>For V1 templates, no alias is gene... | [
"Creates",
"a",
"mapping",
"for",
"assigning",
"and",
"looking",
"up",
"the",
"variable",
"alias",
"for",
"templates",
"both",
"within",
"a",
"file",
"and",
"referenced",
"from",
"external",
"files",
".",
"For",
"local",
"files",
"the",
"alias",
"is",
"just"... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/AliasUtils.java#L77-L116 |
53,854 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java | TemplateVariableManager.generateTableEntries | void generateTableEntries(CodeBuilder ga) {
for (Variable var : allVariables) {
try {
var.local.tableEntry(ga);
} catch (Throwable t) {
throw new RuntimeException("unable to write table entry for: " + var.local, t);
}
}
} | java | void generateTableEntries(CodeBuilder ga) {
for (Variable var : allVariables) {
try {
var.local.tableEntry(ga);
} catch (Throwable t) {
throw new RuntimeException("unable to write table entry for: " + var.local, t);
}
}
} | [
"void",
"generateTableEntries",
"(",
"CodeBuilder",
"ga",
")",
"{",
"for",
"(",
"Variable",
"var",
":",
"allVariables",
")",
"{",
"try",
"{",
"var",
".",
"local",
".",
"tableEntry",
"(",
"ga",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
... | Write a local variable table entry for every registered variable. | [
"Write",
"a",
"local",
"variable",
"table",
"entry",
"for",
"every",
"registered",
"variable",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java#L415-L423 |
53,855 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java | TemplateVariableManager.defineFields | void defineFields(ClassVisitor writer) {
for (Variable var : allVariables) {
var.maybeDefineField(writer);
}
if (currentCalleeField != null) {
currentCalleeField.defineField(writer);
}
if (currentRendereeField != null) {
currentRendereeField.defineField(writer);
}
if (curre... | java | void defineFields(ClassVisitor writer) {
for (Variable var : allVariables) {
var.maybeDefineField(writer);
}
if (currentCalleeField != null) {
currentCalleeField.defineField(writer);
}
if (currentRendereeField != null) {
currentRendereeField.defineField(writer);
}
if (curre... | [
"void",
"defineFields",
"(",
"ClassVisitor",
"writer",
")",
"{",
"for",
"(",
"Variable",
"var",
":",
"allVariables",
")",
"{",
"var",
".",
"maybeDefineField",
"(",
"writer",
")",
";",
"}",
"if",
"(",
"currentCalleeField",
"!=",
"null",
")",
"{",
"currentCa... | Defines all the fields necessary for the registered variables. | [
"Defines",
"all",
"the",
"fields",
"necessary",
"for",
"the",
"registered",
"variables",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java#L448-L461 |
53,856 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java | TemplateVariableManager.getCurrentCalleeField | FieldRef getCurrentCalleeField() {
FieldRef local = currentCalleeField;
if (local == null) {
local =
currentCalleeField =
FieldRef.createField(owner, CURRENT_CALLEE_FIELD, CompiledTemplate.class);
}
return local;
} | java | FieldRef getCurrentCalleeField() {
FieldRef local = currentCalleeField;
if (local == null) {
local =
currentCalleeField =
FieldRef.createField(owner, CURRENT_CALLEE_FIELD, CompiledTemplate.class);
}
return local;
} | [
"FieldRef",
"getCurrentCalleeField",
"(",
")",
"{",
"FieldRef",
"local",
"=",
"currentCalleeField",
";",
"if",
"(",
"local",
"==",
"null",
")",
"{",
"local",
"=",
"currentCalleeField",
"=",
"FieldRef",
".",
"createField",
"(",
"owner",
",",
"CURRENT_CALLEE_FIELD... | Returns the field that holds the current callee template.
<p>Unlike normal variables the VariableSet doesn't maintain responsibility for saving and
restoring the current callee to a local. | [
"Returns",
"the",
"field",
"that",
"holds",
"the",
"current",
"callee",
"template",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java#L488-L496 |
53,857 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java | TemplateVariableManager.getCurrentRenderee | FieldRef getCurrentRenderee() {
FieldRef local = currentRendereeField;
if (local == null) {
local =
currentRendereeField =
FieldRef.createField(owner, CURRENT_RENDEREE_FIELD, SoyValueProvider.class);
}
return local;
} | java | FieldRef getCurrentRenderee() {
FieldRef local = currentRendereeField;
if (local == null) {
local =
currentRendereeField =
FieldRef.createField(owner, CURRENT_RENDEREE_FIELD, SoyValueProvider.class);
}
return local;
} | [
"FieldRef",
"getCurrentRenderee",
"(",
")",
"{",
"FieldRef",
"local",
"=",
"currentRendereeField",
";",
"if",
"(",
"local",
"==",
"null",
")",
"{",
"local",
"=",
"currentRendereeField",
"=",
"FieldRef",
".",
"createField",
"(",
"owner",
",",
"CURRENT_RENDEREE_FI... | Returns the field that holds the currently rendering SoyValueProvider.
<p>Unlike normal variables the VariableSet doesn't maintain responsibility for saving and
restoring the current renderee to a local. | [
"Returns",
"the",
"field",
"that",
"holds",
"the",
"currently",
"rendering",
"SoyValueProvider",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java#L504-L512 |
53,858 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java | TemplateVariableManager.getCurrentAppendable | FieldRef getCurrentAppendable() {
FieldRef local = currentAppendable;
if (local == null) {
local =
currentAppendable =
FieldRef.createField(
owner, CURRENT_APPENDABLE_FIELD, LoggingAdvisingAppendable.class);
}
return local;
} | java | FieldRef getCurrentAppendable() {
FieldRef local = currentAppendable;
if (local == null) {
local =
currentAppendable =
FieldRef.createField(
owner, CURRENT_APPENDABLE_FIELD, LoggingAdvisingAppendable.class);
}
return local;
} | [
"FieldRef",
"getCurrentAppendable",
"(",
")",
"{",
"FieldRef",
"local",
"=",
"currentAppendable",
";",
"if",
"(",
"local",
"==",
"null",
")",
"{",
"local",
"=",
"currentAppendable",
"=",
"FieldRef",
".",
"createField",
"(",
"owner",
",",
"CURRENT_APPENDABLE_FIEL... | Returns the field that holds the currently rendering LoggingAdvisingAppendable object that is
used for streaming renders.
<p>Unlike normal variables the VariableSet doesn't maintain responsibility for saving and
restoring the current renderee to a local.
<p>TODO(lukes): it would be better if the VariableSet would sav... | [
"Returns",
"the",
"field",
"that",
"holds",
"the",
"currently",
"rendering",
"LoggingAdvisingAppendable",
"object",
"that",
"is",
"used",
"for",
"streaming",
"renders",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java#L524-L533 |
53,859 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java | TemplateVariableManager.getVariable | Variable getVariable(String name) {
VarKey varKey = VarKey.create(Kind.USER_DEFINED, name);
return getVariable(varKey);
} | java | Variable getVariable(String name) {
VarKey varKey = VarKey.create(Kind.USER_DEFINED, name);
return getVariable(varKey);
} | [
"Variable",
"getVariable",
"(",
"String",
"name",
")",
"{",
"VarKey",
"varKey",
"=",
"VarKey",
".",
"create",
"(",
"Kind",
".",
"USER_DEFINED",
",",
"name",
")",
";",
"return",
"getVariable",
"(",
"varKey",
")",
";",
"}"
] | Looks up a user defined variable with the given name. The variable must have been created in a
currently active scope. | [
"Looks",
"up",
"a",
"user",
"defined",
"variable",
"with",
"the",
"given",
"name",
".",
"The",
"variable",
"must",
"have",
"been",
"created",
"in",
"a",
"currently",
"active",
"scope",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java#L539-L542 |
53,860 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java | TemplateVariableManager.getVariable | Variable getVariable(SyntheticVarName name) {
VarKey varKey = VarKey.create(Kind.SYNTHETIC, name.name());
return getVariable(varKey);
} | java | Variable getVariable(SyntheticVarName name) {
VarKey varKey = VarKey.create(Kind.SYNTHETIC, name.name());
return getVariable(varKey);
} | [
"Variable",
"getVariable",
"(",
"SyntheticVarName",
"name",
")",
"{",
"VarKey",
"varKey",
"=",
"VarKey",
".",
"create",
"(",
"Kind",
".",
"SYNTHETIC",
",",
"name",
".",
"name",
"(",
")",
")",
";",
"return",
"getVariable",
"(",
"varKey",
")",
";",
"}"
] | Looks up a synthetic variable with the given name. The variable must have been created in a
currently active scope. | [
"Looks",
"up",
"a",
"synthetic",
"variable",
"with",
"the",
"given",
"name",
".",
"The",
"variable",
"must",
"have",
"been",
"created",
"in",
"a",
"currently",
"active",
"scope",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/TemplateVariableManager.java#L548-L551 |
53,861 | google/closure-templates | java/src/com/google/template/soy/internal/i18n/BidiFormatter.java | BidiFormatter.knownDirAttrSanitized | public SanitizedContent knownDirAttrSanitized(Dir dir) {
Preconditions.checkNotNull(dir);
if (dir != contextDir) {
switch (dir) {
case LTR:
return LTR_DIR;
case RTL:
return RTL_DIR;
case NEUTRAL:
// fall out.
}
}
return NEUTRAL_DIR;
} | java | public SanitizedContent knownDirAttrSanitized(Dir dir) {
Preconditions.checkNotNull(dir);
if (dir != contextDir) {
switch (dir) {
case LTR:
return LTR_DIR;
case RTL:
return RTL_DIR;
case NEUTRAL:
// fall out.
}
}
return NEUTRAL_DIR;
} | [
"public",
"SanitizedContent",
"knownDirAttrSanitized",
"(",
"Dir",
"dir",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"dir",
")",
";",
"if",
"(",
"dir",
"!=",
"contextDir",
")",
"{",
"switch",
"(",
"dir",
")",
"{",
"case",
"LTR",
":",
"return",
... | Returns "dir=\"ltr\"" or "dir=\"rtl\"", depending on the given directionality, if it is not
NEUTRAL or the same as the context directionality. Otherwise, returns "".
@param dir Given directionality. Must not be null.
@return "dir=\"rtl\"" for RTL text in non-RTL context; "dir=\"ltr\"" for LTR text in non-LTR
context; ... | [
"Returns",
"dir",
"=",
"\\",
"ltr",
"\\",
"or",
"dir",
"=",
"\\",
"rtl",
"\\",
"depending",
"on",
"the",
"given",
"directionality",
"if",
"it",
"is",
"not",
"NEUTRAL",
"or",
"the",
"same",
"as",
"the",
"context",
"directionality",
".",
"Otherwise",
"retu... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/BidiFormatter.java#L87-L100 |
53,862 | google/closure-templates | java/src/com/google/template/soy/internal/i18n/BidiFormatter.java | BidiFormatter.estimateDirection | @VisibleForTesting
static Dir estimateDirection(String str, boolean isHtml) {
return BidiUtils.estimateDirection(str, isHtml);
} | java | @VisibleForTesting
static Dir estimateDirection(String str, boolean isHtml) {
return BidiUtils.estimateDirection(str, isHtml);
} | [
"@",
"VisibleForTesting",
"static",
"Dir",
"estimateDirection",
"(",
"String",
"str",
",",
"boolean",
"isHtml",
")",
"{",
"return",
"BidiUtils",
".",
"estimateDirection",
"(",
"str",
",",
"isHtml",
")",
";",
"}"
] | Estimates the directionality of a string using the best known general-purpose method, i.e.
using relative word counts. Dir.NEUTRAL return value indicates completely neutral input.
@param str String whose directionality is to be estimated
@param isHtml Whether {@code str} is HTML / HTML-escaped
@return {@code str}'s es... | [
"Estimates",
"the",
"directionality",
"of",
"a",
"string",
"using",
"the",
"best",
"known",
"general",
"-",
"purpose",
"method",
"i",
".",
"e",
".",
"using",
"relative",
"word",
"counts",
".",
"Dir",
".",
"NEUTRAL",
"return",
"value",
"indicates",
"completel... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/BidiFormatter.java#L245-L248 |
53,863 | google/closure-templates | java/src/com/google/template/soy/conformance/ValidatedConformanceConfig.java | ValidatedConformanceConfig.create | public static ValidatedConformanceConfig create(ConformanceConfig config) {
ImmutableList.Builder<RuleWithWhitelists> rulesBuilder = new ImmutableList.Builder<>();
for (Requirement requirement : config.getRequirementList()) {
Preconditions.checkArgument(
!requirement.getErrorMessage().isEmpty(),... | java | public static ValidatedConformanceConfig create(ConformanceConfig config) {
ImmutableList.Builder<RuleWithWhitelists> rulesBuilder = new ImmutableList.Builder<>();
for (Requirement requirement : config.getRequirementList()) {
Preconditions.checkArgument(
!requirement.getErrorMessage().isEmpty(),... | [
"public",
"static",
"ValidatedConformanceConfig",
"create",
"(",
"ConformanceConfig",
"config",
")",
"{",
"ImmutableList",
".",
"Builder",
"<",
"RuleWithWhitelists",
">",
"rulesBuilder",
"=",
"new",
"ImmutableList",
".",
"Builder",
"<>",
"(",
")",
";",
"for",
"(",... | Creates a validated configuration object.
@throws IllegalArgumentException if there is an error in the config object. | [
"Creates",
"a",
"validated",
"configuration",
"object",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/conformance/ValidatedConformanceConfig.java#L45-L60 |
53,864 | google/closure-templates | java/src/com/google/template/soy/conformance/ValidatedConformanceConfig.java | ValidatedConformanceConfig.createCustomRule | private static Rule<?> createCustomRule(String javaClass, SoyErrorKind error) {
Class<? extends Rule<?>> customRuleClass;
try {
@SuppressWarnings("unchecked")
Class<? extends Rule<?>> asSubclass =
(Class<? extends Rule<?>>) Class.forName(javaClass).asSubclass(Rule.class);
customRuleC... | java | private static Rule<?> createCustomRule(String javaClass, SoyErrorKind error) {
Class<? extends Rule<?>> customRuleClass;
try {
@SuppressWarnings("unchecked")
Class<? extends Rule<?>> asSubclass =
(Class<? extends Rule<?>>) Class.forName(javaClass).asSubclass(Rule.class);
customRuleC... | [
"private",
"static",
"Rule",
"<",
"?",
">",
"createCustomRule",
"(",
"String",
"javaClass",
",",
"SoyErrorKind",
"error",
")",
"{",
"Class",
"<",
"?",
"extends",
"Rule",
"<",
"?",
">",
">",
"customRuleClass",
";",
"try",
"{",
"@",
"SuppressWarnings",
"(",
... | Instantiates a custom conformance check from its fully-qualified class name, specified in the
conformance protobuf.
<p>Custom conformance checks must extend {@link Rule}. They must also have a binary constructor
with {@link ErrorReporter} and {@link SoyErrorKind} parameters. | [
"Instantiates",
"a",
"custom",
"conformance",
"check",
"from",
"its",
"fully",
"-",
"qualified",
"class",
"name",
"specified",
"in",
"the",
"conformance",
"protobuf",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/conformance/ValidatedConformanceConfig.java#L113-L134 |
53,865 | google/closure-templates | java/src/com/google/template/soy/jssrc/SoyJsSrcOptions.java | SoyJsSrcOptions.setUseGoogIsRtlForBidiGlobalDir | public void setUseGoogIsRtlForBidiGlobalDir(boolean useGoogIsRtlForBidiGlobalDir) {
Preconditions.checkState(
!useGoogIsRtlForBidiGlobalDir || shouldGenerateGoogMsgDefs,
"Do not specify useGoogIsRtlForBidiGlobalDir without shouldGenerateGoogMsgDefs.");
Preconditions.checkState(
!useGoogI... | java | public void setUseGoogIsRtlForBidiGlobalDir(boolean useGoogIsRtlForBidiGlobalDir) {
Preconditions.checkState(
!useGoogIsRtlForBidiGlobalDir || shouldGenerateGoogMsgDefs,
"Do not specify useGoogIsRtlForBidiGlobalDir without shouldGenerateGoogMsgDefs.");
Preconditions.checkState(
!useGoogI... | [
"public",
"void",
"setUseGoogIsRtlForBidiGlobalDir",
"(",
"boolean",
"useGoogIsRtlForBidiGlobalDir",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"useGoogIsRtlForBidiGlobalDir",
"||",
"shouldGenerateGoogMsgDefs",
",",
"\"Do not specify useGoogIsRtlForBidiGlobalDir withou... | Sets the Javascript code snippet that will evaluate at template runtime to a boolean value
indicating whether the bidi global direction is rtl. Can only be used when
shouldGenerateGoogMsgDefs is true.
@param useGoogIsRtlForBidiGlobalDir Whether to determine the bidi global direction at template
runtime by evaluating g... | [
"Sets",
"the",
"Javascript",
"code",
"snippet",
"that",
"will",
"evaluate",
"at",
"template",
"runtime",
"to",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"bidi",
"global",
"direction",
"is",
"rtl",
".",
"Can",
"only",
"be",
"used",
"when",
"sho... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/SoyJsSrcOptions.java#L189-L197 |
53,866 | google/closure-templates | java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java | TranslateToPyExprVisitor.visitPrimitiveNode | @Override
protected PyExpr visitPrimitiveNode(PrimitiveNode node) {
// Note: ExprNode.toSourceString() technically returns a Soy expression. In the case of
// primitives, the result is usually also the correct Python expression.
return new PyExpr(node.toSourceString(), Integer.MAX_VALUE);
} | java | @Override
protected PyExpr visitPrimitiveNode(PrimitiveNode node) {
// Note: ExprNode.toSourceString() technically returns a Soy expression. In the case of
// primitives, the result is usually also the correct Python expression.
return new PyExpr(node.toSourceString(), Integer.MAX_VALUE);
} | [
"@",
"Override",
"protected",
"PyExpr",
"visitPrimitiveNode",
"(",
"PrimitiveNode",
"node",
")",
"{",
"// Note: ExprNode.toSourceString() technically returns a Soy expression. In the case of",
"// primitives, the result is usually also the correct Python expression.",
"return",
"new",
"P... | Implementations for primitives. | [
"Implementations",
"for",
"primitives",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java#L183-L188 |
53,867 | google/closure-templates | java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java | TranslateToPyExprVisitor.genPyExprUsingSoySyntax | private PyExpr genPyExprUsingSoySyntax(OperatorNode opNode) {
List<PyExpr> operandPyExprs = visitChildren(opNode);
String newExpr = PyExprUtils.genExprWithNewToken(opNode.getOperator(), operandPyExprs, null);
return new PyExpr(newExpr, PyExprUtils.pyPrecedenceForOperator(opNode.getOperator()));
} | java | private PyExpr genPyExprUsingSoySyntax(OperatorNode opNode) {
List<PyExpr> operandPyExprs = visitChildren(opNode);
String newExpr = PyExprUtils.genExprWithNewToken(opNode.getOperator(), operandPyExprs, null);
return new PyExpr(newExpr, PyExprUtils.pyPrecedenceForOperator(opNode.getOperator()));
} | [
"private",
"PyExpr",
"genPyExprUsingSoySyntax",
"(",
"OperatorNode",
"opNode",
")",
"{",
"List",
"<",
"PyExpr",
">",
"operandPyExprs",
"=",
"visitChildren",
"(",
"opNode",
")",
";",
"String",
"newExpr",
"=",
"PyExprUtils",
".",
"genExprWithNewToken",
"(",
"opNode"... | Generates a Python expression for the given OperatorNode's subtree assuming that the Python
expression for the operator uses the same syntax format as the Soy operator.
@param opNode the OperatorNode whose subtree to generate a Python expression for
@return the generated Python expression | [
"Generates",
"a",
"Python",
"expression",
"for",
"the",
"given",
"OperatorNode",
"s",
"subtree",
"assuming",
"that",
"the",
"Python",
"expression",
"for",
"the",
"operator",
"uses",
"the",
"same",
"syntax",
"format",
"as",
"the",
"Soy",
"operator",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java#L641-L646 |
53,868 | google/closure-templates | java/src/com/google/template/soy/base/internal/BaseUtils.java | BaseUtils.ensureDirsExistInPath | public static void ensureDirsExistInPath(String path) {
if (path == null || path.length() == 0) {
throw new AssertionError("ensureDirsExistInPath called with null or empty path.");
}
String dirPath =
(path.charAt(path.length() - 1) == File.separatorChar)
? path.substring(0, path.... | java | public static void ensureDirsExistInPath(String path) {
if (path == null || path.length() == 0) {
throw new AssertionError("ensureDirsExistInPath called with null or empty path.");
}
String dirPath =
(path.charAt(path.length() - 1) == File.separatorChar)
? path.substring(0, path.... | [
"public",
"static",
"void",
"ensureDirsExistInPath",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"ensureDirsExistInPath called with null ... | Ensures that the directories in the given path exist, creating them if necessary.
<p>Note: If the path does not end with the separator char (slash in Linux), then the name at
the end is assumed to be the file name, so directories are only created down to its parent.
@param path The path for which to ensure directorie... | [
"Ensures",
"that",
"the",
"directories",
"in",
"the",
"given",
"path",
"exist",
"creating",
"them",
"if",
"necessary",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/BaseUtils.java#L92-L108 |
53,869 | google/closure-templates | java/src/com/google/template/soy/base/internal/BaseUtils.java | BaseUtils.extractPartAfterLastDot | public static String extractPartAfterLastDot(String dottedIdent) {
int lastDotIndex = dottedIdent.lastIndexOf('.');
return (lastDotIndex == -1) ? dottedIdent : dottedIdent.substring(lastDotIndex + 1);
} | java | public static String extractPartAfterLastDot(String dottedIdent) {
int lastDotIndex = dottedIdent.lastIndexOf('.');
return (lastDotIndex == -1) ? dottedIdent : dottedIdent.substring(lastDotIndex + 1);
} | [
"public",
"static",
"String",
"extractPartAfterLastDot",
"(",
"String",
"dottedIdent",
")",
"{",
"int",
"lastDotIndex",
"=",
"dottedIdent",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"(",
"lastDotIndex",
"==",
"-",
"1",
")",
"?",
"dottedIdent",
"... | Gets the part after the last dot in a dotted identifier. If there are no dots, returns the
whole input string.
<p>Important: The input must be a dotted identifier. This is not checked. | [
"Gets",
"the",
"part",
"after",
"the",
"last",
"dot",
"in",
"a",
"dotted",
"identifier",
".",
"If",
"there",
"are",
"no",
"dots",
"returns",
"the",
"whole",
"input",
"string",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/BaseUtils.java#L151-L154 |
53,870 | google/closure-templates | java/src/com/google/template/soy/types/SoyType.java | SoyType.toProto | public final SoyTypeP toProto() {
SoyTypeP local = protoDual;
if (local == null) {
SoyTypeP.Builder builder = SoyTypeP.newBuilder();
doToProto(builder);
local = builder.build();
protoDual = local;
}
return local;
} | java | public final SoyTypeP toProto() {
SoyTypeP local = protoDual;
if (local == null) {
SoyTypeP.Builder builder = SoyTypeP.newBuilder();
doToProto(builder);
local = builder.build();
protoDual = local;
}
return local;
} | [
"public",
"final",
"SoyTypeP",
"toProto",
"(",
")",
"{",
"SoyTypeP",
"local",
"=",
"protoDual",
";",
"if",
"(",
"local",
"==",
"null",
")",
"{",
"SoyTypeP",
".",
"Builder",
"builder",
"=",
"SoyTypeP",
".",
"newBuilder",
"(",
")",
";",
"doToProto",
"(",
... | The type represented in proto format. For template metadata protos. | [
"The",
"type",
"represented",
"in",
"proto",
"format",
".",
"For",
"template",
"metadata",
"protos",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyType.java#L194-L203 |
53,871 | google/closure-templates | java/src/com/google/template/soy/soytree/RawTextNode.java | RawTextNode.substringLocation | public SourceLocation substringLocation(int start, int end) {
checkElementIndex(start, rawText.length(), "start");
checkArgument(start < end);
checkArgument(end <= rawText.length());
if (offsets == null) {
return getSourceLocation();
}
return new SourceLocation(
getSourceLocation()... | java | public SourceLocation substringLocation(int start, int end) {
checkElementIndex(start, rawText.length(), "start");
checkArgument(start < end);
checkArgument(end <= rawText.length());
if (offsets == null) {
return getSourceLocation();
}
return new SourceLocation(
getSourceLocation()... | [
"public",
"SourceLocation",
"substringLocation",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"checkElementIndex",
"(",
"start",
",",
"rawText",
".",
"length",
"(",
")",
",",
"\"start\"",
")",
";",
"checkArgument",
"(",
"start",
"<",
"end",
")",
";",
... | Returns the source location of the given substring. | [
"Returns",
"the",
"source",
"location",
"of",
"the",
"given",
"substring",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/RawTextNode.java#L151-L165 |
53,872 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/ContextualAutoescaper.java | ContextualAutoescaper.rewrite | public void rewrite(
ImmutableList<SoyFileNode> sourceFiles, IdGenerator idGenerator, TemplateRegistry registry) {
// Inferences collects all the typing decisions we make and escaping modes we choose.
Inferences inferences = new Inferences(registry);
// TODO(lukes): having a separation of inference ... | java | public void rewrite(
ImmutableList<SoyFileNode> sourceFiles, IdGenerator idGenerator, TemplateRegistry registry) {
// Inferences collects all the typing decisions we make and escaping modes we choose.
Inferences inferences = new Inferences(registry);
// TODO(lukes): having a separation of inference ... | [
"public",
"void",
"rewrite",
"(",
"ImmutableList",
"<",
"SoyFileNode",
">",
"sourceFiles",
",",
"IdGenerator",
"idGenerator",
",",
"TemplateRegistry",
"registry",
")",
"{",
"// Inferences collects all the typing decisions we make and escaping modes we choose.",
"Inferences",
"i... | Rewrites the given Soy files so that dynamic output is properly escaped according to the
context in which it appears.
@param fileSet Modified in place.
@return Extra templates which were derived from templates under fileSet and which must be
compiled with fileSet to produce a correct output. See {@link DerivedTemplate... | [
"Rewrites",
"the",
"given",
"Soy",
"files",
"so",
"that",
"dynamic",
"output",
"is",
"properly",
"escaped",
"according",
"to",
"the",
"context",
"in",
"which",
"it",
"appears",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/ContextualAutoescaper.java#L85-L118 |
53,873 | google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/ContextualAutoescaper.java | ContextualAutoescaper.reportError | private void reportError(ErrorReporter errorReporter, SoyAutoescapeException e) {
// First, get to the root cause of the exception, and assemble an error message indicating
// the full call stack that led to the failure.
String message = "- " + e.getOriginalMessage();
while (e.getCause() instanceof SoyA... | java | private void reportError(ErrorReporter errorReporter, SoyAutoescapeException e) {
// First, get to the root cause of the exception, and assemble an error message indicating
// the full call stack that led to the failure.
String message = "- " + e.getOriginalMessage();
while (e.getCause() instanceof SoyA... | [
"private",
"void",
"reportError",
"(",
"ErrorReporter",
"errorReporter",
",",
"SoyAutoescapeException",
"e",
")",
"{",
"// First, get to the root cause of the exception, and assemble an error message indicating",
"// the full call stack that led to the failure.",
"String",
"message",
"... | Reports an autoescape exception. | [
"Reports",
"an",
"autoescape",
"exception",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/ContextualAutoescaper.java#L121-L130 |
53,874 | google/closure-templates | java/src/com/google/template/soy/passes/htmlmatcher/HtmlMatcherAccumulatorNode.java | HtmlMatcherAccumulatorNode.accumulateActiveEdges | public void accumulateActiveEdges(ImmutableList<ActiveEdge> activeEdges) {
for (ActiveEdge accEdge : activeEdges) {
accEdge.getGraphNode().linkEdgeToNode(accEdge.getActiveEdge(), this);
}
} | java | public void accumulateActiveEdges(ImmutableList<ActiveEdge> activeEdges) {
for (ActiveEdge accEdge : activeEdges) {
accEdge.getGraphNode().linkEdgeToNode(accEdge.getActiveEdge(), this);
}
} | [
"public",
"void",
"accumulateActiveEdges",
"(",
"ImmutableList",
"<",
"ActiveEdge",
">",
"activeEdges",
")",
"{",
"for",
"(",
"ActiveEdge",
"accEdge",
":",
"activeEdges",
")",
"{",
"accEdge",
".",
"getGraphNode",
"(",
")",
".",
"linkEdgeToNode",
"(",
"accEdge",
... | Links the all the given active edges to this node.
<p>This produces a many-to-one linkage in the HTML matcher graph.
<p>Note that a {@link HtmlMatcherGraphNode} may occur in the list more than once, each time
with a different active edge. For example, this Soy template body:
<pre>
<span>
{if $cond1}Content1{/i... | [
"Links",
"the",
"all",
"the",
"given",
"active",
"edges",
"to",
"this",
"node",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/htmlmatcher/HtmlMatcherAccumulatorNode.java#L82-L86 |
53,875 | google/closure-templates | java/src/com/google/template/soy/soyparse/Tokens.java | Tokens.createSrcLoc | static SourceLocation createSrcLoc(String filePath, Token first, Token... rest) {
int beginLine = first.beginLine;
int beginColumn = first.beginColumn;
int endLine = first.endLine;
int endColumn = first.endColumn;
for (Token next : rest) {
checkArgument(startsLaterThan(next, beginLine, beginC... | java | static SourceLocation createSrcLoc(String filePath, Token first, Token... rest) {
int beginLine = first.beginLine;
int beginColumn = first.beginColumn;
int endLine = first.endLine;
int endColumn = first.endColumn;
for (Token next : rest) {
checkArgument(startsLaterThan(next, beginLine, beginC... | [
"static",
"SourceLocation",
"createSrcLoc",
"(",
"String",
"filePath",
",",
"Token",
"first",
",",
"Token",
"...",
"rest",
")",
"{",
"int",
"beginLine",
"=",
"first",
".",
"beginLine",
";",
"int",
"beginColumn",
"=",
"first",
".",
"beginColumn",
";",
"int",
... | Returns a source location for the given tokens.
<p>All the provided tokens should be in strictly increasing order. | [
"Returns",
"a",
"source",
"location",
"for",
"the",
"given",
"tokens",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/Tokens.java#L31-L48 |
53,876 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateRegistry.java | TemplateRegistry.getTemplates | public ImmutableList<TemplateMetadata> getTemplates(CallNode node) {
if (node instanceof CallBasicNode) {
String calleeName = ((CallBasicNode) node).getCalleeName();
TemplateMetadata template = basicTemplatesOrElementsMap.get(calleeName);
return template == null ? ImmutableList.of() : ImmutableLis... | java | public ImmutableList<TemplateMetadata> getTemplates(CallNode node) {
if (node instanceof CallBasicNode) {
String calleeName = ((CallBasicNode) node).getCalleeName();
TemplateMetadata template = basicTemplatesOrElementsMap.get(calleeName);
return template == null ? ImmutableList.of() : ImmutableLis... | [
"public",
"ImmutableList",
"<",
"TemplateMetadata",
">",
"getTemplates",
"(",
"CallNode",
"node",
")",
"{",
"if",
"(",
"node",
"instanceof",
"CallBasicNode",
")",
"{",
"String",
"calleeName",
"=",
"(",
"(",
"CallBasicNode",
")",
"node",
")",
".",
"getCalleeNam... | Look up possible targets for a call. | [
"Look",
"up",
"possible",
"targets",
"for",
"a",
"call",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateRegistry.java#L149-L158 |
53,877 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateRegistry.java | TemplateRegistry.getCallContentKind | public Optional<SanitizedContentKind> getCallContentKind(CallNode node) {
ImmutableList<TemplateMetadata> templateNodes = getTemplates(node);
// For per-file compilation, we may not have any of the delegate templates in the compilation
// unit.
if (!templateNodes.isEmpty()) {
return Optional.fromN... | java | public Optional<SanitizedContentKind> getCallContentKind(CallNode node) {
ImmutableList<TemplateMetadata> templateNodes = getTemplates(node);
// For per-file compilation, we may not have any of the delegate templates in the compilation
// unit.
if (!templateNodes.isEmpty()) {
return Optional.fromN... | [
"public",
"Optional",
"<",
"SanitizedContentKind",
">",
"getCallContentKind",
"(",
"CallNode",
"node",
")",
"{",
"ImmutableList",
"<",
"TemplateMetadata",
">",
"templateNodes",
"=",
"getTemplates",
"(",
"node",
")",
";",
"// For per-file compilation, we may not have any o... | Gets the content kind that a call results in. If used with delegate calls, the delegate
templates must use strict autoescaping. This relies on the fact that all delegate calls must
have the same kind when using strict autoescaping. This is enforced by CheckDelegatesPass.
@param node The {@link CallBasicNode} or {@link... | [
"Gets",
"the",
"content",
"kind",
"that",
"a",
"call",
"results",
"in",
".",
"If",
"used",
"with",
"delegate",
"calls",
"the",
"delegate",
"templates",
"must",
"use",
"strict",
"autoescaping",
".",
"This",
"relies",
"on",
"the",
"fact",
"that",
"all",
"del... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateRegistry.java#L200-L209 |
53,878 | google/closure-templates | java/src/com/google/template/soy/soytree/TemplateMetadata.java | TemplateMetadata.fromTemplate | public static TemplateMetadata fromTemplate(TemplateNode template) {
TemplateMetadata.Builder builder =
builder()
.setTemplateName(template.getTemplateName())
.setSourceLocation(template.getSourceLocation())
.setSoyFileKind(SoyFileKind.SRC)
.setContentKind(tem... | java | public static TemplateMetadata fromTemplate(TemplateNode template) {
TemplateMetadata.Builder builder =
builder()
.setTemplateName(template.getTemplateName())
.setSourceLocation(template.getSourceLocation())
.setSoyFileKind(SoyFileKind.SRC)
.setContentKind(tem... | [
"public",
"static",
"TemplateMetadata",
"fromTemplate",
"(",
"TemplateNode",
"template",
")",
"{",
"TemplateMetadata",
".",
"Builder",
"builder",
"=",
"builder",
"(",
")",
".",
"setTemplateName",
"(",
"template",
".",
"getTemplateName",
"(",
")",
")",
".",
"setS... | Builds a Template from a parsed TemplateNode. | [
"Builds",
"a",
"Template",
"from",
"a",
"parsed",
"TemplateNode",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TemplateMetadata.java#L49-L78 |
53,879 | google/closure-templates | java/src/com/google/template/soy/incrementaldomsrc/IncrementalDomGenCallCodeUtils.java | IncrementalDomGenCallCodeUtils.maybeWrapContent | @Override
protected Expression maybeWrapContent(
CodeChunk.Generator generator, CallParamContentNode node, Expression content) {
SanitizedContentKind kind = node.getContentKind();
if (kind == SanitizedContentKind.HTML || kind == SanitizedContentKind.ATTRIBUTES) {
return content;
}
return super... | java | @Override
protected Expression maybeWrapContent(
CodeChunk.Generator generator, CallParamContentNode node, Expression content) {
SanitizedContentKind kind = node.getContentKind();
if (kind == SanitizedContentKind.HTML || kind == SanitizedContentKind.ATTRIBUTES) {
return content;
}
return super... | [
"@",
"Override",
"protected",
"Expression",
"maybeWrapContent",
"(",
"CodeChunk",
".",
"Generator",
"generator",
",",
"CallParamContentNode",
"node",
",",
"Expression",
"content",
")",
"{",
"SanitizedContentKind",
"kind",
"=",
"node",
".",
"getContentKind",
"(",
")"... | Never wrap contents as SanitizedContent if HTML or ATTRIBUTES. | [
"Never",
"wrap",
"contents",
"as",
"SanitizedContent",
"if",
"HTML",
"or",
"ATTRIBUTES",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/incrementaldomsrc/IncrementalDomGenCallCodeUtils.java#L43-L51 |
53,880 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/shared/CompiledTemplates.java | CompiledTemplates.getTemplateFactory | public CompiledTemplate.Factory getTemplateFactory(String name) {
CompiledTemplate.Factory factory = getTemplateData(name).factory;
if (factory == null) {
throw new IllegalArgumentException("cannot get a factory for the private template: " + name);
}
return factory;
} | java | public CompiledTemplate.Factory getTemplateFactory(String name) {
CompiledTemplate.Factory factory = getTemplateData(name).factory;
if (factory == null) {
throw new IllegalArgumentException("cannot get a factory for the private template: " + name);
}
return factory;
} | [
"public",
"CompiledTemplate",
".",
"Factory",
"getTemplateFactory",
"(",
"String",
"name",
")",
"{",
"CompiledTemplate",
".",
"Factory",
"factory",
"=",
"getTemplateData",
"(",
"name",
")",
".",
"factory",
";",
"if",
"(",
"factory",
"==",
"null",
")",
"{",
"... | Returns a factory for the given fully qualified template name. | [
"Returns",
"a",
"factory",
"for",
"the",
"given",
"fully",
"qualified",
"template",
"name",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/shared/CompiledTemplates.java#L86-L92 |
53,881 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/shared/CompiledTemplates.java | CompiledTemplates.getTransitiveIjParamsForTemplate | public ImmutableSortedSet<String> getTransitiveIjParamsForTemplate(String templateName) {
TemplateData templateData = getTemplateData(templateName);
ImmutableSortedSet<String> transitiveIjParams = templateData.transitiveIjParams;
// racy-lazy init pattern. We may calculate this more than once, but that is ... | java | public ImmutableSortedSet<String> getTransitiveIjParamsForTemplate(String templateName) {
TemplateData templateData = getTemplateData(templateName);
ImmutableSortedSet<String> transitiveIjParams = templateData.transitiveIjParams;
// racy-lazy init pattern. We may calculate this more than once, but that is ... | [
"public",
"ImmutableSortedSet",
"<",
"String",
">",
"getTransitiveIjParamsForTemplate",
"(",
"String",
"templateName",
")",
"{",
"TemplateData",
"templateData",
"=",
"getTemplateData",
"(",
"templateName",
")",
";",
"ImmutableSortedSet",
"<",
"String",
">",
"transitiveI... | Returns the transitive closure of all the injected params that might be used by this template. | [
"Returns",
"the",
"transitive",
"closure",
"of",
"all",
"the",
"injected",
"params",
"that",
"might",
"be",
"used",
"by",
"this",
"template",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/shared/CompiledTemplates.java#L104-L123 |
53,882 | google/closure-templates | java/src/com/google/template/soy/basicdirectives/CleanHtmlDirective.java | CleanHtmlDirective.generateOptionalSafeTagsArg | private String generateOptionalSafeTagsArg(List<? extends TargetExpr> args) {
String optionalSafeTagsArg = "";
if (!args.isEmpty()) {
// TODO(msamuel): Instead of parsing generated JS, we should have a CheckArgumentsPass that
// allows directives and functions to examine their input expressions prio... | java | private String generateOptionalSafeTagsArg(List<? extends TargetExpr> args) {
String optionalSafeTagsArg = "";
if (!args.isEmpty()) {
// TODO(msamuel): Instead of parsing generated JS, we should have a CheckArgumentsPass that
// allows directives and functions to examine their input expressions prio... | [
"private",
"String",
"generateOptionalSafeTagsArg",
"(",
"List",
"<",
"?",
"extends",
"TargetExpr",
">",
"args",
")",
"{",
"String",
"optionalSafeTagsArg",
"=",
"\"\"",
";",
"if",
"(",
"!",
"args",
".",
"isEmpty",
"(",
")",
")",
"{",
"// TODO(msamuel): Instead... | Converts a list of TargetExpr's into a list of safe tags as an argument for the supported
backends. This will iterate over the expressions, ensure they're valid safe tags, and convert
them into an array of Strings.
<p>The generated output is valid for JS and Python. Any other languages should reevaluate if
they requir... | [
"Converts",
"a",
"list",
"of",
"TargetExpr",
"s",
"into",
"a",
"list",
"of",
"safe",
"tags",
"as",
"an",
"argument",
"for",
"the",
"supported",
"backends",
".",
"This",
"will",
"iterate",
"over",
"the",
"expressions",
"ensure",
"they",
"re",
"valid",
"safe... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basicdirectives/CleanHtmlDirective.java#L165-L190 |
53,883 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/LazyClosureCompiler.java | LazyClosureCompiler.asRawTextOnly | private Optional<Expression> asRawTextOnly(String name, RenderUnitNode renderUnit) {
StringBuilder builder = null;
List<SoyNode> children = new ArrayList<>(renderUnit.getChildren());
for (int i = 0; i < children.size(); i++) {
SoyNode child = children.get(i);
if (child instanceof MsgHtmlTagNode)... | java | private Optional<Expression> asRawTextOnly(String name, RenderUnitNode renderUnit) {
StringBuilder builder = null;
List<SoyNode> children = new ArrayList<>(renderUnit.getChildren());
for (int i = 0; i < children.size(); i++) {
SoyNode child = children.get(i);
if (child instanceof MsgHtmlTagNode)... | [
"private",
"Optional",
"<",
"Expression",
">",
"asRawTextOnly",
"(",
"String",
"name",
",",
"RenderUnitNode",
"renderUnit",
")",
"{",
"StringBuilder",
"builder",
"=",
"null",
";",
"List",
"<",
"SoyNode",
">",
"children",
"=",
"new",
"ArrayList",
"<>",
"(",
"... | Returns an SoyValueProvider expression for the given RenderUnitNode if it is composed of only
raw text. | [
"Returns",
"an",
"SoyValueProvider",
"expression",
"for",
"the",
"given",
"RenderUnitNode",
"if",
"it",
"is",
"composed",
"of",
"only",
"raw",
"text",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/LazyClosureCompiler.java#L265-L297 |
53,884 | google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/BytecodeProducer.java | BytecodeProducer.gen | public final void gen(CodeBuilder adapter) {
boolean shouldClearIsGeneratingBit = false;
if (Flags.DEBUG && !isGenerating.get()) {
isGenerating.set(true);
shouldClearIsGeneratingBit = true;
}
try {
if (location.isKnown()) {
// These add entries to the line number tables that ar... | java | public final void gen(CodeBuilder adapter) {
boolean shouldClearIsGeneratingBit = false;
if (Flags.DEBUG && !isGenerating.get()) {
isGenerating.set(true);
shouldClearIsGeneratingBit = true;
}
try {
if (location.isKnown()) {
// These add entries to the line number tables that ar... | [
"public",
"final",
"void",
"gen",
"(",
"CodeBuilder",
"adapter",
")",
"{",
"boolean",
"shouldClearIsGeneratingBit",
"=",
"false",
";",
"if",
"(",
"Flags",
".",
"DEBUG",
"&&",
"!",
"isGenerating",
".",
"get",
"(",
")",
")",
"{",
"isGenerating",
".",
"set",
... | Writes the bytecode to the adapter. | [
"Writes",
"the",
"bytecode",
"to",
"the",
"adapter",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeProducer.java#L72-L102 |
53,885 | google/closure-templates | java/src/com/google/template/soy/shared/SoyGeneralOptions.java | SoyGeneralOptions.setCompileTimeGlobalsInternal | private void setCompileTimeGlobalsInternal(
ImmutableMap<String, PrimitiveData> compileTimeGlobalsMap) {
Preconditions.checkState(compileTimeGlobals == null, "Compile-time globals already set.");
compileTimeGlobals = compileTimeGlobalsMap;
} | java | private void setCompileTimeGlobalsInternal(
ImmutableMap<String, PrimitiveData> compileTimeGlobalsMap) {
Preconditions.checkState(compileTimeGlobals == null, "Compile-time globals already set.");
compileTimeGlobals = compileTimeGlobalsMap;
} | [
"private",
"void",
"setCompileTimeGlobalsInternal",
"(",
"ImmutableMap",
"<",
"String",
",",
"PrimitiveData",
">",
"compileTimeGlobalsMap",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"compileTimeGlobals",
"==",
"null",
",",
"\"Compile-time globals already set.\"",
... | Sets the map from compile-time global name to value using Soy primitive types.
@param compileTimeGlobalsMap Map from compile-time global name to value. | [
"Sets",
"the",
"map",
"from",
"compile",
"-",
"time",
"global",
"name",
"to",
"value",
"using",
"Soy",
"primitive",
"types",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyGeneralOptions.java#L124-L128 |
53,886 | google/closure-templates | java/src/com/google/template/soy/shared/SoyGeneralOptions.java | SoyGeneralOptions.setCompileTimeGlobals | public SoyGeneralOptions setCompileTimeGlobals(File compileTimeGlobalsFile) throws IOException {
setCompileTimeGlobalsInternal(
SoyUtils.parseCompileTimeGlobals(Files.asCharSource(compileTimeGlobalsFile, UTF_8)));
return this;
} | java | public SoyGeneralOptions setCompileTimeGlobals(File compileTimeGlobalsFile) throws IOException {
setCompileTimeGlobalsInternal(
SoyUtils.parseCompileTimeGlobals(Files.asCharSource(compileTimeGlobalsFile, UTF_8)));
return this;
} | [
"public",
"SoyGeneralOptions",
"setCompileTimeGlobals",
"(",
"File",
"compileTimeGlobalsFile",
")",
"throws",
"IOException",
"{",
"setCompileTimeGlobalsInternal",
"(",
"SoyUtils",
".",
"parseCompileTimeGlobals",
"(",
"Files",
".",
"asCharSource",
"(",
"compileTimeGlobalsFile"... | Sets the file containing compile-time globals.
<p>Each line of the file should have the format
<pre>
<global_name> = <primitive_data>
</pre>
where primitive_data is a valid Soy expression literal for a primitive type (null, boolean,
integer, float, or string). Empty lines and lines beginning with "//" ar... | [
"Sets",
"the",
"file",
"containing",
"compile",
"-",
"time",
"globals",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyGeneralOptions.java#L149-L153 |
53,887 | google/closure-templates | java/src/com/google/template/soy/shared/SoyGeneralOptions.java | SoyGeneralOptions.setCompileTimeGlobals | public SoyGeneralOptions setCompileTimeGlobals(URL compileTimeGlobalsResource)
throws IOException {
setCompileTimeGlobalsInternal(
SoyUtils.parseCompileTimeGlobals(
Resources.asCharSource(compileTimeGlobalsResource, UTF_8)));
return this;
} | java | public SoyGeneralOptions setCompileTimeGlobals(URL compileTimeGlobalsResource)
throws IOException {
setCompileTimeGlobalsInternal(
SoyUtils.parseCompileTimeGlobals(
Resources.asCharSource(compileTimeGlobalsResource, UTF_8)));
return this;
} | [
"public",
"SoyGeneralOptions",
"setCompileTimeGlobals",
"(",
"URL",
"compileTimeGlobalsResource",
")",
"throws",
"IOException",
"{",
"setCompileTimeGlobalsInternal",
"(",
"SoyUtils",
".",
"parseCompileTimeGlobals",
"(",
"Resources",
".",
"asCharSource",
"(",
"compileTimeGloba... | Sets the resource file containing compile-time globals.
<p>Each line of the file should have the format
<pre>
<global_name> = <primitive_data>
</pre>
where primitive_data is a valid Soy expression literal for a primitive type (null, boolean,
integer, float, or string). Empty lines and lines beginning wit... | [
"Sets",
"the",
"resource",
"file",
"containing",
"compile",
"-",
"time",
"globals",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/SoyGeneralOptions.java#L174-L180 |
53,888 | google/closure-templates | java/src/com/google/template/soy/soytree/HtmlAttributeNode.java | HtmlAttributeNode.getStaticContent | @Nullable
public String getStaticContent() {
if (!hasValue()) {
return null;
}
HtmlAttributeValueNode attrValue = (HtmlAttributeValueNode) getChild(1);
if (attrValue.numChildren() == 0) {
return "";
}
if (attrValue.numChildren() > 1) {
return null;
}
StandaloneNode at... | java | @Nullable
public String getStaticContent() {
if (!hasValue()) {
return null;
}
HtmlAttributeValueNode attrValue = (HtmlAttributeValueNode) getChild(1);
if (attrValue.numChildren() == 0) {
return "";
}
if (attrValue.numChildren() > 1) {
return null;
}
StandaloneNode at... | [
"@",
"Nullable",
"public",
"String",
"getStaticContent",
"(",
")",
"{",
"if",
"(",
"!",
"hasValue",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"HtmlAttributeValueNode",
"attrValue",
"=",
"(",
"HtmlAttributeValueNode",
")",
"getChild",
"(",
"1",
")",
"... | Returns the static value, if one exists, or null otherwise. | [
"Returns",
"the",
"static",
"value",
"if",
"one",
"exists",
"or",
"null",
"otherwise",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/HtmlAttributeNode.java#L55-L72 |
53,889 | google/closure-templates | java/src/com/google/template/soy/internal/i18n/SoyBidiUtils.java | SoyBidiUtils.decodeBidiGlobalDirFromJsOptions | public static BidiGlobalDir decodeBidiGlobalDirFromJsOptions(
int bidiGlobalDir, boolean useGoogIsRtlForBidiGlobalDir) {
if (bidiGlobalDir == 0) {
if (!useGoogIsRtlForBidiGlobalDir) {
return null;
}
return BidiGlobalDir.forIsRtlCodeSnippet(
GOOG_IS_RTL_CODE_SNIPPET, GOOG_IS... | java | public static BidiGlobalDir decodeBidiGlobalDirFromJsOptions(
int bidiGlobalDir, boolean useGoogIsRtlForBidiGlobalDir) {
if (bidiGlobalDir == 0) {
if (!useGoogIsRtlForBidiGlobalDir) {
return null;
}
return BidiGlobalDir.forIsRtlCodeSnippet(
GOOG_IS_RTL_CODE_SNIPPET, GOOG_IS... | [
"public",
"static",
"BidiGlobalDir",
"decodeBidiGlobalDirFromJsOptions",
"(",
"int",
"bidiGlobalDir",
",",
"boolean",
"useGoogIsRtlForBidiGlobalDir",
")",
"{",
"if",
"(",
"bidiGlobalDir",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"useGoogIsRtlForBidiGlobalDir",
")",
"{",
... | Decodes the bidi global directionality from the usual command line options used to specify it.
Checks that at most one of the options was specified.
@param bidiGlobalDir 1: ltr, -1: rtl, 0: unspecified.
@param useGoogIsRtlForBidiGlobalDir Whether to determine the bidi global direction at template
runtime by evaluating... | [
"Decodes",
"the",
"bidi",
"global",
"directionality",
"from",
"the",
"usual",
"command",
"line",
"options",
"used",
"to",
"specify",
"it",
".",
"Checks",
"that",
"at",
"most",
"one",
"of",
"the",
"options",
"was",
"specified",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/SoyBidiUtils.java#L74-L90 |
53,890 | google/closure-templates | java/src/com/google/template/soy/internal/i18n/SoyBidiUtils.java | SoyBidiUtils.decodeBidiGlobalDirFromPyOptions | public static BidiGlobalDir decodeBidiGlobalDirFromPyOptions(String bidiIsRtlFn) {
if (bidiIsRtlFn == null || bidiIsRtlFn.isEmpty()) {
return null;
}
int dotIndex = bidiIsRtlFn.lastIndexOf('.');
Preconditions.checkArgument(
dotIndex > 0 && dotIndex < bidiIsRtlFn.length() - 1,
"If s... | java | public static BidiGlobalDir decodeBidiGlobalDirFromPyOptions(String bidiIsRtlFn) {
if (bidiIsRtlFn == null || bidiIsRtlFn.isEmpty()) {
return null;
}
int dotIndex = bidiIsRtlFn.lastIndexOf('.');
Preconditions.checkArgument(
dotIndex > 0 && dotIndex < bidiIsRtlFn.length() - 1,
"If s... | [
"public",
"static",
"BidiGlobalDir",
"decodeBidiGlobalDirFromPyOptions",
"(",
"String",
"bidiIsRtlFn",
")",
"{",
"if",
"(",
"bidiIsRtlFn",
"==",
"null",
"||",
"bidiIsRtlFn",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"int",
"dotIndex",
"="... | Decodes bidi global directionality from the Python bidiIsRtlFn command line option.
@param bidiIsRtlFn The string containing the full module path and function name.
@return BidiGlobalDir object - or null if the option was not specified. | [
"Decodes",
"bidi",
"global",
"directionality",
"from",
"the",
"Python",
"bidiIsRtlFn",
"command",
"line",
"option",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/SoyBidiUtils.java#L98-L110 |
53,891 | google/closure-templates | java/src/com/google/template/soy/sharedpasses/render/CountingFlushableAppendable.java | CountingFlushableAppendable.beforeBlock | @Override public void beforeBlock() {
if (count > 0) {
try {
flush();
} catch (IOException e) {
logger.log(Level.SEVERE, "Flush from soy failed", e);
}
}
} | java | @Override public void beforeBlock() {
if (count > 0) {
try {
flush();
} catch (IOException e) {
logger.log(Level.SEVERE, "Flush from soy failed", e);
}
}
} | [
"@",
"Override",
"public",
"void",
"beforeBlock",
"(",
")",
"{",
"if",
"(",
"count",
">",
"0",
")",
"{",
"try",
"{",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
... | Soy is about to block on a future. Flush the output stream if there is anything to flush,
so we use the time we are blocking to transfer as many bytes as possible. | [
"Soy",
"is",
"about",
"to",
"block",
"on",
"a",
"future",
".",
"Flush",
"the",
"output",
"stream",
"if",
"there",
"is",
"anything",
"to",
"flush",
"so",
"we",
"use",
"the",
"time",
"we",
"are",
"blocking",
"to",
"transfer",
"as",
"many",
"bytes",
"as",... | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/CountingFlushableAppendable.java#L79-L87 |
53,892 | google/closure-templates | java/src/com/google/template/soy/shared/internal/DirectiveDigest.java | DirectiveDigest.updateNames | public void updateNames(
List<String> escapeMapNames, List<String> matcherNames, List<String> filterNames) {
// Store the names for this directive for use in building the helper function.
escapesName = escapeMapVar >= 0 ? escapeMapNames.get(escapeMapVar) : null;
matcherName = matcherVar >= 0 ? matcher... | java | public void updateNames(
List<String> escapeMapNames, List<String> matcherNames, List<String> filterNames) {
// Store the names for this directive for use in building the helper function.
escapesName = escapeMapVar >= 0 ? escapeMapNames.get(escapeMapVar) : null;
matcherName = matcherVar >= 0 ? matcher... | [
"public",
"void",
"updateNames",
"(",
"List",
"<",
"String",
">",
"escapeMapNames",
",",
"List",
"<",
"String",
">",
"matcherNames",
",",
"List",
"<",
"String",
">",
"filterNames",
")",
"{",
"// Store the names for this directive for use in building the helper function.... | Update the escaper, matcher, and filter names based on the supplied lists and indices.
@param escapeMapNames The list of escape map names.
@param matcherNames The list of matcher regex names.
@param filterNames The list of filter regex names. | [
"Update",
"the",
"escaper",
"matcher",
"and",
"filter",
"names",
"based",
"on",
"the",
"supplied",
"lists",
"and",
"indices",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/DirectiveDigest.java#L85-L91 |
53,893 | google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.emptyString | public static SanitizedContent emptyString(ContentKind kind) {
if (kind == ContentKind.TEXT) {
return UnsanitizedString.create("");
}
return SanitizedContent.create("", kind, Dir.NEUTRAL); // Empty string is neutral.
} | java | public static SanitizedContent emptyString(ContentKind kind) {
if (kind == ContentKind.TEXT) {
return UnsanitizedString.create("");
}
return SanitizedContent.create("", kind, Dir.NEUTRAL); // Empty string is neutral.
} | [
"public",
"static",
"SanitizedContent",
"emptyString",
"(",
"ContentKind",
"kind",
")",
"{",
"if",
"(",
"kind",
"==",
"ContentKind",
".",
"TEXT",
")",
"{",
"return",
"UnsanitizedString",
".",
"create",
"(",
"\"\"",
")",
";",
"}",
"return",
"SanitizedContent",
... | Creates an empty string constant. | [
"Creates",
"an",
"empty",
"string",
"constant",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L70-L75 |
53,894 | google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.fromResource | public static SanitizedContent fromResource(
Class<?> contextClass, String resourceName, Charset charset, ContentKind kind)
throws IOException {
pretendValidateResource(resourceName, kind);
return SanitizedContent.create(
Resources.toString(Resources.getResource(contextClass, resourceName), ... | java | public static SanitizedContent fromResource(
Class<?> contextClass, String resourceName, Charset charset, ContentKind kind)
throws IOException {
pretendValidateResource(resourceName, kind);
return SanitizedContent.create(
Resources.toString(Resources.getResource(contextClass, resourceName), ... | [
"public",
"static",
"SanitizedContent",
"fromResource",
"(",
"Class",
"<",
"?",
">",
"contextClass",
",",
"String",
"resourceName",
",",
"Charset",
"charset",
",",
"ContentKind",
"kind",
")",
"throws",
"IOException",
"{",
"pretendValidateResource",
"(",
"resourceNam... | Loads assumed-safe content from a Java resource.
<p>This performs ZERO VALIDATION of the data, and takes you on your word that the input is
valid. We assume that resources should be safe because they are part of the binary, and
therefore not attacker controlled, unless the source code is compromised (in which there's
... | [
"Loads",
"assumed",
"-",
"safe",
"content",
"from",
"a",
"Java",
"resource",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L140-L153 |
53,895 | google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.constantUri | public static SanitizedContent constantUri(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.URI, Dir.LTR);
} | java | public static SanitizedContent constantUri(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.URI, Dir.LTR);
} | [
"public",
"static",
"SanitizedContent",
"constantUri",
"(",
"@",
"CompileTimeConstant",
"final",
"String",
"constant",
")",
"{",
"return",
"fromConstant",
"(",
"constant",
",",
"ContentKind",
".",
"URI",
",",
"Dir",
".",
"LTR",
")",
";",
"}"
] | Wraps an assumed-safe URI constant.
<p>This only accepts compile-time constants, based on the assumption that URLs that are
controlled by the application (and not user input) are considered safe. | [
"Wraps",
"an",
"assumed",
"-",
"safe",
"URI",
"constant",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L188-L190 |
53,896 | google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.constantHtml | public static SanitizedContent constantHtml(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.HTML, null);
} | java | public static SanitizedContent constantHtml(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.HTML, null);
} | [
"public",
"static",
"SanitizedContent",
"constantHtml",
"(",
"@",
"CompileTimeConstant",
"final",
"String",
"constant",
")",
"{",
"return",
"fromConstant",
"(",
"constant",
",",
"ContentKind",
".",
"HTML",
",",
"null",
")",
";",
"}"
] | Wraps an assumed-safe constant string that specifies a safe, balanced, document fragment.
<p>This only accepts compile-time constants, based on the assumption that HTML snippets that
are controlled by the application (and not user input) are considered safe. | [
"Wraps",
"an",
"assumed",
"-",
"safe",
"constant",
"string",
"that",
"specifies",
"a",
"safe",
"balanced",
"document",
"fragment",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L198-L200 |
53,897 | google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.constantAttributes | public static SanitizedContent constantAttributes(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.ATTRIBUTES, Dir.LTR);
} | java | public static SanitizedContent constantAttributes(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.ATTRIBUTES, Dir.LTR);
} | [
"public",
"static",
"SanitizedContent",
"constantAttributes",
"(",
"@",
"CompileTimeConstant",
"final",
"String",
"constant",
")",
"{",
"return",
"fromConstant",
"(",
"constant",
",",
"ContentKind",
".",
"ATTRIBUTES",
",",
"Dir",
".",
"LTR",
")",
";",
"}"
] | Wraps an assumed-safe constant string that specifies an attribute.
<p>This only accepts compile-time constants, based on the assumption that attributes that are
controlled by the application (and not user input) are considered safe. | [
"Wraps",
"an",
"assumed",
"-",
"safe",
"constant",
"string",
"that",
"specifies",
"an",
"attribute",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L208-L210 |
53,898 | google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.constantCss | public static SanitizedContent constantCss(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.CSS, Dir.LTR);
} | java | public static SanitizedContent constantCss(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.CSS, Dir.LTR);
} | [
"public",
"static",
"SanitizedContent",
"constantCss",
"(",
"@",
"CompileTimeConstant",
"final",
"String",
"constant",
")",
"{",
"return",
"fromConstant",
"(",
"constant",
",",
"ContentKind",
".",
"CSS",
",",
"Dir",
".",
"LTR",
")",
";",
"}"
] | Wraps an assumed-safe CSS constant.
<p>This only accepts compile-time constants, based on the assumption that CSSes that are
controlled by the application (and not user input) are considered safe. | [
"Wraps",
"an",
"assumed",
"-",
"safe",
"CSS",
"constant",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L218-L220 |
53,899 | google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.constantJs | public static SanitizedContent constantJs(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.JS, Dir.LTR);
} | java | public static SanitizedContent constantJs(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.JS, Dir.LTR);
} | [
"public",
"static",
"SanitizedContent",
"constantJs",
"(",
"@",
"CompileTimeConstant",
"final",
"String",
"constant",
")",
"{",
"return",
"fromConstant",
"(",
"constant",
",",
"ContentKind",
".",
"JS",
",",
"Dir",
".",
"LTR",
")",
";",
"}"
] | Wraps an assumed-safe JS constant.
<p>This only accepts compile-time constants, based on the assumption that scripts that are
controlled by the application (and not user input) are considered safe. | [
"Wraps",
"an",
"assumed",
"-",
"safe",
"JS",
"constant",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L228-L230 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.