Skip to content

Commit d78bab0

Browse files
committed
Adding way to change what the api index markdown file is called and updating readme to reflect change.
1 parent aad99e7 commit d78bab0

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ Options
5151
This specifies the 'template' for links we're generating. By default
5252
this is "%c.md".
5353

54+
--index [filename]
55+
This specifies the 'filename' for API Index markdown file we're generating.
56+
By default this is "ApiIndex.md".
57+
5458
This should generate all the .md files. I'm excited to hear your feedback.
5559

5660
Cheers,

bin/phpdocmd

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ $positional = array();
3232

3333
$named = array(
3434
'lt' => '%c.md',
35+
'index' => 'ApiIndex.md',
3536
);
3637

3738
for ($i = 0; $i < count($arguments); $i++) {
@@ -63,13 +64,14 @@ echo "Parsing structure.xml\n";
6364

6465
$classDefinitions = $parser->run();
6566

66-
$templateDir = dirname(__DIR__).'/templates/';
67+
$templateDir = dirname(__DIR__) . '/templates/';
6768

6869
$generator = new PHPDocMD\Generator(
6970
$classDefinitions,
7071
$outputDir,
7172
$templateDir,
72-
$named['lt']
73+
$named['lt'],
74+
$named['index']
7375
);
7476

7577
echo "Generating pages\n";

src/Generator.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,27 @@ class Generator
4444
*/
4545
protected $linkTemplate;
4646

47+
/**
48+
* Filename for API Index.
49+
*
50+
* @var string
51+
*/
52+
protected $apiIndexFile;
53+
4754
/**
4855
* @param array $classDefinitions
4956
* @param string $outputDir
5057
* @param string $templateDir
5158
* @param string $linkTemplate
59+
* @param string $apiIndexFile
5260
*/
53-
public function __construct(array $classDefinitions, $outputDir, $templateDir, $linkTemplate = '%c.md')
61+
public function __construct(array $classDefinitions, $outputDir, $templateDir, $linkTemplate = '%c.md', $apiIndexFile = 'ApiIndex.md')
5462
{
5563
$this->classDefinitions = $classDefinitions;
5664
$this->outputDir = $outputDir;
5765
$this->templateDir = $templateDir;
5866
$this->linkTemplate = $linkTemplate;
67+
$this->apiIndexFile = $apiIndexFile;
5968
}
6069

6170
/**
@@ -91,7 +100,7 @@ public function run()
91100
)
92101
);
93102

94-
file_put_contents($this->outputDir . '/ApiIndex.md', $index);
103+
file_put_contents($this->outputDir . '/' . $this->apiIndexFile, $index);
95104
}
96105

97106
/**

0 commit comments

Comments
 (0)