<commit_before><html>
  <head>
    <title>
		{% if decl%}
			{{decl.name}}
		{% else %}
		    no declaration found
		{% endif %}
    </title>  
    <link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="/easyui/themes/color.css">
    <link rel="stylesheet" type="text/css" href="/css/easyui.css">
    <link rel="stylesheet" type="text/css" href="/css/studio.css">
	<link rel="alternate" type="application/json+oembed"
	  href="http://sutl-studio.appspot.com/oembed.json?url={{url}}"
	  title="sUTL Try embed profile" />
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.0/mustache.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script>
  </head>
  <body>
    <div id="layoutMain" class="easyui-layout" style="width:100%;height:100%">
    {% if decl %}
        <div data-options="region:'center'">
			<div id="accBody" class="easyui-tabs" data-options="onSelect:OnSelect" style="width: 100%; height: 100%;">
				<div title="sUTL Declaration" data-options="selected:true" style="padding:0px;">	
					<div class="ss-item">
						<div id="edTransform" class="editor" name="transform" style="min-width: 200px; width:100%; height:90%;"></div>
						<div id="transformmsg" class="message"></div>
					</div>
		       	</div>    
		         	<div title="Source" style="padding:0px;">	
		           	<div class="ss-item">
						<div id="edSource" class="editor" name="source" style="min-width: 200px; width:100%; height:90%;"></div>
		               	<div id="sourcemsg" class="message"></div>
					</div>
		       	</div>    
		         	<div title="Result" style="padding:0px;">	
		           	<div class="ss-item">
					<div id="edResult" class="editor" name="result" style="min-width: 200px; width:100%; height:90%;"></div>
				</div>
			</div>    
		</div>
	{% else %}
	    No sUTL declaration found
	{% endif %}
	</div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="/js/sUTL.js"></script>
    <script>
    
    var ldecl = {{decl | safe}};
    var lsource = {{source | safe}};
    var llib = {{lib | safe}};
    
    var setupEditor = function(aId)
    {
        var editor = ace.edit(aId);
        editor.setTheme("ace/theme/monokai");
        editor.getSession().setMode("ace/mode/json");
        editor.getSession().setTabSize(2);
        editor.getSession().setUseSoftTabs(true);
        editor.setFontSize(14);
        return editor;
    };
    
    var forceUpdate = function(aEditor)
    {
    	aEditor.resize(true);
//        aEditor.gotoLine(1);
//        aEditor.gotoLine(0);
    }
    
    var _edSource = null;
    var _edTransform = null;
    var _edResult = null;

	_edSource = setupEditor("edSource");
	_edTransform = setupEditor("edTransform");
	_edResult = setupEditor("edResult");

	var edix = -1;
  	if (lsource)
  		_edSource.setValue(lsource, edix);
	else
		_edSource.setValue("", edix);
    
  	if (ldecl)
  		_edTransform.setValue(JSON.stringify(ldecl, null, 2), edix);
	else
		_edTransform.setValue("", edix);
	
	_edResult.setValue("", edix);

	var lupdateResult = function() {
        try
        {
            var lsource = JSON.parse(_edSource.getValue());
            var ldecl = JSON.parse(_edTransform.getValue());
            
            var lresult = null;

            var clresult;
	        
            clresult = sUTL.compilelib([ldecl], [llib], false);

            if (!clresult)
            {
                lresult = "** Can't load libs **";
            }
            else if ("fail" in clresult)
            {
                lresult = clresult["fail"];
            }
            else
            {
                lresult = sUTL.evaluate(lsource, ldecl["transform-t"], clresult["lib"] || {}, 0);
            }

            _edResult.setValue(JSON.stringify(lresult, null, 2), edix);
        }
        catch (e)
        {
            console.log(e);
            var lerrorMessage = "Result Exception: " + e.message;
            _edResult.setValue(lerrorMessage, edix);
        }
    }

	lupdateResult();
	
	_edSource.getSession().on('change', lupdateResult);
	_edTransform.getSession().on('change', lupdateResult);

	forceUpdate(_edTransform);
	//forceUpdate(_edSource);
	
	var OnSelect = function(title, index)
	{
		forceUpdate(_edSource);
    	forceUpdate(_edResult);
	}
    </script>
   </body>
