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)
|
usedFiles := make(map[string]ArticleFile)
|
||||||
nextFileId := int64(0)
|
prevFileId := int64(0)
|
||||||
|
|
||||||
pc, html, err := md.Parse(func(path string) (string, error) {
|
pc, html, err := md.Parse(func(path string) (string, error) {
|
||||||
content, ok := tarFiles[strings.TrimPrefix(path, "./")]
|
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")
|
return "", errors.New("file '" + path + "' not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
usedFiles[path] = ArticleFile{nextFileId, content}
|
prevFileId++
|
||||||
nextFileId++
|
usedFiles[path] = ArticleFile{prevFileId, content}
|
||||||
|
|
||||||
return filePrefix + strconv.FormatInt(nextFileId, 10), nil
|
return filePrefix + strconv.FormatInt(prevFileId, 10), nil
|
||||||
}, readmeBytes)
|
}, readmeBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user