Enable Go modules (#5835)

* Remove vendor

* Enable Go modules

* ci: add command to fetch dependencies

* ci: update setting

* ci: update settings

* Require Go 1.11

* Rename module name to gogs.io/gogs
This commit is contained in:
Unknwon
2019-10-23 23:03:17 -07:00
committed by GitHub
parent fb100dbf98
commit 613139e7be
1496 changed files with 985 additions and 785022 deletions

View File

@@ -5,12 +5,11 @@
package markup
import (
"bytes"
"path/filepath"
"strings"
log "gopkg.in/clog.v1"
"github.com/chaseadamsio/goorgeous"
"github.com/niklasfasching/go-org/org"
)
var orgModeExtensions = []string{".org"}
@@ -28,14 +27,11 @@ func IsOrgModeFile(name string) bool {
// RawOrgMode renders content in Org-mode syntax to HTML without handling special links.
func RawOrgMode(body []byte, urlPrefix string) (result []byte) {
// TODO: remove recover code once the third-party package is stable
defer func() {
if err := recover(); err != nil {
result = body
log.Warn("PANIC (RawOrgMode): %v", err)
}
}()
return goorgeous.OrgCommon(body)
html, err := org.New().Silent().Parse(bytes.NewReader(body), urlPrefix).Write(org.NewHTMLWriter())
if err != nil {
return []byte(err.Error())
}
return []byte(html)
}
// OrgMode takes a string or []byte and renders to HTML in Org-mode syntax with special links.