<commit_before>/// <reference path="../../../typings/bundle.d.ts" />

import jade = require('jade');
import Application = require('../../models/application');
import User = require('../../models/user');
import Post = require('../../models/post');
import conf = require('../../config');

export = render;

var render = (req: any, res: any): void => {
	Post.getTimeline(req.me.id, 30, null, null, (posts: Post[]) => {
		Post.generateTimeline(posts, (timeline: Post[]) => {
			res.display(req, res, 'home', {
				timeline: timeline,
				timelineHtml: jade.compileFile('../views/templates/timeline.jade', {
					
				})({
					posts: timeline
				}),
				parseText: parseText
			});
		});
	});
};

function parseText(text: string): string {
	text = escapeHtml(text);
	text = parseURL(text);
	text = parseReply(text);
	text = parseNewLine(text);
	return text;

	function parseURL(text: string): string {
		return text.replace(/https?:\/\/[-_.!~*a-zA-Z0-9;\/?:\@&=+\$,%#]+/g,(url: string) => {
			return `<a href="${url}" target="_blank" class="url">${url}</a>`;
		});
	}

	function parseReply(text: string): string {
		return text.replace(/@([a-zA-Z0-9_]+)/g,(_: string, screenName: string) => {<commit_msg>Fix path<commit_after>/// <reference path="../../../typings/bundle.d.ts" />

import jade = require('jade');
import Application = require('../../models/application');
import User = require('../../models/user');
import Post = require('../../models/post');
import conf = require('../../config');

export = render;

var render = (req: any, res: any): void => {
	Post.getTimeline(req.me.id, 30, null, null, (posts: Post[]) => {
		Post.generateTimeline(posts, (timeline: Post[]) => {
			res.display(req, res, 'home', {
				timeline: timeline,
				timelineHtml: jade.compileFile(__dirname + '/../views/templates/timeline.jade', {
					
				})({
					posts: timeline
				}),
				parseText: parseText
			});
		});
	});
};

function parseText(text: string): string {
	text = escapeHtml(text);
	text = parseURL(text);
	text = parseReply(text);
	text = parseNewLine(text);
	return text;

	function parseURL(text: string): string {
		return text.replace(/https?:\/\/[-_.!~*a-zA-Z0-9;\/?:\@&=+\$,%#]+/g,(url: string) => {
			return `<a href="${url}" target="_blank" class="url">${url}</a>`;
		});
	}

	function parseReply(text: string): string {
		return text.replace(/@([a-zA-Z0-9_]+)/g,(_: string, screenName: string) => {
{'fraction_non_alphanumeric': 0.23880597014925373, 'fraction_numerical': 0.004975124378109453, 'mean_word_length': 3.5961904761904764, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, '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': '2200358', 'n_tokens_mistral': 907, 'n_tokens_neox': 812, 'n_words': 166}