This commit is contained in:
slene 2014-03-20 17:31:18 +08:00
parent c3532718a7
commit 21379e30a1
3 changed files with 17 additions and 5 deletions

View file

@ -36,7 +36,7 @@ func isLink(link []byte) bool {
func IsMarkdownFile(name string) bool { func IsMarkdownFile(name string) bool {
name = strings.ToLower(name) name = strings.ToLower(name)
switch filepath.Ext(name) { switch filepath.Ext(name) {
case "md", "markdown": case "md", "markdown", "mdown":
return true return true
} }
return false return false
@ -61,7 +61,7 @@ type CustomRender struct {
func (options *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { func (options *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
if len(link) > 0 && !isLink(link) { if len(link) > 0 && !isLink(link) {
if link[0] == '#' { if link[0] == '#' {
link = append([]byte(options.urlPrefix), link...) // link = append([]byte(options.urlPrefix), link...)
} else { } else {
link = []byte(path.Join(options.urlPrefix, string(link))) link = []byte(path.Join(options.urlPrefix, string(link)))
} }

View file

@ -647,6 +647,14 @@ html, body {
padding: 30px 30px 50px; padding: 30px 30px 50px;
} }
.file-content .file-body.file-code {
padding: 0;
}
.file-content .file-body.file-code > pre {
border: none;
}
.branch-list th, .commit-list th { .branch-list th, .commit-list th {
background-color: #FFF; background-color: #FFF;
line-height: 28px !important; line-height: 28px !important;

View file

@ -1,6 +1,10 @@
<div class="panel panel-default file-content"> <div class="panel panel-default file-content">
<div class="panel-heading file-head"> <div class="panel-heading file-head">
<i class="icon fa fa-book"></i> {{.FileName}} {{if .ReadmeExist}}
<i class="icon fa fa-book"></i>
{{else}}
<i class="icon fa fa-file-text-o"></i>
{{end}}{{.FileName}}
</div> </div>
{{if .FileIsLarge}} {{if .FileIsLarge}}
<div class="panel-footer"> <div class="panel-footer">
@ -12,8 +16,8 @@
{{.FileContent|str2html}} {{.FileContent|str2html}}
</div> </div>
{{else}} {{else}}
<div class="panel-body file-body markdown"> <div class="panel-body file-body file-code markdown">
<pre><code>{{.FileContent}}</code></pre> <pre class="linenums"><code>{{.FileContent}}</code></pre>
</div> </div>
{{end}} {{end}}
{{end}} {{end}}