1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-07-07 18:20:05 +01:00

Merge pull request #28 from hacksalot/rel-next

rel-next
This commit is contained in:
hacksalot 2015-12-20 15:56:43 -05:00
commit 93456b5f40
3 changed files with 66 additions and 48 deletions

View File

@ -2,7 +2,8 @@ HackMyResume
============ ============
*Create polished résumés and CVs in multiple formats from your command line or *Create polished résumés and CVs in multiple formats from your command line or
shell. Author in clean Markdown and JSON, export to Word, HTML, PDF, LaTeX, shell. Author in clean Markdown and JSON, export to Word, HTML, PDF, LaTeX,
plain text, and other arbitrary formats.* plain text, and other arbitrary formats. Fight the power, save trees. Compatible
with [FRESH][fresca] and [JRS][6] resumes.*
![](assets/resume-bouqet.png) ![](assets/resume-bouqet.png)
@ -24,8 +25,6 @@ or Windows.
- Store your resume data as a durable, versionable JSON or YAML document. - Store your resume data as a durable, versionable JSON or YAML document.
- Generate polished resumes in multiple formats without violating [DRY][dry]. - Generate polished resumes in multiple formats without violating [DRY][dry].
- Output to HTML, Markdown, LaTeX, PDF, MS Word, JSON, YAML, plain text, or XML. - Output to HTML, Markdown, LaTeX, PDF, MS Word, JSON, YAML, plain text, or XML.
- Compatible with [FRESH][fresh], [JSON Resume][6], [FRESCA][fresca], and
[FCV Desktop][7].
- Validate resumes against the FRESH or JSON Resume schema. - Validate resumes against the FRESH or JSON Resume schema.
- Support for multiple input and output resumes. - Support for multiple input and output resumes.
- Use from your command line or [desktop][7]. - Use from your command line or [desktop][7].
@ -49,8 +48,9 @@ To use HackMyResume you'll need to create a valid resume in either
[FRESH][fresca] or [JSON Resume][6] format. Then you can start using the command [FRESH][fresca] or [JSON Resume][6] format. Then you can start using the command
line tool. There are four basic commands you should be aware of: line tool. There are four basic commands you should be aware of:
- `build` generates resumes in HTML, Word, Markdown, PDF, and other formats. Use - `**build**` generates resumes in HTML, Word, Markdown, PDF, and other formats.
it when you need to submit, upload, print, or email resumes in specific formats. Use it when you need to submit, upload, print, or email resumes in specific
formats.
```bash ```bash
# hackmyresume BUILD <INPUTS> TO <OUTPUTS> [-t THEME] # hackmyresume BUILD <INPUTS> TO <OUTPUTS> [-t THEME]
@ -58,7 +58,7 @@ it when you need to submit, upload, print, or email resumes in specific formats.
hackmyresume BUILD r1.json r2.json TO out/rez.html out/rez.md foo/rez.all hackmyresume BUILD r1.json r2.json TO out/rez.html out/rez.md foo/rez.all
``` ```
- `new` creates a new resume in FRESH or JSON Resume format. - `**new**` creates a new resume in FRESH or JSON Resume format.
```bash ```bash
# hackmyresume NEW <OUTPUTS> [-f <FORMAT>] # hackmyresume NEW <OUTPUTS> [-f <FORMAT>]
@ -67,8 +67,10 @@ it when you need to submit, upload, print, or email resumes in specific formats.
hackmyresume NEW r1.json r2.json -f jrs hackmyresume NEW r1.json r2.json -f jrs
``` ```
- `convert` converts your source resume between FRESH and JSON Resume formats. - `**convert**` converts your source resume between FRESH and JSON Resume
Use it to convert between the two formats to take advantage of tools and services. formats.
Use it to convert between the two formats to take advantage of tools and
services.
```bash ```bash
# hackmyresume CONVERT <INPUTS> TO <OUTPUTS> # hackmyresume CONVERT <INPUTS> TO <OUTPUTS>
@ -76,7 +78,7 @@ Use it to convert between the two formats to take advantage of tools and service
hackmyresume CONVERT 1.json 2.json 3.json TO out/1.json out/2.json out/3.json hackmyresume CONVERT 1.json 2.json 3.json TO out/1.json out/2.json out/3.json
``` ```
- `validate` validates the specified resume against either the FRESH or JSON - `**validate**` validates the specified resume against either the FRESH or JSON
Resume schema. Use it to make sure your resume data is sufficient and complete. Resume schema. Use it to make sure your resume data is sufficient and complete.
```bash ```bash
@ -161,25 +163,34 @@ Generating YAML resume: out/resume.yml
### Applying a theme ### Applying a theme
You can specify a predefined or custom theme via the optional `-t` parameter. For a predefined theme, include the theme name. For a custom theme, include the path to the custom theme's folder. You can specify a predefined or custom theme via the optional `-t` parameter.
For a predefined theme, include the theme name. For a custom theme, include the
path to the custom theme's folder.
```bash ```bash
hackmyresume build resume.json -t modern hackmyresume build resume.json -t modern
hackmyresume build resume.json -t ~/foo/bar/my-custom-theme/ hackmyresume build resume.json -t ~/foo/bar/my-custom-theme/
``` ```
As of v0.9.0, available predefined themes are `modern`, `minimist`, and `hello-world`, and `compact`. As of v1.0.0, available predefined themes are `positive`, `modern`, `compact`,
`minimist`, and `hello-world`.
### Merging resumes ### Merging resumes
You can **merge multiple resumes together** by specifying them in order from most generic to most specific: You can **merge multiple resumes together** by specifying them in order from
most generic to most specific:
```bash ```bash
# Merge specific.json onto base.json and generate all formats # Merge specific.json onto base.json and generate all formats
hackmyresume build base.json specific.json -o resume.all hackmyresume build base.json specific.json -o resume.all
``` ```
This can be useful for overriding a base (generic) resume with information from a specific (targeted) resume. For example, you might override your generic catch-all "software developer" resume with specific details from your targeted "game developer" resume, or combine two partial resumes into a "complete" resume. Merging follows conventional [extend()][9]-style behavior and there's no arbitrary limit to how many resumes you can merge: This can be useful for overriding a base (generic) resume with information from
a specific (targeted) resume. For example, you might override your generic
catch-all "software developer" resume with specific details from your targeted
"game developer" resume, or combine two partial resumes into a "complete"
resume. Merging follows conventional [extend()][9]-style behavior and there's
no arbitrary limit to how many resumes you can merge:
```bash ```bash
hackmyresume build in1.json in2.json in3.json in4.json TO out.html out.doc hackmyresume build in1.json in2.json in3.json in4.json TO out.html out.doc
@ -210,14 +221,17 @@ hackmyresume build resume.json
### Using .all ### Using .all
The special `.all` extension tells HackMyResume to generate all supported output formats for the given resume. For example, this... The special `.all` extension tells HackMyResume to generate all supported output
formats for the given resume. For example, this...
```bash ```bash
# Generate all resume formats (HTML, PDF, DOC, TXT, etc.) # Generate all resume formats (HTML, PDF, DOC, TXT, etc.)
hackmyresume build me.json -o out/resume.all hackmyresume build me.json -o out/resume.all
``` ```
..tells HackMyResume to read `me.json` and generate `out/resume.md`, `out/resume.doc`, `out/resume.html`, `out/resume.txt`, `out/resume.pdf`, and `out/resume.json`. ..tells HackMyResume to read `me.json` and generate `out/resume.md`,
`out/resume.doc`, `out/resume.html`, `out/resume.txt`, `out/resume.pdf`, and
`out/resume.json`.
### Validating ### Validating
@ -240,17 +254,17 @@ Validating JSON resume: resumeB.json (VALID)
### Converting ### Converting
HackMyResume can convert between the [FRESH][fresca] and [JSON Resume][6] formats. HackMyResume can convert between the [FRESH][fresca] and [JSON Resume][6]
Just run: formats. Just run:
```bash ```bash
hackmyresume CONVERT <INPUTS> <OUTPUTS> hackmyresume CONVERT <INPUTS> <OUTPUTS>
``` ```
where <INPUTS> is one or more resumes in FRESH or JSON Resume format, and where <INPUTS> is one or more resumes in FRESH or JSON Resume format, and
<OUTPUTS> is a corresponding list of output file names. HackMyResume will autodetect <OUTPUTS> is a corresponding list of output file names. HackMyResume will
the format (FRESH or JRS) of each input resume and convert it to the other autodetect the format (FRESH or JRS) of each input resume and convert it to the
format (JRS or FRESH). other format (JRS or FRESH).
### Prettifying ### Prettifying

