diff --git a/src/Composer/_defaultpages/Template/Details b/src/Composer/_defaultpages/Template/Details new file mode 100644 index 0000000..21ceff7 --- /dev/null +++ b/src/Composer/_defaultpages/Template/Details @@ -0,0 +1,5 @@ +{{SimplePanel +|type=info +|title={{{headings|}}} +|body={{{cql|}}} +}} \ No newline at end of file diff --git a/src/Composer/_defaultpages/Template/DetailsSummary b/src/Composer/_defaultpages/Template/DetailsSummary new file mode 100644 index 0000000..f15e86a --- /dev/null +++ b/src/Composer/_defaultpages/Template/DetailsSummary @@ -0,0 +1,6 @@ +{| class="mw-collapsible mw-collapsed wikitable" +! {{{title|}}} +|- +| +{{{body|}}} +|} \ No newline at end of file diff --git a/src/Composer/_defaultpages/Template/Excerpt b/src/Composer/_defaultpages/Template/Excerpt index e69de29..f15e86a 100644 --- a/src/Composer/_defaultpages/Template/Excerpt +++ b/src/Composer/_defaultpages/Template/Excerpt @@ -0,0 +1,6 @@ +{| class="mw-collapsible mw-collapsed wikitable" +! {{{title|}}} +|- +| +{{{body|}}} +|} \ No newline at end of file diff --git a/src/Converter/ConfluenceConverter.php b/src/Converter/ConfluenceConverter.php index 4125a6a..2e70ea0 100644 --- a/src/Converter/ConfluenceConverter.php +++ b/src/Converter/ConfluenceConverter.php @@ -26,6 +26,8 @@ use HalloWelt\MigrateConfluence\Converter\Processor\ConvertTaskListMacro; use HalloWelt\MigrateConfluence\Converter\Processor\ConvertTipMacro; use HalloWelt\MigrateConfluence\Converter\Processor\ConvertWarningMacro; +use HalloWelt\MigrateConfluence\Converter\Processor\DetailsMacro; +use HalloWelt\MigrateConfluence\Converter\Processor\DetailsSummaryMacro; use HalloWelt\MigrateConfluence\Converter\Processor\Emoticon; use HalloWelt\MigrateConfluence\Converter\Processor\ExpandMacro; use HalloWelt\MigrateConfluence\Converter\Processor\Image; @@ -251,6 +253,8 @@ private function runProcessors( $dom ) { ), new StructuredMacroContenByLabel( $this->currentPageTitle ), new ExpandMacro(), + new DetailsMacro(), + new DetailsSummaryMacro(), new MacroAlign(), new StructuredMacroJira(), new StructuredMacroViewFile( diff --git a/src/Converter/Processor/DetailsMacro.php b/src/Converter/Processor/DetailsMacro.php new file mode 100644 index 0000000..3268462 --- /dev/null +++ b/src/Converter/Processor/DetailsMacro.php @@ -0,0 +1,27 @@ + + * control + * + *

Control details

+ * + */ +class DetailsMacro extends ConvertMacroToTemplateBase { + + /** + * @inheritDoc + */ + protected function getMacroName(): string { + return 'details'; + } + + /** + * @inheritDoc + */ + protected function getWikiTextTemplateName(): string { + return 'Details'; + } +} diff --git a/src/Converter/Processor/DetailsSummaryMacro.php b/src/Converter/Processor/DetailsSummaryMacro.php new file mode 100644 index 0000000..f3b30eb --- /dev/null +++ b/src/Converter/Processor/DetailsSummaryMacro.php @@ -0,0 +1,28 @@ + + * ... + * ... + * Title + * label = "..." and parent = currentContent ( ) + * + */ +class DetailsSummaryMacro extends ConvertMacroToTemplateBase { + + /** + * @inheritDoc + */ + protected function getMacroName(): string { + return 'detailssummary'; + } + + /** + * @inheritDoc + */ + protected function getWikiTextTemplateName(): string { + return 'DetailsSummary'; + } +} diff --git a/tests/phpunit/Converter/Processor/DetailsMacroTest.php b/tests/phpunit/Converter/Processor/DetailsMacroTest.php new file mode 100644 index 0000000..75535cf --- /dev/null +++ b/tests/phpunit/Converter/Processor/DetailsMacroTest.php @@ -0,0 +1,37 @@ +dir = dirname( dirname( __DIR__ ) ) . '/data'; + + $input = file_get_contents( "$this->dir/details-macro-input.xml" ); + + $dom = new DOMDocument(); + $dom->loadXML( $input ); + + $processor = new DetailsMacro(); + $processor->process( $dom ); + + $actualOutput = $dom->saveXML( $dom->documentElement ); + $expectedOutput = file_get_contents( "$this->dir/details-macro-output.xml" ); + + $this->assertEquals( $expectedOutput, $actualOutput ); + } + +} diff --git a/tests/phpunit/Converter/Processor/DetailsSummaryMacroTest.php b/tests/phpunit/Converter/Processor/DetailsSummaryMacroTest.php new file mode 100644 index 0000000..4d2c57a --- /dev/null +++ b/tests/phpunit/Converter/Processor/DetailsSummaryMacroTest.php @@ -0,0 +1,37 @@ +dir = dirname( dirname( __DIR__ ) ) . '/data'; + + $input = file_get_contents( "$this->dir/detailssummary-macro-input.xml" ); + + $dom = new DOMDocument(); + $dom->loadXML( $input ); + + $processor = new DetailsSummaryMacro(); + $processor->process( $dom ); + + $actualOutput = $dom->saveXML( $dom->documentElement ); + $expectedOutput = file_get_contents( "$this->dir/detailssummary-macro-output.xml" ); + + $this->assertEquals( $expectedOutput, $actualOutput ); + } + +} diff --git a/tests/phpunit/data/details-macro-input.xml b/tests/phpunit/data/details-macro-input.xml new file mode 100644 index 0000000..58a3801 --- /dev/null +++ b/tests/phpunit/data/details-macro-input.xml @@ -0,0 +1,8 @@ + + + Lorem + +

