24 Use <code>{x}</code> as a placeholder for each argument.
26 <textarea id="template"></textarea>
29 Arguments (comma separated)
34 <textarea id="args"></textarea>
39 <input id="go" type="button" value="Generate code" />
41 <textarea id="output"></textarea>
43 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
48 $("#go").click(function(){
51 var template = $("#template").val()
52 var args = $("#args").val()
55 var argLines = args.split("\n")
56 for (var line in argLines) {
58 var argLine = argLines[line];
59 var thisTemp = template
61 // get individual args
62 var args = argLine.split(",")
64 for (var argI in args) {
65 var argText = args[argI];
66 var argPlaceholder = "{" + argI + "}";
68 while (thisTemp.indexOf(argPlaceholder) > -1) {
69 thisTemp = thisTemp.replace(argPlaceholder, argText);
78 $("#output").val(output);