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
e039577d
Commit
e039577d
authored
Jun 27, 2015
by
Karthic Rao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export of variables undone
parent
9995466a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
config/setup/templates.go
config/setup/templates.go
+5
-5
config/setup/templates_test.go
config/setup/templates_test.go
+4
-4
No files found.
config/setup/templates.go
View file @
e039577d
...
...
@@ -39,11 +39,11 @@ func templatesParse(c *Controller) ([]templates.Rule, error) {
// Any remaining arguments are extensions
rule
.
Extensions
=
c
.
RemainingArgs
()
if
len
(
rule
.
Extensions
)
==
0
{
rule
.
Extensions
=
D
efaultTemplateExtensions
rule
.
Extensions
=
d
efaultTemplateExtensions
}
}
else
{
rule
.
Path
=
D
efaultTemplatePath
rule
.
Extensions
=
D
efaultTemplateExtensions
rule
.
Path
=
d
efaultTemplatePath
rule
.
Extensions
=
d
efaultTemplateExtensions
}
for
_
,
ext
:=
range
rule
.
Extensions
{
...
...
@@ -56,6 +56,6 @@ func templatesParse(c *Controller) ([]templates.Rule, error) {
return
rules
,
nil
}
const
D
efaultTemplatePath
=
"/"
const
d
efaultTemplatePath
=
"/"
var
D
efaultTemplateExtensions
=
[]
string
{
".html"
,
".htm"
,
".tmpl"
,
".tpl"
,
".txt"
}
var
d
efaultTemplateExtensions
=
[]
string
{
".html"
,
".htm"
,
".tmpl"
,
".tpl"
,
".txt"
}
config/setup/templates_test.go
View file @
e039577d
...
...
@@ -27,14 +27,14 @@ func TestTemplates(t *testing.T) {
t
.
Fatalf
(
"Expected handler to be type Templates, got: %#v"
,
handler
)
}
if
myHandler
.
Rules
[
0
]
.
Path
!=
D
efaultTemplatePath
{
if
myHandler
.
Rules
[
0
]
.
Path
!=
d
efaultTemplatePath
{
t
.
Errorf
(
"Expected / as the default Path"
)
}
if
fmt
.
Sprint
(
myHandler
.
Rules
[
0
]
.
Extensions
)
!=
fmt
.
Sprint
(
D
efaultTemplateExtensions
)
{
t
.
Errorf
(
"Expected %v to be the Default Extensions"
,
D
efaultTemplateExtensions
)
if
fmt
.
Sprint
(
myHandler
.
Rules
[
0
]
.
Extensions
)
!=
fmt
.
Sprint
(
d
efaultTemplateExtensions
)
{
t
.
Errorf
(
"Expected %v to be the Default Extensions"
,
d
efaultTemplateExtensions
)
}
var
indexFiles
[]
string
for
_
,
extension
:=
range
D
efaultTemplateExtensions
{
for
_
,
extension
:=
range
d
efaultTemplateExtensions
{
indexFiles
=
append
(
indexFiles
,
"index"
+
extension
)
}
if
fmt
.
Sprint
(
myHandler
.
Rules
[
0
]
.
IndexFiles
)
!=
fmt
.
Sprint
(
indexFiles
)
{
...
...
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