View File

@ -1,6 +1,6 @@
{ {
"name": "hackmyresume", "name": "hackmyresume",
"version": "1.0.0", "version": "1.0.1",
"description": "Generate polished résumés and CVs in HTML, Markdown, LaTeX, MS Word, PDF, plain text, JSON, XML, YAML, smoke signal, and carrier pigeon.", "description": "Generate polished résumés and CVs in HTML, Markdown, LaTeX, MS Word, PDF, plain text, JSON, XML, YAML, smoke signal, and carrier pigeon.",
"repository": { "repository": {
"type": "git", "type": "git",
@ -18,7 +18,11 @@
"PDF", "PDF",
"YAML", "YAML",
"HTML", "HTML",
"CLI" "LaTeX",
"CLI",
"Handlebars",
"Underscore",
"template"
], ],
"author": "hacksalot <hacksalot@fluentdesk.com> (https://github.com/hacksalot)", "author": "hacksalot <hacksalot@fluentdesk.com> (https://github.com/hacksalot)",
"license": "MIT", "license": "MIT",

View File

@ -11,49 +11,49 @@ Definition of the Markdown to WordProcessingML conversion routine.
module.exports = function( html ) { module.exports = function( html ) {
var final = ''; // Tokenize the HTML stream.
var is_bold = false, is_italic = false, is_link = false;
var depth = 0;
var tokens = HTML5Tokenizer.tokenize( html ); var tokens = HTML5Tokenizer.tokenize( html );
var final = '', is_bold, is_italic, is_link, link_url;
// Process <em>, <strong>, and <a> elements in the HTML stream, producing
// equivalent WordProcessingML that can be dumped into a <w:p> or other
// text container element.
_.each( tokens, function( tok ) { _.each( tokens, function( tok ) {
switch( tok.type ) { switch( tok.type ) {
case 'StartTag': case 'StartTag':
switch( tok.tagName ) { switch( tok.tagName ) {
case 'p': case 'p': final += '<w:p>'; break;
final += '<w:p>'; case 'strong': is_bold = true; break;
break; case 'em': is_italic = true; break;
case 'strong':
is_bold = true;
break;
case 'em':
is_italic = true;
break;
case 'a': case 'a':
is_link = true; is_link = true;
link_url = tok.attributes.filter(function(attr){
return attr[0] === 'href'; }
)[0][1];
break; break;
} }
break; break;
case 'EndTag': case 'EndTag':
switch( tok.tagName ) { switch( tok.tagName ) {
case 'p': case 'p': final += '</w:p>'; break;
final += '</w:p>'; case 'strong': is_bold = false; break;
break; case 'em': is_italic = false; break;
case 'strong': case 'a': is_link = false; break;
is_bold = false;
break;
case 'em':
is_italic = false;
break;
case 'a':
is_link = false;
break;
} }
break; break;
case 'Chars': case 'Chars':
var style = is_bold ? '<w:b/>' : ''; var style = is_bold ? '<w:b/>' : '';
style += is_italic ? '<w:i/>': ''; style += is_italic ? '<w:i/>': '';
final += '<w:r><w:rPr>' + style + '</w:rPr><w:t>' + tok.chars + '</w:t></w:r>'; style += is_link ? '<w:rStyle w:val="Hyperlink"/>' : '';
final +=
(is_link ? ('<w:hlink w:dest="' + link_url + '">') : '') +
'<w:r><w:rPr>' + style + '</w:rPr><w:t>' + tok.chars +
'</w:t></w:r>' + (is_link ? '</w:hlink>' : '');
break; break;
} }
}); });