hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.39k stars 4.85k forks source link

template render error: parseAggregate: expected colon after dict key #1605

Closed ocxsBlog closed 8 years ago

ocxsBlog commented 8 years ago

When I run hexo g, some errors happened, there are as follows.

template render error: parseAggregate: expected colon after dict key
at Error.exports.TemplateError (e:\blog\Hexo\node_modules\hexo\node_modules\nunjucks\src\lib.js:51:19
·····

In my context, a equation using latex was written, here are shown for you.

be shown as equation(3): \begin{equation} G(x,y) = Ae^{- \left( \frac{{\left(x-{\mu}{x} \right)}^{2}}{2{{\sigma}{x}}^{2}} + \frac{{\left(y-{\mu}{y} \right)}^{2}}{2{{\sigma}{y}}^{2}} \right)} \tag{3} \end{equation}

If I deleted this ,no error happened.

But If

如公式(2)所示: \begin{equation} G(x) = Ae^{-x^2/2\sigma^2} \tag{2} \end{equation}

was written in context, no error happened too.

And the case needed to be said is that I add

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default"></script>

in my context. Does it make something wrong ? I cannot handle this problem, Help~ Thanks in advance~

More information is shown in image. image image image image image

Xuanwo commented 8 years ago

@ocxsBlog I used mathjax before without problem. And can you paste your yml info of your post? (content beofre ---)

ocxsBlog commented 8 years ago

@Xuanwo Thank you for your reply. But I don't find "your yml info of your post"? Do you mean my "_config.yml"? or "_config.yml" in themes? (I have two _config.yml files ,one in global ./, one in themes ./themes/yilia/)

Xuanwo commented 8 years ago

@ocxsBlog Sorry for my confusing words. I mean your md content, looks like:

title: Hexo
date: 2015-12-2 16:06:11
tags: [xxx]
categories: yyy
toc: true
---
ocxsBlog commented 8 years ago

@Xuanwo Thanks. Here are for you. :smile:

title: hexo
date: 2015-11-19 20:14:57
categories:
tags: [Computer Vision, OpenCV]
toc: true

something wrong ?

Xuanwo commented 8 years ago

@ocxsBlog remove the space in Computer Vision and have try ?

ocxsBlog commented 8 years ago

@Xuanwo Ok!

Xuanwo commented 8 years ago

@ocxsBlog :tada: , have fun with Hexo !

ocxsBlog commented 8 years ago

@Xuanwo Unfortunately, it doesn't work.

Xuanwo commented 8 years ago

@ocxsBlog Sad, change categories: into categories: xxx?

ocxsBlog commented 8 years ago
be shown as equation(3):
\begin{equation}
G(x,y) = Ae^{- \left( \frac{{\left(x-{\mu}{x} \right)}^{2}}{2{{\sigma}{x}}^{2}} + \frac{{\left(y-{\mu}{y} \right)}^{2}}{2{{\sigma}{y}}^{2}} \right)} \tag{3}
\end{equation}

If I add it , something will be wrong as mentioned before. But If I remove it , everything is OK!

But if I add another latex code, it doesnot matter.

Xuanwo commented 8 years ago

I got it, the {{ and }} will be rendered.

maybe you can use {{%raw%}} and {{% endraw %}} to wrap up them.

Xuanwo commented 8 years ago

looks like:

{{%raw%}}
be shown as equation(3):
\begin{equation}
G(x,y) = Ae^{- \left( \frac{{\left(x-{\mu}{x} \right)}^{2}}{2{{\sigma}{x}}^{2}} + \frac{{\left(y-{\mu}{y} \right)}^{2}}{2{{\sigma}{y}}^{2}} \right)} \tag{3}
\end{equation}
{{% endraw %}}
ocxsBlog commented 8 years ago

@Xuanwo It does not work, maybe something wrong in my latex code, I'll check it again. Thank you!

ocxsBlog commented 8 years ago

@Xuanwo I check my latex code in here, it's right.

Xuanwo commented 8 years ago

sorry for my miss leading, try this:

{% raw %}
content
{% endraw %}

the docs are here https://hexo.io/docs/tag-plugins.html#Raw

ocxsBlog commented 8 years ago

@Xuanwo sorry for replying lately. Yes, your way does work. Thank you very much. :+1:

Xuanwo commented 8 years ago

:smiley: , Happy with Hexo~

Huixxi commented 7 years ago

Must be the problem of double'}' so to '{{ }}', you can replace '{ }' with { }

cksachdev commented 4 years ago

I am getting same issue. I want to put

{{{ output.home_link }}}

in my Hexo post and I simply can't. I tried putting in the code block as well. But hexo static generation fails. Any suggestions?

Hushuangjun commented 9 months ago

I am getting same issue. I want to put

{{{ output.home_link }}}

in my Hexo post and I simply can't. I tried putting in the code block as well. But hexo static generation fails. Any suggestions?

add' '(blank) between “{{”, like this "{ {"