<commit_before>// Creates a link between Coredata.php and fellow libraries for importing and exporting into TILE

(function(){
	var root=this;
	
	// COREDATA
	// Base class that has methods
	// for creating and editing base 
	// containers of data
	var CoreData=function(args){
		if(!args.content) return;
		
		var self=this;
		self.content=args.content;
		self.containers=[];
		
	};
	CoreData.prototype={
		// step through content and tease out the
		// containers
		parseContent:function(){
			// to be overwritten by child classes
		},
		// main function for saving data into. Decides
		// which function to use
		saveData:function(obj){
			var self=this;
			
			switch(obj.type.toLowerCase()){
				case 'shapes':
					self.saveShape(obj);
					break;
				case 'lines':
					self.saveLines(obj);
					break;
				case 'selections':
					self.saveSelection(obj);
					break;
				case 'labels':
					self.saveLabel(obj);
					break;
				default:
					return;
					break;
			};
		},
		saveShape:function(obj){
			
		},
		saveLine:function(obj){
			
		},
		saveSelection:function(obj){
			
		},
		saveLabel:function(obj){
			
		},
		// Takes containers and outputs 
		// JSON object 
		to_json:function(){
			var self=this;
			
			var json=TILE.engine.getJSON();
			var data={'content':self.content,'tile':json};
			
			// output
			return data;
			
		}
	};
	
	// Used as base class for saving XML during client session
	var streamXMLData=$.extend({
		
		
	},CoreData); 
	
	
	// Uses base XML class to read TEI documents
	var teiWriter=$.extend({
		
	},streamXMLData);

	
});


var CoreData={
	name:"CoreData",
	start:function(mode){
		var self=this;
		
		// add formats to the known formats
		// Call the findFileFormats script
		// store to later add to save and load dialogs
		var str=$.ajax({
			url:'ImportExportScripts/findFileFormats.php',
			type:'GET',
			async:false
		}).responseText;
		
		// send to tile engine
		TILE.engine.addImportExportFormats(str);
		
		// create appropriate parser
		self.parser=null;
		if(TILE.content){
			if(/xmlns\=\"http\:\/\/www\.tei\-c\.org/i.test(TILE.content)){
				// handler for TEI XML
				self.parser=new teiWriter({content:});<commit_msg>Updating coredata plugin again - some minor bugs were in the last commit<commit_after>// Creates a link between Coredata.php and fellow libraries for importing and exporting into TILE

(function(){
	var root=this;
	
	// COREDATA
	// Base class that has methods
	// for creating and editing base 
	// containers of data
	var CoreData=function(args){
		if(!args.content) return;
		
		var self=this;
		self.content=args.content;
		self.containers=[];
		
	};
	CoreData.prototype={
		// step through content and tease out the
		// containers
		parseContent:function(){
			// to be overwritten by child classes
		},
		// main function for saving data into. Decides
		// which function to use
		saveData:function(obj){
			var self=this;
			
			switch(obj.type.toLowerCase()){
				case 'shapes':
					self.saveShape(obj);
					break;
				case 'lines':
					self.saveLines(obj);
					break;
				case 'selections':
					self.saveSelection(obj);
					break;
				case 'labels':
					self.saveLabel(obj);
					break;
				default:
					return;
					break;
			};
		},
		saveShape:function(obj){
			
		},
		saveLine:function(obj){
			
		},
		saveSelection:function(obj){
			
		},
		saveLabel:function(obj){
			
		},
		// Takes containers and outputs 
		// JSON object 
		to_json:function(){
			var self=this;
			
			var json=TILE.engine.getJSON();
			var data={'content':self.content,'tile':json};
			
			// output
			return data;
			
		}
	};
	
	var streamXMLData=function(args){
		var self=new CoreData(args);
		
	};
	
	// Used as base class for saving XML during client session
	streamXMLData.prototype=$.extend({
		
		
	},CoreData); 
	
	var teiWriter=function(args){
		var self=new streamXMLData(args);
		
	};	
	
	// Uses base XML class to read TEI documents
	teiWriter.prototype=$.extend({
		
	},streamXMLData);

	
});


var CoreData={
	name:"CoreData",
	start:function(mode){
		var self=this;
		
		// add formats to the known formats
		// Call the findFileFormats script
		// store to later add to save and load dialogs
		var str=$.ajax({
			url:'ImportExportScripts/findFileFormats.php',
			type:'GET',
			async:false
		}).responseText;
		
		// send to tile engine
		TILE.engine.addImportExportFormats(str);
		
		// create appropriate parser
		self.parser=null;
		if(TILE.content){
			if(/xmlns\=\"http\:\/\/www\.tei\-c\.org/i.test(TILE.content)){
				// handler for TEI XML
				self.parser=new teiWriter({content:TILE.content});
{'fraction_non_alphanumeric': 0.12942453854505973, 'fraction_numerical': 0.0, 'mean_word_length': 2.851170568561873, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '6515284', 'n_tokens_mistral': 1835, 'n_tokens_neox': 1469, 'n_words': 382}