<commit_before>//
//
//
//
//

var slug = require('slug');
var lang_module = require('./lang');
var tools = require('./tools');

var db = require('./db').connect();

var postsPerPage = 10;


var app = function()
{
	var express = require('express');
	var app = express();
	
	app.set('views', GLOBAL.views_dir_path);
	app.set('view engine', 'jade');

	app.get('/rss/:lang',renderRSS);	
	app.get('/rss',renderRSS);
	
	// TEMPORARY (redirection for users using old bloglaurel.com rss)
	app.get('/feed',renderFrenchRSS);
	app.get('/coeur',renderFrenchRSS);
	app.get('/coeur/rss.php',renderFrenchRSS);
	app.get('/coeur/atom.php',renderFrenchRSS);
	
	
	app.get('/',renderPosts);
	app.get('/page:PageID',renderPosts);
	app.get('/:slug/:PostID', renderOnePost );
	
	
	app.post('/comment', postComment );
	app.post('/contact', postContact ); // email form
			
	//app.get('*', renderPosts );	

	return app;
}();



function renderPosts(req,res)
{
	var page = req.params.PageID;
	if (!page) page = 1;
	
	// console.log("posts (page " + page + ")");
	
	list(req,(page - 1) , postsPerPage , function(error,content)
	{
		pages(req,postsPerPage ,function(nbPages)
		{				
			tools.renderJade(req,res,'posts',{ siteName: "Laurel",
			posts: content,
			page: page, // to highlight current page
			pages: nbPages });
		});
	});
}



// TEMPORARY (redirection for users using old bloglaurel.com rss)

function renderFrenchRSS(req,res)
{
	// console.log("old rss");
	
	var page = 1;
	req.params.lang = "fr";
		
	list(req,(page - 1) , postsPerPage , function(error,content)
	{
		pages(req,postsPerPage ,function(nbPages)
		{	
			tools.renderJade(req,res,'rss',{ siteName: "Laurel" + " - " + "RSS",
			posts: content });
		});
	});
}




function renderRSS(req,res)
{
	// console.log("rss");
	
	var page = 1;
		
	list(req,(page - 1) , postsPerPage , function(error,content)
	{
		pages(req,postsPerPage ,function(nbPages)
		{	
			tools.renderJade(req,res,'rss',{ siteName: "Laurel" + " - " + "RSS",
			posts: content });
		});
	});
}

<commit_msg>fixed content type for RSS<commit_after>//
//
//
//
//

var slug = require('slug');
var lang_module = require('./lang');
var tools = require('./tools');

var db = require('./db').connect();

var postsPerPage = 10;


var app = function()
{
	var express = require('express');
	var app = express();
	
	app.set('views', GLOBAL.views_dir_path);
	app.set('view engine', 'jade');

	app.get('/rss/:lang',renderRSS);	
	app.get('/rss',renderRSS);
	
	// TEMPORARY (redirection for users using old bloglaurel.com rss)
	app.get('/feed',renderFrenchRSS);
	app.get('/coeur',renderFrenchRSS);
	app.get('/coeur/rss.php',renderFrenchRSS);
	app.get('/coeur/atom.php',renderFrenchRSS);
	
	
	app.get('/',renderPosts);
	app.get('/page:PageID',renderPosts);
	app.get('/:slug/:PostID', renderOnePost );
	
	
	app.post('/comment', postComment );
	app.post('/contact', postContact ); // email form
			
	//app.get('*', renderPosts );	

	return app;
}();



function renderPosts(req,res)
{
	var page = req.params.PageID;
	if (!page) page = 1;
	
	// console.log("posts (page " + page + ")");
	
	list(req,(page - 1) , postsPerPage , function(error,content)
	{
		pages(req,postsPerPage ,function(nbPages)
		{				
			tools.renderJade(req,res,'posts',{ siteName: "Laurel",
			posts: content,
			page: page, // to highlight current page
			pages: nbPages });
		});
	});
}



// TEMPORARY (redirection for users using old bloglaurel.com rss)

function renderFrenchRSS(req,res)
{
	// console.log("old rss");
	
	var page = 1;
	req.params.lang = "fr";
		
	list(req,(page - 1) , postsPerPage , function(error,content)
	{
		pages(req,postsPerPage ,function(nbPages)
		{	
			tools.renderJade(req,res,'rss',{ siteName: "Laurel" + " - " + "RSS",
			posts: content });
		});
	});
}




function renderRSS(req,res)
{
	// console.log("rss");
	
	var page = 1;
		
	list(req,(page - 1) , postsPerPage , function(error,content)
	{
		pages(req,postsPerPage ,function(nbPages)
		{	
			res.setHeader('Content-Type', 'application/rss+xml');
			tools.renderJade(req,res,'rss',{ siteName: "Laurel" + " - " + "RSS",
			posts: content });
		});
	});
}


{'fraction_non_alphanumeric': 0.19961146187469644, 'fraction_numerical': 0.003885381253035454, 'mean_word_length': 3.7618497109826587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '2452592', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1511, 'n_words': 278}