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
Wordpress importer doesn't translate [code] #1186
Comments
This is a wordpress.com-only thing, documented here: http://en.support.wordpress.com/code/posting-source-code/ |
I just did a simple regex replace of |
One issue with it was that wordpress replaced things like |
We’d need a smarter parser, because:
This requires some work and time, though. Someone might take care of this, one day… |
That is handled by my regular expression The other problem I found is that there are blank lines between each line in |
There is already this https://github.com/getnikola/nikola/blob/master/nikola/plugins/command/import_wordpress.py#L352, but I don't understand what it is doing. What does the |
probably some other form of fenced code blocks in python-markdown. (it’s also seemingly for another code-block extension. wordpress is a fucking mess.) |
I am willing to take a shot at fixing this, since I have to do it anyway for my imported blog. |
Understood. Go on, and have fun. (make sure to read the documentation for the wordpress feature, linked above.) |
I'll probably end up leaving the configuration parameters unimplemented, as I didn't use them. |
s/unimplemented/ignored/ s/I didn't/Nikola doesn’t/ |
The extra newlines are only appearing in my oldest blog posts. So probably that was some Wordpress thing that was fixed. There's no reliable way to detect the issue programmatically (unless we have some date that we know it changed). |
OK, so I guess the only question I have is, what is the best way to convert things like |
I was actually planning on unimplemented, but I guess I can do ignored too. I just need to make my regex a little more general. |
Just happily ignore the newline issue, as users are meant to review the output anyways. For converting, you’d need to know that you are in a |
I mean, is there a |
There are three you need to take care of:
|
Ah, the rest are just literal? I found http://www.ascii.cl/htmlcodes.htm. I think I also need |
In my Wordpress block, I made good use of their code blocks, which are delimited like
or, to use a language
(I think
language
can also be spelled justlang
).If the wordpress importer uses Markdown, it could just translate
[code]
to, `[code lang='x']` to
x, and enable fenced code blocks.The text was updated successfully, but these errors were encountered: