diff --git a/README.md b/README.md index dfd1b1b..5b6a12e 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ -# Markdown Resume Generator +# Markdown Resume Generator [](https://travis-ci.org/there4/markdown-resume) +> Convert markdown to HTML and PDF resumes Turn a simple Markdown document into an elegant resume with both a perfect pdf printable format, and a responsive css3 html5 file. You can view a sample at the [blog post for the project][blog]. -[](https://travis-ci.org/there4/markdown-resume) - ## Features -* Three styles to choose from: modern, blockish, unstyled (Fork and add more!) +* Multiple styles to choose from: `modern`, `blockish`, `unstyled`, `readable`, `swissen` _(Fork and add more!)_ * PDF generation via [wkhtmltopdf][wkhtmltopdf] * Responsive design for multiple device viewport sizes * Simple Markdown formatting @@ -17,14 +16,16 @@ at the [blog post for the project][blog]. ## Quickstart - There is no installation or need to run composer. Just run the phar file: + There is no installation or need to run composer. Just download and [run the phar file](https://github.com/there4/markdown-resume/raw/master/bin/md2resume): +``` ./bin/md2resume html examples/source/sample.md examples/output/ ./bin/md2resume pdf examples/source/sample.md examples/output/ +``` ## Help ``` -Markdown Resume Generator version 2.0.8 by Craig Davis +Markdown Resume Generator version 2.0.10 by Craig Davis Usage: [options] command [arguments] @@ -53,18 +54,21 @@ Available commands: Choose a template with the -t option. - ./bin/md2resume html --template blockish examples/source/sample.md examples/output/ + `./bin/md2resume html --template blockish examples/source/sample.md examples/output/` If you want to edit your markdown resume in your editor while watching it update in your browser, run this command: - watch ./bin/md2resume html --refresh examples/source/sample.md examples/output/ + `watch ./bin/md2resume html --refresh yes --template modern examples/source/sample.md examples/output/` This makes the build script run periodically, and html document will refresh every two seconds via a meta tag. Open the `./examples/ouput/sample.html` file in your browser, and then just save your markdown document when you want to see a fresh preview. +For information about running this inside a Docker container, please read [Issue 46](https://github.com/there4/markdown-resume/issues/46#issuecomment-126520792) +where [Sebastian Klose](https://github.com/sklose) has shared his approach. + ## Authoring Your Resume Markdown is limited to basic html markup. Follow the `examples/source/sample.md` @@ -87,6 +91,15 @@ commands, you'll need to first install the dependencies: * `composer install` After that, you can run the `md2resume_dev.php` file from the command line. + +## Building a Release + +1. Tag the repo with the new build number. This will be picked up for both + the `version` file used by the self update command and placed into the + phar file. +2. Run `pake build`. +3. Push both the tag and the code. + Check out the pake tooling for more information about the build. Pake will be installed to `./vendor/bin/pake`. So for instance a complete phar file build looks like `./vendor/bin/pake build`. @@ -100,25 +113,28 @@ are a more comfortable with html than markdown, you should use it. ## Changelog +* __2.0.10__ : Updated spacing in moder template with commites from [@501st-alpha1](https://github.com/501st-alpha1) +* __2.0.9__ : Updated Modern template with improved spacing. Update parsing of + `--template` option to close [issue #7](https://github.com/there4/markdown-resume/issues/7) * __2.0.8__ : New `readable` theme contributed by @ahmadnazir, minor refactor to support a /links directory * __2.0.7__ : Update composer to use `sunra/php-simple-html-dom-parser` this - appears to be better maintained and more popular to close #27 -* __2.0.6__ : Fix empty template list from phar file to close #24 -* __2.0.5__ : Remove default value for the `--refresh` option to close #22 -* __2.0.4__ : Fix path resolution problem with absolute paths to close #16 -* __2.0.3__ : Add optional duration to the `--refresh` option to close #15 -* __2.0.2__ : Add new dependency check for `mbstring` to close #20 -* __2.0.1__ : Add new `swissen` template with Helvetica styling (@beautifulcode) + appears to be better maintained and more popular to [close #27](https://github.com/there4/markdown-resume/issues/27) +* __2.0.6__ : Fix empty template list from phar file to [close #24](https://github.com/there4/markdown-resume/issues/24) +* __2.0.5__ : Remove default value for the `--refresh` option to [close #22](https://github.com/there4/markdown-resume/issues/22) +* __2.0.4__ : Fix path resolution problem with absolute paths to [close #16](https://github.com/there4/markdown-resume/issues/16) +* __2.0.3__ : Add optional duration to the `--refresh` option to [close #15](https://github.com/there4/markdown-resume/issues/15) +* __2.0.2__ : Add new dependency check for `mbstring` to [close #20](https://github.com/there4/markdown-resume/issues/20) +* __2.0.1__ : Add new `swissen` template with Helvetica styling [@beautifulcode](https://github.com/beautifulcode) * __2.0.0__ : Complete rewrite with the [symfony console component][console]. Deployment is now done with a compiled phar file, and development dependencies are managed with composer. * __0.9.0__ : Add composer and update README with new changelog -* __0.8.8__ : Add Chinese text example (@ishitcno1) -* __0.8.7__ : Update pdf formatting of the modern template (@roleary) -* __0.8.6__ : Fix output path (@abhikandoi2000) -* __0.8.5__ : Fix issue #2 -* __0.8.4__ : Correct chmod and add parameter for output directory (@kevinxucs) +* __0.8.8__ : Add Chinese text example [@ishitcno1](https://github.com/ishitcno1) +* __0.8.7__ : Update pdf formatting of the modern template [@roleary](https://github.com/roleary) +* __0.8.6__ : Fix output path [@abhikandoi2000](https://github.com/abhikandoi2000) +* __0.8.5__ : Fix [issue #2](https://github.com/there4/markdown-resume/issues/2) +* __0.8.4__ : Correct chmod and add parameter for output directory [@kevinxucs](https://github.com/kevinxucs) * __0.8.2__ : Update build script and add refresh command option * __0.8.1__ : Updating formatting of initial templates * __0.8__ : Initial Release to Public diff --git a/bin/md2resume b/bin/md2resume index 50335e7..d638657 100755 Binary files a/bin/md2resume and b/bin/md2resume differ diff --git a/composer.json b/composer.json index 52018f2..33e6b31 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "html5" ], "license": "MIT", - "version": "2.0.8", + "version": "2.0.10", "selfupdatepath": "://github.com/there4/markdown-resume/raw/master/bin/md2resume", "selfupdateversion": "://github.com/there4/markdown-resume/raw/master/version", "authors": [ diff --git a/pakefile b/pakefile index 17e0f01..6d2c6a4 100644 --- a/pakefile +++ b/pakefile @@ -32,7 +32,10 @@ pake_task('build', 'version', 'version_file', 'readme', 'lint', 'fixer', 'sniff' pake_alias('default', 'build'); -function run_build() {} +function run_build() +{ + // Used only for naming a string of dependencies. +} function run_test() { @@ -112,7 +115,7 @@ function run_readme() function run_mv() { - pake_sh('cp ./bin/md2resume ~/bin/md2resume', true); + pake_sh('cp ./bin/md2resume ~/bin/md2resume', true); } /* End of pakefile */ diff --git a/src/Resume/Command/HtmlCommand.php b/src/Resume/Command/HtmlCommand.php index a9a3567..5ab9d2a 100644 --- a/src/Resume/Command/HtmlCommand.php +++ b/src/Resume/Command/HtmlCommand.php @@ -35,7 +35,7 @@ class HtmlCommand extends Command 'template', 't', InputOption::VALUE_REQUIRED, - 'Which of the templates to use' + 'Which of the templates to use. Use an absolute path for a custom template.' ) ->addOption( 'refresh', @@ -43,6 +43,12 @@ class HtmlCommand extends Command InputOption::VALUE_REQUIRED, 'Regenerate the html and include a meta command to refresh the ' . 'document every periodically. Measured in seconds.' + ) + ->addOption( + 'output', + 'o', + InputOption::VALUE_REQUIRED, + 'The optional override of default filename to output to' ); } @@ -50,10 +56,18 @@ class HtmlCommand extends Command { $this->app = $this->getApplication(); $source = $input->getArgument('source'); + $sourceName = pathinfo($source, PATHINFO_FILENAME); $destination = rtrim($input->getArgument('destination'), DIRECTORY_SEPARATOR); $template = $input->getOption('template'); $refresh = $input->getOption('refresh'); - $destFilename = join(DIRECTORY_SEPARATOR, array($destination, pathinfo($source, PATHINFO_FILENAME) . '.html')); + $optFilename = $input->getOption('output'); + $destFilename = ""; + + if ($optFilename) { + $destFilename = $destination . DIRECTORY_SEPARATOR . $optFilename . '.html'; + } else { + $destFilename = $destination . DIRECTORY_SEPARATOR . $sourceName . '.html'; + } $rendered = $this->generateHtml($source, $template, $refresh); file_put_contents($destFilename, $rendered); @@ -88,6 +102,10 @@ class HtmlCommand extends Command array_push($assets, new FileAsset($fileInfo->getPathname())); } + usort($assets, function (FileAsset $a, FileAsset $b) { + return strcmp($a->getSourcePath(), $b->getSourcePath()); + }); + $collection = new AssetCollection( $assets ); @@ -112,7 +130,13 @@ class HtmlCommand extends Command if (!$template) { $template = $this->app->defaultTemplate; } - $templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template))); + + if (strpos($template, DIRECTORY_SEPARATOR) !== false) { + $templatePath = realpath($template); + } else { + $templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template))); + } + $templateIndexPath = join(DIRECTORY_SEPARATOR, array($templatePath, 'index.html')); if (!file_exists($templateIndexPath)) { @@ -151,6 +175,11 @@ class HtmlCommand extends Command return $rendered; } + + protected function determineOutfile($outputFilename) + { + return join(DIRECTORY_SEPARATOR, array($destination, pathinfo($source, PATHINFO_FILENAME) . '.html')); + } } /* End of file HtmlCommand.php */ diff --git a/src/Resume/Command/PdfCommand.php b/src/Resume/Command/PdfCommand.php index ec18ea8..272fdc0 100644 --- a/src/Resume/Command/PdfCommand.php +++ b/src/Resume/Command/PdfCommand.php @@ -30,6 +30,12 @@ class PdfCommand extends HtmlCommand 't', InputOption::VALUE_REQUIRED, 'Which of the templates to use' + ) + ->addOption( + 'output', + 'o', + InputOption::VALUE_REQUIRED, + 'The optional override of default filename to output to' ); } @@ -37,11 +43,19 @@ class PdfCommand extends HtmlCommand { $this->app = $this->getApplication(); $source = $input->getArgument('source'); + $sourceName = pathinfo($source, PATHINFO_FILENAME); $destination = rtrim($input->getArgument('destination'), DIRECTORY_SEPARATOR); $template = $input->getOption('template'); $pdfSource = join(DIRECTORY_SEPARATOR, array($destination, '.tmp_pdf_source.html')); + $optFilename = $input->getOption('output'); + $destFilename = join(DIRECTORY_SEPARATOR, array($destination, pathinfo($source, PATHINFO_FILENAME) . '.pdf')); + if ($optFilename) { + $destFilename = $destination . DIRECTORY_SEPARATOR . $optFilename . '.pdf'; + } else { + $destFilename = $destination . DIRECTORY_SEPARATOR . $sourceName . '.pdf'; + } // Make sure we've got out converter available exec('wkhtmltopdf -V', $results, $returnVal); if ($returnVal) { diff --git a/templates/modern/css/pdf.css b/templates/modern/css/pdf.css index 04fd466..66028d0 100644 --- a/templates/modern/css/pdf.css +++ b/templates/modern/css/pdf.css @@ -44,7 +44,7 @@ body.pdf { } h3+p { float: left; - width: 84%; + width: 78%; } blockquote { @@ -54,7 +54,7 @@ body.pdf { } ul li { - width: 28%; + width: 33%; float: left; } ul dl { @@ -66,13 +66,13 @@ body.pdf { margin: 0 0 .75em; } dd { - padding: 0 4em 0 0; + padding: 0 2em 0 0; } } ol { float: left; - width: 84%; + width: 79%; margin: .7em 0 0; } @@ -91,7 +91,7 @@ body.pdf { margin: .7em 0 0; page-break-inside: avoid !important; display: block; - width:84%; + width:79%; float: left; dt {} dd { diff --git a/templates/modern/css/resume.css b/templates/modern/css/resume.css index ee5cc3a..e8dad80 100644 --- a/templates/modern/css/resume.css +++ b/templates/modern/css/resume.css @@ -82,7 +82,7 @@ h2 { } h3 { - margin: 0; + margin: 0px 20px; padding: 0 0 .5em; font-size: 150%; font-style: italic; @@ -102,6 +102,7 @@ ul { margin: 0; padding: 0; list-style: none; + display: table; } ul li { margin: 0; @@ -146,7 +147,7 @@ ol li:nth-child(1) { dl { display: inline-block; - width: 75%; + width: 78%; margin: 0; padding: 0; dt { diff --git a/templates/modern/css/screen.css b/templates/modern/css/screen.css index 28afff3..43feef8 100644 --- a/templates/modern/css/screen.css +++ b/templates/modern/css/screen.css @@ -91,11 +91,11 @@ h3+p { float: left; - width: 84%; + width: 78%; } ul li { - width: 28%; + width: 33%; float: left; } ul dl { @@ -105,13 +105,13 @@ margin-bottom: .75em; } dd { - padding: 0 4em 0 0; + padding: 0 2em 0 0; } } ol { float: left; - width: 84%; + width: 79%; margin: .6em 0 0; } diff --git a/templates/swissen/css/pdf.css b/templates/swissen/css/pdf.css index 29ab7f7..841e01c 100644 --- a/templates/swissen/css/pdf.css +++ b/templates/swissen/css/pdf.css @@ -37,12 +37,12 @@ body.pdf { } h3 { float: left; - width: 16%; + width: 20%; font-style: normal; } h3+p { float: left; - width: 84%; + width: 80%; } blockquote { @@ -52,7 +52,7 @@ body.pdf { } ul li { - width: 28%; + width: 33.33%; float: left; } ul dl { @@ -70,7 +70,7 @@ body.pdf { ol { float: left; - width: 84%; + width: 80%; margin: .7em 0 0; } diff --git a/templates/swissen/css/resume.css b/templates/swissen/css/resume.css index 802de36..b78bed7 100644 --- a/templates/swissen/css/resume.css +++ b/templates/swissen/css/resume.css @@ -109,6 +109,7 @@ ul { margin: 0; padding: 0; list-style: none; + display: table; } ul li { margin: 0; @@ -133,7 +134,7 @@ ul dl { ol { margin: 0; padding: 0 0 .75em; - width: 84%; + width: 80%; display: inline-block; } diff --git a/templates/swissen/css/screen.css b/templates/swissen/css/screen.css index 7078a66..8bbc6c3 100644 --- a/templates/swissen/css/screen.css +++ b/templates/swissen/css/screen.css @@ -82,16 +82,16 @@ h3 { float: left; - width: 16%; + width: 20%; } h3+p { float: left; - width: 84%; + width: 80%; } ul li { - width: 28%; + width: 33.33%; float: left; } ul dl { @@ -107,7 +107,7 @@ ol { float: left; - width: 84%; + width: 80%; margin: .6em 0 0; } diff --git a/version b/version index e8f41f0..fee3c92 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.0.8 \ No newline at end of file +2.0.10 \ No newline at end of file