fix computation of image ids
Signed-off-by: Tobias Erbshäußer <tobias@tesoft.dev>
This commit is contained in:
+4
-4
@@ -66,7 +66,7 @@ func ParseArticle(reader io.Reader, filePrefix string) (*Article, error) {
|
||||
}
|
||||
|
||||
usedFiles := make(map[string]ArticleFile)
|
||||
nextFileId := int64(0)
|
||||
prevFileId := int64(0)
|
||||
|
||||
pc, html, err := md.Parse(func(path string) (string, error) {
|
||||
content, ok := tarFiles[strings.TrimPrefix(path, "./")]
|
||||
@@ -74,10 +74,10 @@ func ParseArticle(reader io.Reader, filePrefix string) (*Article, error) {
|
||||
return "", errors.New("file '" + path + "' not found")
|
||||
}
|
||||
|
||||
usedFiles[path] = ArticleFile{nextFileId, content}
|
||||
nextFileId++
|
||||
prevFileId++
|
||||
usedFiles[path] = ArticleFile{prevFileId, content}
|
||||
|
||||
return filePrefix + strconv.FormatInt(nextFileId, 10), nil
|
||||
return filePrefix + strconv.FormatInt(prevFileId, 10), nil
|
||||
}, readmeBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user