aboutsummaryrefslogtreecommitdiff
path: root/templates/repo
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-04-07 22:33:19 -0400
committerUnknwon <u@gogs.io>2017-04-07 22:33:19 -0400
commit6ebdf91b327313a0d258ee473b5da5314377e348 (patch)
tree7fcca8f9db8fed71f4f6b2115e7d69d48453e29a /templates/repo
parent91cd350b631f721d1d6dd38bbafd3cac612e53c6 (diff)
templates/repo: fix README.ipynb not rendered (#4367)
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/view_file.tmpl37
1 files changed, 19 insertions, 18 deletions
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index 92bd7139..b8d6c1e4 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -36,28 +36,29 @@
{{end}}
</h4>
<div class="ui attached table segment">
- <div id="{{if .IsIPythonNotebook}}ipython-notebook{{end}}" class="file-view {{if .IsMarkdown}}markdown{{else if .ReadmeInList}}plain-text{{else if .IsIPythonNotebook}}ipython-notebook1{{else if and .IsTextFile}}code-view{{end}} has-emoji">
- {{if or .IsMarkdown .ReadmeInList}}
+ <div id="{{if .IsIPythonNotebook}}ipython-notebook{{end}}" class="file-view {{if .IsMarkdown}}markdown{{else if .IsIPythonNotebook}}ipython-notebook{{else if .ReadmeInList}}plain-text{{else if and .IsTextFile}}code-view{{end}} has-emoji">
+ {{if .IsMarkdown}}
{{if .FileContent}}{{.FileContent | Str2html}}{{end}}
{{else if .IsIPythonNotebook}}
- {{if .FileContent}}
- <script>
- var rendered = null;
- $.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
- var notebook = nb.parse(notebook_json);
- rendered = notebook.render();
- $("#ipython-notebook").append(rendered);
- $("#ipython-notebook code").each(function(i, block) {
- $(block).addClass("py").addClass("python");
- hljs.highlightBlock(block);
- });
+ <script>
+ var rendered = null;
+ console.log("fuck")
+ $.getJSON("{{.RawFileLink}}", null, function(notebook_json) {
+ var notebook = nb.parse(notebook_json);
+ rendered = notebook.render();
+ $("#ipython-notebook").append(rendered);
+ $("#ipython-notebook code").each(function(i, block) {
+ $(block).addClass("py").addClass("python");
+ hljs.highlightBlock(block);
+ });
- $("#ipython-notebook .nb-markdown-cell").each(function(i, markdown) {
- $(markdown).html(marked($(markdown).html()));
- });
+ $("#ipython-notebook .nb-markdown-cell").each(function(i, markdown) {
+ $(markdown).html(marked($(markdown).html()));
});
- </script>
- {{end}}
+ });
+ </script>
+ {{else if .ReadmeInList}}
+ {{if .FileContent}}{{.FileContent | Str2html}}{{end}}
{{else if not .IsTextFile}}
<div class="view-raw ui center">
{{if .IsImageFile}}