兼容Markdown导入特殊的链接

pull/358/head
lifei6671 2018-07-23 14:38:33 +08:00
parent d7186ff270
commit 1eae95ea5d
1 changed files with 10 additions and 4 deletions

View File

@ -715,6 +715,12 @@ 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))