mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
Merge pull request #30 from ahmadnazir/bootswatch
Add new theme: Bootswatch 'Reader' Theme Refactor asset rendering and grouping
This commit is contained in:
commit
3305c9d564
BIN
bin/md2resume
BIN
bin/md2resume
Binary file not shown.
2
composer.lock
generated
2
composer.lock
generated
@ -3,7 +3,7 @@
|
|||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
||||||
],
|
],
|
||||||
"hash": "c7a457f7ccfb1a6ec431bf89e1d4933c",
|
"hash": "5f42fb6da16a9d26eb5a44694e6123a6",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "fabpot/php-cs-fixer",
|
"name": "fabpot/php-cs-fixer",
|
||||||
|
@ -68,6 +68,39 @@ class HtmlCommand extends Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function generateContent($templatePath, $contentType)
|
||||||
|
{
|
||||||
|
// We build these into a single string so that we can deploy this resume as a
|
||||||
|
// single file.
|
||||||
|
$assetPath = join(DIRECTORY_SEPARATOR, array($templatePath, $contentType));
|
||||||
|
|
||||||
|
if (!file_exists($assetPath)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$assets = array();
|
||||||
|
|
||||||
|
// Our PHAR deployment can't handle the GlobAsset typically used here
|
||||||
|
foreach (new \DirectoryIterator($assetPath) as $fileInfo) {
|
||||||
|
if ($fileInfo->isDot() || !$fileInfo->isFile()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
array_push($assets, new FileAsset($fileInfo->getPathname()));
|
||||||
|
}
|
||||||
|
|
||||||
|
$collection = new AssetCollection(
|
||||||
|
$assets
|
||||||
|
);
|
||||||
|
|
||||||
|
switch ($contentType) {
|
||||||
|
case 'css':
|
||||||
|
$collection->ensureFilter(new Filter\LessphpFilter());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collection->dump();
|
||||||
|
}
|
||||||
|
|
||||||
protected function generateHtml($source, $template, $refresh)
|
protected function generateHtml($source, $template, $refresh)
|
||||||
{
|
{
|
||||||
// Check that the source file is sane
|
// Check that the source file is sane
|
||||||
@ -86,25 +119,9 @@ class HtmlCommand extends Command
|
|||||||
throw new \Exception("Unable to open template file: $templateIndexPath");
|
throw new \Exception("Unable to open template file: $templateIndexPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
// We build these into a single string so that we can deploy this resume as a
|
$style = $this->generateContent($templatePath, 'css');
|
||||||
// single file.
|
|
||||||
$cssAssetPath = join(DIRECTORY_SEPARATOR, array($templatePath, '/css'));
|
|
||||||
$cssAssets = array();
|
|
||||||
|
|
||||||
// Our PHAR deployment can't handle the GlobAsset typically used here
|
$links = $this->generateContent($templatePath, 'links');
|
||||||
foreach (new \DirectoryIterator($cssAssetPath) as $fileInfo) {
|
|
||||||
if ($fileInfo->isDot() || !$fileInfo->isFile()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
array_push($cssAssets, new FileAsset($fileInfo->getPathname()));
|
|
||||||
}
|
|
||||||
|
|
||||||
$css = new AssetCollection(
|
|
||||||
$cssAssets,
|
|
||||||
array(new Filter\LessphpFilter())
|
|
||||||
);
|
|
||||||
|
|
||||||
$style = $css->dump();
|
|
||||||
|
|
||||||
$templateContent = file_get_contents($templateIndexPath);
|
$templateContent = file_get_contents($templateIndexPath);
|
||||||
$resumeContent = file_get_contents($source);
|
$resumeContent = file_get_contents($source);
|
||||||
@ -126,6 +143,7 @@ class HtmlCommand extends Command
|
|||||||
$rendered = $m->render($templateContent, array(
|
$rendered = $m->render($templateContent, array(
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'style' => $style,
|
'style' => $style,
|
||||||
|
'links' => $links,
|
||||||
'resume' => $resumeHtml,
|
'resume' => $resumeHtml,
|
||||||
'reload' => (bool) $refresh,
|
'reload' => (bool) $refresh,
|
||||||
'refresh_rate' => $refresh
|
'refresh_rate' => $refresh
|
||||||
|
1
templates/readable/description.txt
Normal file
1
templates/readable/description.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Bootswatch 'readable' theme
|
17
templates/readable/index.html
Normal file
17
templates/readable/index.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
{{#reload}}
|
||||||
|
<meta http-equiv="refresh" content="{{refresh_rate}}">
|
||||||
|
{{/reload}}
|
||||||
|
|
||||||
|
<title>{{title}}</title>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
{{{resume}}}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
{{{links}}}
|
||||||
|
</html>
|
1
templates/readable/links/bootswatch
Normal file
1
templates/readable/links/bootswatch
Normal file
@ -0,0 +1 @@
|
|||||||
|
<link href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/readable/bootstrap.min.css" rel="stylesheet">
|
Loading…
x
Reference in New Issue
Block a user