mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
ENHANCEMENT Excluding _images folders automatically
This commit is contained in:
parent
8f2a9375b9
commit
c61635be80
@ -31,7 +31,7 @@ class DocumentationService {
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
private static $ignored_files = array('.', '..', '.DS_Store', '.svn', '.git', 'assets', 'themes');
|
||||
private static $ignored_files = array('.', '..', '.DS_Store', '.svn', '.git', 'assets', 'themes', '_images');
|
||||
|
||||
/**
|
||||
* Set the ignored files list
|
||||
@ -227,12 +227,9 @@ class DocumentationService {
|
||||
* @return DocumentationEntity $module the registered module
|
||||
*/
|
||||
public static function is_registered_module($module, $version = false, $lang = false) {
|
||||
|
||||
if(isset(self::$registered_modules[$module])) {
|
||||
$module = self::$registered_modules[$module];
|
||||
|
||||
if($lang && !$module->hasLanguage($lang)) return false;
|
||||
|
||||
if($version && !$module->hasVersion($version)) return false;
|
||||
|
||||
return $module;
|
||||
|
15
tests/DocumentationParserTest.php
Normal file
15
tests/DocumentationParserTest.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @package sapphiredocs
|
||||
*/
|
||||
class DocumentationParserTest extends SapphireTest {
|
||||
|
||||
function testGetPagesFromFolder() {
|
||||
$pages = DocumentationParser::get_pages_from_folder(BASE_PATH . '/sapphiredocs/tests/docs/en/');
|
||||
$this->assertContains('index', $pages->column('Filename'), 'Index');
|
||||
$this->assertContains('subfolder', $pages->column('Filename'), 'Foldername');
|
||||
$this->assertContains('test', $pages->column('Filename'), 'Filename');
|
||||
$this->assertNotContains('_images', $pages->column('Filename'), 'Ignored files');
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user