-
Notifications
You must be signed in to change notification settings - Fork 316
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
Re-implement Dotclear importer #512
Conversation
Hello @jrfern, If you wish to try this out, you may edit your Gemfile as follows: # Gemfile
gem "jekyll"
gem "jekyll-import", github: "jekyll/jekyll-import", ref: "refs/pull/512/head" (There is no need to include TODO:
|
Great! Thank you very much. Now I get
When run without this option (and after following your instructions)
Inside the zip archive there's a "img" directory with the image files and subdirectories. |
front_matter_data["dotclear_post_url"] = post["post_url"] | ||
|
||
Jekyll.logger.info "Creating:", path | ||
File.write(path, "#{YAML.dump(front_matter_data)}---\n\n#{ReverseMarkdown.convert(content).strip}\n") |
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.
ReverseMarkdown-- should this be an optional thing? Or do we always want to reverse 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.
The current implementation on this branch creates .md
files, so reversing the (X)HTML to Markdown felt necessary.
Do you think it's best to create .html
files with markup as in the backup file?
FileUtils.mkdir_p("_drafts") unless posts.empty? | ||
|
||
posts.each do |post| | ||
date, title, content = post.values_at("post_creadt", "post_title", "post_content") |
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.
post_created
? Might have forgotten an e?
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.
The strings here mirror the header keys in the backup file (attached as part of this PR):
[post post_id,blog_id,user_id,cat_id,post_dt,post_tz,post_creadt,post_upddt,post_password,...]
9168da1
to
4c936e6
Compare
@jrfern The
In the backup file you provided previously, the value to key |
Yes, please, @ashmaroli
ashmaroli at users.noreply.github.com? Impossible. I'm feeling silly, but I haven't been able to find your email, just your jekyll-talk, github, reddit, linkedin accounts... Mine is jrfern at gmail...
I don't understand, the MiUser phrase was a reference to the path. I unzipped the media.zip file, and it created media/img/image_files. Then run the command with --mediafolder path/media/img/ (as it never worked I don't know if it should be simply --mediafolder path/media/ ). Hope this helps. One more thing, for my tests your suggested
Should I change that now that the PR has been approved? |
Ah! I should have just mentioned it right away instead.. it's ashmaroli at gmail..
The original implementation (in existing releases) was to expect just
The reference is permanent. It would be valid even if the pull request branch gets deleted after the pull request is merged. However, since the pull request is still a work-in-progress, you may have to run |
@ashmaroli Real backup file sent privately. |
Thanks @jrfern |
Hello @jrfern |
Recuperated 60 entries into _drafts and their images! Great! I'm fighting at the moment with the paginate-v2 plugin and so can't check but I would say that the import worked. Thank you again, @ashmaroli |
Happy to hear that, @jrfern. Good luck tackling the pagination plugin 🙂 |
First analysis of the new plugin. I moved the older post ('Informe K-12 Open Minds Conference 2007 - parte I: Europeos') to the posts directory. Works quite well, not totally well. The excerpt part is missing (it's in the backup). For example:
This is converted into
The blockquote (the whole header) is missing in the import. ERROR `/assets/dotclear/img/.dia_1_m.jpg' not found.In the backup
Now it is
The images are treated as links. That was OK in the sense that there used to be two versions of each image, and the small one is a link to the big one, but there are no names starting with a dot in assets/dotclear and the link shoud be turned into an >img> tag. So we miss the introductions to the entries and the images are treated as links. Can any of these points be fixed programmatically? |
@jrfern Added support for importing excerpts. While I had seen the
These files do not have separate identity in the
They're already valid img tags. You don't see it or a placeholder holder for missing image because of CSS. |
Great! The excerpt was the only problem with the import, the issue with the images was a problem with the backup, not the import. From my side the new code works and I have recuperated the posts from this old blog. |
* "Categories" are not currently imported from the export-file. | ||
* "Tags" however will be imported and added to relevant posts' front matter. | ||
* Post URLs are imported from the export-file into front matter with key `original_url`. | ||
* Jekyll doesn't manage timezone for individual posts. Therefore, timezone metadata of individual posts will be ignored. |
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.
If a timezone offset is present, it would be preferable to preserve it for each post, I think. I always use timezone offsets in my post dates. If it's too hard to extract then we can skip 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.
I agree with this. Unfortunately, the timezone here is the IANA id (e.g. Europe/Madrid
) instead of the offset.
In the attached mock export-file, it is "CET"
.
csv | ||
pp | ||
)) | ||
JekyllImport.require_with_fallback(%w()) |
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.
Omit this if we don't require anything.
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 is required for compatibility with the local plugin docs/_plugins/importer_metadata.rb
.
@jekyllbot: merge +minor |
Ashwin Maroli: Re-implement Dotclear importer (#512) Merge pull request 512
Re-implement Dotclear importer based on export file provided by @jrfern in #510 (comment).
This drops dependency on
activesupport
, includes associated tests and adds provided export file for future development.Closes #510