-
Notifications
You must be signed in to change notification settings - Fork 464
Extending and refactoring WordPress importer #1867
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
Conversation
Should be simple to implement by just talking to the |
if out_folder_slug: | ||
self.posts_pages[post_id] = (post_type, out_folder_slug[0], out_folder_slug[1]) | ||
|
||
def write_attachments_info(self, path, attachments): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who would use those files? Would it actually be useful to give Nikola some real post attachments support, btw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files could be used by plugins for the WordPress page compiler. For example, if you include attachments into a post as a gallery, you have something like
[gallery columns="3" link="file" ids="52,53,54,55,56,57,58"]
inside the post -- here 52 up to 58 are IDs for attachments. If you have this .json
file, you can map the IDs to actual images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About giving Nikola proper post attachments functionality: I don't really care enough about that feature to implement/want it.
Reviewed 1 of 2 files at r1. Comments from the review on Reviewable.io |
nikola/plugins/command/import_wordpress.py, line 443 [r1] (raw file): Comments from the review on Reviewable.io |
Regarding the other post formats: I don't know. That was already implemented before I touched it; apparently there's a markdown plugin for WordPress. (I looked it up: #484) |
Ok, I now looked at the WordPress plugin which allows to use different text formats, and added more explicit support, including an error when an unsupported format is encountered. |
Regarding calling So installing a plugin and then calling |
for cat, path in cat_map.items(): | ||
self._category_paths[cat] = utils.join_hierarchical_category_path(path) | ||
|
||
def _adjust_config_template(self, channel, rendered_template): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huge 👎
Instead, you should change the input to the template and the template itself, just like I did in 0f4b1e2 (relevant lines: 57/216). Don’t mess with regex. (It was done before, this code is probably ancient)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I took the old code and modified it. I've removed it now and did it the way you wanted. (Actually I prefer it that way, too :) )
Ok, I think I'm done for now. |
* Allowing to use WordPress page compiler on imported site instead of | ||
converting posts to markdown with --use-wordpress-compiler | ||
* Allowing to automatically install the WordPress page compiler when | ||
needed with --install_wordpress_compiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use -
instead of _
also, you should advertise the compiler if the user does not ask for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that was a copy'n'paste typo. Fixed.
|
@@ -1908,13 +1908,23 @@ the following: | |||
|
|||
This is also useful for DISQUS thread migration! | |||
|
|||
* Allows you to export your comments with each post | |||
* Exports information on attachments per post | |||
* Will try to convert the content of your posts. This is *not* error free, because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put info about your compiler here, drop this paragraph (you should really push the wordpress compiler)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote the documentation a bit. Can you take another look?
…, and let it decide extension. No longer using extension .wp for WordPress-to-markdown converted posts. Exporting wp-status and excerpt (if available). Allowing to exclude private items and include empty items.
d36ced3
to
4cbf1aa
Compare
Ok, all tests successfull (with two of my WordPress dumps and different settings, and automatic ones). Squashing a bit, and merging. |
Also supporting category hierarchies.
…tions (suggested by @Kwpolska).
cc @felixfontein Signed-off-by: Chris Warrick <kwpolska@gmail.com>
…from all actions.
… either locally (when transforming posts right away) or into the new site.
…l be called conf.py.import_wordpress-xxx)
Not showing 'assuming --user' message when output_dir is forced.
Also supplying attachment info to WordPress page compiler when directly converting to HTML.
…ss page compiler won't find shortcode plugins coming in the package.
ae11c0e
to
190573a
Compare
Extending and refactoring WordPress importer.
Beginning with some refactoring and extending of the WordPress importer.
Done so far:
.wp
for WordPress-to-markdown converted posts..html
files).