mirror of
				https://github.com/JuanCanham/HackMyResume.git
				synced 2025-10-31 13:17:26 +00:00 
			
		
		
		
	| @@ -20,68 +20,69 @@ The JRSTheme class is a representation of a JSON Resume theme asset. | ||||
| class JRSTheme | ||||
|  | ||||
|  | ||||
| ###* | ||||
| Open and parse the specified theme. | ||||
| @method open | ||||
| ### | ||||
| open: ( thFolder ) -> | ||||
|  | ||||
|   @folder = thFolder | ||||
|   ###* | ||||
|   Open and parse the specified theme. | ||||
|   @method open | ||||
|   ### | ||||
|   open: ( thFolder ) -> | ||||
|  | ||||
|   # Open the [theme-name].json file; should have the same | ||||
|   # name as folder | ||||
|   pathInfo = parsePath thFolder | ||||
|     @folder = thFolder | ||||
|  | ||||
|   # Open and parse the theme's package.json file. | ||||
|   pkgJsonPath = PATH.join thFolder, 'package.json' | ||||
|   if pathExists pkgJsonPath | ||||
|     thApi = require thFolder | ||||
|     thPkg = require pkgJsonPath | ||||
|     this.name = thPkg.name | ||||
|     this.render = (thApi && thApi.render) || undefined | ||||
|     this.engine = 'jrs' | ||||
|     # Open the [theme-name].json file; should have the same | ||||
|     # name as folder | ||||
|     pathInfo = parsePath thFolder | ||||
|  | ||||
|     # Create theme formats (HTML and PDF). Just add the bare minimum mix of | ||||
|     # properties necessary to allow JSON Resume themes to share a rendering | ||||
|     # path with FRESH themes. | ||||
|     this.formats = | ||||
|       html: | ||||
|         outFormat: 'html' | ||||
|         files: [{ | ||||
|           action: 'transform', | ||||
|           render: this.render, | ||||
|           major: true, | ||||
|           ext: 'html', | ||||
|           css: null | ||||
|         }] | ||||
|       pdf: | ||||
|         outFormat: 'pdf' | ||||
|         files: [{ | ||||
|           action: 'transform', | ||||
|           render: this.render, | ||||
|           major: true, | ||||
|           ext: 'pdf', | ||||
|           css: null | ||||
|         }] | ||||
|   else | ||||
|     throw { fluenterror: HACKMYSTATUS.missingPackageJSON }; | ||||
|   @ | ||||
|     # Open and parse the theme's package.json file. | ||||
|     pkgJsonPath = PATH.join thFolder, 'package.json' | ||||
|     if pathExists pkgJsonPath | ||||
|       thApi = require thFolder | ||||
|       thPkg = require pkgJsonPath | ||||
|       this.name = thPkg.name | ||||
|       this.render = (thApi && thApi.render) || undefined | ||||
|       this.engine = 'jrs' | ||||
|  | ||||
|       # Create theme formats (HTML and PDF). Just add the bare minimum mix of | ||||
|       # properties necessary to allow JSON Resume themes to share a rendering | ||||
|       # path with FRESH themes. | ||||
|       this.formats = | ||||
|         html: | ||||
|           outFormat: 'html' | ||||
|           files: [{ | ||||
|             action: 'transform', | ||||
|             render: this.render, | ||||
|             major: true, | ||||
|             ext: 'html', | ||||
|             css: null | ||||
|           }] | ||||
|         pdf: | ||||
|           outFormat: 'pdf' | ||||
|           files: [{ | ||||
|             action: 'transform', | ||||
|             render: this.render, | ||||
|             major: true, | ||||
|             ext: 'pdf', | ||||
|             css: null | ||||
|           }] | ||||
|     else | ||||
|       throw { fluenterror: HACKMYSTATUS.missingPackageJSON }; | ||||
|     @ | ||||
|  | ||||
|  | ||||
|  | ||||
| ###* | ||||
| Determine if the theme supports the output format. | ||||
| @method hasFormat | ||||
| ### | ||||
| hasFormat: ( fmt ) ->  _.has this.formats, fmt | ||||
|   ###* | ||||
|   Determine if the theme supports the output format. | ||||
|   @method hasFormat | ||||
|   ### | ||||
|   hasFormat: ( fmt ) ->  _.has this.formats, fmt | ||||
|  | ||||
|  | ||||
|  | ||||
| ###* | ||||
| Return the requested output format. | ||||
| @method getFormat | ||||
| ### | ||||
| getFormat = ( fmt ) -> @formats[ fmt ] | ||||
|   ###* | ||||
|   Return the requested output format. | ||||
|   @method getFormat | ||||
|   ### | ||||
|   getFormat: ( fmt ) -> @formats[ fmt ] | ||||
|  | ||||
|  | ||||
| module.exports = JRSTheme; | ||||
|   | ||||
| @@ -25,9 +25,10 @@ JRSGenerator = module.exports = | ||||
|  | ||||
|     # Disable JRS theme chatter (console.log, console.error, etc.) | ||||
|     turnoff = ['log', 'error', 'dir']; | ||||
|     org = turnoff.map(c) -> | ||||
|     org = turnoff.map (c) -> | ||||
|       ret = console[c] | ||||
|       console[c] = () -> | ||||
|       ret | ||||
|  | ||||
|     # Freeze and render | ||||
|     rezHtml = theme.render json.harden() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user