Ipsum dolor

+
+
+
\ No newline at end of file diff --git a/tests/phpunit/data/details-macro-output.xml b/tests/phpunit/data/details-macro-output.xml new file mode 100644 index 0000000..6352641 --- /dev/null +++ b/tests/phpunit/data/details-macro-output.xml @@ -0,0 +1,9 @@ + + {{Details###BREAK### + |id = Lorem###BREAK### + |body = ###BREAK### + +

Ipsum dolor

+ }}###BREAK### + +
\ No newline at end of file diff --git a/tests/phpunit/data/detailssummary-macro-input.xml b/tests/phpunit/data/detailssummary-macro-input.xml new file mode 100644 index 0000000..1e6c674 --- /dev/null +++ b/tests/phpunit/data/detailssummary-macro-input.xml @@ -0,0 +1,8 @@ + + + Col 1 + Heading 1, Heading 2, Heading 3, Heading 4 + Title + label = "Label 1" and parent = currentContent ( ) + + \ No newline at end of file diff --git a/tests/phpunit/data/detailssummary-macro-output.xml b/tests/phpunit/data/detailssummary-macro-output.xml new file mode 100644 index 0000000..876a886 --- /dev/null +++ b/tests/phpunit/data/detailssummary-macro-output.xml @@ -0,0 +1,9 @@ + + {{DetailsSummary###BREAK### + |firstcolumn = Col 1###BREAK### + |headings = Heading 1, Heading 2, Heading 3, Heading 4###BREAK### + |sortBy = Title###BREAK### + |cql = label = "Label 1" and parent = currentContent ( )###BREAK### +}}###BREAK### + + \ No newline at end of file