aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-03-31 15:29:43 -0400
committerUnknwon <u@gogs.io>2017-03-31 15:29:43 -0400
commitc1c269d9ef50595475cf4c6728d9b20a6417c490 (patch)
tree287621c5244c9b11b6e980190fce9bb887d2bf1f /routers
parent9edac05e05387e335466957ecf3400a19c6ae808 (diff)
modules: rename markdown -> markup
To further support more markup languages (e.g. Org-mode, AsciiDoc, reStructuredText), the name 'markdown' is inappropriate. This is the first step towards more markup language support.
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/misc/markdown.go8
-rw-r--r--routers/install.go4
-rw-r--r--routers/repo/issue.go12
-rw-r--r--routers/repo/release.go6
-rw-r--r--routers/repo/view.go14
-rw-r--r--routers/repo/wiki.go4
6 files changed, 24 insertions, 24 deletions
diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go
index 64895db0..58ff93f5 100644
--- a/routers/api/v1/misc/markdown.go
+++ b/routers/api/v1/misc/markdown.go
@@ -8,7 +8,7 @@ import (
api "github.com/gogits/go-gogs-client"
"github.com/gogits/gogs/modules/context"
- "github.com/gogits/gogs/modules/markdown"
+ "github.com/gogits/gogs/modules/markup"
)
// https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-an-arbitrary-markdown-document
@@ -25,9 +25,9 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
switch form.Mode {
case "gfm":
- ctx.Write(markdown.Render([]byte(form.Text), form.Context, nil))
+ ctx.Write(markup.Render([]byte(form.Text), form.Context, nil))
default:
- ctx.Write(markdown.RenderRaw([]byte(form.Text), ""))
+ ctx.Write(markup.RenderRaw([]byte(form.Text), ""))
}
}
@@ -38,5 +38,5 @@ func MarkdownRaw(ctx *context.APIContext) {
ctx.Error(422, "", err)
return
}
- ctx.Write(markdown.RenderRaw(body, ""))
+ ctx.Write(markup.RenderRaw(body, ""))
}
diff --git a/routers/install.go b/routers/install.go
index 0a856934..2e6bee10 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -26,7 +26,7 @@ import (
"github.com/gogits/gogs/modules/cron"
"github.com/gogits/gogs/modules/form"
"github.com/gogits/gogs/modules/mailer"
- "github.com/gogits/gogs/modules/markdown"
+ "github.com/gogits/gogs/modules/markup"
"github.com/gogits/gogs/modules/setting"
"github.com/gogits/gogs/modules/ssh"
"github.com/gogits/gogs/modules/template/highlight"
@@ -62,7 +62,7 @@ func GlobalInit() {
if setting.InstallLock {
highlight.NewContext()
- markdown.BuildSanitizer()
+ markup.BuildSanitizer()
if err := models.NewEngine(); err != nil {
log.Fatal(2, "Fail to initialize ORM engine: %v", err)
}
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 4ab8bc9b..917bcad5 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -22,7 +22,7 @@ import (
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/form"
- "github.com/gogits/gogs/modules/markdown"
+ "github.com/gogits/gogs/modules/markup"
"github.com/gogits/gogs/modules/setting"
)
@@ -541,7 +541,7 @@ func viewIssue(ctx *context.Context, isPullList bool) {
ctx.Data["PageIsIssueList"] = true
}
- issue.RenderedContent = string(markdown.Render([]byte(issue.Content), ctx.Repo.RepoLink,
+ issue.RenderedContent = string(markup.Render([]byte(issue.Content), ctx.Repo.RepoLink,
ctx.Repo.Repository.ComposeMetas()))
repo := ctx.Repo.Repository
@@ -608,7 +608,7 @@ func viewIssue(ctx *context.Context, isPullList bool) {
participants[0] = issue.Poster
for _, comment = range issue.Comments {
if comment.Type == models.COMMENT_TYPE_COMMENT {
- comment.RenderedContent = string(markdown.Render([]byte(comment.Content), ctx.Repo.RepoLink,
+ comment.RenderedContent = string(markup.Render([]byte(comment.Content), ctx.Repo.RepoLink,
ctx.Repo.Repository.ComposeMetas()))
// Check tag.
@@ -728,7 +728,7 @@ func UpdateIssueContent(ctx *context.Context) {
}
ctx.JSON(200, map[string]interface{}{
- "content": string(markdown.Render([]byte(issue.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())),
+ "content": string(markup.Render([]byte(issue.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())),
})
}
@@ -939,7 +939,7 @@ func UpdateCommentContent(ctx *context.Context) {
}
ctx.JSON(200, map[string]interface{}{
- "content": string(markdown.Render([]byte(comment.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())),
+ "content": string(markup.Render([]byte(comment.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())),
})
}
@@ -1092,7 +1092,7 @@ func Milestones(ctx *context.Context) {
if m.NumOpenIssues+m.NumClosedIssues > 0 {
m.Completeness = m.NumClosedIssues * 100 / (m.NumOpenIssues + m.NumClosedIssues)
}
- m.RenderedContent = string(markdown.Render([]byte(m.Content), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas()))
+ m.RenderedContent = string(markup.Render([]byte(m.Content), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas()))
}
ctx.Data["Milestones"] = miles
diff --git a/routers/repo/release.go b/routers/repo/release.go
index 5c6ba4ea..b25add77 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -14,7 +14,7 @@ import (
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/form"
- "github.com/gogits/gogs/modules/markdown"
+ "github.com/gogits/gogs/modules/markup"
"github.com/gogits/gogs/modules/setting"
)
@@ -83,7 +83,7 @@ func Releases(ctx *context.Context) {
return
}
- r.Note = markdown.RenderString(r.Note, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())
+ r.Note = markup.RenderString(r.Note, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())
results[i] = r
break
}
@@ -132,7 +132,7 @@ func Releases(ctx *context.Context) {
return
}
- r.Note = markdown.RenderString(r.Note, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())
+ r.Note = markup.RenderString(r.Note, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())
}
if len(drafts) > 0 {
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 8b68d188..a97c6705 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -20,7 +20,7 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
- "github.com/gogits/gogs/modules/markdown"
+ "github.com/gogits/gogs/modules/markup"
"github.com/gogits/gogs/modules/setting"
"github.com/gogits/gogs/modules/template"
"github.com/gogits/gogs/modules/template/highlight"
@@ -55,7 +55,7 @@ func renderDirectory(ctx *context.Context, treeLink string) {
var readmeFile *git.Blob
for _, entry := range entries {
- if entry.IsDir() || !markdown.IsReadmeFile(entry.Name()) {
+ if entry.IsDir() || !markup.IsReadmeFile(entry.Name()) {
continue
}
@@ -86,9 +86,9 @@ func renderDirectory(ctx *context.Context, treeLink string) {
d, _ := ioutil.ReadAll(dataRc)
buf = append(buf, d...)
switch {
- case markdown.IsMarkdownFile(readmeFile.Name()):
+ case markup.IsMarkdownFile(readmeFile.Name()):
ctx.Data["IsMarkdown"] = true
- buf = markdown.Render(buf, treeLink, ctx.Repo.Repository.ComposeMetas())
+ buf = markup.Render(buf, treeLink, ctx.Repo.Repository.ComposeMetas())
default:
buf = bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1)
}
@@ -153,14 +153,14 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
d, _ := ioutil.ReadAll(dataRc)
buf = append(buf, d...)
- isMarkdown := markdown.IsMarkdownFile(blob.Name())
+ isMarkdown := markup.IsMarkdownFile(blob.Name())
ctx.Data["IsMarkdown"] = isMarkdown
- ctx.Data["ReadmeExist"] = isMarkdown && markdown.IsReadmeFile(blob.Name())
+ ctx.Data["ReadmeExist"] = isMarkdown && markup.IsReadmeFile(blob.Name())
ctx.Data["IsIPythonNotebook"] = strings.HasSuffix(blob.Name(), ".ipynb")
if isMarkdown {
- ctx.Data["FileContent"] = string(markdown.Render(buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas()))
+ ctx.Data["FileContent"] = string(markup.Render(buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas()))
} else {
// Building code view blocks with line number on server side.
var fileContent string
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go
index df8d78a3..e0c5fdc5 100644
--- a/routers/repo/wiki.go
+++ b/routers/repo/wiki.go
@@ -15,7 +15,7 @@ import (
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/form"
- "github.com/gogits/gogs/modules/markdown"
+ "github.com/gogits/gogs/modules/markup"
)
const (
@@ -107,7 +107,7 @@ func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, str
return nil, ""
}
if isViewPage {
- ctx.Data["content"] = string(markdown.Render(data, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas()))
+ ctx.Data["content"] = string(markup.Render(data, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas()))
} else {
ctx.Data["content"] = string(data)
}