File: basepage.qtpl

package info (click to toggle)
golang-github-valyala-quicktemplate 1.6.3%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 472 kB
  • sloc: makefile: 15; xml: 15
file content (31 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (3)
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
This is a base page template. All the other template pages implement this interface.

{% interface
Page {
	Title()
	Body()
}
%}


Page prints a page implementing Page interface.
{% func PageTemplate(p Page) %}
<html>
	<head>
		<title>{%= p.Title() %}</title>
	</head>
	<body>
		<div>
			<a href="/">return to main page</a>
		</div>
		{%= p.Body() %}
	</body>
</html>
{% endfunc %}


Base page implementation. Other pages may inherit from it if they need
overriding only certain Page methods
{% code type BasePage struct {} %}
{% func (p *BasePage) Title() %}This is a base title{% endfunc %}
{% func (p *BasePage) Body() %}This is a base body{% endfunc %}