1. Andriy Kornatskyy
  2. wheezy.template
  3. Issues
Issue #4 wontfix

Parsing a variable without whitespace

Anonymous created an issue

Fantastic codebase you have, I've been playing around with it for a few hours.

So I wanted to do something simular to this: <script src="@BASE_URLjs/jquery.js"></script>

unfortunately it picks it up as "@BASE_URLjs"

I'm pretty certain you're not supporting embedded variables like what I'm trying to achieve, unless I do something like the newline trick, @BASE_URL[0:] or Sean Ryan(BASE_URL) or something similar, which is kind of odd.

Something I did try is on line 320 I changed the regex to:

 200: (re.compile(r'%s(\w*(\.\w+)*)' % token_start),

I basically removed the requirement for inital text so its possible to do <script src="@(BASE_URL)js/jquery.js"></script> which works perfectly.

Of course in this specific case I could just have BASE_URL not have a trailing slash, but you can see my point of where this could be used.

Comments (4)

  1. Andriy Kornatskyy repo owner

    The s function is a shortcut alias for unicode. s(BASE_URL)

    I personally would not use trailing slash in BASE_URL... this let me read well whole url correctly. @BASE_URL/js/jquery.js

    @( any-python-multiline-code ) is used by CodeExtension.

  2. Anonymous

    Fair enough, just one thing - I get "global name 's' is not defined" in python 3.2 when I use s(BASE_URL) as you suggested.

  3. Log in to comment