|
|
@ -93,10 +93,11 @@ func renderDirectory(ctx *context.Context, treeLink string) { |
|
|
|
if isTextFile { |
|
|
|
if isTextFile { |
|
|
|
d, _ := ioutil.ReadAll(dataRc) |
|
|
|
d, _ := ioutil.ReadAll(dataRc) |
|
|
|
buf = append(buf, d...) |
|
|
|
buf = append(buf, d...) |
|
|
|
ctx.Data["IsRenderedHTML"] = true |
|
|
|
|
|
|
|
if markup.Type(readmeFile.Name()) != "" { |
|
|
|
if markup.Type(readmeFile.Name()) != "" { |
|
|
|
|
|
|
|
ctx.Data["IsMarkup"] = true |
|
|
|
ctx.Data["FileContent"] = string(markup.Render(readmeFile.Name(), buf, treeLink, ctx.Repo.Repository.ComposeMetas())) |
|
|
|
ctx.Data["FileContent"] = string(markup.Render(readmeFile.Name(), buf, treeLink, ctx.Repo.Repository.ComposeMetas())) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
ctx.Data["IsRenderedHTML"] = true |
|
|
|
ctx.Data["FileContent"] = string(bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1)) |
|
|
|
ctx.Data["FileContent"] = string(bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -194,7 +195,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st |
|
|
|
readmeExist := markup.IsReadmeFile(blob.Name()) |
|
|
|
readmeExist := markup.IsReadmeFile(blob.Name()) |
|
|
|
ctx.Data["ReadmeExist"] = readmeExist |
|
|
|
ctx.Data["ReadmeExist"] = readmeExist |
|
|
|
if markup.Type(blob.Name()) != "" { |
|
|
|
if markup.Type(blob.Name()) != "" { |
|
|
|
ctx.Data["IsRenderedHTML"] = true |
|
|
|
ctx.Data["IsMarkup"] = true |
|
|
|
ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas())) |
|
|
|
ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas())) |
|
|
|
} else if readmeExist { |
|
|
|
} else if readmeExist { |
|
|
|
ctx.Data["IsRenderedHTML"] = true |
|
|
|
ctx.Data["IsRenderedHTML"] = true |
|
|
|