javascriptconcatenationtiddlywiki

concatenate Braces with string in javascript


TiddlyWiki uses the folowing markup to display text as code :

{{{
your code here
}}}

I did this script to display MATLAB files inline

<script>
var p;
 if (document.all){
   // For IE, create an ActiveX Object instance
   p = new ActiveXObject("Microsoft.XMLHTTP");
 }
 else {
   // For mozilla, create an instance of XMLHttpRequest.
   p = new XMLHttpRequest();
 }
 p.open("GET","$1",false);
 p.send(null);
wikify(p.responseText,place);
</script>

Where $1 is a .m file url.

This code works, the .m file content is finely displayed.

I just don't manage to concatenate p.responseText with brace to display nicely the .m file content.

Can you please help me ?


Solution

  • So, the solution is to concatenate the following wrapper to the content:

    wikify("{{{\n" + p.responseText + "\n}}}",place);