Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
a7f0705b
Commit
a7f0705b
authored
Jul 01, 2015
by
Abiola Ibrahim
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
aecdecbd
16f18bfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
dist/CHANGES.txt
dist/CHANGES.txt
+3
-1
middleware/templates/context.go
middleware/templates/context.go
+19
-1
No files found.
dist/CHANGES.txt
View file @
a7f0705b
...
...
@@ -2,16 +2,18 @@ CHANGES
<master>
- Removed git directive from core; now available as an addon
- browse: Sort by clicking column heading or using query string
- core: Serving hostname that doesn't resolve issues warning then listens on 0.0.0.0
- errors: Missing error page during parse time is warning, not error
- fastcgi: Fix for backend responding without status text
-
git: Pull changes immediately with GitHub webhook
-
fastcgi: Fix PATH_TRANSLATED when PATH_INFO is empty (RFC 3875)
- gzip: Enable by file path and/or extension
- gzip: Customize compression level
- log: Fix for missing status in log entry when error unhandled
- proxy: Strip prefix from path for proxy to path
- redir: Meta tag redirects
- templates: Support for nested includes
0.7.1 (June 2, 2015)
...
...
middleware/templates/context.go
View file @
a7f0705b
package
templates
import
(
"bytes"
"io/ioutil"
"net"
"net/http"
"net/url"
"text/template"
"time"
"github.com/mholt/caddy/middleware"
...
...
@@ -26,8 +28,24 @@ func (c context) Include(filename string) (string, error) {
if
err
!=
nil
{
return
""
,
err
}
body
,
err
:=
ioutil
.
ReadAll
(
file
)
return
string
(
body
),
err
if
err
!=
nil
{
return
""
,
err
}
tpl
,
err
:=
template
.
New
(
filename
)
.
Parse
(
string
(
body
))
if
err
!=
nil
{
return
""
,
err
}
var
buf
bytes
.
Buffer
err
=
tpl
.
Execute
(
&
buf
,
c
)
if
err
!=
nil
{
return
""
,
err
}
return
buf
.
String
(),
nil
}
// Date returns the current timestamp in the specified format
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment