mirror of https://github.com/mindoc-org/mindoc.git
兼容Markdown导入特殊的链接
parent
d7186ff270
commit
1eae95ea5d
|
@ -715,12 +715,18 @@ func (book *Book) ImportBook(zipPath string) error {
|
||||||
originalLink := links[0][2]
|
originalLink := links[0][2]
|
||||||
var linkPath string
|
var linkPath string
|
||||||
var err error
|
var err error
|
||||||
|
if strings.HasPrefix(originalLink,"<") {
|
||||||
|
originalLink = strings.TrimPrefix(originalLink,"<")
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(originalLink,">") {
|
||||||
|
originalLink = strings.TrimSuffix(originalLink,">")
|
||||||
|
}
|
||||||
//如果是从根目录开始,
|
//如果是从根目录开始,
|
||||||
if strings.HasPrefix(originalLink,"/") {
|
if strings.HasPrefix(originalLink, "/") {
|
||||||
linkPath,err = filepath.Abs(filepath.Join(tempPath,originalLink))
|
linkPath, err = filepath.Abs(filepath.Join(tempPath, originalLink))
|
||||||
}else if strings.HasPrefix(originalLink, "./"){
|
} else if strings.HasPrefix(originalLink, "./") {
|
||||||
linkPath, err = filepath.Abs(filepath.Join(filepath.Dir(path), originalLink[1:]))
|
linkPath, err = filepath.Abs(filepath.Join(filepath.Dir(path), originalLink[1:]))
|
||||||
}else{
|
} else{
|
||||||
linkPath, err = filepath.Abs(filepath.Join(filepath.Dir(path), originalLink))
|
linkPath, err = filepath.Abs(filepath.Join(filepath.Dir(path), originalLink))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue