diff --git a/src/Templates/default/html/paragraph.html.twig b/src/Templates/default/html/paragraph.html.twig new file mode 100644 index 0000000..9c680df --- /dev/null +++ b/src/Templates/default/html/paragraph.html.twig @@ -0,0 +1,5 @@ +{% set text = paragraphNode.value.render()|trim %} + +{%- if text %} +
{{ text|raw }}
+{% endif %} diff --git a/tests/AbstractIntegrationTest.php b/tests/AbstractIntegrationTest.php index d6719da..0c7819e 100644 --- a/tests/AbstractIntegrationTest.php +++ b/tests/AbstractIntegrationTest.php @@ -7,7 +7,7 @@ use Symfony\Component\Filesystem\Filesystem; use SymfonyDocsBuilder\BuildConfig; -class AbstractIntegrationTest extends TestCase +abstract class AbstractIntegrationTest extends TestCase { protected function createBuildConfig(string $sourceDir): BuildConfig { diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 79cdf69..28b3b71 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -96,14 +96,16 @@ public function testParseUnitBlock(string $blockName) $sourceFile = sprintf('%s/fixtures/source/blocks/%s.rst', __DIR__, $blockName); - $document = $parser->parseFile($sourceFile)->renderDocument(); + $actualHtml = $parser->parseFile($sourceFile)->renderDocument(); + $expectedHtml = file_get_contents(sprintf('%s/fixtures/expected/blocks/%s.html', __DIR__, $blockName)); + $actualCrawler = new Crawler($actualHtml); + $expectedCrawler = new Crawler($expectedHtml); $indenter = $this->createIndenter(); - $expectedFile = sprintf('%s/fixtures/expected/blocks/%s.html', __DIR__, $blockName); $this->assertSame( - str_replace(" \n", "\n", $indenter->indent(file_get_contents($expectedFile))), - str_replace(" \n", "\n", $indenter->indent($document)) + $indenter->indent(trim($expectedCrawler->filter('body')->html())), + $indenter->indent(trim($actualCrawler->filter('body')->html())) ); } @@ -197,6 +199,10 @@ public function parserUnitBlockProvider() 'blockName' => 'references/php-method', ]; + yield 'reference-and-code' => [ + 'blockName' => 'references/reference-and-code', + ]; + yield 'code-block-php' => [ 'blockName' => 'code-blocks/php', ]; diff --git a/tests/fixtures/expected/blocks/code-blocks/bash.html b/tests/fixtures/expected/blocks/code-blocks/bash.html index 1161c18..9477b1b 100644 --- a/tests/fixtures/expected/blocks/code-blocks/bash.html +++ b/tests/fixtures/expected/blocks/code-blocks/bash.html @@ -1,19 +1,7 @@ - - - - - - - - - -1
git clone git@github.com:symfony/symfony.git
1
2
@@ -35,7 +26,3 @@
</html>
1 2@@ -16,6 +7,3 @@
1
<!-- some code -->
1
fetch = +refs/notes/*:refs/notes/*
1 2 @@ -40,6 +31,3 @@
1 2 @@ -26,6 +17,3 @@
1-
git clone git@github.com:symfony/symfony.git
+ git clone git@github.com:symfony/symfony.git
1 @@ -43,6 +34,3 @@
1
some text
1
{# some code #}
1
<!-- some code -->
1
# some code
Screencast
Do you prefer video tutorials? Check out the the screencasts.
Best Practice
Use the bcrypt encoder for hashing your users' passwords.
Caution
Using too many sidebars or caution directives can be distracting!
some text
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/configuration-block.html b/tests/fixtures/expected/blocks/directives/configuration-block.html index 7d6505d..25b41bc 100644 --- a/tests/fixtures/expected/blocks/directives/configuration-block.html +++ b/tests/fixtures/expected/blocks/directives/configuration-block.html @@ -1,13 +1,4 @@ - - - - - - - - - -Note @@ -20,6 +11,3 @@
Note
Sometimes we add notes. But not too often because they interrupt the flow.
- - See also -
-Also check out the homepage
-+ + See also +
+Also check out the homepage
+