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

htmlString don't work in julius #1291

Closed
jairoGilC opened this issue Nov 4, 2016 · 10 comments
Closed

htmlString don't work in julius #1291

jairoGilC opened this issue Nov 4, 2016 · 10 comments

Comments

@jairoGilC
Copy link

jairoGilC commented Nov 4, 2016

Hi I have the following htmlString in the homepage.julius that work fine:

var i = 1;
var html = 
    '<div  class="form-group form-inline" >' +
      '<div class="form-group" >' + 
        '<div for="documentType' + i +'"> TD </div>' +
        '<select name="documentType' + i +'" id="documentType' + i +'" data-select="documentType' + i +'">' +
          '<option value="1">1'+
          '<option value="2">2'+
          '<option value="3">3'+
          '<option value="4">4'+
          '<option value="7">7'+
        '</select>'            +
        '<spam for="documentType' + i +'" id="documentType' + i +'Spam" class="help-block error-block">Error</spam>' +
      '</div>' +   

But when add any other tag, the autogen file It goes blank, so I copy and paste the code in the autogen File and work fine so I suppose that the error is in the julius parse.

var i = 1;
var html = 
    '<div  class="form-group form-inline" >' +
      '<div class="form-group" >' + 
        '<div for="documentType' + i +'"> TD </div>' +
        '<select name="documentType' + i +'" id="documentType' + i +'" data-select="documentType' + i +'">' +
          '<option value="1">1'+
          '<option value="2">2'+
          '<option value="3">3'+
          '<option value="4">4'+
          '<option value="7">7'+
        '</select>'            +
        '<spam for="documentType' + i +'" id="documentType' + i +'Spam" class="help-block error-block">Error</spam>' +
      '</div>' +     
         
      '<div class="form-group" >' +
        '<div for="documentNumber' + i +'"> Numero de documento </div>' +
        '<input type=number name="documentNumber' + i +'' + i +'" id="documentNumber' + i +'" data-int="documentNumber' + i +'">' +
        ' <spam for="documentNumber' + i +'" id="documentNumber' + i +'Spam" class="help-block error-block">Error</spam>' +
      '</div>' +   
    '</div>' ; 
@paul-rouse
Copy link
Contributor

This seems to be the minifying, not actually julius. I have just reported an issue against language-javascript (erikd/language-javascript#58).

You should be able to circumvent it by breaking your expression for html into several shorter pieces. The problem is the complexity of the expression, and my testing suggests that the problem is the number of + i + groups - ie those which imply a conversion - not simply the number of plus signs.

@paul-rouse
Copy link
Contributor

@jairoGilC Can you confirm that your original problem is fixed if you use language-javascript-0.6.0.9, please.

@jairoGilC
Copy link
Author

jairoGilC commented Nov 8, 2016

@paul-rouse Thanks for all your help, in language-javascript-0.6.0.9 get the same error with the same expression

I'm a noob in Yesod and Haskell and maybe make a mistake, to test I change my .yaml with this:

resolver: lts-6.11
packages:
- '.'
extra-deps: 
  - language-javascript-0.6.0.9

and then run stack build but when test get the same problem the autogen File is empty

@paul-rouse
Copy link
Contributor

@jairoGilC Yes, that is correct. I think you might have something old left behind, so could you please try again after:

  • delete everything from static/tmp
  • do stack clean before stack build

@jairoGilC
Copy link
Author

jairoGilC commented Nov 8, 2016

@paul-rouse delete the contend of /tmp and with this comand the result is the same, I dont know if this is relevant but search language-javascript in all the proyect the only file where still can find a reference to the 6.0.8 version is in yesod-devel/ghcargs.txt

"-optl-Wl,-rpath,/home/pys/.stack/snapshots/x86_64-linux/lts-6.13/7.10.3/lib/x86_64-linux-ghc-7.10.3/language-javascript-0.6.0.8-2MPHWrz8iC2BlivMgOE8HE"

@paul-rouse
Copy link
Contributor

@jairoGilC That is the version in the snapshot - the version you declare in extra-deps in stack.yaml goes into the .stack-work directory in the project, and overrides the snapshot one.

I am sorry to repeat this - are you absolutely sure you deleted the old static/tmp/autogen file?

@jairoGilC
Copy link
Author

@paul-rouse I'm sure, this time delete the folder tmp not only the files but the result is the same

@paul-rouse
Copy link
Contributor

@jairoGilC I still think something must be left over from when it wasn't working, I just don't know what! I was able to reproduce the problem you described originally, but for me it goes away when I rebuild with language-javascript-0.6.0.9 and delete the autogen file.

@jairoGilC
Copy link
Author

jairoGilC commented Nov 8, 2016

I change the .yml to 0.6.0.8 and then to 0.6.0.9 again and yesod-devel/ghcargs.txt finally change, and the bug was fixed; thanks @paul-rouse for all your help

@paul-rouse
Copy link
Contributor

@jairoGilC I am glad you got it working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants