File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
src/wp2hugo/internal/hugogenerator/hugopage Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ type Page struct {
36
36
HTMLContent string
37
37
}
38
38
39
- var _wpContentRegEx = regexp .MustCompile (`/wp-content/uploads/[^"]+ ` )
39
+ var _imageLinks = regexp .MustCompile (`!\[.*?]\((.+?)\) ` )
40
40
41
41
func (page Page ) getRelativeURL () string {
42
42
return page .AbsoluteURL .Path
@@ -52,12 +52,17 @@ func (page Page) Write(w io.Writer) error {
52
52
return nil
53
53
}
54
54
55
- func (page Page ) GetWPContentLinks () ([]string , error ) {
55
+ func (page Page ) WPImageLinks () ([]string , error ) {
56
56
markdown , err := page .getMarkdown ()
57
57
if err != nil {
58
58
return nil , err
59
59
}
60
- return _wpContentRegEx .FindAllString (* markdown , - 1 ), nil
60
+ var links []string
61
+ matches := _imageLinks .FindAllStringSubmatch (* markdown , - 1 )
62
+ for _ , match := range matches {
63
+ links = append (links , match [1 ])
64
+ }
65
+ return links , nil
61
66
}
62
67
63
68
func (page Page ) writeMetadata (w io.Writer ) error {
You can’t perform that action at this time.
0 commit comments