Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Upstream
Gitea
Commits
58f0c681
Commit
58f0c681
authored
9 years ago
by
Unknwon
Browse files
Options
Download
Email Patches
Plain Diff
Some minor changes
parent
12b5a76b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
.bra.toml
+0
-1
.bra.toml
.gitignore
+1
-20
.gitignore
Makefile
+6
-0
Makefile
cmd/web.go
+1
-2
cmd/web.go
conf/README.md
+1
-5
conf/README.md
modules/template/template.go
+81
-79
modules/template/template.go
with
90 additions
and
107 deletions
+90
-107
.bra.toml
View file @
58f0c681
[run]
init_cmds
=
[
#["grep", "-rn", "FIXME", "."],
[
"make"
,
"build-dev"
,
"TAGS=sqlite"
],
[
"./gogs"
,
"web"
]
]
...
...
This diff is collapsed.
Click to expand it.
.gitignore
View file @
58f0c681
...
...
@@ -8,31 +8,12 @@ data/
.idea/
*.iml
public/img/avatar/
files/
*.o
*.a
*.so
_obj
_test
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.exe~
/gogs
profile/
__pycache__
*.pem
output*
.brackets.json
docker/fig.yml
docker/docker/Dockerfile
docker/docker/init_gogs.sh
gogs.sublime-project
gogs.sublime-workspace
.tags*
release
/release
This diff is collapsed.
Click to expand it.
Makefile
View file @
58f0c681
...
...
@@ -53,3 +53,9 @@ clean-mac: clean
test
:
go
test
-cover
-race
./...
fixme
:
grep
-rnw
"FIXME"
routers models modules
todo
:
grep
-rnw
"TODO"
routers models modules
This diff is collapsed.
Click to expand it.
cmd/web.go
View file @
58f0c681
...
...
@@ -7,7 +7,6 @@ package cmd
import
(
"crypto/tls"
"fmt"
gotmpl
"html/template"
"io/ioutil"
"net/http"
"net/http/fcgi"
...
...
@@ -126,7 +125,7 @@ func newMacaron() *macaron.Macaron {
))
m
.
Use
(
macaron
.
Renderer
(
macaron
.
RenderOptions
{
Directory
:
path
.
Join
(
setting
.
StaticRootPath
,
"templates"
),
Funcs
:
[]
gotmpl
.
FuncMap
{
template
.
Func
s
}
,
Funcs
:
template
.
New
Func
Map
()
,
IndentJSON
:
macaron
.
Env
!=
macaron
.
PROD
,
}))
...
...
This diff is collapsed.
Click to expand it.
conf/README.md
View file @
58f0c681
Execute following command in ROOT directory when anything is changed:
$ go-bindata -o=modules/bindata/bindata.go -ignore="
\\
.DS_Store|README.md" -pkg=bindata conf/...
Add -debug flag to make life easier in development(somehow isn't working):
$ go-bindata -debug -o=modules/bindata/bindata.go -ignore="
\\
.DS_Store|README.md" -pkg=bindata conf/...
\ No newline at end of file
$ make bindata
\ No newline at end of file
This diff is collapsed.
Click to expand it.
modules/template/template.go
View file @
58f0c681
...
...
@@ -22,86 +22,88 @@ import (
"github.com/gogits/gogs/modules/setting"
)
var
Funcs
template
.
FuncMap
=
map
[
string
]
interface
{}{
"GoVer"
:
func
()
string
{
return
strings
.
Title
(
runtime
.
Version
())
},
"UseHTTPS"
:
func
()
bool
{
return
strings
.
HasPrefix
(
setting
.
AppUrl
,
"https"
)
},
"AppName"
:
func
()
string
{
return
setting
.
AppName
},
"AppSubUrl"
:
func
()
string
{
return
setting
.
AppSubUrl
},
"AppUrl"
:
func
()
string
{
return
setting
.
AppUrl
},
"AppVer"
:
func
()
string
{
return
setting
.
AppVer
},
"AppDomain"
:
func
()
string
{
return
setting
.
Domain
},
"DisableGravatar"
:
func
()
bool
{
return
setting
.
DisableGravatar
},
"LoadTimes"
:
func
(
startTime
time
.
Time
)
string
{
return
fmt
.
Sprint
(
time
.
Since
(
startTime
)
.
Nanoseconds
()
/
1e6
)
+
"ms"
},
"AvatarLink"
:
base
.
AvatarLink
,
"Safe"
:
Safe
,
"Str2html"
:
Str2html
,
"TimeSince"
:
base
.
TimeSince
,
"RawTimeSince"
:
base
.
RawTimeSince
,
"FileSize"
:
base
.
FileSize
,
"Subtract"
:
base
.
Subtract
,
"Add"
:
func
(
a
,
b
int
)
int
{
return
a
+
b
},
"ActionIcon"
:
ActionIcon
,
"DateFmtLong"
:
func
(
t
time
.
Time
)
string
{
return
t
.
Format
(
time
.
RFC1123Z
)
},
"DateFmtShort"
:
func
(
t
time
.
Time
)
string
{
return
t
.
Format
(
"Jan 02, 2006"
)
},
"List"
:
List
,
"Mail2Domain"
:
func
(
mail
string
)
string
{
if
!
strings
.
Contains
(
mail
,
"@"
)
{
return
"try.gogs.io"
}
func
NewFuncMap
()
[]
template
.
FuncMap
{
return
[]
template
.
FuncMap
{
map
[
string
]
interface
{}{
"GoVer"
:
func
()
string
{
return
strings
.
Title
(
runtime
.
Version
())
},
"UseHTTPS"
:
func
()
bool
{
return
strings
.
HasPrefix
(
setting
.
AppUrl
,
"https"
)
},
"AppName"
:
func
()
string
{
return
setting
.
AppName
},
"AppSubUrl"
:
func
()
string
{
return
setting
.
AppSubUrl
},
"AppUrl"
:
func
()
string
{
return
setting
.
AppUrl
},
"AppVer"
:
func
()
string
{
return
setting
.
AppVer
},
"AppDomain"
:
func
()
string
{
return
setting
.
Domain
},
"DisableGravatar"
:
func
()
bool
{
return
setting
.
DisableGravatar
},
"LoadTimes"
:
func
(
startTime
time
.
Time
)
string
{
return
fmt
.
Sprint
(
time
.
Since
(
startTime
)
.
Nanoseconds
()
/
1e6
)
+
"ms"
},
"AvatarLink"
:
base
.
AvatarLink
,
"Safe"
:
Safe
,
"Str2html"
:
Str2html
,
"TimeSince"
:
base
.
TimeSince
,
"RawTimeSince"
:
base
.
RawTimeSince
,
"FileSize"
:
base
.
FileSize
,
"Subtract"
:
base
.
Subtract
,
"Add"
:
func
(
a
,
b
int
)
int
{
return
a
+
b
},
"ActionIcon"
:
ActionIcon
,
"DateFmtLong"
:
func
(
t
time
.
Time
)
string
{
return
t
.
Format
(
time
.
RFC1123Z
)
},
"DateFmtShort"
:
func
(
t
time
.
Time
)
string
{
return
t
.
Format
(
"Jan 02, 2006"
)
},
"List"
:
List
,
"Mail2Domain"
:
func
(
mail
string
)
string
{
if
!
strings
.
Contains
(
mail
,
"@"
)
{
return
"try.gogs.io"
}
return
strings
.
SplitN
(
mail
,
"@"
,
2
)[
1
]
},
"SubStr"
:
func
(
str
string
,
start
,
length
int
)
string
{
if
len
(
str
)
==
0
{
return
""
}
end
:=
start
+
length
if
length
==
-
1
{
end
=
len
(
str
)
}
if
len
(
str
)
<
end
{
return
str
}
return
str
[
start
:
end
]
},
"DiffTypeToStr"
:
DiffTypeToStr
,
"DiffLineTypeToStr"
:
DiffLineTypeToStr
,
"Sha1"
:
Sha1
,
"ShortSha"
:
base
.
ShortSha
,
"MD5"
:
base
.
EncodeMD5
,
"ActionContent2Commits"
:
ActionContent2Commits
,
"ToUtf8"
:
ToUtf8
,
"EscapePound"
:
func
(
str
string
)
string
{
return
strings
.
Replace
(
strings
.
Replace
(
str
,
"%"
,
"%25"
,
-
1
),
"#"
,
"%23"
,
-
1
)
},
"RenderCommitMessage"
:
RenderCommitMessage
,
"ThemeColorMetaTag"
:
func
()
string
{
return
setting
.
ThemeColorMetaTag
},
return
strings
.
SplitN
(
mail
,
"@"
,
2
)[
1
]
},
"SubStr"
:
func
(
str
string
,
start
,
length
int
)
string
{
if
len
(
str
)
==
0
{
return
""
}
end
:=
start
+
length
if
length
==
-
1
{
end
=
len
(
str
)
}
if
len
(
str
)
<
end
{
return
str
}
return
str
[
start
:
end
]
},
"DiffTypeToStr"
:
DiffTypeToStr
,
"DiffLineTypeToStr"
:
DiffLineTypeToStr
,
"Sha1"
:
Sha1
,
"ShortSha"
:
base
.
ShortSha
,
"MD5"
:
base
.
EncodeMD5
,
"ActionContent2Commits"
:
ActionContent2Commits
,
"ToUtf8"
:
ToUtf8
,
"EscapePound"
:
func
(
str
string
)
string
{
return
strings
.
Replace
(
strings
.
Replace
(
str
,
"%"
,
"%25"
,
-
1
),
"#"
,
"%23"
,
-
1
)
},
"RenderCommitMessage"
:
RenderCommitMessage
,
"ThemeColorMetaTag"
:
func
()
string
{
return
setting
.
ThemeColorMetaTag
},
}}
}
func
Safe
(
raw
string
)
template
.
HTML
{
...
...
This diff is collapsed.
Click to expand it.
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