-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic in gallery convertor #64
Comments
I suspect this is caused by the importer assuming that a gallery shortcode will have a list of IDs, however, that's not always the case. My export contains gallery shortcodes in the following format (the
That will include all media that is attached to the post by default on WordPress. |
If the WordPress `gallery` shortcode is missing `ids` then persist the original shortcode in the generated Markdown code. Ref: #64 From the original comment ``` I suspect this is caused by the importer assuming that a gallery shortcode will have a list of IDs, however, that's not always the case. My export contains gallery shortcodes in the following format (the link="file" bit I don't think is relevant, but I've included it for completeness). [gallery link="file"] That will include all media that is attached to the post by default on WordPress. ```
Thanks for reporting this. But I have added to code to gracefully log an error and persist the original shortcode in the output Markdown |
Thanks for this. I've raised a follow-on issue with sample XML and the corresponding WordPress page that generated it in case you want to handle that case. |
11:12:54AM DBG wordpress_gallery_converter.go:29 > Replacing gallery with figures
panic: runtime error: index out of range [1] with length 0
goroutine 1 [running]:
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator/hugopage.galleryReplacementFunction({0x105461948, 0x14001c63680}, {0x14001b41940, 0xa?, 0x2?})
wp2hugo/internal/hugogenerator/hugopage/wordpress_gallery_converter.go:51 +0x754
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator/hugopage.replaceGalleryWithFigure.func1({0x14001b41940?, 0x1400161d680?, 0x430?})
wp2hugo/internal/hugogenerator/hugopage/wordpress_gallery_converter.go:33 +0x3c
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator/hugopage.replaceAllStringSubmatchFunc(0x14000ac5360, {0x1400058db00, 0x430}, 0x140000266e0)
wp2hugo/internal/hugogenerator/hugopage/wordpress_category_list_converter.go:39 +0x124
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator/hugopage.replaceGalleryWithFigure({0x105461948, 0x14001c63680}, {0x1400058db00, 0x430})
wp2hugo/internal/hugogenerator/hugopage/wordpress_gallery_converter.go:31 +0x90
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator/hugopage.(*Page).getMarkdown(0x140017e82c0, {0x105461948, 0x14001c63680}, {0x1400058db00, 0x430}, {0x0, 0x0, 0x1400230e1db?})
wp2hugo/internal/hugogenerator/hugopage/hugo_page.go:222 +0x80
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator/hugopage.NewPage({0x105461948, 0x14001c63680}, {{0x1400230e1c0, 0x5}, {0x0, 0x0}, 0x0, {0x1400230e1c8, 0x13}, {0x1400230e1db, ...}, ...}, ...)
wp2hugo/internal/hugogenerator/hugopage/hugo_page.go:83 +0x130
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator.Generator.newHugoPage({{0x10500d0d3, 0x6}, {0x105461948, 0x14001c63680}, {0x104ff7ee7, 0x4}, {{0x14000225430, 0xa}, {0x140003afec0, 0x1b}, ...}, ...}, ...)
wp2hugo/internal/hugogenerator/hugo_gen_setup.go:393 +0x15c
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator.Generator.writePage({{0x10500d0d3, 0x6}, {0x105461948, 0x14001c63680}, {0x104ff7ee7, 0x4}, {{0x14000225430, 0xa}, {0x140003afec0, 0x1b}, ...}, ...}, ...)
wp2hugo/internal/hugogenerator/hugo_gen_setup.go:374 +0x178
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator.Generator.writePosts({{0x10500d0d3, 0x6}, {0x105461948, 0x14001c63680}, {0x104ff7ee7, 0x4}, {{0x14000225430, 0xa}, {0x140003afec0, 0x1b}, ...}, ...}, ...)
wp2hugo/internal/hugogenerator/hugo_gen_setup.go:327 +0x1f4
github.com/ashishb/wp2hugo/src/wp2hugo/internal/hugogenerator.Generator.Generate({{0x10500d0d3, 0x6}, {0x105461948, 0x14001c63680}, {0x104ff7ee7, 0x4}, {{0x14000225430, 0xa}, {0x140003afec0, 0x1b}, ...}, ...})
wp2hugo/internal/hugogenerator/hugo_gen_setup.go:95 +0x130
main.generate({{0x14000225430, 0xa}, {0x140003afec0, 0x1b}, {0x0, 0x0}, 0x140004a4ed0, {0x14000225718, 0x5}, {0x140025a0cf0, ...}, ...}, ...)
wp2hugo/cmd/wp2hugo/main.go:71 +0x278
main.handle({0x16b1933de, 0x27})
wp2hugo/cmd/wp2hugo/main.go:55 +0xe8
main.main()
wp2hugo/cmd/wp2hugo/main.go:41 +0xd4
The text was updated successfully, but these errors were encountered: