-
Notifications
You must be signed in to change notification settings - Fork 317
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
joomla3: allow importing drafts #272
Conversation
A new "state" parameter is added to select posts based on their publishing state. By default only published articles are imported, and unpublished articles are imported into the _drafts directory.
@@ -16,6 +16,7 @@ def self.specify_options(c) | |||
c.option 'host', '--host', 'Database host name' | |||
c.option 'category', '--category', 'ID of the category' | |||
c.option 'prefix', '--prefix', 'Table prefix name' | |||
c.option 'state', '--state', 'Which publishing state to select. 0: unpublished, 1: published, 2: archived (default: 1)' |
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.
This will need to change to state STATE
right after c.option
so the parser knows it takes an arg. Surprised the ones above aren't like that... Whoops!
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.
Also, I would consider using the full words here – it's much more readable to use --state unpublished
than --state 0
.
Thank you, @GreatEmerald! I took a look through and left a few comments. Let me know what you think! ✨ |
Yeap, that sounds good generally. I was hoping someone with more Ruby knowledge would look at it ;) I don't really get your first comment: what should all those options look like, then? While I'm at it, I was also wondering if there's a good way to deal with https://github.com/jekyll/jekyll-import/blob/master/lib/jekyll-import/importers/joomla3.rb#L50 since it just filters out the "uncategorised" category, which may very well be useful to import; one can run the tool twice, once with category ID specifically set to 2, but, well, as you mentioned, that's pretty cryptic. Maybe an option like |
Oh, and when I used the tool I noticed that some of the articles didn't actually get imported at all, despite me rerunning the tool four times to make sure nothing is exluded. I'll try to find out why. |
Were you able to figure out this bug?
Let's think about the general use case for importing your posts into Jekyll. You probably want every piece of content you produces, including unpublished and archived. The only things I wouldn't care about are trashed items. When I run the importer, I'd like all of my draft, published, unpublished, and archived posts imported unless I specify. Perhaps the best thing is to default to importing all and only using the $ jekyll import joomla3
# Imports *everything* by default except trashed items
$ jekyll import joomla3 --states unpublished,published
# Imports posts with `unpublished` and `published` states only What do you think? |
Yes, I double-checked and it turns out that it did import everything correctly after all, it was just me searching for one term when the article was named another... And yes, that is indeed reasonable and how I expected the importer to work as well. The reason why I also made it initially only import one is because it makes code simpler, but the enum ("hash") idea would indeed nicely solve the issue to allow for importing all by default. As for the "uncategorised" category, indeed, I don't really know why the original author thought that it should be excluded by default. I'd rather it was included by default too. |
Closing after a long period of inactivity, feel free to re-open to fix remaining conflicts and get this merged. |
Fix for issue #268. Also some whitespace cleanup (tabs and spaces where mixed beforehand).
This is a bit of a behaviour change in that it now only imports published articles by default, as opposed to both published and archived ones. But it can be rerun several times for several publishing states, so it shouldn't be much of an issue.