Hello Jeremy, I'm just using the maketid widget from Matabelle,which is based on Stephans widget. Let me know if what I posted below is what you asked
1. 2. make: "{"text":"$(code)$","bag":"default","revision":"0","type":"text/vnd.tiddlywiki","title":"_ipx/templates/insertCode/codeTemplate","modified":"20141031075025632","created":"20141031074930842","comments":"$(comments)$"}" 3. makeClone: undefined 4. modificationField: undefined 5. newtags: undefined 6. t: undefined 7. tempTest: "{"text":"Now↵Try ↵LB","bag":"default","revision":"0","type":"text/vnd.tiddlywiki","title":"_ipx/templates/insertCode/codeTemplate","modified":"20141031075025632","created":"20141031074930842","comments":"no"}" 8. El martes, 4 de noviembre de 2014 12:58:53 UTC+1, Jeremy Ruston escribió: > > Hi Danielo > > I don't think that that code is a great approach. There's too much scope > for variable substitution to break the JSON formatting. In particular, JSON > needs string constants to be encoded if they include double quotes, and the > variable substitution mechanism isn't capable of that. It would be much > better to apply variable substitution to each field in turn. > > Can you log the complete original JSON string as well as the value that > comes out of substituteVariableReferences? > > Best wishes > > Jeremy > > > > On Tue, Nov 4, 2014 at 11:54 AM, Danielo Rodríguez <rdan...@gmail.com > <javascript:>> wrote: > >> Hello, >> >> I traced down the code and the problem is on the JSON.parse part. >> After the substituteVariableReferences execution, JSON.parse will receive >> the following string: >> >> "{"text":"Now↵Try >> ↵LB","bag":"default","revision":"0","type":"text/vnd.tiddlywiki","title" >> >> Which does not seems to be a valid JSON string. >> The code that fails is like this >> >> // Make the clone of the template >> var make = this.wiki.getTiddlerAsJson(this.maketidTemplate); >> debugger; >> var tempTest =this.substituteVariableReferences(make); >> var makeClone = JSON.parse(tempTest); >> >> The problem is that substituteVariableReferences returns that string >> with those unexpected characters. Maybe the substituteVariableReferences >> should return \n instead? >> >> El martes, 4 de noviembre de 2014 12:38:07 UTC+1, Jeremy Ruston escribió: >>> >>> Hi Danielo >>> >>> There's no problem that I can see with the snippet you posted above. Can >>> you put up a minimal test case? >>> >>> Best wishes >>> >>> Jeremy >>> >>> >>> On Tue, Nov 4, 2014 at 11:27 AM, Danielo Rodríguez <rdan...@gmail.com> >>> wrote: >>> >>>> The error is much more concise in firefox: >>>> >>>> SyntaxError: JSON.parse: bad control character in string literal at >>>> line 1 column 13 of the JSON data >>>> >>>> Why? >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "TiddlyWiki" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to tiddlywiki+...@googlegroups.com. >>>> To post to this group, send email to tiddl...@googlegroups.com. >>>> Visit this group at http://groups.google.com/group/tiddlywiki. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Jeremy Ruston >>> mailto:jeremy...@gmail.com >>> >> > > > -- > Jeremy Ruston > mailto:jeremy...@gmail.com <javascript:> > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/d/optout.