<commit_before>exp = require 'express'
app = exp()
B   = require 'bluebird'
cns = require 'consolidate'
fs  = require 'fs'
fs.readFileB = B.promisify fs.readFile
hlt = require 'highlight.js'
hmz = require 'humanize-plus'
mkd = require 'marked'
pth = require 'path'
tof = require 'toffee'

cfg = {
	port: 4747
}

mkd.setOptions {
	highlight: (code) -> hlt.highlightAuto(code).value
}


log = console.log

get_markdown = (page) ->
	fs.readFileB pth.join('content', "#{page}.md")
	  .then (file) -> mkd file.toString 'utf8'

make_title = (page) ->
	title = hmz.titleCase page
	"UlrichDev | #{title}"

render_page = (res,body,page) ->
	res.render 'scaffold', {
		content: body,
		page: page,
		title: make_title page
	}


not_found_404 = "<p>We could not find the page you asked for. It may not exist anymore, or you may just be wrong. If there are enough requests we might (re)create it.</p>"

app.engine 'toffee', cns.toffee
<commit_msg>use custom renderer for carated headings<commit_after>exp = require 'express'
app = exp()
B   = require 'bluebird'
cns = require 'consolidate'
fs  = require 'fs'
fs.readFileB = B.promisify fs.readFile
hlt = require 'highlight.js'
hmz = require 'humanize-plus'
mkd = require 'marked'
pth = require 'path'
rdr = new mkd.Renderer
tof = require 'toffee'

cfg = {
	port: 4747
}

rdr.heading = (text,level) ->
	return "<h#{level}>&gt; #{text}</h#{level}>"

mkd.setOptions {
	highlight: (code) -> hlt.highlightAuto(code).value
	renderer: rdr
}


log = console.log

get_markdown = (page) ->
	fs.readFileB pth.join('content', "#{page}.md")
	  .then (file) -> mkd file.toString 'utf8'

make_title = (page) ->
	title = hmz.titleCase page
	"UlrichDev | #{title}"

render_page = (res,body,page) ->
	res.render 'scaffold', {
		content: body,
		page: page,
		title: make_title page
	}


not_found_404 = "<p>We could not find the page you asked for. It may not exist anymore, or you may just be wrong. If there are enough requests we might (re)create it.</p>"

app.engine 'toffee', cns.toffee

{'fraction_non_alphanumeric': 0.14612326043737575, 'fraction_numerical': 0.007952286282306162, 'mean_word_length': 4.007462686567164, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 20, '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': '2586253', 'n_tokens_mistral': 786, 'n_tokens_neox': 754, 'n_words': 219}