</html><commit_msg>Fixed the "Try" page to have Transform up front instead of Declaration (and pushed declaration to the back)<commit_after><html>
  <head>
    <title>
		{% if decl%}
			{{decl.name}}
		{% else %}
		    no declaration found
		{% endif %}
    </title>  
    <link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="/easyui/themes/color.css">
    <link rel="stylesheet" type="text/css" href="/css/easyui.css">
    <link rel="stylesheet" type="text/css" href="/css/studio.css">
	<link rel="alternate" type="application/json+oembed"
	  href="http://sutl-studio.appspot.com/oembed.json?url={{url}}"
	  title="sUTL Try embed profile" />
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.2.0/mustache.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script>
  </head>
  <body>
    <div id="layoutMain" class="easyui-layout" style="width:100%;height:100%">
    {% if decl %}
        <div data-options="region:'center'">
			<div id="accBody" class="easyui-tabs" data-options="onSelect:OnSelect" style="width: 100%; height: 100%;">
				<div title="Transform" data-options="selected:true" style="padding:0px;">	
					<div class="ss-item">
						<div id="edTransform" class="editor" name="transform" style="min-width: 200px; width:100%; height:90%;"></div>
						<div id="transformmsg" class="message"></div>
					</div>
		       	</div>    
		        <div title="Source" style="padding:0px;">	
		           	<div class="ss-item">
						<div id="edSource" class="editor" name="source" style="min-width: 200px; width:100%; height:90%;"></div>
		               	<div id="sourcemsg" class="message"></div>
					</div>
		       	</div>    
		        <div title="Result" style="padding:0px;">	
		           	<div class="ss-item">
						<div id="edResult" class="editor" name="result" style="min-width: 200px; width:100%; height:90%;"></div>
					</div>
		       	</div>    
		        <div title="Declaration" style="padding:0px;">	
					<div class="ss-item">
						<div id="edDeclaration" class="editor" name="declaration" style="min-width: 200px; width:100%; height:90%;"></div>
					</div>
				</div>
			</div>    
		</div>
	{% else %}
	    No sUTL declaration found
	{% endif %}
	</div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="/js/sUTL.js"></script>
    <script>
    var ldecl = {{decl | safe}};
    var lsource = {{source | safe}};
    var llib = {{lib | safe}};
    
    var setupEditor = function(aId, aReadOnly)
    {
        var editor = ace.edit(aId);
        editor.setTheme("ace/theme/monokai");
        editor.getSession().setMode("ace/mode/json");
        editor.getSession().setTabSize(2);
        editor.getSession().setUseSoftTabs(true);
        editor.setFontSize(14);
        editor.setReadOnly(aReadOnly);
        return editor;
    };
    
    var forceUpdate = function(aEditor)
    {
    	aEditor.resize(true);
//        aEditor.gotoLine(1);
//        aEditor.gotoLine(0);
    }
    
    var _edSource = null;
    var _edTransform = null;
    var _edResult = null;
    var _edDeclaration = null;

	_edSource = setupEditor("edSource", false);
	_edTransform = setupEditor("edTransform", false);
	_edResult = setupEditor("edResult", true);
	_edDeclaration = setupEditor("edDeclaration", true);

	var edix = -1;
  	if (lsource)
  		_edSource.setValue(lsource, edix);
	else
		_edSource.setValue("", edix);

  	if (ldecl)
  	{
  		_edTransform.setValue(JSON.stringify(ldecl["transform-t"], null, 2), edix);
  		_edDeclaration.setValue(JSON.stringify(ldecl, null, 2), edix);
  	}
	else
	{
		_edTransform.setValue("", edix);
  		_edDeclaration.setValue("", edix);
	}
	
	_edResult.setValue("", edix);

	var lupdateResult = function() {
        try
        {
            var lsource = JSON.parse(_edSource.getValue());
            var ltransform = JSON.parse(_edTransform.getValue());
            var lnewDecl = jQuery.extend(true, {}, ldecl);
            lnewDecl["transform-t"] = ltransform;
            ldecl = lnewDecl;

            _edDeclaration.setValue(JSON.stringify(lnewDecl, null, 2), edix);

            var lresult = null;

            var clresult;
	        
            clresult = sUTL.compilelib([ldecl], [llib], false);

            if (!clresult)
            {
                lresult = "** Can't load libs **";
            }
            else if ("fail" in clresult)
            {
                lresult = clresult["fail"];
            }
            else
            {
                lresult = sUTL.evaluate(lsource, ldecl["transform-t"], clresult["lib"] || {}, 0);
            }

            _edResult.setValue(JSON.stringify(lresult, null, 2), edix);
        }
        catch (e)
        {
            console.log(e);
            var lerrorMessage = "Result Exception: " + e.message;
            _edResult.setValue(lerrorMessage, edix);
        }
    }

	lupdateResult();
	
	_edSource.getSession().on('change', lupdateResult);
	_edTransform.getSession().on('change', lupdateResult);

	forceUpdate(_edTransform);
	//forceUpdate(_edSource);
	
	var OnSelect = function(title, index)
	{
		forceUpdate(_edSource);
    	forceUpdate(_edResult);
    	forceUpdate(_edDeclaration);
	}
    </script>
   </body>
</html>
{'fraction_non_alphanumeric': 0.17293378443692606, 'fraction_numerical': 0.012856452392460126, 'mean_word_length': 2.6545390321441187, 'pattern_counts': {'":': 0, '<': 118, '<?xml version=': 0, '>': 118, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4065621', 'n_tokens_mistral': 3735, 'n_tokens_neox': 3389, 'n_words': 601}