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 {
3636 HTMLContent string
3737}
3838
39- var _wpContentRegEx = regexp .MustCompile (`/wp-content/uploads/[^"]+ ` )
39+ var _imageLinks = regexp .MustCompile (`!\[.*?]\((.+?)\) ` )
4040
4141func (page Page ) getRelativeURL () string {
4242 return page .AbsoluteURL .Path
@@ -52,12 +52,17 @@ func (page Page) Write(w io.Writer) error {
5252 return nil
5353}
5454
55- func (page Page ) GetWPContentLinks () ([]string , error ) {
55+ func (page Page ) WPImageLinks () ([]string , error ) {
5656 markdown , err := page .getMarkdown ()
5757 if err != nil {
5858 return nil , err
5959 }
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
6166}
6267
6368func (page Page ) writeMetadata (w io.Writer ) error {
You can’t perform that action at this time.
0 commit comments