Skip to content

init suport for org mode #1527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import (

"code.gitea.io/gitea/cmd"
"code.gitea.io/gitea/modules/log"
_ "code.gitea.io/gitea/modules/markup/markdown"
_ "code.gitea.io/gitea/modules/markup/orgmode"
"code.gitea.io/gitea/modules/setting"

"github.com/urfave/cli"
)

Expand Down
4 changes: 2 additions & 2 deletions models/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
api "code.gitea.io/sdk/gitea"

"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markdown"
"code.gitea.io/gitea/modules/markup"
)

// CommentType defines whether a comment is just a simple comment, an action (like close) or a reference.
Expand Down Expand Up @@ -276,7 +276,7 @@ func (c *Comment) LoadAssignees() error {
// MailParticipants sends new comment emails to repository watchers
// and mentioned people.
func (c *Comment) MailParticipants(e Engine, opType ActionType, issue *Issue) (err error) {
mentions := markdown.FindAllMentions(c.Content)
mentions := markup.FindAllMentions(c.Content)
if err = UpdateIssueMentions(e, c.IssueID, mentions); err != nil {
return fmt.Errorf("UpdateIssueMentions [%d]: %v", c.IssueID, err)
}
Expand Down
4 changes: 2 additions & 2 deletions models/issue_mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/Unknwon/com"

"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markdown"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/setting"
)

Expand Down Expand Up @@ -90,7 +90,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
// MailParticipants sends new issue thread created emails to repository watchers
// and mentioned people.
func (issue *Issue) MailParticipants() (err error) {
mentions := markdown.FindAllMentions(issue.Content)
mentions := markup.FindAllMentions(issue.Content)
if err = UpdateIssueMentions(x, issue.ID, mentions); err != nil {
return fmt.Errorf("UpdateIssueMentions [%d]: %v", issue.ID, err)
}
Expand Down
2 changes: 1 addition & 1 deletion models/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/mailer"
"code.gitea.io/gitea/modules/markdown"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting"
"gopkg.in/gomail.v2"
"gopkg.in/macaron.v1"
Expand Down
4 changes: 2 additions & 2 deletions models/migrations/v16.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"time"

"code.gitea.io/gitea/modules/markdown"
"code.gitea.io/gitea/modules/markup"

"github.com/go-xorm/xorm"
)
Expand Down Expand Up @@ -101,7 +101,7 @@ func addUnitsToTables(x *xorm.Engine) error {
config["ExternalTrackerURL"] = repo.ExternalTrackerURL
config["ExternalTrackerFormat"] = repo.ExternalTrackerFormat
if len(repo.ExternalTrackerStyle) == 0 {
repo.ExternalTrackerStyle = markdown.IssueNameStyleNumeric
repo.ExternalTrackerStyle = markup.IssueNameStyleNumeric
}
config["ExternalTrackerStyle"] = repo.ExternalTrackerStyle
case UnitTypeExternalUncyclo:
Expand Down
10 changes: 5 additions & 5 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"code.gitea.io/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markdown"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/options"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
Expand Down Expand Up @@ -407,10 +407,10 @@ func (repo *Repository) ComposeMetas() map[string]string {
"repo": repo.Name,
}
switch unit.ExternalTrackerConfig().ExternalTrackerStyle {
case markdown.IssueNameStyleAlphanumeric:
repo.ExternalMetas["style"] = markdown.IssueNameStyleAlphanumeric
case markup.IssueNameStyleAlphanumeric:
repo.ExternalMetas["style"] = markup.IssueNameStyleAlphanumeric
default:
repo.ExternalMetas["style"] = markdown.IssueNameStyleNumeric
repo.ExternalMetas["style"] = markup.IssueNameStyleNumeric
}

}
Expand Down Expand Up @@ -595,7 +595,7 @@ func (repo *Repository) DescriptionHTML() template.HTML {
sanitize := func(s string) string {
return fmt.Sprintf(`<a href="%[1]s" target="_blank" rel="noopener">%[1]s</a>`, s)
}
return template.HTML(descPattern.ReplaceAllStringFunc(markdown.Sanitize(repo.Description), sanitize))
return template.HTML(descPattern.ReplaceAllStringFunc(markup.Sanitize(repo.Description), sanitize))
}

// LocalCopyPath returns the local repository copy path
Expand Down
12 changes: 6 additions & 6 deletions models/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package models
import (
"testing"

"code.gitea.io/gitea/modules/markdown"
"code.gitea.io/gitea/modules/markup"

"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -36,13 +36,13 @@ func TestRepo(t *testing.T) {
assert.Equal(t, "https://someurl.com/{user}/{repo}/{issue}", metas["format"])
}

testSuccess(markdown.IssueNameStyleNumeric)
testSuccess(markup.IssueNameStyleNumeric)

externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markdown.IssueNameStyleAlphanumeric
testSuccess(markdown.IssueNameStyleAlphanumeric)
externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markup.IssueNameStyleAlphanumeric
testSuccess(markup.IssueNameStyleAlphanumeric)

externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markdown.IssueNameStyleNumeric
testSuccess(markdown.IssueNameStyleNumeric)
externalTracker.ExternalTrackerConfig().ExternalTrackerStyle = markup.IssueNameStyleNumeric
testSuccess(markup.IssueNameStyleNumeric)
}

func TestGetRepositoryCount(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"code.gitea.io/gitea/modules/avatar"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markdown"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/setting"
)

Expand Down Expand Up @@ -163,7 +163,7 @@ func (u *User) UpdateDiffViewStyle(style string) error {
func (u *User) AfterSet(colName string, _ xorm.Cell) {
switch colName {
case "full_name":
u.FullName = markdown.Sanitize(u.FullName)
u.FullName = markup.Sanitize(u.FullName)
case "created_unix":
u.Created = time.Unix(u.CreatedUnix, 0).Local()
case "updated_unix":
Expand Down Expand Up @@ -867,7 +867,7 @@ func updateUser(e Engine, u *User) error {
u.Website = base.TruncateString(u.Website, 255)
u.Description = base.TruncateString(u.Description, 255)

u.FullName = markdown.Sanitize(u.FullName)
u.FullName = markup.Sanitize(u.FullName)
_, err := e.Id(u.ID).AllCols().Update(u)
return err
}
Expand Down
Loading