From 3124e2fdce6af655ee4d0a5b5ec0b9dbfd615e84 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Mon, 1 Oct 2018 11:41:14 +0200 Subject: [PATCH 01/45] [FEATURE] Add Rst Exporter to generate documentation in rst format --- bin/generate-fluid-documentation | 2 + resources/partials/Arguments.rst | 16 ++ resources/partials/ResourceLinks.rst | 9 + resources/templates/Default/Package.rst | 10 + resources/templates/Default/Root.rst | 13 ++ resources/templates/Default/Schema.rst | 12 ++ resources/templates/Default/Vendor.rst | 11 + resources/templates/Default/ViewHelper.rst | 22 ++ .../templates/Default/ViewHelperGroup.rst | 14 ++ src/Export/RstExporter.php | 203 ++++++++++++++++++ 10 files changed, 312 insertions(+) create mode 100644 resources/partials/Arguments.rst create mode 100644 resources/partials/ResourceLinks.rst create mode 100644 resources/templates/Default/Package.rst create mode 100644 resources/templates/Default/Root.rst create mode 100644 resources/templates/Default/Schema.rst create mode 100644 resources/templates/Default/Vendor.rst create mode 100644 resources/templates/Default/ViewHelper.rst create mode 100644 resources/templates/Default/ViewHelperGroup.rst create mode 100644 src/Export/RstExporter.php diff --git a/bin/generate-fluid-documentation b/bin/generate-fluid-documentation index bbd7f40..7c6c193 100755 --- a/bin/generate-fluid-documentation +++ b/bin/generate-fluid-documentation @@ -9,6 +9,7 @@ require_once $pwd . DIRECTORY_SEPARATOR . 'vendor/autoload.php'; use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; use NamelessCoder\FluidDocumentationGenerator\Export\HtmlExporter; use NamelessCoder\FluidDocumentationGenerator\Export\JsonExporter; +use NamelessCoder\FluidDocumentationGenerator\Export\RstExporter; use NamelessCoder\FluidDocumentationGenerator\Export\XsdExporter; use NamelessCoder\FluidDocumentationGenerator\Entity\Schema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; @@ -22,6 +23,7 @@ $exporters = [ new XsdExporter($publicUrlPrefix), new JsonExporter($publicUrlPrefix), new HtmlExporter($publicUrlPrefix), + new RstExporter($publicUrlPrefix) ]; $generator = SchemaDocumentationGenerator::getInstance($exporters, $force); $generator->generateFilesForRoot(); diff --git a/resources/partials/Arguments.rst b/resources/partials/Arguments.rst new file mode 100644 index 0000000..94287c1 --- /dev/null +++ b/resources/partials/Arguments.rst @@ -0,0 +1,16 @@ + + +* {argument.name} + + + + + +{argument.name} ({argument.type}) {f:if(condition: '{argument.required} == 1', then: 'required')} +================================= + + +Default: {argument.default} + +{argument.description} + diff --git a/resources/partials/ResourceLinks.rst b/resources/partials/ResourceLinks.rst new file mode 100644 index 0000000..4df5572 --- /dev/null +++ b/resources/partials/ResourceLinks.rst @@ -0,0 +1,9 @@ + +Resources +--------- + +* + {resourceName} + + + diff --git a/resources/templates/Default/Package.rst b/resources/templates/Default/Package.rst new file mode 100644 index 0000000..36c218b --- /dev/null +++ b/resources/templates/Default/Package.rst @@ -0,0 +1,10 @@ +.. include:: {rootPath}Includes.txt + +Package: {title} +================================= + +.. toctree:: + :titlesonly: + :glob: + + */* diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst new file mode 100644 index 0000000..364865b --- /dev/null +++ b/resources/templates/Default/Root.rst @@ -0,0 +1,13 @@ +.. include:: Includes.txt + +===================================== +Fluid ViewHelper Documentation (Root) +===================================== + +:Rendered: |today| + +.. toctree:: + :titlesonly: + :glob: + + */* diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst new file mode 100644 index 0000000..853a6c1 --- /dev/null +++ b/resources/templates/Default/Schema.rst @@ -0,0 +1,12 @@ +.. include:: {rootPath}Includes.txt + +{package.fullyQualifiedName} Version {schema.schema.version.version} +================================== + +{schema.documentedViewHelpers -> f:count()} ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + * diff --git a/resources/templates/Default/Vendor.rst b/resources/templates/Default/Vendor.rst new file mode 100644 index 0000000..ad8c506 --- /dev/null +++ b/resources/templates/Default/Vendor.rst @@ -0,0 +1,11 @@ +.. include:: {rootPath}Includes.txt + +Packages from {vendor.vendorName} +========================== + +.. toctree:: + :maxdepth: 1 + :titlesonly: + :glob: + + */* diff --git a/resources/templates/Default/ViewHelper.rst b/resources/templates/Default/ViewHelper.rst new file mode 100644 index 0000000..bfd4e67 --- /dev/null +++ b/resources/templates/Default/ViewHelper.rst @@ -0,0 +1,22 @@ +.. include:: {rootPath}Includes.txt + +======================== +ViewHelper Documentation {f:if(condition: metadata.namespace.alias, then: '{metadata.namespace.alias}:')}{viewHelper.localName} +======================== + + + + {viewHelper.description -> f:format.raw()} + + + This ViewHelper has no description. + + + +Arguments +========= + + + This ViewHelper has no arguments + + diff --git a/resources/templates/Default/ViewHelperGroup.rst b/resources/templates/Default/ViewHelperGroup.rst new file mode 100644 index 0000000..aeba9f9 --- /dev/null +++ b/resources/templates/Default/ViewHelperGroup.rst @@ -0,0 +1,14 @@ +.. include:: {rootPath}Includes.txt + +================ +ViewHelpers in {group.name} +================ + +{group.documentedViewHelpers -> f:count()} ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + */* + * diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php new file mode 100644 index 0000000..457f9a3 --- /dev/null +++ b/src/Export/RstExporter.php @@ -0,0 +1,203 @@ +rootUrl = $rootUrl; + $resourcesDirectory = DataFileResolver::getInstance()->getResourcesDirectoryPath(); + $this->view = new TemplateView(); + $this->view->getRenderingContext()->setCache(new SimpleFileCache(DataFileResolver::getInstance()->getCacheDirectoryPath())); + $this->view->getRenderingContext()->setTemplatePaths(new TemplatePaths( + [ + TemplatePaths::CONFIG_TEMPLATEROOTPATHS => [$resourcesDirectory . 'templates' . DIRECTORY_SEPARATOR], + TemplatePaths::CONFIG_LAYOUTROOTPATHS => [$resourcesDirectory . 'layouts' . DIRECTORY_SEPARATOR], + TemplatePaths::CONFIG_PARTIALROOTPATHS => [$resourcesDirectory . 'partials' . DIRECTORY_SEPARATOR], + TemplatePaths::CONFIG_FORMAT => 'rst' + ] + )); + } + + public function getIdentifier(): string + { + return 'rst'; + } + + public function setGenerator(SchemaDocumentationGenerator $generator): void + { + $this->generator = $generator; + } + + public function createAdditionalViewHelperResources(ViewHelperDocumentation $viewHelperDocumentation, ?string $label = null): array + { + return []; + } + + public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string $label = null): array + { + return []; + } + + public function exportRoot(bool $forceUpdate = false): void + { + $this->view->assign('vendors', DataFileResolver::getInstance()->resolveInstalledVendors()); + $this->view->assign('readme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readRootDataFile('README.md')) ); + DataFileResolver::getInstance()->getWriter()->publishDataFile( + 'Index.rst', + $this->view->render('Root') + ); + } + + public function exportVendor(SchemaVendor $vendor): void + { + $resolver = DataFileResolver::getInstance(); + $this->view->assign('vendor', $vendor); + $this->view->assign('title', $vendor->getVendorName() . ' - ViewHelper Documentation'); + $this->view->assign('vendors', DataFileResolver::getInstance()->resolveInstalledVendors()); + $this->view->assign('readme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readVendorDataFile($vendor, 'README.md')) ); + $this->view->assign('metadata', DataFileResolver::getInstance()->readVendorMetaDataFile($vendor)); + $this->view->assign('rootPath', '../'); + $resolver->getWriter()->publishDataFileForVendor( + $vendor, + 'Index.rst', + $this->view->render('Vendor') + ); + } + + public function exportPackage(SchemaPackage $package): void + { + $resolver = DataFileResolver::getInstance(); + $this->view->assign('package', $package); + $this->view->assign('title', $package->getFullyQualifiedName() . ' - ViewHelper Documentation'); + $this->view->assign('rootPath', '../../'); + $this->view->assign('vendor', $package->getVendor()); + $this->view->assign('vendors', DataFileResolver::getInstance()->resolveInstalledVendors()); + $this->view->assign('vendorReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readVendorDataFile($package->getVendor(), 'README.md')) ); + $this->view->assign('packageReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readPackageDataFile($package, 'README.md')) ); + $resolver->getWriter()->publishDataFileForPackage( + $package, + 'Index.rst', + $this->view->render('Package') + ); + } + + public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate = false): void + { + + $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $processedSchema->getPath() . 'Index.rst')) { + return; + } + $schema = $processedSchema->getSchema(); + $this->view->assign('schema', $processedSchema); + $this->view->assign('title', $schema->getVersion()->getFullyQualifiedName() . ' - ViewHelpers'); + $this->view->assign('rootPath', '../../../'); + $this->view->assign('vendorReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readVendorDataFile($schema->getVendor(), 'README.md')) ); + $this->view->assign('packageReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readPackageDataFile($schema->getPackage(), 'README.md')) ); + $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema)); + $this->view->assign('resources', $this->generator->generateResourceLinksForSchema($processedSchema)); + $resolver->getWriter()->publishDataFileForSchema( + $processedSchema, + 'Index.rst', + $this->view->render('Schema') + ); + } + + public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentation, bool $forceUpdate = false): void + { + $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $viewHelperDocumentation->getSchema()->getPath() . $viewHelperDocumentation->getPath() . '.rst')) { + return; + } + $path = $viewHelperDocumentation->getPath(); + $expandedGroups = []; + if (strpos($path, '/') !== false) { + $rebuiltPath = ''; + $segments = explode('/', $path); + array_pop($segments); + foreach ($segments as $segment) { + $rebuiltPath .= $segment; + $expandedGroups[$rebuiltPath] = $rebuiltPath; + $rebuiltPath .= '/'; + } + } + $schema = $viewHelperDocumentation->getSchema()->getSchema(); + $backPath = str_repeat('../', substr_count($path, '/')); + $rootPath = $backPath . '../../../'; + $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema)); + $this->view->assign('viewHelper', $viewHelperDocumentation); + $this->view->assign('rootPath', $rootPath); + $this->view->assign('title', $viewHelperDocumentation->getName() . ' - ' . $schema->getVersion()->getFullyQualifiedName()); + $this->view->assign('expandedGroups', $expandedGroups); + $this->view->assign('basePath', $rootPath . $viewHelperDocumentation->getSchema()->getPath()); + $resolver->getWriter()->publishDataFileForSchema( + $viewHelperDocumentation->getSchema(), + $path . '.rst', + $this->view->render('ViewHelper') + ); + } + + public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDocumentationGroup, bool $forceUpdate = false): void + { + $resolver = DataFileResolver::getInstance(); + $groupPath = $viewHelperDocumentationGroup->getPath() . DIRECTORY_SEPARATOR; + $schema = $viewHelperDocumentationGroup->getSchema(); + $publishingPath = $resolver->getPublicDirectoryPath() . $schema->getPath() . $groupPath; + if (!$forceUpdate && file_exists($publishingPath . 'Index.rst')) { + return; + } + $expandedGroups = []; + if (strpos($groupPath, '/') !== false) { + $rebuiltPath = ''; + $segments = explode('/', $groupPath); + array_pop($segments); + foreach ($segments as $segment) { + $rebuiltPath .= $segment; + $expandedGroups[$rebuiltPath] = $rebuiltPath; + $rebuiltPath .= '/'; + } + } + $backPath = str_repeat('../', substr_count($groupPath, '/')); + $rootPath = $backPath . '../../../../'; + $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema->getSchema())); + $this->view->assign('title', $viewHelperDocumentationGroup->getName() . ' ViewHelpers - ' . $schema->getSchema()->getVersion()->getFullyQualifiedName()); + $this->view->assign('rootPath', $rootPath); + $this->view->assign('backPath', $backPath); + $this->view->assign('basePath', $rootPath . $schema->getPath()); + $this->view->assign('expandedGroups', $expandedGroups); + $this->view->assign('resources', $this->generator->generateResourceLinksForSchema($schema)); + $this->view->assign('group', $viewHelperDocumentationGroup); + $resolver->getWriter()->publishDataFileForSchema( + $viewHelperDocumentationGroup->getSchema(), + $groupPath . 'Index.rst', + $this->view->render('ViewHelperGroup') + ); + } +} From aebc70d4f3d6e3a733693e03652ce7c6806a78b1 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Mon, 1 Oct 2018 12:16:56 +0200 Subject: [PATCH 02/45] Improve backpath and some cosmetic for headlines (not finished) --- resources/templates/Default/Package.rst | 2 ++ resources/templates/Default/Root.rst | 4 ++-- resources/templates/Default/Schema.rst | 1 + resources/templates/Default/Vendor.rst | 2 +- resources/templates/Default/ViewHelperGroup.rst | 4 +--- src/Export/RstExporter.php | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/resources/templates/Default/Package.rst b/resources/templates/Default/Package.rst index 36c218b..6da1bd8 100644 --- a/resources/templates/Default/Package.rst +++ b/resources/templates/Default/Package.rst @@ -1,8 +1,10 @@ .. include:: {rootPath}Includes.txt +================================= Package: {title} ================================= + .. toctree:: :titlesonly: :glob: diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst index 364865b..4756a66 100644 --- a/resources/templates/Default/Root.rst +++ b/resources/templates/Default/Root.rst @@ -8,6 +8,6 @@ Fluid ViewHelper Documentation (Root) .. toctree:: :titlesonly: - :glob: - */* + typo3/Index + typo3fluid/Index diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst index 853a6c1..3d1d1f2 100644 --- a/resources/templates/Default/Schema.rst +++ b/resources/templates/Default/Schema.rst @@ -1,5 +1,6 @@ .. include:: {rootPath}Includes.txt +================================ {package.fullyQualifiedName} Version {schema.schema.version.version} ================================== diff --git a/resources/templates/Default/Vendor.rst b/resources/templates/Default/Vendor.rst index ad8c506..db16d17 100644 --- a/resources/templates/Default/Vendor.rst +++ b/resources/templates/Default/Vendor.rst @@ -1,10 +1,10 @@ .. include:: {rootPath}Includes.txt +========================== Packages from {vendor.vendorName} ========================== .. toctree:: - :maxdepth: 1 :titlesonly: :glob: diff --git a/resources/templates/Default/ViewHelperGroup.rst b/resources/templates/Default/ViewHelperGroup.rst index aeba9f9..dc4a832 100644 --- a/resources/templates/Default/ViewHelperGroup.rst +++ b/resources/templates/Default/ViewHelperGroup.rst @@ -8,7 +8,5 @@ ViewHelpers in {group.name} .. toctree:: :titlesonly: - :glob: - */* - * + diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 457f9a3..f912ae0 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -185,7 +185,7 @@ public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDo } } $backPath = str_repeat('../', substr_count($groupPath, '/')); - $rootPath = $backPath . '../../../../'; + $rootPath = $backPath . '../../../'; $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema->getSchema())); $this->view->assign('title', $viewHelperDocumentationGroup->getName() . ' ViewHelpers - ' . $schema->getSchema()->getVersion()->getFullyQualifiedName()); $this->view->assign('rootPath', $rootPath); From 46a91d9f0872c18e3acb1f81d6ecd5875b36bccd Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Tue, 2 Oct 2018 10:54:43 +0200 Subject: [PATCH 03/45] [BUGFIX] Pass the forceUpdate parameter into the Exporter --- src/Export/ExporterInterface.php | 5 +++-- src/Export/JsonExporter.php | 4 ++-- src/Export/XsdExporter.php | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Export/ExporterInterface.php b/src/Export/ExporterInterface.php index c89b27e..1e48c4f 100644 --- a/src/Export/ExporterInterface.php +++ b/src/Export/ExporterInterface.php @@ -3,9 +3,9 @@ namespace NamelessCoder\FluidDocumentationGenerator\Export; -use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; +use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentation; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentationGroup; @@ -14,7 +14,8 @@ interface ExporterInterface { public function getIdentifier(): string; public function setGenerator(SchemaDocumentationGenerator $generator): void; - public function exportRoot(): void; + + public function exportRoot(bool $forceUpdate): void; public function exportVendor(SchemaVendor $vendor): void; public function exportPackage(SchemaPackage $package): void; public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate = false): void; diff --git a/src/Export/JsonExporter.php b/src/Export/JsonExporter.php index 7022ba8..1e1cdd8 100644 --- a/src/Export/JsonExporter.php +++ b/src/Export/JsonExporter.php @@ -6,9 +6,9 @@ use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; use NamelessCoder\FluidDocumentationGenerator\Data\GraphDataHandler; use NamelessCoder\FluidDocumentationGenerator\Entity\Schema; -use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; +use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentation; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentationGroup; @@ -53,7 +53,7 @@ public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string ]; } - public function exportRoot(): void + public function exportRoot(bool $forceUpdate): void { $resolver = DataFileResolver::getInstance(); $index = []; diff --git a/src/Export/XsdExporter.php b/src/Export/XsdExporter.php index 8f8b9b3..84127d3 100644 --- a/src/Export/XsdExporter.php +++ b/src/Export/XsdExporter.php @@ -4,9 +4,9 @@ namespace NamelessCoder\FluidDocumentationGenerator\Export; use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; -use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; +use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentation; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentationGroup; @@ -47,7 +47,7 @@ public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string ]; } - public function exportRoot(): void + public function exportRoot(bool $forceUpdate): void { // This method has no function in this exporter } From e1232e9eb81749dfa1186ed9146f58014d714944 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Tue, 2 Oct 2018 10:55:14 +0200 Subject: [PATCH 04/45] [TASK] Adjust tests --- .../SchemaDocumentationGeneratorTest.php | 48 +++++++++---------- Tests/Functional/SchemaProcessingTest.php | 22 +++------ composer.json | 1 + 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/Tests/Functional/SchemaDocumentationGeneratorTest.php b/Tests/Functional/SchemaDocumentationGeneratorTest.php index f0d159f..0aa041b 100644 --- a/Tests/Functional/SchemaDocumentationGeneratorTest.php +++ b/Tests/Functional/SchemaDocumentationGeneratorTest.php @@ -33,16 +33,16 @@ class SchemaDocumentationGeneratorTest extends TestCase protected function setUp() { - $this->vfs = vfsStream::setup('public'); + $this->vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); - $resolver = DataFileResolver::getInstance(vfsStream::url('public')); + $resolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); $resolver->setResourcesDirectory(__DIR__ . '/../../resources/'); $resolver->setSchemasDirectory(__DIR__ . '/../Fixtures/schemas/'); $this->subject = new SchemaDocumentationGenerator( [ new JsonExporter(''), - new XsdExporter(''), - new HtmlExporter('') + new XsdExporter(vfsStream::url('')), + new HtmlExporter(vfsStream::url('')) ], true ); @@ -51,40 +51,36 @@ protected function setUp() public function testGenerateResourcesForRoot(): void { $this->subject->generateFilesForRoot(); - $folder = $this->vfs->getChild('public'); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/index.html')); } public function testGenerateResourcesForVendor(): void { $this->subject->generateFilesForVendor(new SchemaVendor('test')); - $folder = $this->vfs->getChild('public')->getChild('test'); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/index.html')); } public function testGenerateResourcesForPackage(): void { $this->subject->generateFilesForPackage(new SchemaPackage(new SchemaVendor('test'), 'test')); - $folder = $this->vfs->getChild('public')->getChild('test')->getChild('test'); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/index.html')); } public function testGenerateResourcesForSchema(): void { $schema = new Schema(new SchemaVersion(new SchemaPackage(new SchemaVendor('test'), 'test'), '1.0.0')); $this->subject->generateFilesForSchema($schema); - $folder = $this->vfs->getChild('public')->getChild('test')->getChild('test')->getChild('1.0.0'); - $this->assertSame('tree.json', $folder->getChild('tree.json')->getName()); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); - $this->assertSame('schema.xsd', $folder->getChild('schema.xsd')->getName()); - $this->assertSame('Format', $folder->getChild('Format')->getName()); - $this->assertSame('Json', $folder->getChild('Format')->getChild('Json')->getName()); - $this->assertSame('Encode.html', $folder->getChild('Format')->getChild('Json')->getChild('Encode.html')->getName()); - $this->assertSame('Decode.html', $folder->getChild('Format')->getChild('Json')->getChild('Decode.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/tree.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/index.html')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/schema.xsd')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format/Json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format/Json/Encode.html')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format/Json/Decode.html')); } public function testGenerateMachineResourceLinksForSchema(): void @@ -94,8 +90,8 @@ public function testGenerateMachineResourceLinksForSchema(): void [ 'JSON tree' => 'tree.json', 'JSON index' => 'index.json', - 'XSD schema' => 'schema.xsd', - 'HTML overview' => '', + 'XSD schema' => 'vfs://schema.xsd', + 'HTML overview' => 'vfs://', ], $this->subject->generateResourceLinksForSchema($schemaMock) ); @@ -108,7 +104,7 @@ public function testGenerateResourceLinksForViewHelper(): void $this->assertSame( [ 'JSON schema' => 'Root.json', - 'HTML overview' => 'Root.html', + 'HTML overview' => 'vfs://Root.html', ], $this->subject->generateResourceLinksForViewHelper($viewHelper) ); @@ -121,7 +117,7 @@ public function testGenerateMachineResourceLinksForViewHelper(): void $this->assertSame( [ 'json' => 'Root.json', - 'html' => 'Root.html', + 'html' => 'vfs://Root.html', ], $this->subject->generateMachineResourceLinksForViewHelper($viewHelper) ); diff --git a/Tests/Functional/SchemaProcessingTest.php b/Tests/Functional/SchemaProcessingTest.php index e19d438..2bd48d9 100644 --- a/Tests/Functional/SchemaProcessingTest.php +++ b/Tests/Functional/SchemaProcessingTest.php @@ -9,8 +9,8 @@ use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVersion; use org\bovigo\vfs\vfsStream; +use org\bovigo\vfs\vfsStreamDirectory; use PHPUnit\Framework\TestCase; -use TYPO3Fluid\Fluid\Core\ViewHelper\ArgumentDefinition; class SchemaProcessingTest extends TestCase { @@ -33,12 +33,9 @@ protected function setUp() } /** - * @param string $viewHelperName - * @param string $expectedDocumentation - * @param array $expectedArguments - * @dataProvider getDocumentedViewHelperExpectations + * @test */ - public function testViewHelperIsDocumentedCorrectly(string $viewHelperName, string $expectedDocumentation, array $expectedArguments): void + public function viewHelperDocumentationContainsEntriesAsExpected(): void { $vendor = new SchemaVendor('test'); $package = new SchemaPackage($vendor, 'test'); @@ -46,15 +43,8 @@ public function testViewHelperIsDocumentedCorrectly(string $viewHelperName, stri $schema = new Schema($version); $processedSchema = $schema->process(); $documentedViewHelpers = $processedSchema->getDocumentedViewHelpers(); - $this->assertArrayHasKey($viewHelperName, $documentedViewHelpers); - } - - public function getDocumentedViewHelperExpectations(): array - { - return [ - [ - 'format.json.encode', 'foobar', [new ArgumentDefinition('test', 'string', 'foobar', true)] - ] - ]; + $this->assertArrayHasKey('root', $documentedViewHelpers); + $this->assertArrayHasKey('format.json.encode', $documentedViewHelpers); + $this->assertArrayHasKey('format.json.decode', $documentedViewHelpers); } } diff --git a/composer.json b/composer.json index daa8e4b..81161cc 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "bin/generate-fluid-documentation.php" ], "require-dev": { + "ext-json": "*", "phpunit/phpunit": "^7.1", "mikey179/vfsStream": "^1.6" } From b6672f8849bce1307bd5bf5dbbe57592891feb9c Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Tue, 2 Oct 2018 11:02:53 +0200 Subject: [PATCH 05/45] [TASK] Add config for travis --- .gitignore | 1 + .travis.yml | 19 +++++++++++++++++++ composer.json | 3 ++- phpunit.xml.dist | 48 ++++++++++++++++++++++++++---------------------- 4 files changed, 48 insertions(+), 23 deletions(-) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index ea14a76..59b99be 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ cache/* !cache/.keep schemas/* !schemas/.keep +build/logs/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7802812 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: php + +sudo: false + +php: +- "7.1" +- "7.2" + +cache: + directories: + - $HOME/.composer/cache + +install: composer install + +script: +- vendor/bin/phpunit + +after_script: +- travis_retry php vendor/bin/php-coveralls -v diff --git a/composer.json b/composer.json index 81161cc..33ec264 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "require-dev": { "ext-json": "*", "phpunit/phpunit": "^7.1", - "mikey179/vfsStream": "^1.6" + "mikey179/vfsStream": "^1.6", + "php-coveralls/php-coveralls": "^2.1" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 26e5e92..65f997c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,25 +1,29 @@ + + backupGlobals="false" + backupStaticAttributes="false" + colors="false" + convertErrorsToExceptions="true" + convertWarningsToExceptions="true" + forceCoversAnnotation="false" + processIsolation="false" + stopOnError="false" + stopOnFailure="false" + stopOnIncomplete="false" + stopOnSkipped="false" + verbose="false"> - - - tests/ - - - - - src/ - - + + + tests/ + + + + + src/ + + + + + From ff74a20b43bccbd45c18ede3ef2b2cac7a346576 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Tue, 2 Oct 2018 11:09:24 +0200 Subject: [PATCH 06/45] [TASK] Add Travis-CI and Coveralls Build status images --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 34a889d..285c7a0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://travis-ci.com/maddy2101/fluid-documentation-generator.svg?branch=master)](https://travis-ci.com/maddy2101/fluid-documentation-generator) +[![Coverage Status](https://coveralls.io/repos/github/maddy2101/fluid-documentation-generator/badge.svg?branch=master)](https://coveralls.io/github/maddy2101/fluid-documentation-generator?branch=master) + Fluid (ViewHelper) Documentation Generator ========================================== From 9288f31d24c6634dda01abd1de867767dd3e31b7 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Tue, 2 Oct 2018 11:14:26 +0200 Subject: [PATCH 07/45] [BUGFIX] Lowercase tests folder as configured --- {Tests => tests}/Fixtures/schemas/test/test/1.0.0/schema.xsd | 0 {Tests => tests}/Functional/FileResolvingTest.php | 0 {Tests => tests}/Functional/SchemaDocumentationGeneratorTest.php | 0 {Tests => tests}/Functional/SchemaProcessingTest.php | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {Tests => tests}/Fixtures/schemas/test/test/1.0.0/schema.xsd (100%) rename {Tests => tests}/Functional/FileResolvingTest.php (100%) rename {Tests => tests}/Functional/SchemaDocumentationGeneratorTest.php (100%) rename {Tests => tests}/Functional/SchemaProcessingTest.php (100%) diff --git a/Tests/Fixtures/schemas/test/test/1.0.0/schema.xsd b/tests/Fixtures/schemas/test/test/1.0.0/schema.xsd similarity index 100% rename from Tests/Fixtures/schemas/test/test/1.0.0/schema.xsd rename to tests/Fixtures/schemas/test/test/1.0.0/schema.xsd diff --git a/Tests/Functional/FileResolvingTest.php b/tests/Functional/FileResolvingTest.php similarity index 100% rename from Tests/Functional/FileResolvingTest.php rename to tests/Functional/FileResolvingTest.php diff --git a/Tests/Functional/SchemaDocumentationGeneratorTest.php b/tests/Functional/SchemaDocumentationGeneratorTest.php similarity index 100% rename from Tests/Functional/SchemaDocumentationGeneratorTest.php rename to tests/Functional/SchemaDocumentationGeneratorTest.php diff --git a/Tests/Functional/SchemaProcessingTest.php b/tests/Functional/SchemaProcessingTest.php similarity index 100% rename from Tests/Functional/SchemaProcessingTest.php rename to tests/Functional/SchemaProcessingTest.php From 3536d33c6da6e2682dbff8b6819eec51d0f04d57 Mon Sep 17 00:00:00 2001 From: Anja Date: Wed, 3 Oct 2018 13:14:22 +0200 Subject: [PATCH 08/45] [TASK] Add scrutinizer badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 285c7a0..6da35cf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Build Status](https://travis-ci.com/maddy2101/fluid-documentation-generator.svg?branch=master)](https://travis-ci.com/maddy2101/fluid-documentation-generator) [![Coverage Status](https://coveralls.io/repos/github/maddy2101/fluid-documentation-generator/badge.svg?branch=master)](https://coveralls.io/github/maddy2101/fluid-documentation-generator?branch=master) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/maddy2101/fluid-documentation-generator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/maddy2101/fluid-documentation-generator/?branch=master) Fluid (ViewHelper) Documentation Generator ========================================== From 03d50965f7fc54eca799f4566d50ca149d82969c Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 14:03:06 +0200 Subject: [PATCH 09/45] [TASK] Provide Test file structure for rendering tests --- .gitignore | 3 +- .../output/Documentation/Includes.txt | 21 + tests/Fixtures/output/Documentation/Index.rst | 12 + .../output/Documentation/Settings.cfg | 23 + .../typo3/backend/9.5/Avatar.rst | 39 ++ .../Documentation/typo3/backend/9.5/Index.rst | 17 + .../typo3/backend/9.5/Link/EditRecord.rst | 161 +++++ .../typo3/backend/9.5/Link/Index.rst | 13 + .../typo3/backend/9.5/Link/NewRecord.rst | 200 ++++++ .../typo3/backend/9.5/ModuleLayout.rst | 33 + .../backend/9.5/ModuleLayout/Button/Index.rst | 13 + .../9.5/ModuleLayout/Button/LinkButton.rst | 94 +++ .../ModuleLayout/Button/ShortcutButton.rst | 99 +++ .../typo3/backend/9.5/ModuleLayout/Index.rst | 16 + .../typo3/backend/9.5/ModuleLayout/Menu.rst | 35 + .../backend/9.5/ModuleLayout/MenuItem.rst | 41 ++ .../typo3/backend/9.5/ModuleLink.rst | 46 ++ .../typo3/backend/9.5/Uri/EditRecord.rst | 52 ++ .../typo3/backend/9.5/Uri/Index.rst | 14 + .../typo3/backend/9.5/Uri/NewRecord.rst | 85 +++ .../schemas/typo3/backend/9.5/schema.xsd | 607 ++++++++++++++++++ ...ewhelperRstDocumentationGenerationTest.php | 65 ++ 22 files changed, 1688 insertions(+), 1 deletion(-) create mode 100644 tests/Fixtures/output/Documentation/Includes.txt create mode 100644 tests/Fixtures/output/Documentation/Index.rst create mode 100644 tests/Fixtures/output/Documentation/Settings.cfg create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Avatar.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Index.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/Index.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLink.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/Index.rst create mode 100644 tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst create mode 100644 tests/Fixtures/schemas/typo3/backend/9.5/schema.xsd create mode 100644 tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php diff --git a/.gitignore b/.gitignore index 59b99be..d42e763 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ composer.lock +vendor/ public/* !public/.keep cache/* !cache/.keep schemas/* !schemas/.keep -build/logs/ +build/logs/ \ No newline at end of file diff --git a/tests/Fixtures/output/Documentation/Includes.txt b/tests/Fixtures/output/Documentation/Includes.txt new file mode 100644 index 0000000..38aa398 --- /dev/null +++ b/tests/Fixtures/output/Documentation/Includes.txt @@ -0,0 +1,21 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. This is 'Includes.txt'. It is included at the very top of each and + every ReST source file in this documentation project (= manual). + + +.. ================================================== +.. DEFINE SOME TEXTROLES +.. -------------------------------------------------- + +.. role:: typoscript(code) + +.. role:: ts(typoscript) + :class: typoscript + +.. role:: php(code) + +.. highlight:: php diff --git a/tests/Fixtures/output/Documentation/Index.rst b/tests/Fixtures/output/Documentation/Index.rst new file mode 100644 index 0000000..ffbf97a --- /dev/null +++ b/tests/Fixtures/output/Documentation/Index.rst @@ -0,0 +1,12 @@ +.. include:: Includes.txt + +============================== +Fluid ViewHelper Documentation +============================== + +:Rendered: |today| + +.. toctree:: + :titlesonly: + + typo3/backend/9.5/Index diff --git a/tests/Fixtures/output/Documentation/Settings.cfg b/tests/Fixtures/output/Documentation/Settings.cfg new file mode 100644 index 0000000..0ab0992 --- /dev/null +++ b/tests/Fixtures/output/Documentation/Settings.cfg @@ -0,0 +1,23 @@ +[general] + +project = Scheduler +version = latest (9-dev) +release = latest (9-dev) +t3author = François Suter +copyright = 1997-2018 + +description = This is the documentation of TYPO3's system + extension 'scheduler' which lets you register tasks + to happen at a specific time. + + +[html_theme_options] + +# Add 'Edit me on Github' button +github_branch = master +github_repository = TYPO3/TYPO3.CMS +path_to_documentation_dir = typo3/sysext/scheduler/Documentation + +# show as related links +project_issues = https://forge.typo3.org/projects/typo3cms-core/issues +project_repository = https://git.typo3.org/Packages/TYPO3.CMS.git diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Avatar.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Avatar.rst new file mode 100644 index 0000000..4fc3611 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Avatar.rst @@ -0,0 +1,39 @@ +.. include:: ../../../Includes.txt + +====== +avatar +====== + + + Render the avatar img tag for a given backend user + + +Arguments +========= + + + + + + +backendUser (anySimpleType) +================================= + + +uid of the backend user + + +size (anySimpleType) +================================= + + +width and height of the image + + +showIcon (anySimpleType) +================================= + + +show the record icon as well + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Index.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Index.rst new file mode 100644 index 0000000..ff1cda5 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Index.rst @@ -0,0 +1,17 @@ +.. include:: ../../../Includes.txt + +============= +typo3/backend +============= + +3 ViewHelpers documented +3 Sub namespaces + +.. toctree:: + :titlesonly: + :glob: + + */Index + Avatar + ModuleLayout + ModuleLink diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst new file mode 100644 index 0000000..9e019db --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst @@ -0,0 +1,161 @@ +.. include:: ../../../../Includes.txt + +=============== +link.editRecord +=============== + + + Use this ViewHelper to provide edit links to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + + + Edit record + + + + +Arguments +========= + + + + +* additionalAttributes + +* data + +* class + +* dir + +* id + +* lang + +* style + +* title + +* accesskey + +* tabindex + +* onclick + +* uid + +* table + +* returnUrl + + + + + +additionalAttributes (anySimpleType) +================================= + + +Additional tag attributes. They will be added directly to the resulting HTML tag. + + +data (anySimpleType) +================================= + + +Additional data-* attributes. They will each be added with a "data-" prefix. + + +class (string) +================================= + + +CSS class(es) for this element + + +dir (string) +================================= + + +Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + + +id (string) +================================= + + +Unique (in this file) identifier for this HTML element. + + +lang (string) +================================= + + +Language for this element. Use short names specified in RFC 1766 + + +style (string) +================================= + + +Individual CSS styles for this element + + +title (string) +================================= + + +Tooltip text of element + + +accesskey (string) +================================= + + +Keyboard shortcut to access this element + + +tabindex (integer) +================================= + + +Specifies the tab order of this element + + +onclick (string) +================================= + + +JavaScript evaluated for the onclick event + + +uid (anySimpleType) +================================= + + +uid of record to be edited + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/Index.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/Index.rst new file mode 100644 index 0000000..63db8e5 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/Index.rst @@ -0,0 +1,13 @@ +.. include:: ../../../../Includes.txt + +==== +link +==== + +2 ViewHelpers documented + +.. toctree:: + :titlesonly: + + EditRecord + NewRecord diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst new file mode 100644 index 0000000..3b6f062 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst @@ -0,0 +1,200 @@ +.. include:: ../../../../Includes.txt + +============== +link.newRecord +============== + + + Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + + + +Arguments +========= + + + + +* additionalAttributes + +* data + +* class + +* dir + +* id + +* lang + +* style + +* title + +* accesskey + +* tabindex + +* onclick + +* uid + +* pid + +* table + +* returnUrl + + + + + +additionalAttributes (anySimpleType) +================================= + + +Additional tag attributes. They will be added directly to the resulting HTML tag. + + +data (anySimpleType) +================================= + + +Additional data-* attributes. They will each be added with a "data-" prefix. + + +class (string) +================================= + + +CSS class(es) for this element + + +dir (string) +================================= + + +Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + + +id (string) +================================= + + +Unique (in this file) identifier for this HTML element. + + +lang (string) +================================= + + +Language for this element. Use short names specified in RFC 1766 + + +style (string) +================================= + + +Individual CSS styles for this element + + +title (string) +================================= + + +Tooltip text of element + + +accesskey (string) +================================= + + +Keyboard shortcut to access this element + + +tabindex (integer) +================================= + + +Specifies the tab order of this element + + +onclick (string) +================================= + + +JavaScript evaluated for the onclick event + + +uid (anySimpleType) +================================= + + +uid < 0 will insert the record after the given uid + + +pid (anySimpleType) +================================= + + +the page id where the record will be created + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout.rst new file mode 100644 index 0000000..6d832f7 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout.rst @@ -0,0 +1,33 @@ +.. include:: ../../../Includes.txt + +============ +moduleLayout +============ + + + A view helper for having properly styled backend modules. +It is recommended to use it in Fluid Layouts. +It will render the required HTML for the doc header. +All module specific output and further configuration of the doc header +must be rendered as children of this view helper. += Examples = + + + + + + + + + + +Arguments +========= + + + This ViewHelper has no arguments + + + + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst new file mode 100644 index 0000000..be6e420 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst @@ -0,0 +1,13 @@ +.. include:: ../../../../../Includes.txt + +=================== +moduleLayout.button +=================== + +2 ViewHelpers documented + +.. toctree:: + :titlesonly: + + LinkButton + ShortcutButton \ No newline at end of file diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst new file mode 100644 index 0000000..4c9d217 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst @@ -0,0 +1,94 @@ +.. include:: ../../../../../Includes.txt + +============================== +moduleLayout.button.linkButton +============================== + + + A view helper for adding a link button to the doc header area. +It must be a child of += Examples = + + + + + + + +Arguments +========= + + + + +* icon + +* title + +* disabled + +* showLabel + +* position + +* group + +* link + + + + + +icon (string) +================================= + + +Icon identifier for the button + + +title (string) +================================= + + +Title of the button + + +disabled (anySimpleType) +================================= + + +Whether the button is disabled + + +showLabel (anySimpleType) +================================= + + +Defines whether to show the title as a label within the button + + +position (string) +================================= + + +Position of the button (left or right) + + +group (integer) +================================= + + +Button group of the button + + +link (string) +================================= + + +Link for the button + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst new file mode 100644 index 0000000..c4e48b3 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst @@ -0,0 +1,99 @@ +.. include:: ../../../../../Includes.txt + +================================== +moduleLayout.button.shortcutButton +================================== + + + A view helper for adding a shortcut button to the doc header area. +It must be a child of += Examples = + + + + + + + +Arguments +========= + + + + +* icon + +* title + +* disabled + +* showLabel + +* position + +* group + +* displayName + +* getVars + + + + + +icon (string) +================================= + + +Icon identifier for the button + + +title (string) +================================= + + +Title of the button + + +disabled (anySimpleType) +================================= + + +Whether the button is disabled + + +showLabel (anySimpleType) +================================= + + +Defines whether to show the title as a label within the button + + +position (string) +================================= + + +Position of the button (left or right) + + +group (integer) +================================= + + +Button group of the button + + +displayName (string) +================================= + + +Name for the shortcut + + +getVars (anySimpleType) +================================= + + +List of additional GET variables to store. The current id, module and all module arguments will always be stored + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst new file mode 100644 index 0000000..2c966a6 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst @@ -0,0 +1,16 @@ +.. include:: ../../../../Includes.txt + +============ +moduleLayout +============ + +2 ViewHelpers documented +1 Sub namespace + +.. toctree:: + :titlesonly: + :glob: + + */Index + Menu + MenuItem diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst new file mode 100644 index 0000000..80dea27 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst @@ -0,0 +1,35 @@ +.. include:: ../../../../Includes.txt + +================= +moduleLayout.menu +================= + + + A view helper for adding a menu to the doc header area. +It must be a child of and accepts +only view helpers as children. += Examples = + + + + + + + + + +Arguments +========= + + + + + + +identifier (string) +================================= + + +Identifier of the menu + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst new file mode 100644 index 0000000..99cafc5 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst @@ -0,0 +1,41 @@ +.. include:: ../../../../Includes.txt + +===================== +moduleLayout.menuItem +===================== + + + A view helper for adding a menu item to a doc header menu. +It must be a child of += Examples = + + + + + + + + + +Arguments +========= + + + + + + +label (string) +================================= + + +Label of the menu item + + +uri (string) +================================= + + +Action uri + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLink.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLink.rst new file mode 100644 index 0000000..79a3425 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLink.rst @@ -0,0 +1,46 @@ +.. include:: ../../../Includes.txt + +========== +moduleLink +========== + + + Create internal link within backend app + + +Arguments +========= + + + + + + +route (string) +================================= + + +The route to link to + + +arguments (anySimpleType) +================================= + + +Additional link arguments + + +query (string) +================================= + + +Additional link arguments as string + + +currentUrlParameterName (string) +================================= + + +Add current url as given parameter + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst new file mode 100644 index 0000000..1a7a782 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst @@ -0,0 +1,52 @@ +.. include:: ../../../../Includes.txt + +============== +uri.editRecord +============== + + + Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + + + +Arguments +========= + + + + + + +uid (anySimpleType) +================================= + + +uid of record to be edited, 0 for creation + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/Index.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/Index.rst new file mode 100644 index 0000000..5087868 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/Index.rst @@ -0,0 +1,14 @@ +.. include:: ../../../../Includes.txt + +=== +uri +=== + +2 ViewHelpers documented + +.. toctree:: + :titlesonly: + + EditRecord + NewRecord + diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst new file mode 100644 index 0000000..7f5d0f0 --- /dev/null +++ b/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst @@ -0,0 +1,85 @@ +.. include:: ../../../../Includes.txt + +============= +uri.newRecord +============= + + + Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + +Arguments +========= + + + + + + +uid (anySimpleType) +================================= + + +uid < 0 will insert the record after the given uid + + +pid (anySimpleType) +================================= + + +the page id where the record will be created + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Fixtures/schemas/typo3/backend/9.5/schema.xsd b/tests/Fixtures/schemas/typo3/backend/9.5/schema.xsd new file mode 100644 index 0000000..0ca64d9 --- /dev/null +++ b/tests/Fixtures/schemas/typo3/backend/9.5/schema.xsd @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/]]> + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + and accepts +only view helpers as children. += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php new file mode 100644 index 0000000..65ea5cf --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php @@ -0,0 +1,65 @@ +subject->generateFilesForRoot(); + + foreach ($this->dataFileResolver->resolveInstalledVendors() as $vendor) { + $this->subject->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $this->subject->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + echo $version->getVersion() . ' '; + $this->subject->generateFilesForSchema(new Schema($version)); + } + } + } + $this->assertSame(file_get_contents(__DIR__ . '/../Fixtures/output/Documentation/Index.rst'), + $this->vfs->getChild('outputDir/public/Index.rst')); + } + + protected function setUp() + { + $this->vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $this->dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $this->dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $this->dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/schemas/typo3'); + $this->subject = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + } +} From fffb1bdede166244673dd91b39b70546992eef90 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 14:53:26 +0200 Subject: [PATCH 10/45] [TASK] Clean up tests for root Index.rst generation test --- ...ootIndexRstDocumentationGenerationTest.php | 63 ++++++++++++++++++ ...ewhelperRstDocumentationGenerationTest.php | 65 ------------------- 2 files changed, 63 insertions(+), 65 deletions(-) create mode 100644 tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php delete mode 100644 tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php new file mode 100644 index 0000000..0ebf28a --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -0,0 +1,63 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/schemas/typo3'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: Includes.txt' . PHP_EOL, $output[0]); + } +} diff --git a/tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php deleted file mode 100644 index 65ea5cf..0000000 --- a/tests/Functional/Typo3BackendViewhelperRstDocumentationGenerationTest.php +++ /dev/null @@ -1,65 +0,0 @@ -subject->generateFilesForRoot(); - - foreach ($this->dataFileResolver->resolveInstalledVendors() as $vendor) { - $this->subject->generateFilesForVendor($vendor); - foreach ($vendor->getPackages() as $package) { - $this->subject->generateFilesForPackage($package); - foreach ($package->getVersions() as $version) { - echo $version->getVersion() . ' '; - $this->subject->generateFilesForSchema(new Schema($version)); - } - } - } - $this->assertSame(file_get_contents(__DIR__ . '/../Fixtures/output/Documentation/Index.rst'), - $this->vfs->getChild('outputDir/public/Index.rst')); - } - - protected function setUp() - { - $this->vfs = vfsStream::setup('outputDir'); - $this->vfs->addChild(vfsStream::newDirectory('cache')); - $this->dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $this->dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $this->dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/schemas/typo3'); - $this->subject = new SchemaDocumentationGenerator( - [ - new RstExporter() - ] - ); - } -} From b301385d926c3585166c21547af63930108c91a7 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 15:05:22 +0200 Subject: [PATCH 11/45] [TASK] Correct headline in root Index.rst --- resources/templates/Default/Root.rst | 6 +++--- ...whelperRootIndexRstDocumentationGenerationTest.php | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst index 4756a66..5c8f2c8 100644 --- a/resources/templates/Default/Root.rst +++ b/resources/templates/Default/Root.rst @@ -1,8 +1,8 @@ .. include:: Includes.txt -===================================== -Fluid ViewHelper Documentation (Root) -===================================== +============================== +Fluid ViewHelper Documentation +============================== :Rendered: |today| diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index 0ebf28a..d7861b6 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -60,4 +60,15 @@ public function includeClausePointsToSettingsCfg() $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $this->assertSame('.. include:: Includes.txt' . PHP_EOL, $output[0]); } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('Fluid ViewHelper Documentation' . PHP_EOL, $output[$index]); + } } From 3dfb85711d51401f47773a1a42b24143644ec10c Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 15:12:16 +0200 Subject: [PATCH 12/45] [TASK] Headline decoration is same length as headline --- src/Data/DataFileResolver.php | 1 + ...elperRootIndexRstDocumentationGenerationTest.php | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/Data/DataFileResolver.php b/src/Data/DataFileResolver.php index b8e8e80..14d1c4a 100644 --- a/src/Data/DataFileResolver.php +++ b/src/Data/DataFileResolver.php @@ -209,6 +209,7 @@ public function getResourcesDirectoryPath(): string public function getPublicDirectoryPath(): string { +// return '/home/maddy/Documents/fluid/viewhelper_docu/Documentation/'; return $this->rootDirectory . DIRECTORY_SEPARATOR . static::PUBLIC_DIRECTORY . DIRECTORY_SEPARATOR; } diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index d7861b6..0988244 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -71,4 +71,17 @@ public function headlineAsExpected() $index = 3; $this->assertSame('Fluid ViewHelper Documentation' . PHP_EOL, $output[$index]); } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + } } From 7605541f183ff6048bb5a9f999b0242239748975 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 15:24:00 +0200 Subject: [PATCH 13/45] [TASK] Headline decoration must only contain equal signs --- ...BackendViewhelperRootIndexRstDocumentationGenerationTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index 0988244..1a874bb 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -82,6 +82,8 @@ public function headlineIsProperlyDecorated() $headlineTextIndex = 3; $lengthOfHeadline = strlen($output[$headlineTextIndex]); $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); } } From 0012292eec7b170ccda29a36fcd48fa034e140c4 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 15:46:38 +0200 Subject: [PATCH 14/45] [TASK] Clarify fixture files for rst rendering --- src/Data/DataFileResolver.php | 1 - .../input}/typo3/backend/9.5/schema.xsd | 0 .../output/Documentation/Includes.txt | 0 .../output/Documentation/Index.rst | 0 .../output/Documentation/Settings.cfg | 0 .../Documentation/typo3/backend/9.5/Avatar.rst | 0 .../Documentation/typo3/backend/9.5/Index.rst | 0 .../typo3/backend/9.5/Link/EditRecord.rst | 0 .../typo3/backend/9.5/Link/Index.rst | 0 .../typo3/backend/9.5/Link/NewRecord.rst | 0 .../typo3/backend/9.5/ModuleLayout.rst | 0 .../backend/9.5/ModuleLayout/Button/Index.rst | 0 .../9.5/ModuleLayout/Button/LinkButton.rst | 0 .../9.5/ModuleLayout/Button/ShortcutButton.rst | 0 .../typo3/backend/9.5/ModuleLayout/Index.rst | 0 .../typo3/backend/9.5/ModuleLayout/Menu.rst | 0 .../typo3/backend/9.5/ModuleLayout/MenuItem.rst | 0 .../typo3/backend/9.5/ModuleLink.rst | 0 .../typo3/backend/9.5/Uri/EditRecord.rst | 0 .../Documentation/typo3/backend/9.5/Uri/Index.rst | 0 .../typo3/backend/9.5/Uri/NewRecord.rst | 0 ...perRootIndexRstDocumentationGenerationTest.php | 15 +++++++++++++-- 22 files changed, 13 insertions(+), 3 deletions(-) rename tests/Fixtures/{schemas => rendering/input}/typo3/backend/9.5/schema.xsd (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/Includes.txt (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/Index.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/Settings.cfg (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Avatar.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Index.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Link/Index.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLayout.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/ModuleLink.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Uri/Index.rst (100%) rename tests/Fixtures/{ => rendering}/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst (100%) diff --git a/src/Data/DataFileResolver.php b/src/Data/DataFileResolver.php index 14d1c4a..b8e8e80 100644 --- a/src/Data/DataFileResolver.php +++ b/src/Data/DataFileResolver.php @@ -209,7 +209,6 @@ public function getResourcesDirectoryPath(): string public function getPublicDirectoryPath(): string { -// return '/home/maddy/Documents/fluid/viewhelper_docu/Documentation/'; return $this->rootDirectory . DIRECTORY_SEPARATOR . static::PUBLIC_DIRECTORY . DIRECTORY_SEPARATOR; } diff --git a/tests/Fixtures/schemas/typo3/backend/9.5/schema.xsd b/tests/Fixtures/rendering/input/typo3/backend/9.5/schema.xsd similarity index 100% rename from tests/Fixtures/schemas/typo3/backend/9.5/schema.xsd rename to tests/Fixtures/rendering/input/typo3/backend/9.5/schema.xsd diff --git a/tests/Fixtures/output/Documentation/Includes.txt b/tests/Fixtures/rendering/output/Documentation/Includes.txt similarity index 100% rename from tests/Fixtures/output/Documentation/Includes.txt rename to tests/Fixtures/rendering/output/Documentation/Includes.txt diff --git a/tests/Fixtures/output/Documentation/Index.rst b/tests/Fixtures/rendering/output/Documentation/Index.rst similarity index 100% rename from tests/Fixtures/output/Documentation/Index.rst rename to tests/Fixtures/rendering/output/Documentation/Index.rst diff --git a/tests/Fixtures/output/Documentation/Settings.cfg b/tests/Fixtures/rendering/output/Documentation/Settings.cfg similarity index 100% rename from tests/Fixtures/output/Documentation/Settings.cfg rename to tests/Fixtures/rendering/output/Documentation/Settings.cfg diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Avatar.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Avatar.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Index.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/Index.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/ModuleLink.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/Index.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst diff --git a/tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst similarity index 100% rename from tests/Fixtures/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst rename to tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index 1a874bb..af99081 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -21,7 +21,7 @@ class Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest extends Test * the generated file is compared against this fixture file * @var string */ - private $fixtureFilePath = __DIR__ . '/../Fixtures/output/Documentation/Index.rst'; + private $fixtureFilePath = __DIR__ . '/../Fixtures/rendering/output/Documentation/Index.rst'; /** * output of the generation process @@ -35,7 +35,7 @@ protected function setUp() $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/schemas/typo3'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() @@ -86,4 +86,15 @@ public function headlineIsProperlyDecorated() $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 11; + $this->assertSame('typo3/backend/9.5/Index' . PHP_EOL, $output[$index]); + $this->assertEmpty($output[$index + 1]); + } } From a031e64b432ea736efa6ff72f0a4cb3b5cac0d6d Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 16:20:49 +0200 Subject: [PATCH 15/45] [TASK] Render tocTree part of root Index.rst --- resources/templates/Default/Root.rst | 3 +- src/Export/RstExporter.php | 17 +- .../input/typo3/backend/9.4/schema.xsd | 607 ++++++++++++++++++ ...ootIndexRstDocumentationGenerationTest.php | 6 +- 4 files changed, 626 insertions(+), 7 deletions(-) create mode 100644 tests/Fixtures/rendering/input/typo3/backend/9.4/schema.xsd diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst index 5c8f2c8..e119f9f 100644 --- a/resources/templates/Default/Root.rst +++ b/resources/templates/Default/Root.rst @@ -9,5 +9,4 @@ Fluid ViewHelper Documentation .. toctree:: :titlesonly: - typo3/Index - typo3fluid/Index +{line} diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index f912ae0..870592b 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -5,9 +5,9 @@ use cebe\markdown\GithubMarkdown; use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; -use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; +use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentation; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentationGroup; @@ -67,8 +67,19 @@ public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string public function exportRoot(bool $forceUpdate = false): void { - $this->view->assign('vendors', DataFileResolver::getInstance()->resolveInstalledVendors()); - $this->view->assign('readme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readRootDataFile('README.md')) ); + $vendors = DataFileResolver::getInstance()->resolveInstalledVendors(); + // better to put the output together here, because fluid tends to mess up the empty lines + // that are important to proper rst rendering + $toctree = []; + $intend = ' '; + foreach ($vendors as $vendor) { + foreach ($vendor->getPackages() as $package) { + foreach ($package->getVersions() as $version) { + $toctree[] = $intend . $vendor->getVendorName() . '/' . $package->getPackageName() . '/' . $version->getVersion() . '/Index' . PHP_EOL; + } + } + } + $this->view->assign('tocTree', $toctree); DataFileResolver::getInstance()->getWriter()->publishDataFile( 'Index.rst', $this->view->render('Root') diff --git a/tests/Fixtures/rendering/input/typo3/backend/9.4/schema.xsd b/tests/Fixtures/rendering/input/typo3/backend/9.4/schema.xsd new file mode 100644 index 0000000..0ca64d9 --- /dev/null +++ b/tests/Fixtures/rendering/input/typo3/backend/9.4/schema.xsd @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/]]> + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + and accepts +only view helpers as children. += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index af99081..a38ceeb 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -94,7 +94,9 @@ public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 11; - $this->assertSame('typo3/backend/9.5/Index' . PHP_EOL, $output[$index]); - $this->assertEmpty($output[$index + 1]); +// $this->assertSame(file_get_contents($this->fixtureFilePath), $this->vfs->getChild($this->generatedFilePath)); + $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); + $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); + $this->assertSame(PHP_EOL, $output[$index + 2]); } } From 87757302645575a577c568750bb87472973d3194 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 16:34:41 +0200 Subject: [PATCH 16/45] [TASK] Generated Root Index.rst is the same as fixture file --- resources/templates/Default/Root.rst | 2 +- .../rendering/output/Documentation/Index.rst | 3 ++- ...helperRootIndexRstDocumentationGenerationTest.php | 12 ++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst index e119f9f..e591e4c 100644 --- a/resources/templates/Default/Root.rst +++ b/resources/templates/Default/Root.rst @@ -9,4 +9,4 @@ Fluid ViewHelper Documentation .. toctree:: :titlesonly: -{line} +{line} \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/Index.rst b/tests/Fixtures/rendering/output/Documentation/Index.rst index ffbf97a..511e920 100644 --- a/tests/Fixtures/rendering/output/Documentation/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/Index.rst @@ -9,4 +9,5 @@ Fluid ViewHelper Documentation .. toctree:: :titlesonly: - typo3/backend/9.5/Index + typo3/backend/9.4/Index + typo3/backend/9.5/Index diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index a38ceeb..c961f9e 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -94,9 +94,17 @@ public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 11; -// $this->assertSame(file_get_contents($this->fixtureFilePath), $this->vfs->getChild($this->generatedFilePath)); $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); - $this->assertSame(PHP_EOL, $output[$index + 2]); + $this->assertArrayNotHasKey($index + 2, $output); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(file_get_contents($this->fixtureFilePath), + file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); } } From d47d36e6141cc90d7a7b9a3057262c450e62dbf2 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Thu, 4 Oct 2018 19:17:11 +0200 Subject: [PATCH 17/45] [TASK] Generated file structure complies to fixture --- resources/templates/Default/Package.rst | 12 -- resources/templates/Default/Vendor.rst | 11 - src/Export/RstExporter.php | 25 --- .../output/Documentation/Includes.txt | 21 -- .../output/Documentation/Settings.cfg | 23 -- .../typo3/backend/9.4/Avatar.rst | 39 ++++ .../Documentation/typo3/backend/9.4/Index.rst | 17 ++ .../typo3/backend/9.4/Link/EditRecord.rst | 161 ++++++++++++++ .../typo3/backend/9.4/Link/Index.rst | 13 ++ .../typo3/backend/9.4/Link/NewRecord.rst | 200 ++++++++++++++++++ .../typo3/backend/9.4/ModuleLayout.rst | 33 +++ .../backend/9.4/ModuleLayout/Button/Index.rst | 13 ++ .../9.4/ModuleLayout/Button/LinkButton.rst | 94 ++++++++ .../ModuleLayout/Button/ShortcutButton.rst | 99 +++++++++ .../typo3/backend/9.4/ModuleLayout/Index.rst | 16 ++ .../typo3/backend/9.4/ModuleLayout/Menu.rst | 35 +++ .../backend/9.4/ModuleLayout/MenuItem.rst | 41 ++++ .../typo3/backend/9.4/ModuleLink.rst | 46 ++++ .../typo3/backend/9.4/Uri/EditRecord.rst | 52 +++++ .../typo3/backend/9.4/Uri/Index.rst | 14 ++ .../typo3/backend/9.4/Uri/NewRecord.rst | 85 ++++++++ ...rDirStructureRstDocumentGenerationTest.php | 85 ++++++++ 22 files changed, 1043 insertions(+), 92 deletions(-) delete mode 100644 resources/templates/Default/Package.rst delete mode 100644 resources/templates/Default/Vendor.rst delete mode 100644 tests/Fixtures/rendering/output/Documentation/Includes.txt delete mode 100644 tests/Fixtures/rendering/output/Documentation/Settings.cfg create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst create mode 100644 tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst create mode 100644 tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php diff --git a/resources/templates/Default/Package.rst b/resources/templates/Default/Package.rst deleted file mode 100644 index 6da1bd8..0000000 --- a/resources/templates/Default/Package.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. include:: {rootPath}Includes.txt - -================================= -Package: {title} -================================= - - -.. toctree:: - :titlesonly: - :glob: - - */* diff --git a/resources/templates/Default/Vendor.rst b/resources/templates/Default/Vendor.rst deleted file mode 100644 index db16d17..0000000 --- a/resources/templates/Default/Vendor.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. include:: {rootPath}Includes.txt - -========================== -Packages from {vendor.vendorName} -========================== - -.. toctree:: - :titlesonly: - :glob: - - */* diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 870592b..f2cd3a8 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -88,35 +88,10 @@ public function exportRoot(bool $forceUpdate = false): void public function exportVendor(SchemaVendor $vendor): void { - $resolver = DataFileResolver::getInstance(); - $this->view->assign('vendor', $vendor); - $this->view->assign('title', $vendor->getVendorName() . ' - ViewHelper Documentation'); - $this->view->assign('vendors', DataFileResolver::getInstance()->resolveInstalledVendors()); - $this->view->assign('readme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readVendorDataFile($vendor, 'README.md')) ); - $this->view->assign('metadata', DataFileResolver::getInstance()->readVendorMetaDataFile($vendor)); - $this->view->assign('rootPath', '../'); - $resolver->getWriter()->publishDataFileForVendor( - $vendor, - 'Index.rst', - $this->view->render('Vendor') - ); } public function exportPackage(SchemaPackage $package): void { - $resolver = DataFileResolver::getInstance(); - $this->view->assign('package', $package); - $this->view->assign('title', $package->getFullyQualifiedName() . ' - ViewHelper Documentation'); - $this->view->assign('rootPath', '../../'); - $this->view->assign('vendor', $package->getVendor()); - $this->view->assign('vendors', DataFileResolver::getInstance()->resolveInstalledVendors()); - $this->view->assign('vendorReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readVendorDataFile($package->getVendor(), 'README.md')) ); - $this->view->assign('packageReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readPackageDataFile($package, 'README.md')) ); - $resolver->getWriter()->publishDataFileForPackage( - $package, - 'Index.rst', - $this->view->render('Package') - ); } public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate = false): void diff --git a/tests/Fixtures/rendering/output/Documentation/Includes.txt b/tests/Fixtures/rendering/output/Documentation/Includes.txt deleted file mode 100644 index 38aa398..0000000 --- a/tests/Fixtures/rendering/output/Documentation/Includes.txt +++ /dev/null @@ -1,21 +0,0 @@ -.. ================================================== -.. FOR YOUR INFORMATION -.. -------------------------------------------------- -.. -*- coding: utf-8 -*- with BOM. - -.. This is 'Includes.txt'. It is included at the very top of each and - every ReST source file in this documentation project (= manual). - - -.. ================================================== -.. DEFINE SOME TEXTROLES -.. -------------------------------------------------- - -.. role:: typoscript(code) - -.. role:: ts(typoscript) - :class: typoscript - -.. role:: php(code) - -.. highlight:: php diff --git a/tests/Fixtures/rendering/output/Documentation/Settings.cfg b/tests/Fixtures/rendering/output/Documentation/Settings.cfg deleted file mode 100644 index 0ab0992..0000000 --- a/tests/Fixtures/rendering/output/Documentation/Settings.cfg +++ /dev/null @@ -1,23 +0,0 @@ -[general] - -project = Scheduler -version = latest (9-dev) -release = latest (9-dev) -t3author = François Suter -copyright = 1997-2018 - -description = This is the documentation of TYPO3's system - extension 'scheduler' which lets you register tasks - to happen at a specific time. - - -[html_theme_options] - -# Add 'Edit me on Github' button -github_branch = master -github_repository = TYPO3/TYPO3.CMS -path_to_documentation_dir = typo3/sysext/scheduler/Documentation - -# show as related links -project_issues = https://forge.typo3.org/projects/typo3cms-core/issues -project_repository = https://git.typo3.org/Packages/TYPO3.CMS.git diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst new file mode 100644 index 0000000..4fc3611 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst @@ -0,0 +1,39 @@ +.. include:: ../../../Includes.txt + +====== +avatar +====== + + + Render the avatar img tag for a given backend user + + +Arguments +========= + + + + + + +backendUser (anySimpleType) +================================= + + +uid of the backend user + + +size (anySimpleType) +================================= + + +width and height of the image + + +showIcon (anySimpleType) +================================= + + +show the record icon as well + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst new file mode 100644 index 0000000..ff1cda5 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst @@ -0,0 +1,17 @@ +.. include:: ../../../Includes.txt + +============= +typo3/backend +============= + +3 ViewHelpers documented +3 Sub namespaces + +.. toctree:: + :titlesonly: + :glob: + + */Index + Avatar + ModuleLayout + ModuleLink diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst new file mode 100644 index 0000000..9e019db --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst @@ -0,0 +1,161 @@ +.. include:: ../../../../Includes.txt + +=============== +link.editRecord +=============== + + + Use this ViewHelper to provide edit links to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + + + Edit record + + + + +Arguments +========= + + + + +* additionalAttributes + +* data + +* class + +* dir + +* id + +* lang + +* style + +* title + +* accesskey + +* tabindex + +* onclick + +* uid + +* table + +* returnUrl + + + + + +additionalAttributes (anySimpleType) +================================= + + +Additional tag attributes. They will be added directly to the resulting HTML tag. + + +data (anySimpleType) +================================= + + +Additional data-* attributes. They will each be added with a "data-" prefix. + + +class (string) +================================= + + +CSS class(es) for this element + + +dir (string) +================================= + + +Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + + +id (string) +================================= + + +Unique (in this file) identifier for this HTML element. + + +lang (string) +================================= + + +Language for this element. Use short names specified in RFC 1766 + + +style (string) +================================= + + +Individual CSS styles for this element + + +title (string) +================================= + + +Tooltip text of element + + +accesskey (string) +================================= + + +Keyboard shortcut to access this element + + +tabindex (integer) +================================= + + +Specifies the tab order of this element + + +onclick (string) +================================= + + +JavaScript evaluated for the onclick event + + +uid (anySimpleType) +================================= + + +uid of record to be edited + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst new file mode 100644 index 0000000..63db8e5 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst @@ -0,0 +1,13 @@ +.. include:: ../../../../Includes.txt + +==== +link +==== + +2 ViewHelpers documented + +.. toctree:: + :titlesonly: + + EditRecord + NewRecord diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst new file mode 100644 index 0000000..3b6f062 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst @@ -0,0 +1,200 @@ +.. include:: ../../../../Includes.txt + +============== +link.newRecord +============== + + + Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + + + +Arguments +========= + + + + +* additionalAttributes + +* data + +* class + +* dir + +* id + +* lang + +* style + +* title + +* accesskey + +* tabindex + +* onclick + +* uid + +* pid + +* table + +* returnUrl + + + + + +additionalAttributes (anySimpleType) +================================= + + +Additional tag attributes. They will be added directly to the resulting HTML tag. + + +data (anySimpleType) +================================= + + +Additional data-* attributes. They will each be added with a "data-" prefix. + + +class (string) +================================= + + +CSS class(es) for this element + + +dir (string) +================================= + + +Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + + +id (string) +================================= + + +Unique (in this file) identifier for this HTML element. + + +lang (string) +================================= + + +Language for this element. Use short names specified in RFC 1766 + + +style (string) +================================= + + +Individual CSS styles for this element + + +title (string) +================================= + + +Tooltip text of element + + +accesskey (string) +================================= + + +Keyboard shortcut to access this element + + +tabindex (integer) +================================= + + +Specifies the tab order of this element + + +onclick (string) +================================= + + +JavaScript evaluated for the onclick event + + +uid (anySimpleType) +================================= + + +uid < 0 will insert the record after the given uid + + +pid (anySimpleType) +================================= + + +the page id where the record will be created + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst new file mode 100644 index 0000000..6d832f7 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst @@ -0,0 +1,33 @@ +.. include:: ../../../Includes.txt + +============ +moduleLayout +============ + + + A view helper for having properly styled backend modules. +It is recommended to use it in Fluid Layouts. +It will render the required HTML for the doc header. +All module specific output and further configuration of the doc header +must be rendered as children of this view helper. += Examples = + + + + + + + + + + +Arguments +========= + + + This ViewHelper has no arguments + + + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst new file mode 100644 index 0000000..be6e420 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst @@ -0,0 +1,13 @@ +.. include:: ../../../../../Includes.txt + +=================== +moduleLayout.button +=================== + +2 ViewHelpers documented + +.. toctree:: + :titlesonly: + + LinkButton + ShortcutButton \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst new file mode 100644 index 0000000..4c9d217 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst @@ -0,0 +1,94 @@ +.. include:: ../../../../../Includes.txt + +============================== +moduleLayout.button.linkButton +============================== + + + A view helper for adding a link button to the doc header area. +It must be a child of += Examples = + + + + + + + +Arguments +========= + + + + +* icon + +* title + +* disabled + +* showLabel + +* position + +* group + +* link + + + + + +icon (string) +================================= + + +Icon identifier for the button + + +title (string) +================================= + + +Title of the button + + +disabled (anySimpleType) +================================= + + +Whether the button is disabled + + +showLabel (anySimpleType) +================================= + + +Defines whether to show the title as a label within the button + + +position (string) +================================= + + +Position of the button (left or right) + + +group (integer) +================================= + + +Button group of the button + + +link (string) +================================= + + +Link for the button + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst new file mode 100644 index 0000000..c4e48b3 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst @@ -0,0 +1,99 @@ +.. include:: ../../../../../Includes.txt + +================================== +moduleLayout.button.shortcutButton +================================== + + + A view helper for adding a shortcut button to the doc header area. +It must be a child of += Examples = + + + + + + + +Arguments +========= + + + + +* icon + +* title + +* disabled + +* showLabel + +* position + +* group + +* displayName + +* getVars + + + + + +icon (string) +================================= + + +Icon identifier for the button + + +title (string) +================================= + + +Title of the button + + +disabled (anySimpleType) +================================= + + +Whether the button is disabled + + +showLabel (anySimpleType) +================================= + + +Defines whether to show the title as a label within the button + + +position (string) +================================= + + +Position of the button (left or right) + + +group (integer) +================================= + + +Button group of the button + + +displayName (string) +================================= + + +Name for the shortcut + + +getVars (anySimpleType) +================================= + + +List of additional GET variables to store. The current id, module and all module arguments will always be stored + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst new file mode 100644 index 0000000..2c966a6 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst @@ -0,0 +1,16 @@ +.. include:: ../../../../Includes.txt + +============ +moduleLayout +============ + +2 ViewHelpers documented +1 Sub namespace + +.. toctree:: + :titlesonly: + :glob: + + */Index + Menu + MenuItem diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst new file mode 100644 index 0000000..80dea27 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst @@ -0,0 +1,35 @@ +.. include:: ../../../../Includes.txt + +================= +moduleLayout.menu +================= + + + A view helper for adding a menu to the doc header area. +It must be a child of and accepts +only view helpers as children. += Examples = + + + + + + + + + +Arguments +========= + + + + + + +identifier (string) +================================= + + +Identifier of the menu + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst new file mode 100644 index 0000000..99cafc5 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst @@ -0,0 +1,41 @@ +.. include:: ../../../../Includes.txt + +===================== +moduleLayout.menuItem +===================== + + + A view helper for adding a menu item to a doc header menu. +It must be a child of += Examples = + + + + + + + + + +Arguments +========= + + + + + + +label (string) +================================= + + +Label of the menu item + + +uri (string) +================================= + + +Action uri + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst new file mode 100644 index 0000000..79a3425 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst @@ -0,0 +1,46 @@ +.. include:: ../../../Includes.txt + +========== +moduleLink +========== + + + Create internal link within backend app + + +Arguments +========= + + + + + + +route (string) +================================= + + +The route to link to + + +arguments (anySimpleType) +================================= + + +Additional link arguments + + +query (string) +================================= + + +Additional link arguments as string + + +currentUrlParameterName (string) +================================= + + +Add current url as given parameter + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst new file mode 100644 index 0000000..1a7a782 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst @@ -0,0 +1,52 @@ +.. include:: ../../../../Includes.txt + +============== +uri.editRecord +============== + + + Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + + + +Arguments +========= + + + + + + +uid (anySimpleType) +================================= + + +uid of record to be edited, 0 for creation + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst new file mode 100644 index 0000000..5087868 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst @@ -0,0 +1,14 @@ +.. include:: ../../../../Includes.txt + +=== +uri +=== + +2 ViewHelpers documented + +.. toctree:: + :titlesonly: + + EditRecord + NewRecord + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst new file mode 100644 index 0000000..7f5d0f0 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst @@ -0,0 +1,85 @@ +.. include:: ../../../../Includes.txt + +============= +uri.newRecord +============= + + + Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + +Arguments +========= + + + + + + +uid (anySimpleType) +================================= + + +uid < 0 will insert the record after the given uid + + +pid (anySimpleType) +================================= + + +the page id where the record will be created + + +table (string) +================================= + + +target database table + + +returnUrl (string) +================================= + + + + + diff --git a/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php b/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php new file mode 100644 index 0000000..31805dd --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php @@ -0,0 +1,85 @@ +directoryToArray($this->fixtureFilePath); + $actual = $this->directoryToArray($this->vfs->getChild('outputDir/public')->url()); + $this->assertSame($expected, $actual); + } + + private function directoryToArray(string $directory): array + { + + $result = []; + + $cdir = scandir($directory); + foreach ($cdir as $key => $value) { + if (!in_array($value, ['.', '..'])) { + if (is_dir($directory . DIRECTORY_SEPARATOR . $value)) { + $result[$value] = $this->directoryToArray($directory . DIRECTORY_SEPARATOR . $value); + } else { + $result[] = $value; + } + } + } + + return $result; + } + + protected function setUp() + { + $this->vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } +} \ No newline at end of file From 6b5c562c8ccc619e93074039d1670fb96ecfe210 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 09:25:53 +0200 Subject: [PATCH 18/45] [TASK] Remove unused variable in test --- ...ckendViewhelperDirStructureRstDocumentGenerationTest.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php b/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php index 31805dd..6f2476f 100644 --- a/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php @@ -24,12 +24,6 @@ class Typo3BackendViewhelperDirStructureRstDocumentGenerationTest extends TestCa */ private $fixtureFilePath = __DIR__ . '/../Fixtures/rendering/output/Documentation'; - /** - * output of the generation process - * @var string - */ - private $generatedFilePath = 'outputDir/public/Index.rst'; - /** * @test */ From 2385c9a116e3f72eeda888bf924db86e688c05b3 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 09:45:23 +0200 Subject: [PATCH 19/45] [TASK] Schema Index.rst contains proper headline --- resources/templates/Default/Schema.rst | 2 +- src/Export/RstExporter.php | 9 +- ...emaIndexRstDocumentationGenerationTest.php | 120 ++++++++++++++++++ 3 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst index 3d1d1f2..fdc1b60 100644 --- a/resources/templates/Default/Schema.rst +++ b/resources/templates/Default/Schema.rst @@ -1,7 +1,7 @@ .. include:: {rootPath}Includes.txt ================================ -{package.fullyQualifiedName} Version {schema.schema.version.version} +{package.vendor.vendorName}/{package.packageName} ================================== {schema.documentedViewHelpers -> f:count()} ViewHelpers documented diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index f2cd3a8..9235e10 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -3,7 +3,6 @@ namespace NamelessCoder\FluidDocumentationGenerator\Export; -use cebe\markdown\GithubMarkdown; use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; @@ -102,13 +101,7 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate return; } $schema = $processedSchema->getSchema(); - $this->view->assign('schema', $processedSchema); - $this->view->assign('title', $schema->getVersion()->getFullyQualifiedName() . ' - ViewHelpers'); - $this->view->assign('rootPath', '../../../'); - $this->view->assign('vendorReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readVendorDataFile($schema->getVendor(), 'README.md')) ); - $this->view->assign('packageReadme', (new GithubMarkdown())->parse(DataFileResolver::getInstance()->readPackageDataFile($schema->getPackage(), 'README.md')) ); - $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema)); - $this->view->assign('resources', $this->generator->generateResourceLinksForSchema($processedSchema)); + $this->view->assign('package', $schema->getPackage()); $resolver->getWriter()->publishDataFileForSchema( $processedSchema, 'Index.rst', diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php new file mode 100644 index 0000000..8159aab --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php @@ -0,0 +1,120 @@ +assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('typo3/backend' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 11; + $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); + $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); + $this->assertArrayNotHasKey($index + 2, $output); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(file_get_contents($this->fixtureFilePath), + file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); + } + + protected function setUp() + { + $this->vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } +} From 374f4774ea0675e11748f6017e0d541e5fc95f3c Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 09:48:21 +0200 Subject: [PATCH 20/45] [TASK] Includes.txt is included correctly --- src/Export/RstExporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 9235e10..9a7b585 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -95,13 +95,13 @@ public function exportPackage(SchemaPackage $package): void public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate = false): void { - $resolver = DataFileResolver::getInstance(); if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $processedSchema->getPath() . 'Index.rst')) { return; } $schema = $processedSchema->getSchema(); $this->view->assign('package', $schema->getPackage()); + $this->view->assign('rootPath', '../../../'); $resolver->getWriter()->publishDataFileForSchema( $processedSchema, 'Index.rst', From 1fed55b284b1ee4babfdd0f67214295f7350523d Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 09:54:24 +0200 Subject: [PATCH 21/45] [TASK] Headline decoration has equal length as headline --- resources/templates/Default/Schema.rst | 6 +++--- src/Export/RstExporter.php | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst index fdc1b60..ef5b12a 100644 --- a/resources/templates/Default/Schema.rst +++ b/resources/templates/Default/Schema.rst @@ -1,8 +1,8 @@ .. include:: {rootPath}Includes.txt -================================ -{package.vendor.vendorName}/{package.packageName} -================================== +{headlineDecoration} +{headline} +{headlineDecoration} {schema.documentedViewHelpers -> f:count()} ViewHelpers documented diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 9a7b585..3326c3a 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -100,8 +100,14 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate return; } $schema = $processedSchema->getSchema(); - $this->view->assign('package', $schema->getPackage()); - $this->view->assign('rootPath', '../../../'); + $headline = $schema->getPackage()->getVendor()->getVendorName() . '/' . $schema->getPackage()->getPackageName(); + $decorationHeadlineLength = strlen($headline); + $headlineDecoration = array_pad([], $decorationHeadlineLength, '='); + $this->view->assignMultiple([ + 'headline' => $headline, + 'headlineDecoration' => implode('', $headlineDecoration), + 'rootPath' => '../../../', + ]); $resolver->getWriter()->publishDataFileForSchema( $processedSchema, 'Index.rst', From 6e7b5b9af86b3b14e78677e7f00336b53fbd19bc Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 10:12:16 +0200 Subject: [PATCH 22/45] [TASK] ViewHelper Count is integrated --- resources/templates/Default/Schema.rst | 3 ++- src/Export/RstExporter.php | 2 ++ ...helperSchemaIndexRstDocumentationGenerationTest.php | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst index ef5b12a..4d3b28b 100644 --- a/resources/templates/Default/Schema.rst +++ b/resources/templates/Default/Schema.rst @@ -4,7 +4,8 @@ {headline} {headlineDecoration} -{schema.documentedViewHelpers -> f:count()} ViewHelpers documented +{viewHelpers} ViewHelpers documented +{subGroups} Sub Namespaces .. toctree:: :titlesonly: diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 3326c3a..b18a17e 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -107,6 +107,8 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), 'rootPath' => '../../../', + 'subGroups' => \count($processedSchema->getDocumentationTree()->getSubGroups()), + 'viewHelpers' => \count($processedSchema->getDocumentationTree()->getDocumentedViewHelpers()), ]); $resolver->getWriter()->publishDataFileForSchema( $processedSchema, diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php index 8159aab..d794d9e 100644 --- a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php @@ -73,6 +73,16 @@ public function headlineIsProperlyDecorated() $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); } + /** + * @test + */ + public function viewHelperCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 6; + $this->assertSame('3 ViewHelpers documented' . PHP_EOL, $output[$index]); + } + /** * @test */ From 6276508aa436b9fce73850c8ff5b268c81f4cacb Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 10:13:23 +0200 Subject: [PATCH 23/45] [TASK] Sub Namespaces Count is integrated --- ...helperSchemaIndexRstDocumentationGenerationTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php index d794d9e..5b67fac 100644 --- a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php @@ -83,6 +83,16 @@ public function viewHelperCountIsIntegrated() $this->assertSame('3 ViewHelpers documented' . PHP_EOL, $output[$index]); } + /** + * @test + */ + public function subNamespacesCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('3 Sub Namespaces' . PHP_EOL, $output[$index]); + } + /** * @test */ From 81db21b1d59ce8449f95c71f1b506ca8facdef96 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 10:27:03 +0200 Subject: [PATCH 24/45] [TASK] Toctree gets correct values --- resources/templates/Default/Schema.rst | 4 ++-- src/Export/RstExporter.php | 15 +++++++++++++-- .../Documentation/typo3/backend/9.4/Index.rst | 8 ++++---- ...perRootIndexRstDocumentationGenerationTest.php | 1 - ...rSchemaIndexRstDocumentationGenerationTest.php | 15 ++++++++------- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst index 4d3b28b..635d461 100644 --- a/resources/templates/Default/Schema.rst +++ b/resources/templates/Default/Schema.rst @@ -5,10 +5,10 @@ {headlineDecoration} {viewHelpers} ViewHelpers documented -{subGroups} Sub Namespaces +{subGroups} Sub namespaces .. toctree:: :titlesonly: :glob: - * +{line} diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index b18a17e..7369b31 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -103,12 +103,23 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate $headline = $schema->getPackage()->getVendor()->getVendorName() . '/' . $schema->getPackage()->getPackageName(); $decorationHeadlineLength = strlen($headline); $headlineDecoration = array_pad([], $decorationHeadlineLength, '='); + $toctree = []; + $intend = ' '; + $subGroupsCount = \count($processedSchema->getDocumentationTree()->getSubGroups()); + if ($subGroupsCount > 0) { + $toctree[] = $intend . '*/Index' . PHP_EOL; + } + $viewHelpers = $processedSchema->getDocumentationTree()->getDocumentedViewHelpers(); + foreach ($viewHelpers as $viewHelper) { + $toctree[] = $intend . $viewHelper->getLocalName() . PHP_EOL; + } $this->view->assignMultiple([ 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), 'rootPath' => '../../../', - 'subGroups' => \count($processedSchema->getDocumentationTree()->getSubGroups()), - 'viewHelpers' => \count($processedSchema->getDocumentationTree()->getDocumentedViewHelpers()), + 'subGroups' => $subGroupsCount, + 'viewHelpers' => \count($viewHelpers), + 'tocTree' => $toctree, ]); $resolver->getWriter()->publishDataFileForSchema( $processedSchema, diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst index ff1cda5..57a8370 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst @@ -11,7 +11,7 @@ typo3/backend :titlesonly: :glob: - */Index - Avatar - ModuleLayout - ModuleLink + */Index + Avatar + ModuleLayout + ModuleLink diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index c961f9e..855f2b6 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -96,7 +96,6 @@ public function tocTreeContainsSubDirectoriesAsExpected() $index = 11; $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); - $this->assertArrayNotHasKey($index + 2, $output); } /** diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php index 5b67fac..9ee7875 100644 --- a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php @@ -90,7 +90,7 @@ public function subNamespacesCountIsIntegrated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 7; - $this->assertSame('3 Sub Namespaces' . PHP_EOL, $output[$index]); + $this->assertSame('3 Sub namespaces' . PHP_EOL, $output[$index]); } /** @@ -99,10 +99,11 @@ public function subNamespacesCountIsIntegrated() public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); - $index = 11; - $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); - $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); - $this->assertArrayNotHasKey($index + 2, $output); + $index = 13; + $this->assertSame(' */Index' . PHP_EOL, $output[$index]); + $this->assertSame(' Avatar' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' ModuleLayout' . PHP_EOL, $output[$index + 2]); + $this->assertSame(' ModuleLink' . PHP_EOL, $output[$index + 3]); } /** @@ -110,8 +111,8 @@ public function tocTreeContainsSubDirectoriesAsExpected() */ public function generatedFileIsSameAsFixture() { - $this->assertSame(file_get_contents($this->fixtureFilePath), - file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); + $this->assertSame(trim(file_get_contents($this->fixtureFilePath)), + trim(file_get_contents($this->vfs->getChild($this->generatedFilePath)->url()))); } protected function setUp() From 8fcf06fbbc6e0bd1fa008ca71a45321b7c8c0271 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 10:51:53 +0200 Subject: [PATCH 25/45] [TASK] Test for first level VH documentation --- ...rFirstLevelDocumentationGenerationTest.php | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php diff --git a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php new file mode 100644 index 0000000..6039633 --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php @@ -0,0 +1,65 @@ +assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + protected function setUp() + { + $this->vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } +} \ No newline at end of file From 517e0ea651374d9fe237fcf370a41ab644f70cb1 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 10:53:43 +0200 Subject: [PATCH 26/45] [TASK] Move setup to top of test files --- ...rDirStructureRstDocumentGenerationTest.php | 48 +++++++++---------- ...rFirstLevelDocumentationGenerationTest.php | 16 +++---- ...emaIndexRstDocumentationGenerationTest.php | 48 +++++++++---------- 3 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php b/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php index 6f2476f..642a93a 100644 --- a/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php @@ -24,6 +24,30 @@ class Typo3BackendViewhelperDirStructureRstDocumentGenerationTest extends TestCa */ private $fixtureFilePath = __DIR__ . '/../Fixtures/rendering/output/Documentation'; + protected function setUp() + { + $this->vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + /** * @test */ @@ -52,28 +76,4 @@ private function directoryToArray(string $directory): array return $result; } - - protected function setUp() - { - $this->vfs = vfsStream::setup('outputDir'); - $this->vfs->addChild(vfsStream::newDirectory('cache')); - $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); - $schemaDocumentationGenerator = new SchemaDocumentationGenerator( - [ - new RstExporter() - ] - ); - $schemaDocumentationGenerator->generateFilesForRoot(); - foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { - $schemaDocumentationGenerator->generateFilesForVendor($vendor); - foreach ($vendor->getPackages() as $package) { - $schemaDocumentationGenerator->generateFilesForPackage($package); - foreach ($package->getVersions() as $version) { - $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); - } - } - } - } } \ No newline at end of file diff --git a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php index 6039633..7746fe5 100644 --- a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php @@ -31,14 +31,6 @@ class Typo3BackendViewhelperFirstLevelDocumentationGenerationTest extends TestCa */ private $generatedFilePath = 'outputDir/public/typo3/backend/9.4/ModuleLink.rst'; - /** - * @test - */ - public function fileIsCreated() - { - $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); - } - protected function setUp() { $this->vfs = vfsStream::setup('outputDir'); @@ -62,4 +54,12 @@ protected function setUp() } } } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } } \ No newline at end of file diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php index 9ee7875..7dee2d7 100644 --- a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php @@ -30,6 +30,30 @@ class Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest extends Te */ private $generatedFilePath = 'outputDir/public/typo3/backend/9.4/Index.rst'; + protected function setUp() + { + $this->vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + /** * @test */ @@ -114,28 +138,4 @@ public function generatedFileIsSameAsFixture() $this->assertSame(trim(file_get_contents($this->fixtureFilePath)), trim(file_get_contents($this->vfs->getChild($this->generatedFilePath)->url()))); } - - protected function setUp() - { - $this->vfs = vfsStream::setup('outputDir'); - $this->vfs->addChild(vfsStream::newDirectory('cache')); - $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); - $schemaDocumentationGenerator = new SchemaDocumentationGenerator( - [ - new RstExporter() - ] - ); - $schemaDocumentationGenerator->generateFilesForRoot(); - foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { - $schemaDocumentationGenerator->generateFilesForVendor($vendor); - foreach ($vendor->getPackages() as $package) { - $schemaDocumentationGenerator->generateFilesForPackage($package); - foreach ($package->getVersions() as $version) { - $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); - } - } - } - } } From 39da3b306781f41a9f084f79db03dfee692cabef Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 11:01:52 +0200 Subject: [PATCH 27/45] [TASK] Add Tests for Includes.txt and headline --- resources/templates/Default/ViewHelper.rst | 6 +-- src/Export/RstExporter.php | 52 ++++++++++++------- ...rFirstLevelDocumentationGenerationTest.php | 35 +++++++++++++ 3 files changed, 70 insertions(+), 23 deletions(-) diff --git a/resources/templates/Default/ViewHelper.rst b/resources/templates/Default/ViewHelper.rst index bfd4e67..a8f9249 100644 --- a/resources/templates/Default/ViewHelper.rst +++ b/resources/templates/Default/ViewHelper.rst @@ -1,8 +1,8 @@ .. include:: {rootPath}Includes.txt -======================== -ViewHelper Documentation {f:if(condition: metadata.namespace.alias, then: '{metadata.namespace.alias}:')}{viewHelper.localName} -======================== +{headlineDecoration} +{headline} +{headlineDecoration} diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 7369b31..d8c3c01 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -135,26 +135,38 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio return; } $path = $viewHelperDocumentation->getPath(); - $expandedGroups = []; - if (strpos($path, '/') !== false) { - $rebuiltPath = ''; - $segments = explode('/', $path); - array_pop($segments); - foreach ($segments as $segment) { - $rebuiltPath .= $segment; - $expandedGroups[$rebuiltPath] = $rebuiltPath; - $rebuiltPath .= '/'; - } - } - $schema = $viewHelperDocumentation->getSchema()->getSchema(); - $backPath = str_repeat('../', substr_count($path, '/')); - $rootPath = $backPath . '../../../'; - $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema)); - $this->view->assign('viewHelper', $viewHelperDocumentation); - $this->view->assign('rootPath', $rootPath); - $this->view->assign('title', $viewHelperDocumentation->getName() . ' - ' . $schema->getVersion()->getFullyQualifiedName()); - $this->view->assign('expandedGroups', $expandedGroups); - $this->view->assign('basePath', $rootPath . $viewHelperDocumentation->getSchema()->getPath()); + + $headline = $viewHelperDocumentation->getName(); + $decorationHeadlineLength = strlen($headline); + $headlineDecoration = array_pad([], $decorationHeadlineLength, '='); + + $this->view->assignMultiple([ + 'headline' => $headline, + 'headlineDecoration' => implode('', $headlineDecoration), + 'rootPath' => '../../../', + ]); + + +// $expandedGroups = []; +// if (strpos($path, '/') !== false) { +// $rebuiltPath = ''; +// $segments = explode('/', $path); +// array_pop($segments); +// foreach ($segments as $segment) { +// $rebuiltPath .= $segment; +// $expandedGroups[$rebuiltPath] = $rebuiltPath; +// $rebuiltPath .= '/'; +// } +// } +// $schema = $viewHelperDocumentation->getSchema()->getSchema(); +// $backPath = str_repeat('../', substr_count($path, '/')); +// $rootPath = $backPath . '../../../'; +// $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema)); +// $this->view->assign('viewHelper', $viewHelperDocumentation); +// $this->view->assign('rootPath', $rootPath); +// $this->view->assign('title', $viewHelperDocumentation->getName() . ' - ' . $schema->getVersion()->getFullyQualifiedName()); +// $this->view->assign('expandedGroups', $expandedGroups); +// $this->view->assign('basePath', $rootPath . $viewHelperDocumentation->getSchema()->getPath()); $resolver->getWriter()->publishDataFileForSchema( $viewHelperDocumentation->getSchema(), $path . '.rst', diff --git a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php index 7746fe5..74d593b 100644 --- a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php @@ -62,4 +62,39 @@ public function fileIsCreated() { $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('moduleLink' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } } \ No newline at end of file From 835f9405c0cbcf6ab64523094abc6e81ded88a2b Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 11:10:53 +0200 Subject: [PATCH 28/45] [TASK] Add Tests for Description --- resources/templates/Default/ViewHelper.rst | 10 ++-------- src/Export/RstExporter.php | 1 + ...ViewhelperFirstLevelDocumentationGenerationTest.php | 10 ++++++++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/resources/templates/Default/ViewHelper.rst b/resources/templates/Default/ViewHelper.rst index a8f9249..855ad24 100644 --- a/resources/templates/Default/ViewHelper.rst +++ b/resources/templates/Default/ViewHelper.rst @@ -4,14 +4,8 @@ {headline} {headlineDecoration} - - - {viewHelper.description -> f:format.raw()} - - - This ViewHelper has no description. - - + +{viewHelper.description -> f:format.raw()} Arguments ========= diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index d8c3c01..b837609 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -144,6 +144,7 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), 'rootPath' => '../../../', + 'viewHelper' => $viewHelperDocumentation, ]); diff --git a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php index 74d593b..6329bef 100644 --- a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php @@ -97,4 +97,14 @@ public function headlineIsProperlyDecorated() $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); } + + /** + * @test + */ + public function descriptionGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('Create internal link within backend app' . PHP_EOL, $output[$index]); + } } \ No newline at end of file From 1b9e2ba16264f9ca44f97a7b17507dfaea7c81fe Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 11:15:44 +0200 Subject: [PATCH 29/45] [TASK] Prepare fixture file for test --- .../typo3/backend/9.4/ModuleLink.rst | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst index 79a3425..f7f5c6b 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst @@ -5,42 +5,32 @@ moduleLink ========== - Create internal link within backend app - +Create internal link within backend app Arguments ========= - - - - -route (string) -================================= +route (string) +-------------- The route to link to - -arguments (anySimpleType) -================================= +arguments (anySimpleType) +------------------------- Additional link arguments - -query (string) -================================= +query (string) +-------------- Additional link arguments as string - -currentUrlParameterName (string) -================================= - - -Add current url as given parameter +currentUrlParameterName (string) +-------------------------------- +Add current url as given parameter \ No newline at end of file From b379d5061d0621e3e36d19c04454360c7c692236 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 11:54:41 +0200 Subject: [PATCH 30/45] [TASK] First Level ViewHelper gets rendered as expected --- resources/partials/Arguments.rst | 16 ---------------- resources/templates/Default/ViewHelper.rst | 17 +++++++++++++---- src/Export/RstExporter.php | 17 +++++++++++++++++ .../typo3/backend/9.4/ModuleLink.rst | 2 ++ ...perFirstLevelDocumentationGenerationTest.php | 9 +++++++++ 5 files changed, 41 insertions(+), 20 deletions(-) delete mode 100644 resources/partials/Arguments.rst diff --git a/resources/partials/Arguments.rst b/resources/partials/Arguments.rst deleted file mode 100644 index 94287c1..0000000 --- a/resources/partials/Arguments.rst +++ /dev/null @@ -1,16 +0,0 @@ - - -* {argument.name} - - - - - -{argument.name} ({argument.type}) {f:if(condition: '{argument.required} == 1', then: 'required')} -================================= - - -Default: {argument.default} - -{argument.description} - diff --git a/resources/templates/Default/ViewHelper.rst b/resources/templates/Default/ViewHelper.rst index 855ad24..028c12c 100644 --- a/resources/templates/Default/ViewHelper.rst +++ b/resources/templates/Default/ViewHelper.rst @@ -10,7 +10,16 @@ Arguments ========= - - This ViewHelper has no arguments - - + + +This ViewHelper has no arguments. + + +{argumentData.headline} +{argumentData.headlineDecoration} + + +{argumentData.default} +{argumentData.description} + + \ No newline at end of file diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index b837609..67c62b7 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -140,11 +140,28 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio $decorationHeadlineLength = strlen($headline); $headlineDecoration = array_pad([], $decorationHeadlineLength, '='); + $arguments = []; + foreach ($viewHelperDocumentation->getArgumentDefinitions() as $argumentDefinition) { + $argumentHeadline = trim($argumentDefinition->getName() . ' (' . $argumentDefinition->getType() . ') ' . ($argumentDefinition->isRequired() ? 'required' : '')); + $argumentHeadlineDecoration = array_pad([], strlen($argumentHeadline), '-'); + $argumentsData = [ + 'headline' => $argumentHeadline, + 'headlineDecoration' => implode('', $argumentHeadlineDecoration), + 'description' => $argumentDefinition->getDescription(), + ]; + + if ($argumentDefinition->getDefaultValue() !== 'NULL') { + $argumentsData['default'] = 'Default: ' . trim(str_replace(PHP_EOL, '', $argumentDefinition->getDefaultValue())) . PHP_EOL; + } + $arguments[] = $argumentsData; + } + $this->view->assignMultiple([ 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), 'rootPath' => '../../../', 'viewHelper' => $viewHelperDocumentation, + 'arguments' => $arguments, ]); diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst index f7f5c6b..0ebd809 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst @@ -21,6 +21,8 @@ arguments (anySimpleType) ------------------------- +Default: array () + Additional link arguments query (string) diff --git a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php index 6329bef..18568f8 100644 --- a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php @@ -107,4 +107,13 @@ public function descriptionGetsRendered() $index = 7; $this->assertSame('Create internal link within backend app' . PHP_EOL, $output[$index]); } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(file_get_contents($this->fixtureFilePath), + file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); + } } \ No newline at end of file From be7d25d7e4c22562547368ca03453c9534172359 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 12:03:15 +0200 Subject: [PATCH 31/45] [TASK] Remove dead code --- src/Export/RstExporter.php | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 67c62b7..cd82b8e 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -131,6 +131,7 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentation, bool $forceUpdate = false): void { $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $viewHelperDocumentation->getSchema()->getPath() . $viewHelperDocumentation->getPath() . '.rst')) { return; } @@ -151,11 +152,10 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio ]; if ($argumentDefinition->getDefaultValue() !== 'NULL') { - $argumentsData['default'] = 'Default: ' . trim(str_replace(PHP_EOL, '', $argumentDefinition->getDefaultValue())) . PHP_EOL; + $argumentsData['default'] = 'Default: ' . trim(str_replace(PHP_EOL, '', (string)$argumentDefinition->getDefaultValue())) . PHP_EOL; } $arguments[] = $argumentsData; } - $this->view->assignMultiple([ 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), @@ -163,28 +163,6 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio 'viewHelper' => $viewHelperDocumentation, 'arguments' => $arguments, ]); - - -// $expandedGroups = []; -// if (strpos($path, '/') !== false) { -// $rebuiltPath = ''; -// $segments = explode('/', $path); -// array_pop($segments); -// foreach ($segments as $segment) { -// $rebuiltPath .= $segment; -// $expandedGroups[$rebuiltPath] = $rebuiltPath; -// $rebuiltPath .= '/'; -// } -// } -// $schema = $viewHelperDocumentation->getSchema()->getSchema(); -// $backPath = str_repeat('../', substr_count($path, '/')); -// $rootPath = $backPath . '../../../'; -// $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema)); -// $this->view->assign('viewHelper', $viewHelperDocumentation); -// $this->view->assign('rootPath', $rootPath); -// $this->view->assign('title', $viewHelperDocumentation->getName() . ' - ' . $schema->getVersion()->getFullyQualifiedName()); -// $this->view->assign('expandedGroups', $expandedGroups); -// $this->view->assign('basePath', $rootPath . $viewHelperDocumentation->getSchema()->getPath()); $resolver->getWriter()->publishDataFileForSchema( $viewHelperDocumentation->getSchema(), $path . '.rst', From 5a70a02e8e6a5c1e86bb83ef18790ea725c9c819 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 12:29:58 +0200 Subject: [PATCH 32/45] [TASK] ViewHelperGroup Index.rst gets rendered --- .../templates/Default/ViewHelperGroup.rst | 13 +- src/Export/RstExporter.php | 45 +++--- .../typo3/backend/9.4/ModuleLayout/Index.rst | 9 +- ...upsIndexRstDocumentationGenerationTest.php | 140 ++++++++++++++++++ 4 files changed, 175 insertions(+), 32 deletions(-) create mode 100644 tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php diff --git a/resources/templates/Default/ViewHelperGroup.rst b/resources/templates/Default/ViewHelperGroup.rst index dc4a832..39cda2b 100644 --- a/resources/templates/Default/ViewHelperGroup.rst +++ b/resources/templates/Default/ViewHelperGroup.rst @@ -1,12 +1,17 @@ .. include:: {rootPath}Includes.txt -================ -ViewHelpers in {group.name} -================ +{headlineDecoration} +{headline} +{headlineDecoration} -{group.documentedViewHelpers -> f:count()} ViewHelpers documented + +{viewHelpers} ViewHelpers documented +{subGroups} Sub namespaces .. toctree:: :titlesonly: + :glob: + +{line} diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index cd82b8e..b0c57c6 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -174,32 +174,29 @@ public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDo { $resolver = DataFileResolver::getInstance(); $groupPath = $viewHelperDocumentationGroup->getPath() . DIRECTORY_SEPARATOR; - $schema = $viewHelperDocumentationGroup->getSchema(); - $publishingPath = $resolver->getPublicDirectoryPath() . $schema->getPath() . $groupPath; - if (!$forceUpdate && file_exists($publishingPath . 'Index.rst')) { - return; - } - $expandedGroups = []; - if (strpos($groupPath, '/') !== false) { - $rebuiltPath = ''; - $segments = explode('/', $groupPath); - array_pop($segments); - foreach ($segments as $segment) { - $rebuiltPath .= $segment; - $expandedGroups[$rebuiltPath] = $rebuiltPath; - $rebuiltPath .= '/'; - } - } $backPath = str_repeat('../', substr_count($groupPath, '/')); $rootPath = $backPath . '../../../'; - $this->view->assign('metadata', DataFileResolver::getInstance()->readSchemaMetaDataFile($schema->getSchema())); - $this->view->assign('title', $viewHelperDocumentationGroup->getName() . ' ViewHelpers - ' . $schema->getSchema()->getVersion()->getFullyQualifiedName()); - $this->view->assign('rootPath', $rootPath); - $this->view->assign('backPath', $backPath); - $this->view->assign('basePath', $rootPath . $schema->getPath()); - $this->view->assign('expandedGroups', $expandedGroups); - $this->view->assign('resources', $this->generator->generateResourceLinksForSchema($schema)); - $this->view->assign('group', $viewHelperDocumentationGroup); + + $headline = $viewHelperDocumentationGroup->getGroupId(); + $headlineDecoration = array_pad([], strlen($headline), '='); + $viewHelpers = $viewHelperDocumentationGroup->getDocumentedViewHelpers(); + $subGroupsCount = \count($viewHelperDocumentationGroup->getSubGroups()); + $toctree = []; + $intend = ' '; + if ($subGroupsCount > 0) { + $toctree[] = $intend . '*/Index' . PHP_EOL; + } + foreach ($viewHelpers as $viewHelper) { + $toctree[] = $intend . $viewHelper->getLocalName() . PHP_EOL; + } + $this->view->assignMultiple([ + 'headline' => $headline, + 'headlineDecoration' => implode('', $headlineDecoration), + 'rootPath' => $rootPath, + 'viewHelpers' => \count($viewHelpers), + 'subGroups' => $subGroupsCount, + 'tocTree' => $toctree, + ]); $resolver->getWriter()->publishDataFileForSchema( $viewHelperDocumentationGroup->getSchema(), $groupPath . 'Index.rst', diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst index 2c966a6..f4e2614 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst @@ -4,13 +4,14 @@ moduleLayout ============ + 2 ViewHelpers documented -1 Sub namespace +1 Sub namespaces .. toctree:: :titlesonly: :glob: - */Index - Menu - MenuItem + */Index + MenuItem + Menu diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php new file mode 100644 index 0000000..dfd1bce --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php @@ -0,0 +1,140 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('moduleLayout' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function viewHelperCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('2 ViewHelpers documented' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function subNamespacesCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 8; + $this->assertSame('1 Sub namespaces' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 14; + $this->assertSame(' */Index' . PHP_EOL, $output[$index]); + $this->assertSame(' MenuItem' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' Menu' . PHP_EOL, $output[$index + 2]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(trim(file_get_contents($this->fixtureFilePath)), + trim(file_get_contents($this->vfs->getChild($this->generatedFilePath)->url()))); + } +} From 416c86486cf7e25e8feee298215e7a15d7bbfc47 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 12:39:42 +0200 Subject: [PATCH 33/45] [TASK] ViewHelperGroup Index.rst without subgroups gets rendered --- .../templates/Default/ViewHelperGroup.rst | 4 +- .../typo3/backend/9.4/Link/Index.rst | 6 +- ...upsIndexRstDocumentationGenerationTest.php | 129 ++++++++++++++++++ 3 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php diff --git a/resources/templates/Default/ViewHelperGroup.rst b/resources/templates/Default/ViewHelperGroup.rst index 39cda2b..bfe0849 100644 --- a/resources/templates/Default/ViewHelperGroup.rst +++ b/resources/templates/Default/ViewHelperGroup.rst @@ -5,8 +5,10 @@ {headlineDecoration} + {viewHelpers} ViewHelpers documented -{subGroups} Sub namespaces +{subGroups} Sub namespaces + .. toctree:: :titlesonly: diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst index 63db8e5..f003b2b 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst @@ -4,10 +4,12 @@ link ==== + 2 ViewHelpers documented .. toctree:: :titlesonly: + :glob: - EditRecord - NewRecord + EditRecord + NewRecord diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php new file mode 100644 index 0000000..0b2679a --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php @@ -0,0 +1,129 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('link' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function viewHelperCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('2 ViewHelpers documented' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 13; + $this->assertSame(' EditRecord' . PHP_EOL, $output[$index]); + $this->assertSame(' NewRecord' . PHP_EOL, $output[$index + 1]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(trim(file_get_contents($this->fixtureFilePath)), + trim(file_get_contents($this->vfs->getChild($this->generatedFilePath)->url()))); + } +} From ceb90868d0acbce6e533f7aab522ac20347b4004 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 13:22:36 +0200 Subject: [PATCH 34/45] [TASK] ViewHelpers in Sub Groups get rendered as expected --- src/Export/RstExporter.php | 12 +- .../typo3/backend/9.4/Link/EditRecord.rst | 111 +++++----------- ...SecondLevelDocumentationGenerationTest.php | 119 ++++++++++++++++++ 3 files changed, 156 insertions(+), 86 deletions(-) create mode 100644 tests/Functional/Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index b0c57c6..2171664 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -136,6 +136,8 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio return; } $path = $viewHelperDocumentation->getPath(); + $backPath = str_repeat('../', substr_count($path, '/')); + $rootPath = $backPath . '../../../'; $headline = $viewHelperDocumentation->getName(); $decorationHeadlineLength = strlen($headline); @@ -148,18 +150,20 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio $argumentsData = [ 'headline' => $argumentHeadline, 'headlineDecoration' => implode('', $argumentHeadlineDecoration), - 'description' => $argumentDefinition->getDescription(), + 'description' => trim($argumentDefinition->getDescription()), ]; - if ($argumentDefinition->getDefaultValue() !== 'NULL') { - $argumentsData['default'] = 'Default: ' . trim(str_replace(PHP_EOL, '', (string)$argumentDefinition->getDefaultValue())) . PHP_EOL; + $defaultValue = $argumentDefinition->getDefaultValue(); + if ($defaultValue !== 'NULL' && $defaultValue !== "''") { + $sanitizedDefault = str_replace(PHP_EOL, '', $defaultValue); + $argumentsData['default'] = 'Default: ' . trim($sanitizedDefault) . PHP_EOL; } $arguments[] = $argumentsData; } $this->view->assignMultiple([ 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), - 'rootPath' => '../../../', + 'rootPath' => $rootPath, 'viewHelper' => $viewHelperDocumentation, 'arguments' => $arguments, ]); diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst index 9e019db..9e2e3d1 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst @@ -5,7 +5,7 @@ link.editRecord =============== - Use this ViewHelper to provide edit links to records. The ViewHelper will +Use this ViewHelper to provide edit links to records. The ViewHelper will pass the uid and table to FormEngine. The uid must be given as a positive integer. @@ -21,141 +21,88 @@ For new records, use the newRecordViewHelper Edit record - Arguments ========= - - -* additionalAttributes - -* data - -* class - -* dir - -* id - -* lang - -* style - -* title - -* accesskey - -* tabindex - -* onclick - -* uid - -* table - -* returnUrl - - - - - -additionalAttributes (anySimpleType) -================================= +additionalAttributes (anySimpleType) +------------------------------------ Additional tag attributes. They will be added directly to the resulting HTML tag. - -data (anySimpleType) -================================= +data (anySimpleType) +-------------------- Additional data-* attributes. They will each be added with a "data-" prefix. - -class (string) -================================= +class (string) +-------------- CSS class(es) for this element - -dir (string) -================================= +dir (string) +------------ Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) - -id (string) -================================= +id (string) +----------- Unique (in this file) identifier for this HTML element. - -lang (string) -================================= +lang (string) +------------- Language for this element. Use short names specified in RFC 1766 - -style (string) -================================= +style (string) +-------------- Individual CSS styles for this element - -title (string) -================================= +title (string) +-------------- Tooltip text of element - -accesskey (string) -================================= +accesskey (string) +------------------ Keyboard shortcut to access this element - -tabindex (integer) -================================= +tabindex (integer) +------------------ Specifies the tab order of this element - -onclick (string) -================================= +onclick (string) +---------------- JavaScript evaluated for the onclick event - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid of record to be edited - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Functional/Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php new file mode 100644 index 0000000..09ba93a --- /dev/null +++ b/tests/Functional/Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php @@ -0,0 +1,119 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('link.editRecord' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function descriptionGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('Use this ViewHelper to provide edit links to records. The ViewHelper will' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(file_get_contents($this->fixtureFilePath), + file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); + } +} \ No newline at end of file From 75d87e54a3d4fba8d973ebab135df12c4378069f Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 13:39:43 +0200 Subject: [PATCH 35/45] [BUGFIX] Toctree must intend by 3 spaces --- src/Export/RstExporter.php | 19 +++++++++++-------- .../rendering/output/Documentation/Index.rst | 4 ++-- .../Documentation/typo3/backend/9.4/Index.rst | 8 ++++---- .../typo3/backend/9.4/Link/Index.rst | 4 ++-- .../typo3/backend/9.4/ModuleLayout/Index.rst | 6 +++--- ...upsIndexRstDocumentationGenerationTest.php | 6 +++--- ...upsIndexRstDocumentationGenerationTest.php | 4 ++-- ...ootIndexRstDocumentationGenerationTest.php | 4 ++-- ...emaIndexRstDocumentationGenerationTest.php | 8 ++++---- 9 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 2171664..75c4f5c 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -28,6 +28,12 @@ class RstExporter implements ExporterInterface private $rootUrl; + /** + * intention level for toctree structures + * @var string + */ + private $intend = ' '; + public function __construct(?string $rootUrl = null) { $this->rootUrl = $rootUrl; @@ -70,11 +76,10 @@ public function exportRoot(bool $forceUpdate = false): void // better to put the output together here, because fluid tends to mess up the empty lines // that are important to proper rst rendering $toctree = []; - $intend = ' '; foreach ($vendors as $vendor) { foreach ($vendor->getPackages() as $package) { foreach ($package->getVersions() as $version) { - $toctree[] = $intend . $vendor->getVendorName() . '/' . $package->getPackageName() . '/' . $version->getVersion() . '/Index' . PHP_EOL; + $toctree[] = $this->intend . $vendor->getVendorName() . '/' . $package->getPackageName() . '/' . $version->getVersion() . '/Index' . PHP_EOL; } } } @@ -104,14 +109,13 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate $decorationHeadlineLength = strlen($headline); $headlineDecoration = array_pad([], $decorationHeadlineLength, '='); $toctree = []; - $intend = ' '; $subGroupsCount = \count($processedSchema->getDocumentationTree()->getSubGroups()); if ($subGroupsCount > 0) { - $toctree[] = $intend . '*/Index' . PHP_EOL; + $toctree[] = $this->intend . '*/Index' . PHP_EOL; } $viewHelpers = $processedSchema->getDocumentationTree()->getDocumentedViewHelpers(); foreach ($viewHelpers as $viewHelper) { - $toctree[] = $intend . $viewHelper->getLocalName() . PHP_EOL; + $toctree[] = $this->intend . $viewHelper->getLocalName() . PHP_EOL; } $this->view->assignMultiple([ 'headline' => $headline, @@ -186,12 +190,11 @@ public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDo $viewHelpers = $viewHelperDocumentationGroup->getDocumentedViewHelpers(); $subGroupsCount = \count($viewHelperDocumentationGroup->getSubGroups()); $toctree = []; - $intend = ' '; if ($subGroupsCount > 0) { - $toctree[] = $intend . '*/Index' . PHP_EOL; + $toctree[] = $this->intend . '*/Index' . PHP_EOL; } foreach ($viewHelpers as $viewHelper) { - $toctree[] = $intend . $viewHelper->getLocalName() . PHP_EOL; + $toctree[] = $this->intend . $viewHelper->getLocalName() . PHP_EOL; } $this->view->assignMultiple([ 'headline' => $headline, diff --git a/tests/Fixtures/rendering/output/Documentation/Index.rst b/tests/Fixtures/rendering/output/Documentation/Index.rst index 511e920..c8b980e 100644 --- a/tests/Fixtures/rendering/output/Documentation/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/Index.rst @@ -9,5 +9,5 @@ Fluid ViewHelper Documentation .. toctree:: :titlesonly: - typo3/backend/9.4/Index - typo3/backend/9.5/Index + typo3/backend/9.4/Index + typo3/backend/9.5/Index diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst index 57a8370..ff1cda5 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst @@ -11,7 +11,7 @@ typo3/backend :titlesonly: :glob: - */Index - Avatar - ModuleLayout - ModuleLink + */Index + Avatar + ModuleLayout + ModuleLink diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst index f003b2b..00dec19 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst @@ -11,5 +11,5 @@ link :titlesonly: :glob: - EditRecord - NewRecord + EditRecord + NewRecord diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst index f4e2614..bf17261 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst @@ -12,6 +12,6 @@ moduleLayout :titlesonly: :glob: - */Index - MenuItem - Menu + */Index + MenuItem + Menu diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php index dfd1bce..593c51a 100644 --- a/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php @@ -124,9 +124,9 @@ public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 14; - $this->assertSame(' */Index' . PHP_EOL, $output[$index]); - $this->assertSame(' MenuItem' . PHP_EOL, $output[$index + 1]); - $this->assertSame(' Menu' . PHP_EOL, $output[$index + 2]); + $this->assertSame(' */Index' . PHP_EOL, $output[$index]); + $this->assertSame(' MenuItem' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' Menu' . PHP_EOL, $output[$index + 2]); } /** diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php index 0b2679a..ff2e70d 100644 --- a/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php @@ -114,8 +114,8 @@ public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 13; - $this->assertSame(' EditRecord' . PHP_EOL, $output[$index]); - $this->assertSame(' NewRecord' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' EditRecord' . PHP_EOL, $output[$index]); + $this->assertSame(' NewRecord' . PHP_EOL, $output[$index + 1]); } /** diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php index 855f2b6..cc8c776 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php @@ -94,8 +94,8 @@ public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 11; - $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); - $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); + $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); } /** diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php index 7dee2d7..7dab805 100644 --- a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php @@ -124,10 +124,10 @@ public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 13; - $this->assertSame(' */Index' . PHP_EOL, $output[$index]); - $this->assertSame(' Avatar' . PHP_EOL, $output[$index + 1]); - $this->assertSame(' ModuleLayout' . PHP_EOL, $output[$index + 2]); - $this->assertSame(' ModuleLink' . PHP_EOL, $output[$index + 3]); + $this->assertSame(' */Index' . PHP_EOL, $output[$index]); + $this->assertSame(' Avatar' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' ModuleLayout' . PHP_EOL, $output[$index + 2]); + $this->assertSame(' ModuleLink' . PHP_EOL, $output[$index + 3]); } /** From 7d4df390124111622436aa6fa22ff55f5f359cb0 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 6 Oct 2018 13:51:54 +0200 Subject: [PATCH 36/45] [BUGFIX] Adjust output for nice rendering --- resources/templates/Default/Schema.rst | 4 ++-- resources/templates/Default/ViewHelperGroup.rst | 4 ++-- .../output/Documentation/typo3/backend/9.4/Index.rst | 4 ++-- .../output/Documentation/typo3/backend/9.4/Link/Index.rst | 2 +- .../Documentation/typo3/backend/9.4/ModuleLayout/Index.rst | 4 ++-- ...rGroupWithSubGroupsIndexRstDocumentationGenerationTest.php | 4 ++-- ...oupWithoutSubGroupsIndexRstDocumentationGenerationTest.php | 2 +- ...endViewhelperSchemaIndexRstDocumentationGenerationTest.php | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst index 635d461..9dfdc31 100644 --- a/resources/templates/Default/Schema.rst +++ b/resources/templates/Default/Schema.rst @@ -4,8 +4,8 @@ {headline} {headlineDecoration} -{viewHelpers} ViewHelpers documented -{subGroups} Sub namespaces +* {viewHelpers} ViewHelpers documented +* {subGroups} Sub namespaces .. toctree:: :titlesonly: diff --git a/resources/templates/Default/ViewHelperGroup.rst b/resources/templates/Default/ViewHelperGroup.rst index bfe0849..631ec57 100644 --- a/resources/templates/Default/ViewHelperGroup.rst +++ b/resources/templates/Default/ViewHelperGroup.rst @@ -6,8 +6,8 @@ -{viewHelpers} ViewHelpers documented -{subGroups} Sub namespaces +* {viewHelpers} ViewHelpers documented +* {subGroups} Sub namespaces .. toctree:: diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst index ff1cda5..38618e3 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst @@ -4,8 +4,8 @@ typo3/backend ============= -3 ViewHelpers documented -3 Sub namespaces +* 3 ViewHelpers documented +* 3 Sub namespaces .. toctree:: :titlesonly: diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst index 00dec19..3d42c88 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst @@ -5,7 +5,7 @@ link ==== -2 ViewHelpers documented +* 2 ViewHelpers documented .. toctree:: :titlesonly: diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst index bf17261..b0ef1d5 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst @@ -5,8 +5,8 @@ moduleLayout ============ -2 ViewHelpers documented -1 Sub namespaces +* 2 ViewHelpers documented +* 1 Sub namespaces .. toctree:: :titlesonly: diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php index 593c51a..f372533 100644 --- a/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php @@ -104,7 +104,7 @@ public function viewHelperCountIsIntegrated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 7; - $this->assertSame('2 ViewHelpers documented' . PHP_EOL, $output[$index]); + $this->assertSame('* 2 ViewHelpers documented' . PHP_EOL, $output[$index]); } /** @@ -114,7 +114,7 @@ public function subNamespacesCountIsIntegrated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 8; - $this->assertSame('1 Sub namespaces' . PHP_EOL, $output[$index]); + $this->assertSame('* 1 Sub namespaces' . PHP_EOL, $output[$index]); } /** diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php index ff2e70d..420b82c 100644 --- a/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php @@ -104,7 +104,7 @@ public function viewHelperCountIsIntegrated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 7; - $this->assertSame('2 ViewHelpers documented' . PHP_EOL, $output[$index]); + $this->assertSame('* 2 ViewHelpers documented' . PHP_EOL, $output[$index]); } /** diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php index 7dab805..962e1fa 100644 --- a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php @@ -104,7 +104,7 @@ public function viewHelperCountIsIntegrated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 6; - $this->assertSame('3 ViewHelpers documented' . PHP_EOL, $output[$index]); + $this->assertSame('* 3 ViewHelpers documented' . PHP_EOL, $output[$index]); } /** @@ -114,7 +114,7 @@ public function subNamespacesCountIsIntegrated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); $index = 7; - $this->assertSame('3 Sub namespaces' . PHP_EOL, $output[$index]); + $this->assertSame('* 3 Sub namespaces' . PHP_EOL, $output[$index]); } /** From d054fee23e8d539b0ecc03f8092443321bf353ac Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sun, 7 Oct 2018 09:42:37 +0200 Subject: [PATCH 37/45] [TASK] Separate rst rendering related tests --- .../FileStructureTest.php} | 10 +++++----- .../IndexForSchemaTest.php} | 10 +++++----- .../IndexForViewhelperGroupWithSubGroupsTest.php} | 10 +++++----- .../IndexForViewhelperGroupWithoutSubGroupsTest.php} | 10 +++++----- .../RootIndexFileTest.php} | 10 +++++----- .../ViewHelperFileFirstLevelTest.php} | 10 +++++----- .../ViewHelperFileSecondLevelTest.php} | 10 +++++----- 7 files changed, 35 insertions(+), 35 deletions(-) rename tests/Functional/{Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php => RstRendering/FileStructureTest.php} (89%) rename tests/Functional/{Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php => RstRendering/IndexForSchemaTest.php} (93%) rename tests/Functional/{Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php => RstRendering/IndexForViewhelperGroupWithSubGroupsTest.php} (92%) rename tests/Functional/{Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php => RstRendering/IndexForViewhelperGroupWithoutSubGroupsTest.php} (92%) rename tests/Functional/{Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php => RstRendering/RootIndexFileTest.php} (91%) rename tests/Functional/{Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php => RstRendering/ViewHelperFileFirstLevelTest.php} (92%) rename tests/Functional/{Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php => RstRendering/ViewHelperFileSecondLevelTest.php} (92%) diff --git a/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php b/tests/Functional/RstRendering/FileStructureTest.php similarity index 89% rename from tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php rename to tests/Functional/RstRendering/FileStructureTest.php index 642a93a..a6a2b4d 100644 --- a/tests/Functional/Typo3BackendViewhelperDirStructureRstDocumentGenerationTest.php +++ b/tests/Functional/RstRendering/FileStructureTest.php @@ -1,7 +1,7 @@ vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() diff --git a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php b/tests/Functional/RstRendering/IndexForSchemaTest.php similarity index 93% rename from tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php rename to tests/Functional/RstRendering/IndexForSchemaTest.php index 962e1fa..65181b8 100644 --- a/tests/Functional/Typo3BackendViewhelperSchemaIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/RstRendering/IndexForSchemaTest.php @@ -1,7 +1,7 @@ vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/RstRendering/IndexForViewhelperGroupWithSubGroupsTest.php similarity index 92% rename from tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php rename to tests/Functional/RstRendering/IndexForViewhelperGroupWithSubGroupsTest.php index f372533..d9f3b15 100644 --- a/tests/Functional/Typo3BackendViewhelperGroupWithSubGroupsIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/RstRendering/IndexForViewhelperGroupWithSubGroupsTest.php @@ -1,7 +1,7 @@ vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() diff --git a/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php b/tests/Functional/RstRendering/IndexForViewhelperGroupWithoutSubGroupsTest.php similarity index 92% rename from tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php rename to tests/Functional/RstRendering/IndexForViewhelperGroupWithoutSubGroupsTest.php index 420b82c..03a45a8 100644 --- a/tests/Functional/Typo3BackendViewhelperGroupWithoutSubGroupsIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/RstRendering/IndexForViewhelperGroupWithoutSubGroupsTest.php @@ -1,7 +1,7 @@ vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() diff --git a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php b/tests/Functional/RstRendering/RootIndexFileTest.php similarity index 91% rename from tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php rename to tests/Functional/RstRendering/RootIndexFileTest.php index cc8c776..2e3ac5f 100644 --- a/tests/Functional/Typo3BackendViewhelperRootIndexRstDocumentationGenerationTest.php +++ b/tests/Functional/RstRendering/RootIndexFileTest.php @@ -1,7 +1,7 @@ vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() diff --git a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php b/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php similarity index 92% rename from tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php rename to tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php index 18568f8..e2a3a2a 100644 --- a/tests/Functional/Typo3BackendViewhelperFirstLevelDocumentationGenerationTest.php +++ b/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php @@ -1,7 +1,7 @@ vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() diff --git a/tests/Functional/Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php b/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php similarity index 92% rename from tests/Functional/Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php rename to tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php index 09ba93a..1c46c21 100644 --- a/tests/Functional/Typo3BackendViewhelperSecondLevelDocumentationGenerationTest.php +++ b/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php @@ -1,7 +1,7 @@ vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); - $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../resources/'); - $dataFileResolver->setSchemasDirectory(__DIR__ . '/../Fixtures/rendering/input/'); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); $schemaDocumentationGenerator = new SchemaDocumentationGenerator( [ new RstExporter() From d3a2f0993d654905907d67c071d71fe2c3eb6b79 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sun, 7 Oct 2018 11:03:29 +0200 Subject: [PATCH 38/45] [TASK] Clean up code --- src/Export/RstExporter.php | 55 ++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 75c4f5c..31898e0 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -26,6 +26,9 @@ class RstExporter implements ExporterInterface */ private $generator; + /** + * @var null|string + */ private $rootUrl; /** @@ -72,7 +75,12 @@ public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string public function exportRoot(bool $forceUpdate = false): void { - $vendors = DataFileResolver::getInstance()->resolveInstalledVendors(); + $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . 'Index.rst')) { + return; + } + + $vendors = $resolver->resolveInstalledVendors(); // better to put the output together here, because fluid tends to mess up the empty lines // that are important to proper rst rendering $toctree = []; @@ -84,7 +92,7 @@ public function exportRoot(bool $forceUpdate = false): void } } $this->view->assign('tocTree', $toctree); - DataFileResolver::getInstance()->getWriter()->publishDataFile( + $resolver->getWriter()->publishDataFile( 'Index.rst', $this->view->render('Root') ); @@ -92,10 +100,12 @@ public function exportRoot(bool $forceUpdate = false): void public function exportVendor(SchemaVendor $vendor): void { + // not needed in this export } public function exportPackage(SchemaPackage $package): void { + // not needed in this export } public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate = false): void @@ -106,24 +116,16 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate } $schema = $processedSchema->getSchema(); $headline = $schema->getPackage()->getVendor()->getVendorName() . '/' . $schema->getPackage()->getPackageName(); - $decorationHeadlineLength = strlen($headline); - $headlineDecoration = array_pad([], $decorationHeadlineLength, '='); - $toctree = []; + $headlineDecoration = array_pad([], strlen($headline), '='); $subGroupsCount = \count($processedSchema->getDocumentationTree()->getSubGroups()); - if ($subGroupsCount > 0) { - $toctree[] = $this->intend . '*/Index' . PHP_EOL; - } $viewHelpers = $processedSchema->getDocumentationTree()->getDocumentedViewHelpers(); - foreach ($viewHelpers as $viewHelper) { - $toctree[] = $this->intend . $viewHelper->getLocalName() . PHP_EOL; - } $this->view->assignMultiple([ 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), 'rootPath' => '../../../', 'subGroups' => $subGroupsCount, 'viewHelpers' => \count($viewHelpers), - 'tocTree' => $toctree, + 'tocTree' => $this->getTocTree($viewHelpers, $subGroupsCount), ]); $resolver->getWriter()->publishDataFileForSchema( $processedSchema, @@ -135,7 +137,6 @@ public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentation, bool $forceUpdate = false): void { $resolver = DataFileResolver::getInstance(); - if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $viewHelperDocumentation->getSchema()->getPath() . $viewHelperDocumentation->getPath() . '.rst')) { return; } @@ -144,8 +145,7 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio $rootPath = $backPath . '../../../'; $headline = $viewHelperDocumentation->getName(); - $decorationHeadlineLength = strlen($headline); - $headlineDecoration = array_pad([], $decorationHeadlineLength, '='); + $headlineDecoration = array_pad([], strlen($headline), '='); $arguments = []; foreach ($viewHelperDocumentation->getArgumentDefinitions() as $argumentDefinition) { @@ -181,6 +181,10 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDocumentationGroup, bool $forceUpdate = false): void { $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $viewHelperDocumentationGroup->getPath() . 'Index.rst')) { + return; + } + $groupPath = $viewHelperDocumentationGroup->getPath() . DIRECTORY_SEPARATOR; $backPath = str_repeat('../', substr_count($groupPath, '/')); $rootPath = $backPath . '../../../'; @@ -189,20 +193,13 @@ public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDo $headlineDecoration = array_pad([], strlen($headline), '='); $viewHelpers = $viewHelperDocumentationGroup->getDocumentedViewHelpers(); $subGroupsCount = \count($viewHelperDocumentationGroup->getSubGroups()); - $toctree = []; - if ($subGroupsCount > 0) { - $toctree[] = $this->intend . '*/Index' . PHP_EOL; - } - foreach ($viewHelpers as $viewHelper) { - $toctree[] = $this->intend . $viewHelper->getLocalName() . PHP_EOL; - } $this->view->assignMultiple([ 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), 'rootPath' => $rootPath, 'viewHelpers' => \count($viewHelpers), 'subGroups' => $subGroupsCount, - 'tocTree' => $toctree, + 'tocTree' => $this->getTocTree($viewHelpers, $subGroupsCount), ]); $resolver->getWriter()->publishDataFileForSchema( $viewHelperDocumentationGroup->getSchema(), @@ -210,4 +207,16 @@ public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDo $this->view->render('ViewHelperGroup') ); } + + protected function getTocTree(array $viewHelpers, int $subGroupsCount): array + { + $toctree = []; + if ($subGroupsCount > 0) { + $toctree[] = $this->intend . '*/Index' . PHP_EOL; + } + foreach ($viewHelpers as $viewHelper) { + $toctree[] = $this->intend . $viewHelper->getLocalName() . PHP_EOL; + } + return $toctree; + } } From 5f5d5f96c96ae0046da27cc908ec161c9cf8d576 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sun, 7 Oct 2018 11:20:34 +0200 Subject: [PATCH 39/45] [TASK] Provide Fixture files fresh from a real generation --- resources/partials/ResourceLinks.rst | 9 -- .../typo3/backend/9.4/Avatar.rst | 25 ++-- .../Documentation/typo3/backend/9.4/Index.rst | 1 + .../typo3/backend/9.4/Link/Index.rst | 3 + .../typo3/backend/9.4/Link/NewRecord.rst | 118 +++++------------- .../typo3/backend/9.4/ModuleLayout.rst | 10 +- .../backend/9.4/ModuleLayout/Button/Index.rst | 15 ++- .../9.4/ModuleLayout/Button/LinkButton.rst | 61 +++------ .../ModuleLayout/Button/ShortcutButton.rst | 68 ++++------ .../typo3/backend/9.4/ModuleLayout/Index.rst | 3 + .../typo3/backend/9.4/ModuleLayout/Menu.rst | 15 +-- .../backend/9.4/ModuleLayout/MenuItem.rst | 20 +-- .../typo3/backend/9.4/Uri/EditRecord.rst | 26 ++-- .../typo3/backend/9.4/Uri/Index.rst | 6 +- .../typo3/backend/9.4/Uri/NewRecord.rst | 31 ++--- .../typo3/backend/9.5/Avatar.rst | 25 ++-- .../Documentation/typo3/backend/9.5/Index.rst | 5 +- .../typo3/backend/9.5/Link/EditRecord.rst | 111 +++++----------- .../typo3/backend/9.5/Link/Index.rst | 7 +- .../typo3/backend/9.5/Link/NewRecord.rst | 118 +++++------------- .../typo3/backend/9.5/ModuleLayout.rst | 10 +- .../backend/9.5/ModuleLayout/Button/Index.rst | 15 ++- .../9.5/ModuleLayout/Button/LinkButton.rst | 61 +++------ .../ModuleLayout/Button/ShortcutButton.rst | 68 ++++------ .../typo3/backend/9.5/ModuleLayout/Index.rst | 10 +- .../typo3/backend/9.5/ModuleLayout/Menu.rst | 15 +-- .../backend/9.5/ModuleLayout/MenuItem.rst | 20 +-- .../typo3/backend/9.5/ModuleLink.rst | 30 ++--- .../typo3/backend/9.5/Uri/EditRecord.rst | 26 ++-- .../typo3/backend/9.5/Uri/Index.rst | 6 +- .../typo3/backend/9.5/Uri/NewRecord.rst | 31 ++--- 31 files changed, 311 insertions(+), 658 deletions(-) delete mode 100644 resources/partials/ResourceLinks.rst diff --git a/resources/partials/ResourceLinks.rst b/resources/partials/ResourceLinks.rst deleted file mode 100644 index 4df5572..0000000 --- a/resources/partials/ResourceLinks.rst +++ /dev/null @@ -1,9 +0,0 @@ - -Resources ---------- - -* - {resourceName} - - - diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst index 4fc3611..974eb80 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst @@ -5,35 +5,32 @@ avatar ====== - Render the avatar img tag for a given backend user - +Render the avatar img tag for a given backend user Arguments ========= +backendUser (anySimpleType) +--------------------------- - - -backendUser (anySimpleType) -================================= - +Default: 0 uid of the backend user +size (anySimpleType) +-------------------- -size (anySimpleType) -================================= +Default: 32 width and height of the image +showIcon (anySimpleType) +------------------------ -showIcon (anySimpleType) -================================= - - -show the record icon as well +Default: false +show the record icon as well \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst index 38618e3..737adab 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst @@ -15,3 +15,4 @@ typo3/backend Avatar ModuleLayout ModuleLink + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst index 3d42c88..26e77a8 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst @@ -13,3 +13,6 @@ link EditRecord NewRecord + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst index 3b6f062..c06e8c6 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst @@ -5,7 +5,7 @@ link.newRecord ============== - Use this ViewHelper to provide 'create new record' links. +Use this ViewHelper to provide 'create new record' links. The ViewHelper will pass the command to FormEngine. The table argument is mandatory, it decides what record is to be created. @@ -51,150 +51,94 @@ To edit records, use the editRecordViewHelper Edit record - Arguments ========= - - -* additionalAttributes - -* data - -* class - -* dir - -* id - -* lang - -* style - -* title - -* accesskey - -* tabindex - -* onclick - -* uid - -* pid - -* table - -* returnUrl - - - - - -additionalAttributes (anySimpleType) -================================= +additionalAttributes (anySimpleType) +------------------------------------ Additional tag attributes. They will be added directly to the resulting HTML tag. - -data (anySimpleType) -================================= +data (anySimpleType) +-------------------- Additional data-* attributes. They will each be added with a "data-" prefix. - -class (string) -================================= +class (string) +-------------- CSS class(es) for this element - -dir (string) -================================= +dir (string) +------------ Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) - -id (string) -================================= +id (string) +----------- Unique (in this file) identifier for this HTML element. - -lang (string) -================================= +lang (string) +------------- Language for this element. Use short names specified in RFC 1766 - -style (string) -================================= +style (string) +-------------- Individual CSS styles for this element - -title (string) -================================= +title (string) +-------------- Tooltip text of element - -accesskey (string) -================================= +accesskey (string) +------------------ Keyboard shortcut to access this element - -tabindex (integer) -================================= +tabindex (integer) +------------------ Specifies the tab order of this element - -onclick (string) -================================= +onclick (string) +---------------- JavaScript evaluated for the onclick event - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid < 0 will insert the record after the given uid - -pid (anySimpleType) -================================= +pid (anySimpleType) +------------------- the page id where the record will be created - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst index 6d832f7..88bde63 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst @@ -5,7 +5,7 @@ moduleLayout ============ - A view helper for having properly styled backend modules. +A view helper for having properly styled backend modules. It is recommended to use it in Fluid Layouts. It will render the required HTML for the doc header. All module specific output and further configuration of the doc header @@ -19,15 +19,9 @@ must be rendered as children of this view helper. - Arguments ========= - This ViewHelper has no arguments - - - - - +This ViewHelper has no arguments. \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst index be6e420..4efef2f 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst @@ -1,13 +1,18 @@ .. include:: ../../../../../Includes.txt -=================== -moduleLayout.button -=================== +====== +button +====== -2 ViewHelpers documented + +* 2 ViewHelpers documented .. toctree:: :titlesonly: + :glob: LinkButton - ShortcutButton \ No newline at end of file + ShortcutButton + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst index 4c9d217..157e057 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst @@ -5,7 +5,7 @@ moduleLayout.button.linkButton ============================== - A view helper for adding a link button to the doc header area. +A view helper for adding a link button to the doc header area. It must be a child of = Examples = @@ -17,78 +17,53 @@ It must be a child of /> - Arguments ========= - - -* icon - -* title - -* disabled - -* showLabel - -* position - -* group - -* link - - - - - -icon (string) -================================= +icon (string) +------------- Icon identifier for the button - -title (string) -================================= +title (string) +-------------- Title of the button +disabled (anySimpleType) +------------------------ -disabled (anySimpleType) -================================= +Default: false Whether the button is disabled +showLabel (anySimpleType) +------------------------- -showLabel (anySimpleType) -================================= +Default: false Defines whether to show the title as a label within the button - -position (string) -================================= +position (string) +----------------- Position of the button (left or right) - -group (integer) -================================= +group (integer) +--------------- Button group of the button - -link (string) -================================= - - -Link for the button +link (string) +------------- +Link for the button \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst index c4e48b3..e144150 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst @@ -5,7 +5,7 @@ moduleLayout.button.shortcutButton ================================== - A view helper for adding a shortcut button to the doc header area. +A view helper for adding a shortcut button to the doc header area. It must be a child of = Examples = @@ -13,87 +13,61 @@ It must be a child of - Arguments ========= - - -* icon - -* title - -* disabled - -* showLabel - -* position - -* group - -* displayName - -* getVars - - - - - -icon (string) -================================= +icon (string) +------------- Icon identifier for the button - -title (string) -================================= +title (string) +-------------- Title of the button +disabled (anySimpleType) +------------------------ -disabled (anySimpleType) -================================= +Default: false Whether the button is disabled +showLabel (anySimpleType) +------------------------- -showLabel (anySimpleType) -================================= +Default: false Defines whether to show the title as a label within the button - -position (string) -================================= +position (string) +----------------- Position of the button (left or right) - -group (integer) -================================= +group (integer) +--------------- Button group of the button - -displayName (string) -================================= +displayName (string) +-------------------- Name for the shortcut +getVars (anySimpleType) +----------------------- -getVars (anySimpleType) -================================= - - -List of additional GET variables to store. The current id, module and all module arguments will always be stored +Default: array () +List of additional GET variables to store. The current id, module and all module arguments will always be stored \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst index b0ef1d5..d9f4a9d 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst @@ -15,3 +15,6 @@ moduleLayout */Index MenuItem Menu + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst index 80dea27..37b9c21 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst @@ -5,7 +5,7 @@ moduleLayout.menu ================= - A view helper for adding a menu to the doc header area. +A view helper for adding a menu to the doc header area. It must be a child of and accepts only view helpers as children. = Examples = @@ -16,20 +16,13 @@ only view helpers as children. - Arguments ========= +identifier (string) +------------------- - - -identifier (string) -================================= - - -Identifier of the menu - - +Identifier of the menu \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst index 99cafc5..8aa6f5d 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst @@ -5,7 +5,7 @@ moduleLayout.menuItem ===================== - A view helper for adding a menu item to a doc header menu. +A view helper for adding a menu item to a doc header menu. It must be a child of = Examples = @@ -15,27 +15,19 @@ It must be a child of - Arguments ========= - - - - -label (string) -================================= +label (string) +-------------- Label of the menu item - -uri (string) -================================= - - -Action uri +uri (string) +------------ +Action uri \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst index 1a7a782..a19bead 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst @@ -5,7 +5,7 @@ uri.editRecord ============== - Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will +Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will pass the uid and table to FormEngine. The uid must be given as a positive integer. @@ -19,34 +19,22 @@ For new records, use the newRecordViewHelper /typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar - Arguments ========= - - - - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid of record to be edited, 0 for creation - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst index 5087868..b60f674 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst @@ -4,11 +4,15 @@ uri === -2 ViewHelpers documented + +* 2 ViewHelpers documented .. toctree:: :titlesonly: + :glob: EditRecord NewRecord + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst index 7f5d0f0..5512850 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst @@ -5,7 +5,7 @@ uri.newRecord ============= - Use this ViewHelper to provide 'create new record' links. +Use this ViewHelper to provide 'create new record' links. The ViewHelper will pass the command to FormEngine. The table argument is mandatory, it decides what record is to be created. @@ -45,41 +45,28 @@ To edit records, use the editRecordViewHelper /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar - Arguments ========= - - - - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid < 0 will insert the record after the given uid - -pid (anySimpleType) -================================= +pid (anySimpleType) +------------------- the page id where the record will be created - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst index 4fc3611..974eb80 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst @@ -5,35 +5,32 @@ avatar ====== - Render the avatar img tag for a given backend user - +Render the avatar img tag for a given backend user Arguments ========= +backendUser (anySimpleType) +--------------------------- - - -backendUser (anySimpleType) -================================= - +Default: 0 uid of the backend user +size (anySimpleType) +-------------------- -size (anySimpleType) -================================= +Default: 32 width and height of the image +showIcon (anySimpleType) +------------------------ -showIcon (anySimpleType) -================================= - - -show the record icon as well +Default: false +show the record icon as well \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst index ff1cda5..737adab 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst @@ -4,8 +4,8 @@ typo3/backend ============= -3 ViewHelpers documented -3 Sub namespaces +* 3 ViewHelpers documented +* 3 Sub namespaces .. toctree:: :titlesonly: @@ -15,3 +15,4 @@ typo3/backend Avatar ModuleLayout ModuleLink + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst index 9e019db..9e2e3d1 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst @@ -5,7 +5,7 @@ link.editRecord =============== - Use this ViewHelper to provide edit links to records. The ViewHelper will +Use this ViewHelper to provide edit links to records. The ViewHelper will pass the uid and table to FormEngine. The uid must be given as a positive integer. @@ -21,141 +21,88 @@ For new records, use the newRecordViewHelper Edit record - Arguments ========= - - -* additionalAttributes - -* data - -* class - -* dir - -* id - -* lang - -* style - -* title - -* accesskey - -* tabindex - -* onclick - -* uid - -* table - -* returnUrl - - - - - -additionalAttributes (anySimpleType) -================================= +additionalAttributes (anySimpleType) +------------------------------------ Additional tag attributes. They will be added directly to the resulting HTML tag. - -data (anySimpleType) -================================= +data (anySimpleType) +-------------------- Additional data-* attributes. They will each be added with a "data-" prefix. - -class (string) -================================= +class (string) +-------------- CSS class(es) for this element - -dir (string) -================================= +dir (string) +------------ Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) - -id (string) -================================= +id (string) +----------- Unique (in this file) identifier for this HTML element. - -lang (string) -================================= +lang (string) +------------- Language for this element. Use short names specified in RFC 1766 - -style (string) -================================= +style (string) +-------------- Individual CSS styles for this element - -title (string) -================================= +title (string) +-------------- Tooltip text of element - -accesskey (string) -================================= +accesskey (string) +------------------ Keyboard shortcut to access this element - -tabindex (integer) -================================= +tabindex (integer) +------------------ Specifies the tab order of this element - -onclick (string) -================================= +onclick (string) +---------------- JavaScript evaluated for the onclick event - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid of record to be edited - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst index 63db8e5..26e77a8 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst @@ -4,10 +4,15 @@ link ==== -2 ViewHelpers documented + +* 2 ViewHelpers documented .. toctree:: :titlesonly: + :glob: EditRecord NewRecord + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst index 3b6f062..c06e8c6 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst @@ -5,7 +5,7 @@ link.newRecord ============== - Use this ViewHelper to provide 'create new record' links. +Use this ViewHelper to provide 'create new record' links. The ViewHelper will pass the command to FormEngine. The table argument is mandatory, it decides what record is to be created. @@ -51,150 +51,94 @@ To edit records, use the editRecordViewHelper Edit record - Arguments ========= - - -* additionalAttributes - -* data - -* class - -* dir - -* id - -* lang - -* style - -* title - -* accesskey - -* tabindex - -* onclick - -* uid - -* pid - -* table - -* returnUrl - - - - - -additionalAttributes (anySimpleType) -================================= +additionalAttributes (anySimpleType) +------------------------------------ Additional tag attributes. They will be added directly to the resulting HTML tag. - -data (anySimpleType) -================================= +data (anySimpleType) +-------------------- Additional data-* attributes. They will each be added with a "data-" prefix. - -class (string) -================================= +class (string) +-------------- CSS class(es) for this element - -dir (string) -================================= +dir (string) +------------ Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) - -id (string) -================================= +id (string) +----------- Unique (in this file) identifier for this HTML element. - -lang (string) -================================= +lang (string) +------------- Language for this element. Use short names specified in RFC 1766 - -style (string) -================================= +style (string) +-------------- Individual CSS styles for this element - -title (string) -================================= +title (string) +-------------- Tooltip text of element - -accesskey (string) -================================= +accesskey (string) +------------------ Keyboard shortcut to access this element - -tabindex (integer) -================================= +tabindex (integer) +------------------ Specifies the tab order of this element - -onclick (string) -================================= +onclick (string) +---------------- JavaScript evaluated for the onclick event - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid < 0 will insert the record after the given uid - -pid (anySimpleType) -================================= +pid (anySimpleType) +------------------- the page id where the record will be created - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst index 6d832f7..88bde63 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst @@ -5,7 +5,7 @@ moduleLayout ============ - A view helper for having properly styled backend modules. +A view helper for having properly styled backend modules. It is recommended to use it in Fluid Layouts. It will render the required HTML for the doc header. All module specific output and further configuration of the doc header @@ -19,15 +19,9 @@ must be rendered as children of this view helper. - Arguments ========= - This ViewHelper has no arguments - - - - - +This ViewHelper has no arguments. \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst index be6e420..4efef2f 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst @@ -1,13 +1,18 @@ .. include:: ../../../../../Includes.txt -=================== -moduleLayout.button -=================== +====== +button +====== -2 ViewHelpers documented + +* 2 ViewHelpers documented .. toctree:: :titlesonly: + :glob: LinkButton - ShortcutButton \ No newline at end of file + ShortcutButton + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst index 4c9d217..157e057 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst @@ -5,7 +5,7 @@ moduleLayout.button.linkButton ============================== - A view helper for adding a link button to the doc header area. +A view helper for adding a link button to the doc header area. It must be a child of = Examples = @@ -17,78 +17,53 @@ It must be a child of /> - Arguments ========= - - -* icon - -* title - -* disabled - -* showLabel - -* position - -* group - -* link - - - - - -icon (string) -================================= +icon (string) +------------- Icon identifier for the button - -title (string) -================================= +title (string) +-------------- Title of the button +disabled (anySimpleType) +------------------------ -disabled (anySimpleType) -================================= +Default: false Whether the button is disabled +showLabel (anySimpleType) +------------------------- -showLabel (anySimpleType) -================================= +Default: false Defines whether to show the title as a label within the button - -position (string) -================================= +position (string) +----------------- Position of the button (left or right) - -group (integer) -================================= +group (integer) +--------------- Button group of the button - -link (string) -================================= - - -Link for the button +link (string) +------------- +Link for the button \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst index c4e48b3..e144150 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst @@ -5,7 +5,7 @@ moduleLayout.button.shortcutButton ================================== - A view helper for adding a shortcut button to the doc header area. +A view helper for adding a shortcut button to the doc header area. It must be a child of = Examples = @@ -13,87 +13,61 @@ It must be a child of - Arguments ========= - - -* icon - -* title - -* disabled - -* showLabel - -* position - -* group - -* displayName - -* getVars - - - - - -icon (string) -================================= +icon (string) +------------- Icon identifier for the button - -title (string) -================================= +title (string) +-------------- Title of the button +disabled (anySimpleType) +------------------------ -disabled (anySimpleType) -================================= +Default: false Whether the button is disabled +showLabel (anySimpleType) +------------------------- -showLabel (anySimpleType) -================================= +Default: false Defines whether to show the title as a label within the button - -position (string) -================================= +position (string) +----------------- Position of the button (left or right) - -group (integer) -================================= +group (integer) +--------------- Button group of the button - -displayName (string) -================================= +displayName (string) +-------------------- Name for the shortcut +getVars (anySimpleType) +----------------------- -getVars (anySimpleType) -================================= - - -List of additional GET variables to store. The current id, module and all module arguments will always be stored +Default: array () +List of additional GET variables to store. The current id, module and all module arguments will always be stored \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst index 2c966a6..d9f4a9d 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst @@ -4,13 +4,17 @@ moduleLayout ============ -2 ViewHelpers documented -1 Sub namespace + +* 2 ViewHelpers documented +* 1 Sub namespaces .. toctree:: :titlesonly: :glob: */Index - Menu MenuItem + Menu + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst index 80dea27..37b9c21 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst @@ -5,7 +5,7 @@ moduleLayout.menu ================= - A view helper for adding a menu to the doc header area. +A view helper for adding a menu to the doc header area. It must be a child of and accepts only view helpers as children. = Examples = @@ -16,20 +16,13 @@ only view helpers as children. - Arguments ========= +identifier (string) +------------------- - - -identifier (string) -================================= - - -Identifier of the menu - - +Identifier of the menu \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst index 99cafc5..8aa6f5d 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst @@ -5,7 +5,7 @@ moduleLayout.menuItem ===================== - A view helper for adding a menu item to a doc header menu. +A view helper for adding a menu item to a doc header menu. It must be a child of = Examples = @@ -15,27 +15,19 @@ It must be a child of - Arguments ========= - - - - -label (string) -================================= +label (string) +-------------- Label of the menu item - -uri (string) -================================= - - -Action uri +uri (string) +------------ +Action uri \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst index 79a3425..0ebd809 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst @@ -5,42 +5,34 @@ moduleLink ========== - Create internal link within backend app - +Create internal link within backend app Arguments ========= - - - - -route (string) -================================= +route (string) +-------------- The route to link to +arguments (anySimpleType) +------------------------- -arguments (anySimpleType) -================================= +Default: array () Additional link arguments - -query (string) -================================= +query (string) +-------------- Additional link arguments as string - -currentUrlParameterName (string) -================================= - - -Add current url as given parameter +currentUrlParameterName (string) +-------------------------------- +Add current url as given parameter \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst index 1a7a782..a19bead 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst @@ -5,7 +5,7 @@ uri.editRecord ============== - Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will +Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will pass the uid and table to FormEngine. The uid must be given as a positive integer. @@ -19,34 +19,22 @@ For new records, use the newRecordViewHelper /typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar - Arguments ========= - - - - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid of record to be edited, 0 for creation - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst index 5087868..b60f674 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst @@ -4,11 +4,15 @@ uri === -2 ViewHelpers documented + +* 2 ViewHelpers documented .. toctree:: :titlesonly: + :glob: EditRecord NewRecord + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst index 7f5d0f0..5512850 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst @@ -5,7 +5,7 @@ uri.newRecord ============= - Use this ViewHelper to provide 'create new record' links. +Use this ViewHelper to provide 'create new record' links. The ViewHelper will pass the command to FormEngine. The table argument is mandatory, it decides what record is to be created. @@ -45,41 +45,28 @@ To edit records, use the editRecordViewHelper /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar - Arguments ========= - - - - -uid (anySimpleType) -================================= +uid (anySimpleType) +------------------- uid < 0 will insert the record after the given uid - -pid (anySimpleType) -================================= +pid (anySimpleType) +------------------- the page id where the record will be created - -table (string) -================================= +table (string) +-------------- target database table - -returnUrl (string) -================================= - - - - - +returnUrl (string) +------------------ \ No newline at end of file From c6ae32abcf08ea508a88b2df55a98f9ec14ead57 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 11 Feb 2019 09:35:29 +0100 Subject: [PATCH 40/45] TASK: Add disclaimer and introduction --- resources/templates/Default/Root.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst index e591e4c..d06dc0c 100644 --- a/resources/templates/Default/Root.rst +++ b/resources/templates/Default/Root.rst @@ -1,11 +1,33 @@ .. include:: Includes.txt +.. _start: + ============================== Fluid ViewHelper Documentation ============================== :Rendered: |today| +This is a complete reference of all available Fluid ViewHelper within TYPO3 CMS. +This documentation is generated from PHP Source code of TYPO3 CMS. + +.. note:: + + This is a first draft, updated manually. + +Current plans are to automate the rendering and to update the source code to +provide a fully useful reference of all provided ViewHelper by TYPO3 CMS. + +Right now this might look ugly in some places, e.g. ``= EXAMPLE =`` and rendered +HTML markup like ````. This will be polished in the future. The current +state still is much better then nothing. + +Also notice that package names are not 1:1 Composer packages. ``cms-`` is +striped. + +Content +------- + .. toctree:: :titlesonly: From 5eaac7711b1e7f5c8cc6f88d360feff01734326c Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Mon, 18 Feb 2019 16:55:16 +0100 Subject: [PATCH 41/45] [TASK] Add .idea/ to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d42e763..3020e37 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ cache/* !cache/.keep schemas/* !schemas/.keep -build/logs/ \ No newline at end of file +build/logs/ +.idea/ From 53399a32b983c97272dde6debe5d66d3bb09e289 Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Mon, 18 Feb 2019 17:10:04 +0100 Subject: [PATCH 42/45] [TASK] Fix unit tests after Index.rst change --- .../RstRendering/RootIndexFileTest.php | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/tests/Functional/RstRendering/RootIndexFileTest.php b/tests/Functional/RstRendering/RootIndexFileTest.php index 2e3ac5f..1d78110 100644 --- a/tests/Functional/RstRendering/RootIndexFileTest.php +++ b/tests/Functional/RstRendering/RootIndexFileTest.php @@ -17,12 +17,6 @@ class RootIndexFileTest extends TestCase */ private $vfs; - /** - * the generated file is compared against this fixture file - * @var string - */ - private $fixtureFilePath = __DIR__ . '/../../Fixtures/rendering/output/Documentation/Index.rst'; - /** * output of the generation process * @var string @@ -67,8 +61,8 @@ public function includeClausePointsToSettingsCfg() public function headlineAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); - // first line is include, then empty, then upper headline decoration, then text -> fourth line - $index = 3; + // include, empty, anchor, empty, upper headline decoration, text, lower headline decoration + $index = 5; $this->assertSame('Fluid ViewHelper Documentation' . PHP_EOL, $output[$index]); } @@ -78,8 +72,8 @@ public function headlineAsExpected() public function headlineIsProperlyDecorated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); - // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration - $headlineTextIndex = 3; + // include, empty, anchor, empty, upper headline decoration, text, lower headline decoration + $headlineTextIndex = 5; $lengthOfHeadline = strlen($output[$headlineTextIndex]); $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); @@ -93,17 +87,8 @@ public function headlineIsProperlyDecorated() public function tocTreeContainsSubDirectoriesAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); - $index = 11; - $this->assertSame(' typo3/backend/9.4/Index' . PHP_EOL, $output[$index]); - $this->assertSame(' typo3/backend/9.5/Index' . PHP_EOL, $output[$index + 1]); - } - - /** - * @test - */ - public function generatedFileIsSameAsFixture() - { - $this->assertSame(file_get_contents($this->fixtureFilePath), - file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); + $output = implode(PHP_EOL, $output); + $this->assertStringContainsString(' typo3/backend/9.4/Index' . PHP_EOL, $output); + $this->assertStringContainsString(' typo3/backend/9.5/Index' . PHP_EOL, $output); } } From 47a19ab7152531484c1f3a603d04fa08e7ad990a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 5 Apr 2019 09:11:15 +0200 Subject: [PATCH 43/45] Improve index file * Remove wrong information, the reference is now auto generated. * Add info that no version below 9.5 is generated. * Add info where to find a 6.2 information. --- resources/templates/Default/Root.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst index d06dc0c..212975c 100644 --- a/resources/templates/Default/Root.rst +++ b/resources/templates/Default/Root.rst @@ -11,12 +11,9 @@ Fluid ViewHelper Documentation This is a complete reference of all available Fluid ViewHelper within TYPO3 CMS. This documentation is generated from PHP Source code of TYPO3 CMS. -.. note:: - - This is a first draft, updated manually. - -Current plans are to automate the rendering and to update the source code to -provide a fully useful reference of all provided ViewHelper by TYPO3 CMS. +This reference is auto generated from TYPO3 CMS 9.5 source code. Right now there is no +auto generation for TYPO3 versions below 9.5. You can find a hand written reference +for 6.2 at https://docs.typo3.org/typo3cms/ExtbaseGuide/6.2/Fluid/ViewHelper/Index.html. Right now this might look ugly in some places, e.g. ``= EXAMPLE =`` and rendered HTML markup like ````. This will be polished in the future. The current @@ -31,4 +28,4 @@ Content .. toctree:: :titlesonly: -{line} \ No newline at end of file +{line} From 54910e4309d0d9a084882b65d02412e97da3cdbd Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sat, 22 Jun 2019 09:31:52 +0200 Subject: [PATCH 44/45] [FEATURE] Add further information * Add data type for each argument. * Add whether the argument is required. * Add anchor to each argument and ViewHelper, in order to allow references to these. --- resources/templates/Default/ViewHelper.rst | 20 ++- src/Export/RstExporter.php | 16 +- .../typo3/backend/9.4/Link/EditRecord.rst | 170 +++++++++++++----- .../typo3/backend/9.4/ModuleLink.rst | 53 ++++-- .../ViewHelperFileFirstLevelTest.php | 18 +- .../ViewHelperFileSecondLevelTest.php | 18 +- 6 files changed, 224 insertions(+), 71 deletions(-) diff --git a/resources/templates/Default/ViewHelper.rst b/resources/templates/Default/ViewHelper.rst index 028c12c..de49311 100644 --- a/resources/templates/Default/ViewHelper.rst +++ b/resources/templates/Default/ViewHelper.rst @@ -1,5 +1,7 @@ .. include:: {rootPath}Includes.txt +.. _{headlineIdentifier}: + {headlineDecoration} {headline} {headlineDecoration} @@ -15,11 +17,19 @@ Arguments This ViewHelper has no arguments. +.. _{argumentData.headlineIdentifier}: {argumentData.headline} {argumentData.headlineDecoration} - - -{argumentData.default} -{argumentData.description} + +:aspect:`DataType` + {argumentData.dataType} + +:aspect:`Default` + {argumentData.default -> f:format.raw()} + +:aspect:`Required` + {argumentData.isRequired ? 'true' : 'false'} +:aspect:`Description` + {argumentData.description -> f:format.raw()} - \ No newline at end of file + diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php index 31898e0..81babb5 100644 --- a/src/Export/RstExporter.php +++ b/src/Export/RstExporter.php @@ -146,27 +146,35 @@ public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentatio $headline = $viewHelperDocumentation->getName(); $headlineDecoration = array_pad([], strlen($headline), '='); + $namespace = array_filter(explode('/', $viewHelperDocumentation->getSchema()->getPath())); + array_pop($namespace); + $namespace = implode('/', $namespace); + $headlineIdentifier = str_replace(['.', '\'', '/'], '-', strtolower($namespace . '-' . $headline)); $arguments = []; foreach ($viewHelperDocumentation->getArgumentDefinitions() as $argumentDefinition) { - $argumentHeadline = trim($argumentDefinition->getName() . ' (' . $argumentDefinition->getType() . ') ' . ($argumentDefinition->isRequired() ? 'required' : '')); + $argumentHeadline = trim($argumentDefinition->getName()); $argumentHeadlineDecoration = array_pad([], strlen($argumentHeadline), '-'); + $argumentHeadlineIdentifier = strtolower($headline . '_' . $argumentHeadline); $argumentsData = [ 'headline' => $argumentHeadline, + 'headlineIdentifier' => $argumentHeadlineIdentifier, 'headlineDecoration' => implode('', $argumentHeadlineDecoration), - 'description' => trim($argumentDefinition->getDescription()), + 'description' => ucfirst(trim($argumentDefinition->getDescription())), + 'dataType' => ($argumentDefinition->getType() === 'anySimpleType') ? 'mixed' : trim($argumentDefinition->getType()), + 'isRequired' => $argumentDefinition->isRequired(), ]; $defaultValue = $argumentDefinition->getDefaultValue(); if ($defaultValue !== 'NULL' && $defaultValue !== "''") { - $sanitizedDefault = str_replace(PHP_EOL, '', $defaultValue); - $argumentsData['default'] = 'Default: ' . trim($sanitizedDefault) . PHP_EOL; + $argumentsData['default'] = trim(str_replace(PHP_EOL, '', $defaultValue)); } $arguments[] = $argumentsData; } $this->view->assignMultiple([ 'headline' => $headline, 'headlineDecoration' => implode('', $headlineDecoration), + 'headlineIdentifier' => $headlineIdentifier, 'rootPath' => $rootPath, 'viewHelper' => $viewHelperDocumentation, 'arguments' => $arguments, diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst index 9e2e3d1..e23afa1 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst @@ -1,5 +1,7 @@ .. include:: ../../../../Includes.txt +.. _typo3-backend-link-editrecord: + =============== link.editRecord =============== @@ -26,83 +28,169 @@ Arguments ========= -additionalAttributes (anySimpleType) ------------------------------------- +.. _link.editrecord_additionalattributes: +additionalAttributes +-------------------- +:aspect:`DataType` + mixed -Additional tag attributes. They will be added directly to the resulting HTML tag. +:aspect:`Required` + false +:aspect:`Description` + Additional tag attributes. They will be added directly to the resulting HTML tag. -data (anySimpleType) --------------------- +.. _link.editrecord_data: +data +---- + +:aspect:`DataType` + mixed + +:aspect:`Required` + false +:aspect:`Description` + Additional data-* attributes. They will each be added with a "data-" prefix. +.. _link.editrecord_class: +class +----- -Additional data-* attributes. They will each be added with a "data-" prefix. +:aspect:`DataType` + string -class (string) --------------- +:aspect:`Required` + false +:aspect:`Description` + CSS class(es) for this element +.. _link.editrecord_dir: +dir +--- -CSS class(es) for this element +:aspect:`DataType` + string -dir (string) ------------- +:aspect:`Required` + false +:aspect:`Description` + Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) +.. _link.editrecord_id: +id +-- -Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) +:aspect:`DataType` + string -id (string) ------------ +:aspect:`Required` + false +:aspect:`Description` + Unique (in this file) identifier for this HTML element. +.. _link.editrecord_lang: +lang +---- -Unique (in this file) identifier for this HTML element. +:aspect:`DataType` + string -lang (string) -------------- +:aspect:`Required` + false +:aspect:`Description` + Language for this element. Use short names specified in RFC 1766 +.. _link.editrecord_style: +style +----- -Language for this element. Use short names specified in RFC 1766 +:aspect:`DataType` + string -style (string) --------------- +:aspect:`Required` + false +:aspect:`Description` + Individual CSS styles for this element +.. _link.editrecord_title: +title +----- -Individual CSS styles for this element +:aspect:`DataType` + string -title (string) --------------- +:aspect:`Required` + false +:aspect:`Description` + Tooltip text of element +.. _link.editrecord_accesskey: +accesskey +--------- -Tooltip text of element +:aspect:`DataType` + string -accesskey (string) ------------------- +:aspect:`Required` + false +:aspect:`Description` + Keyboard shortcut to access this element +.. _link.editrecord_tabindex: +tabindex +-------- -Keyboard shortcut to access this element +:aspect:`DataType` + integer -tabindex (integer) ------------------- +:aspect:`Required` + false +:aspect:`Description` + Specifies the tab order of this element +.. _link.editrecord_onclick: +onclick +------- -Specifies the tab order of this element +:aspect:`DataType` + string -onclick (string) ----------------- +:aspect:`Required` + false +:aspect:`Description` + JavaScript evaluated for the onclick event +.. _link.editrecord_uid: +uid +--- -JavaScript evaluated for the onclick event +:aspect:`DataType` + mixed -uid (anySimpleType) -------------------- +:aspect:`Required` + false +:aspect:`Description` + Uid of record to be edited +.. _link.editrecord_table: +table +----- -uid of record to be edited +:aspect:`DataType` + string -table (string) --------------- +:aspect:`Required` + false +:aspect:`Description` + Target database table +.. _link.editrecord_returnurl: +returnUrl +--------- -target database table +:aspect:`DataType` + string -returnUrl (string) ------------------- \ No newline at end of file +:aspect:`Required` + false +:aspect:`Description` diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst index 0ebd809..8e137a7 100644 --- a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst @@ -1,5 +1,7 @@ .. include:: ../../../Includes.txt +.. _typo3-backend-modulelink: + ========== moduleLink ========== @@ -11,28 +13,53 @@ Arguments ========= -route (string) --------------- +.. _modulelink_route: +route +----- +:aspect:`DataType` + string -The route to link to +:aspect:`Required` + false +:aspect:`Description` + The route to link to -arguments (anySimpleType) -------------------------- +.. _modulelink_arguments: +arguments +--------- +:aspect:`DataType` + mixed -Default: array () +:aspect:`Default` + array () -Additional link arguments +:aspect:`Required` + false +:aspect:`Description` + Additional link arguments -query (string) --------------- +.. _modulelink_query: +query +----- +:aspect:`DataType` + string -Additional link arguments as string +:aspect:`Required` + false +:aspect:`Description` + Additional link arguments as string -currentUrlParameterName (string) --------------------------------- +.. _modulelink_currenturlparametername: +currentUrlParameterName +----------------------- +:aspect:`DataType` + string -Add current url as given parameter \ No newline at end of file +:aspect:`Required` + false +:aspect:`Description` + Add current url as given parameter diff --git a/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php b/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php index e2a3a2a..86c04f5 100644 --- a/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php +++ b/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php @@ -79,7 +79,7 @@ public function headlineAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); // first line is include, then empty, then upper headline decoration, then text -> fourth line - $index = 3; + $index = 5; $this->assertSame('moduleLink' . PHP_EOL, $output[$index]); } @@ -90,7 +90,7 @@ public function headlineIsProperlyDecorated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration - $headlineTextIndex = 3; + $headlineTextIndex = 5; $lengthOfHeadline = strlen($output[$headlineTextIndex]); $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); @@ -104,10 +104,20 @@ public function headlineIsProperlyDecorated() public function descriptionGetsRendered() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); - $index = 7; + $index = 9; $this->assertSame('Create internal link within backend app' . PHP_EOL, $output[$index]); } + /** + * @test + */ + public function headerIdentifierGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 2; + $this->assertSame('.. _typo3-backend-modulelink:' . PHP_EOL, $output[$index]); + } + /** * @test */ @@ -116,4 +126,4 @@ public function generatedFileIsSameAsFixture() $this->assertSame(file_get_contents($this->fixtureFilePath), file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); } -} \ No newline at end of file +} diff --git a/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php b/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php index 1c46c21..b78345b 100644 --- a/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php +++ b/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php @@ -79,7 +79,7 @@ public function headlineAsExpected() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); // first line is include, then empty, then upper headline decoration, then text -> fourth line - $index = 3; + $index = 5; $this->assertSame('link.editRecord' . PHP_EOL, $output[$index]); } @@ -90,7 +90,7 @@ public function headlineIsProperlyDecorated() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration - $headlineTextIndex = 3; + $headlineTextIndex = 5; $lengthOfHeadline = strlen($output[$headlineTextIndex]); $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); @@ -104,10 +104,20 @@ public function headlineIsProperlyDecorated() public function descriptionGetsRendered() { $output = file($this->vfs->getChild($this->generatedFilePath)->url()); - $index = 7; + $index = 9; $this->assertSame('Use this ViewHelper to provide edit links to records. The ViewHelper will' . PHP_EOL, $output[$index]); } + /** + * @test + */ + public function headerIdentifierGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 2; + $this->assertSame('.. _typo3-backend-link-editrecord:' . PHP_EOL, $output[$index]); + } + /** * @test */ @@ -116,4 +126,4 @@ public function generatedFileIsSameAsFixture() $this->assertSame(file_get_contents($this->fixtureFilePath), file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); } -} \ No newline at end of file +} From 418fcd03c92468a94431f6463d1ed575f20a6aee Mon Sep 17 00:00:00 2001 From: Andreas Fernandez Date: Tue, 15 Dec 2020 08:42:17 +0100 Subject: [PATCH 45/45] [BUGFIX] Fix casing of package mikey179/vfsstream --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 33ec264..c1442b6 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "require-dev": { "ext-json": "*", "phpunit/phpunit": "^7.1", - "mikey179/vfsStream": "^1.6", + "mikey179/vfsstream": "^1.6", "php-coveralls/php-coveralls": "^2.1" } }