Repository navigation
Expand file tree
/
Copy pathrenderer.soy
More file actions
152 lines (130 loc) · 3.18 KB
/
Copy pathrenderer.soy
File metadata and controls
152 lines (130 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/**
* @fileoverview Renderer Template.
*
* @license Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author mbordihn@google.com (Markus Bordihn)
*/
{namespace cwc.soy.Renderer autoescape="strict"}
/**
* Object template.
*/
{template .objectTemplate}
{@param data_url: string}
{@param type: string}
{@param width: number}
{@param height: number}
<object data="{$data_url}" type="{$type}" width="{$width}" height="{$height}"></object>
{/template}
/**
* HTML base template.
*/
{template .html}
{@param? body: string}
{@param? head: string}
{@param? css: string}
{@param? js: string}
{@param? style: string}
{@param? canvas: string}
<!DOCTYPE html>{\n}
<html>{\n}
<head>{\n}
<style>
* {lb} margin:0; padding:0; {rb}
html, body {lb} width:100%; height:100%; {rb}
canvas {lb} display:block; {rb}
{if $style}{$style}{\n}{/if}
</style>{\n}
{if $css}
{call .css}{param content: $css /}{/call}
{/if}
{if $head}{$head}{\n}{/if}
</head>{\n}
<body>{\n}
{if $canvas}
<canvas id="{$canvas}"></canvas>{\n}
{/if}
{if $body}{$body}{\n}{/if}
{if $js}
{call .javaScriptContent}
{param content: $js /}
{/call}
{/if}
</body>{\n}
</html>{\n}
{/template}
/**
* HTML base template.
*/
{template .htmlGrid}
{@param body: string}
{@param? head: string}
{@param? css: string}
{@param? js: string}
{call .html}
{param body: $body /}
{param head: $head /}
{param css: $css /}
{param js: $js /}
{param style kind="css"}
body {lb}
background-size: 25px 25px;
background-image: linear-gradient(to right, #eee 1px, transparent 1px),
linear-gradient(to bottom, #eee 1px, transparent 1px);
{rb}
{/param}
{/call}
{/template}
/**
* CSS tag.
*/
{template .css}
{@param content: string}
{@param? url: string}
{if $url}
<link rel="stylesheet" href="{$url}">{\n}
{/if}
{if $content}
<style>{\n}{$content}{\n}</style>{\n}
{/if}
{/template}
/**
* JavaScript content.
*/
{template .javaScriptContent}
{@param content: string}
<script>{\n}{$content}{\n}</script>{\n}
{/template}
/**
* JavaScript url.
*/
{template .javaScriptUrl}
{@param url: string}
{@param? filename: string}
{\n}
<script src="{$url}"{if $filename} data-filename="{$filename}"{/if}></script>
{\n}
{/template}
/**
* JavaScript data url.
*/
{template .javaScriptDataUrl}
{@param data: string}
{@param encoding: string}
{@param? filename: string}
{\n}
<script src="data:text/javascript;{$encoding},{$data}"{if $filename} data-filename="{$filename}"{/if}></script>
{\n}
{/template}