Przeglądaj źródła

fix:修复导出PDF代码折叠的BUG

lifei6671 7 lat temu
rodzic
commit
99643b0712
4 zmienionych plików z 35 dodań i 4 usunięć
  1. 8 1
      commands/command.go
  2. 8 1
      commands/daemon/daemon.go
  3. 13 2
      conf/enumerate.go
  4. 6 0
      static/css/export.css

+ 8 - 1
commands/command.go

@@ -60,9 +60,16 @@ func RegisterDataBase() {
 		if strings.HasPrefix(database, "./") {
 			database = filepath.Join(conf.WorkingDirectory, string(database[1:]))
 		}
+		if p,err := filepath.Abs(database); err == nil {
+			database = p
+		}
 
 		dbPath := filepath.Dir(database)
-		os.MkdirAll(dbPath, 0777)
+
+		if _,err := os.Stat(dbPath); err != nil && os.IsNotExist(err) {
+			os.MkdirAll(dbPath, 0777)
+		}
+
 
 		err := orm.RegisterDataBase("default", "sqlite3", database)
 

+ 8 - 1
commands/daemon/daemon.go

@@ -9,6 +9,7 @@ import (
 	"github.com/lifei6671/mindoc/commands"
 	"github.com/lifei6671/mindoc/conf"
 	"github.com/lifei6671/mindoc/controllers"
+	"path/filepath"
 )
 
 type Daemon struct {
@@ -51,7 +52,13 @@ func (d *Daemon) Run() {
 
 	beego.ErrorController(&controllers.ErrorController{})
 
-	fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", conf.VERSION, conf.BUILD_TIME, os.Args[0], conf.GO_VERSION)
+	f,err := filepath.Abs(os.Args[0])
+
+	if err != nil {
+		f = os.Args[0]
+	}
+
+	fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", conf.VERSION, conf.BUILD_TIME, f, conf.GO_VERSION)
 
 	beego.Run()
 }

+ 13 - 2
conf/enumerate.go

@@ -19,7 +19,6 @@ const CaptchaSessionName = "__captcha__"
 const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
 
 //允许用户名中出现点号
-
 const RegexpAccount = `^[a-zA-Z][a-zA-z0-9\.]{2,50}$`
 
 // PageSize 默认分页条数.
@@ -75,7 +74,7 @@ var (
 
 // app_key
 func GetAppKey() string {
-	return beego.AppConfig.DefaultString("app_key", "godoc")
+	return beego.AppConfig.DefaultString("app_key", "mindoc")
 }
 
 func GetDatabasePrefix() string {
@@ -315,4 +314,16 @@ func WorkingDir(elem ...string) string {
 	elems := append([]string{ WorkingDirectory },elem...)
 
 	return filepath.Join(elems...)
+}
+
+func init()  {
+	if p,err := filepath.Abs("./conf/app.conf"); err == nil {
+		ConfigurationFile = p
+	}
+	if p,err := filepath.Abs("./"); err == nil {
+		WorkingDirectory = p
+	}
+	if p,err := filepath.Abs("./runtime/logs"); err == nil {
+		LogFile = p
+	}
 }

+ 6 - 0
static/css/export.css

@@ -8,4 +8,10 @@ body{
 }
 .editormd-preview-container{
     padding: 0 !important;
+}
+
+.markdown-body pre{
+    max-height: none !important;
+    white-space: pre-wrap !important;
+    word-wrap: break-word !important;
 }