Skip to content
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

Trying to create a theme with ONLY swig as template engine #483

Closed
colthreepv opened this issue Feb 7, 2014 · 2 comments
Closed

Trying to create a theme with ONLY swig as template engine #483

colthreepv opened this issue Feb 7, 2014 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@colthreepv
Copy link

Hello, i'm a user of Swig also on other projects..

I wanted to use it stand-alone, without EJS (so i don't have to learn the syntax!)

Seems impossible to use the include tag functionality
very simple theme

Error Reported:

TypeError: Cannot call method 'replace' of null
    at Object.exports.compile (/usr/lib/node_modules/hexo/node_modules/swig/lib/tags/include.js:35:29)
    at /usr/lib/node_modules/hexo/node_modules/swig/lib/parser.js:735:15
    at Object.exports.each (/usr/lib/node_modules/hexo/node_modules/swig/lib/utils.js:45:11)
    at Object.exports.compile (/usr/lib/node_modules/hexo/node_modules/swig/lib/parser.js:709:9)
    at Object.precompile (/usr/lib/node_modules/hexo/node_modules/swig/lib/swig.js:468:14)
    at Object.compile (/usr/lib/node_modules/hexo/node_modules/swig/lib/swig.js:560:16)
    at module.exports (/usr/lib/node_modules/hexo/lib/plugins/renderer/swig.js:4:15)
    at store.(anonymous function) (/usr/lib/node_modules/hexo/lib/extend/renderer.js:67:27)
    at /usr/lib/node_modules/hexo/lib/core/render.js:181:7
    at fn (/usr/lib/node_modules/hexo/node_modules/async/lib/async.js:579:34)

Any idea how i can fix this? Even with a PR ?

@tommy351 tommy351 added the bug label Feb 16, 2014
tommy351 added a commit that referenced this issue Feb 16, 2014
Add `only` param to partial helper
Bind local context to helper functions
@tommy351
Copy link
Member

This bug will be fixed in the next version. I modified the Swig renderer.

-  return swig.compile(data.text)(locals);
+  return swig.render(data.text, {
+    locals: locals,
+    filename: data.path
+  });

@tommy351 tommy351 added this to the 2.5 milestone Feb 16, 2014
@colthreepv
Copy link
Author

Very thanks! ;) i had no idea where to fix it... going to use master in meantime! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants