mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
Update pake to use a regex when writing the command help
Swap to using a fenced code block for the command output
This commit is contained in:
parent
483c262619
commit
91b8fb6e2c
@ -23,7 +23,7 @@ at the [blog post for the project][blog].
|
||||
./bin/md2resume pdf examples/source/sample.md examples/output/
|
||||
|
||||
## Help
|
||||
|
||||
```
|
||||
Markdown Resume Generator version 2.0.0 by Craig Davis
|
||||
|
||||
Usage:
|
||||
@ -48,6 +48,7 @@ at the [blog post for the project][blog].
|
||||
templates List available templates
|
||||
version Show current version information
|
||||
|
||||
```
|
||||
## Examples
|
||||
|
||||
Choose a template with the -t option.
|
||||
|
27
pakefile
27
pakefile
@ -93,25 +93,16 @@ function run_fixer()
|
||||
function run_readme()
|
||||
{
|
||||
echo " * Updating README documentation\n";
|
||||
$readme = file("README.md");
|
||||
$help = explode("\n", shell_exec("php ./md2resume_dev.php list --no-interaction"));
|
||||
|
||||
$helpStart = $helpEnd = 0;
|
||||
foreach ($readme as $lineNumber => $line) {
|
||||
if (trim($line) == "## Help") {
|
||||
$helpStart = $lineNumber;
|
||||
continue;
|
||||
}
|
||||
if ($helpStart && (substr(trim($line), 0, 2) == "##")) {
|
||||
$helpEnd = $lineNumber;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$output = join(array_slice($readme, 0, $helpStart + 1));
|
||||
$output .= "\n " . implode("\n ", $help) . "\n";
|
||||
$output .= join(array_slice($readme, $helpEnd));
|
||||
|
||||
$startPoint = '## Help';
|
||||
$endPoint = '## Examples';
|
||||
$readme = file_get_contents("README.md");
|
||||
$help = shell_exec("php ./md2resume_dev.php list --no-interaction");
|
||||
$output = preg_replace(
|
||||
'/('.preg_quote($startPoint).')(.*)('.preg_quote($endPoint).')/si',
|
||||
"$1\n```\n" . $help . "\n```\n $3",
|
||||
$readme
|
||||
);
|
||||
file_put_contents("README.md", $output);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user