HEXO 迁移过程中,将原有 wordpress 迁移过程出错。YAML 报错,求解。


YAML不熟悉。感觉hexo-migrator-wordpress适配性可能还是存在问题。

在使用命令:
$hexo migrate wordpress ~/Downloads/wordpress.2015-08-10.xml

中,报错:


 shell


 ... 
INFO Post found: 一份儿借鉴的旅行笔记 
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html 
JS-YAML: can not read a block mapping entry; a multiline key may not be an implicit key at line 2, column 5: 
date: 2009-12-25 14:48:45 
^ 
...

具体XML中大致位置:


 <xml> 
32727 <excerpt:encoded><![CDATA[]]></excerpt:encoded> 
32728 <wp:post_id>161</wp:post_id> 
32729 <wp:post_date>2009-12-25 22:48:45</wp:post_date> 
32730 <wp:post_date_gmt>2009-12-25 14:48:46</wp:post_date_gmt> 
32731 <wp:comment_status>open</wp:comment_status> 
32732 <wp:ping_status>open</wp:ping_status> 
</xml>

其中 46秒 和 45秒 的区别是我特意修改了一次xml用于定位问题的。但是,整个xml文件中现在只有这个位置有跟这个时间点字符串有关的信息。

现在不知道从哪里下手了。
还请各位有经验的同学协助分享一下经验。

node.js hexo yaml hexo-migrator-wordpress

哦噶米丶小红帽 9 years, 8 months ago

JS-YAML在遇到很多问题的时候都会报这个错……但是基本上都跟它标出来的这个位置没什么关系。

先把这篇文章剔除掉然后migrate试一下,如果没问题那有可能是该文章的tag或者标题有问题。如果还有问题可以对比一下出问题的文章跟这篇文章的共同点。

YAML对格式要求很高,空格和半角冒号等符号很容易出问题。平时可以手动加双引号之类的,migrate的时候就比较麻烦。

阿波罗小萨 answered 9 years, 8 months ago

在Google group上Get到一个人的solution。但是,还是不太明白怎么操作。 解决方案


 
I solved the problem, myself. For anyone else who struggles with this problem: it appears that one must double escape quotation marks within a blog post's name in order to get Hexo to deal with it properly. Have a great day. Take care, Darwin On Wednesday, April 29, 2015 at 12:48:28 PM UTC-7, Darwin Airola wrote: When I try to create my first blog post, I obtain the following (basically useless -- to me -- error): FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html JS-YAML: can not read a block mapping entry; a multiline key may not be an implicit key at line 2, column 5: date: 2015-04-29 12:43:04 Does someone understand this and how to resolve it? Have a great day. Take care, Darwin
反应真他妈的二 answered 9 years, 8 months ago

Your Answer