Skip to content

Commit c1c269d

Browse files
committed
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.
1 parent 9edac05 commit c1c269d

File tree

14 files changed

+42
-42
lines changed

14 files changed

+42
-42
lines changed

models/comment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
api "github.com/gogits/go-gogs-client"
1717

1818
"github.com/gogits/gogs/models/errors"
19-
"github.com/gogits/gogs/modules/markdown"
19+
"github.com/gogits/gogs/modules/markup"
2020
)
2121

2222
// CommentType defines whether a comment is just a simple comment, an action (like close) or a reference.
@@ -168,7 +168,7 @@ func (c *Comment) EventTag() string {
168168
// mailParticipants sends new comment emails to repository watchers
169169
// and mentioned people.
170170
func (cmt *Comment) mailParticipants(e Engine, opType ActionType, issue *Issue) (err error) {
171-
mentions := markdown.FindAllMentions(cmt.Content)
171+
mentions := markup.FindAllMentions(cmt.Content)
172172
if err = updateIssueMentions(e, cmt.IssueID, mentions); err != nil {
173173
return fmt.Errorf("UpdateIssueMentions [%d]: %v", cmt.IssueID, err)
174174
}

models/issue_mail.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
log "gopkg.in/clog.v1"
1212

1313
"github.com/gogits/gogs/modules/mailer"
14-
"github.com/gogits/gogs/modules/markdown"
14+
"github.com/gogits/gogs/modules/markup"
1515
"github.com/gogits/gogs/modules/setting"
1616
)
1717

@@ -162,7 +162,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
162162
// MailParticipants sends new issue thread created emails to repository watchers
163163
// and mentioned people.
164164
func (issue *Issue) MailParticipants() (err error) {
165-
mentions := markdown.FindAllMentions(issue.Content)
165+
mentions := markup.FindAllMentions(issue.Content)
166166
if err = updateIssueMentions(x, issue.ID, mentions); err != nil {
167167
return fmt.Errorf("UpdateIssueMentions [%d]: %v", issue.ID, err)
168168
}

models/repo.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828

2929
"github.com/gogits/gogs/models/errors"
3030
"github.com/gogits/gogs/modules/bindata"
31-
"github.com/gogits/gogs/modules/markdown"
31+
"github.com/gogits/gogs/modules/markup"
3232
"github.com/gogits/gogs/modules/process"
3333
"github.com/gogits/gogs/modules/setting"
3434
"github.com/gogits/gogs/modules/sync"
@@ -219,7 +219,7 @@ func (repo *Repository) AfterSet(colName string, _ xorm.Cell) {
219219
repo.NumOpenMilestones = repo.NumMilestones - repo.NumClosedMilestones
220220
case "external_tracker_style":
221221
if len(repo.ExternalTrackerStyle) == 0 {
222-
repo.ExternalTrackerStyle = markdown.ISSUE_NAME_STYLE_NUMERIC
222+
repo.ExternalTrackerStyle = markup.ISSUE_NAME_STYLE_NUMERIC
223223
}
224224
case "created_unix":
225225
repo.Created = time.Unix(repo.CreatedUnix, 0).Local()
@@ -356,10 +356,10 @@ func (repo *Repository) ComposeMetas() map[string]string {
356356
"repo": repo.Name,
357357
}
358358
switch repo.ExternalTrackerStyle {
359-
case markdown.ISSUE_NAME_STYLE_ALPHANUMERIC:
360-
repo.ExternalMetas["style"] = markdown.ISSUE_NAME_STYLE_ALPHANUMERIC
359+
case markup.ISSUE_NAME_STYLE_ALPHANUMERIC:
360+
repo.ExternalMetas["style"] = markup.ISSUE_NAME_STYLE_ALPHANUMERIC
361361
default:
362-
repo.ExternalMetas["style"] = markdown.ISSUE_NAME_STYLE_NUMERIC
362+
repo.ExternalMetas["style"] = markup.ISSUE_NAME_STYLE_NUMERIC
363363
}
364364

365365
}

models/repo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
. "github.com/smartystreets/goconvey/convey"
66
"testing"
77

8-
"github.com/gogits/gogs/modules/markdown"
8+
"github.com/gogits/gogs/modules/markup"
99
)
1010

1111
func TestRepo(t *testing.T) {

modules/mailer/mail.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"gopkg.in/macaron.v1"
1414

1515
"github.com/gogits/gogs/modules/base"
16-
"github.com/gogits/gogs/modules/markdown"
16+
"github.com/gogits/gogs/modules/markup"
1717
"github.com/gogits/gogs/modules/setting"
1818
)
1919

@@ -174,7 +174,7 @@ func composeTplData(subject, body, link string) map[string]interface{} {
174174

175175
func composeIssueMessage(issue Issue, repo Repository, doer User, tplName base.TplName, tos []string, info string) *Message {
176176
subject := issue.MailSubject()
177-
body := string(markdown.RenderSpecialLink([]byte(issue.Content()), repo.HTMLURL(), repo.ComposeMetas()))
177+
body := string(markup.RenderSpecialLink([]byte(issue.Content()), repo.HTMLURL(), repo.ComposeMetas()))
178178
data := composeTplData(subject, body, issue.HTMLURL())
179179
data["Doer"] = doer
180180
content, err := mailRender.HTMLString(string(tplName), data)

modules/markdown/markdown.go renamed to modules/markup/markdown.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a MIT-style
33
// license that can be found in the LICENSE file.
44

5-
package markdown
5+
package markup
66

77
import (
88
"bytes"

modules/markdown/markdown_test.go renamed to modules/markup/markdown_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package markdown_test
1+
package markup_test
22

33
import (
4-
. "github.com/gogits/gogs/modules/markdown"
4+
. "github.com/gogits/gogs/modules/markup"
55
. "github.com/smartystreets/goconvey/convey"
66
"testing"
77

modules/template/template.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
"github.com/gogits/gogs/models"
2525
"github.com/gogits/gogs/modules/base"
26-
"github.com/gogits/gogs/modules/markdown"
26+
"github.com/gogits/gogs/modules/markup"
2727
"github.com/gogits/gogs/modules/setting"
2828
)
2929

@@ -125,7 +125,7 @@ func Safe(raw string) template.HTML {
125125
}
126126

127127
func Str2html(raw string) template.HTML {
128-
return template.HTML(markdown.Sanitizer.Sanitize(raw))
128+
return template.HTML(markup.Sanitizer.Sanitize(raw))
129129
}
130130

131131
func List(l *list.List) chan interface{} {
@@ -201,7 +201,7 @@ func ReplaceLeft(s, old, new string) string {
201201
// RenderCommitMessage renders commit message with XSS-safe and special links.
202202
func RenderCommitMessage(full bool, msg, urlPrefix string, metas map[string]string) template.HTML {
203203
cleanMsg := template.HTMLEscapeString(msg)
204-
fullMessage := string(markdown.RenderIssueIndexPattern([]byte(cleanMsg), urlPrefix, metas))
204+
fullMessage := string(markup.RenderIssueIndexPattern([]byte(cleanMsg), urlPrefix, metas))
205205
msgLines := strings.Split(strings.TrimSpace(fullMessage), "\n")
206206
numLines := len(msgLines)
207207
if numLines == 0 {

routers/api/v1/misc/markdown.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
api "github.com/gogits/go-gogs-client"
99

1010
"github.com/gogits/gogs/modules/context"
11-
"github.com/gogits/gogs/modules/markdown"
11+
"github.com/gogits/gogs/modules/markup"
1212
)
1313

1414
// 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) {
2525

2626
switch form.Mode {
2727
case "gfm":
28-
ctx.Write(markdown.Render([]byte(form.Text), form.Context, nil))
28+
ctx.Write(markup.Render([]byte(form.Text), form.Context, nil))
2929
default:
30-
ctx.Write(markdown.RenderRaw([]byte(form.Text), ""))
30+
ctx.Write(markup.RenderRaw([]byte(form.Text), ""))
3131
}
3232
}
3333

@@ -38,5 +38,5 @@ func MarkdownRaw(ctx *context.APIContext) {
3838
ctx.Error(422, "", err)
3939
return
4040
}
41-
ctx.Write(markdown.RenderRaw(body, ""))
41+
ctx.Write(markup.RenderRaw(body, ""))
4242
}

routers/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/gogits/gogs/modules/cron"
2727
"github.com/gogits/gogs/modules/form"
2828
"github.com/gogits/gogs/modules/mailer"
29-
"github.com/gogits/gogs/modules/markdown"
29+
"github.com/gogits/gogs/modules/markup"
3030
"github.com/gogits/gogs/modules/setting"
3131
"github.com/gogits/gogs/modules/ssh"
3232
"github.com/gogits/gogs/modules/template/highlight"
@@ -62,7 +62,7 @@ func GlobalInit() {
6262

6363
if setting.InstallLock {
6464
highlight.NewContext()
65-
markdown.BuildSanitizer()
65+
markup.BuildSanitizer()
6666
if err := models.NewEngine(); err != nil {
6767
log.Fatal(2, "Fail to initialize ORM engine: %v", err)
6868
}

0 commit comments

Comments
 (0)