1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-15 18:17:08 +01:00

Finish HackMyCore reshaping.

Reintroduce HackMyCore, dropping the interim submodule, and reorganize
and improve tests.
This commit is contained in:
hacksalot
2016-01-29 15:23:57 -05:00
parent e9971eb882
commit 0f65e4c9f3
130 changed files with 5384 additions and 337 deletions

View File

@ -0,0 +1,44 @@
###*
Definition of the JRSGenerator class.
@license MIT. See LICENSE.md for details.
@module renderers/jrs-generator
###
_ = require('underscore')
HANDLEBARS = require('handlebars')
FS = require('fs')
registerHelpers = require('../helpers/handlebars-helpers')
PATH = require('path')
parsePath = require('parse-filepath')
READFILES = require('recursive-readdir-sync')
SLASH = require('slash')
MD = require('marked')
###*
Perform template-based resume generation for JSON Resume themes.
@class JRSGenerator
###
JRSGenerator = module.exports =
generate: ( json, jst, format, cssInfo, opts, theme ) ->
# Disable JRS theme chatter (console.log, console.error, etc.)
turnoff = ['log', 'error', 'dir'];
org = turnoff.map(c) ->
ret = console[c]
console[c] = () ->
# Freeze and render
rezHtml = theme.render json.harden()
# Turn logging back on
turnoff.forEach (c, idx) -> console[c] = org[idx]
# Unfreeze and apply Markdown
rezHtml = rezHtml.replace /@@@@~.*?~@@@@/gm, (val) ->
MDIN( val.replace( /~@@@@/gm,'' ).replace( /@@@@~/gm,'' ) )
MDIN = (txt) -> # TODO: Move this
MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, '')