Permalink
Browse files

Add File Inclusion to Markdown dump

  • Loading branch information...
1 parent 496c31b commit 5ea0f20cd588c28cfa61057c1ec64037678d750f @baldurrensch committed Aug 28, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 Formatter/MarkdownFormatter.php
@@ -15,6 +15,7 @@ class MarkdownFormatter extends AbstractFormatter
{
/**
* {@inheritdoc}
+ * @throws \InvalidArgumentException if the file to be included cannot be loaded.
*/
protected function renderOne(array $data)
{
@@ -33,6 +34,15 @@ protected function renderOne(array $data)
}
}
+ if (!empty($data['fileToInclude'])) {
+ if (!is_readable($data['fileToInclude'])) {
+ throw new \InvalidArgumentException("Could not open: {$fileToInclude}");
+ }
+
+ $fileContents = file_get_contents($data['fileToInclude']);
+ $markdown .= $fileContents;
+ }
+
if (isset($data['requirements']) && !empty($data['requirements'])) {
$markdown .= "#### Requirements ####\n\n";

0 comments on commit 5ea0f20

Please sign in to comment.