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
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/html-php.html b/tests/fixtures/expected/blocks/code-blocks/html-php.html index 786d4c9..8f666aa 100644 --- a/tests/fixtures/expected/blocks/code-blocks/html-php.html +++ b/tests/fixtures/expected/blocks/code-blocks/html-php.html @@ -1,13 +1,4 @@ - - - - - - - - - -
+
1
 2
@@ -35,7 +26,3 @@
 </html>
 
-
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/html-twig.html b/tests/fixtures/expected/blocks/code-blocks/html-twig.html index 0aafd23..460bb83 100644 --- a/tests/fixtures/expected/blocks/code-blocks/html-twig.html +++ b/tests/fixtures/expected/blocks/code-blocks/html-twig.html @@ -1,13 +1,4 @@ - - - - - - - - - -
+
1
 2
@@ -16,6 +7,3 @@
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/html.html b/tests/fixtures/expected/blocks/code-blocks/html.html index 4261a2e..cd3f419 100644 --- a/tests/fixtures/expected/blocks/code-blocks/html.html +++ b/tests/fixtures/expected/blocks/code-blocks/html.html @@ -1,19 +1,6 @@ - - - - - - - - - -
+
1
<!-- some code -->
 
-
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/ini.html b/tests/fixtures/expected/blocks/code-blocks/ini.html index 0f52ec4..98f2b89 100644 --- a/tests/fixtures/expected/blocks/code-blocks/ini.html +++ b/tests/fixtures/expected/blocks/code-blocks/ini.html @@ -1,19 +1,7 @@ - - - - - - - - - -
+
1
fetch = +refs/notes/*:refs/notes/*
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/php-annotations.html b/tests/fixtures/expected/blocks/code-blocks/php-annotations.html index 8a5d85c..b18b0f2 100644 --- a/tests/fixtures/expected/blocks/code-blocks/php-annotations.html +++ b/tests/fixtures/expected/blocks/code-blocks/php-annotations.html @@ -1,13 +1,4 @@ - - - - - - - - - -
+
1
 2
@@ -40,6 +31,3 @@
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/php.html b/tests/fixtures/expected/blocks/code-blocks/php.html index 5880771..98dd193 100644 --- a/tests/fixtures/expected/blocks/code-blocks/php.html +++ b/tests/fixtures/expected/blocks/code-blocks/php.html @@ -1,13 +1,4 @@ - - - - - - - - - -
+
1
 2
@@ -26,6 +17,3 @@
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/terminal.html b/tests/fixtures/expected/blocks/code-blocks/terminal.html index bde9415..b4134c9 100644 --- a/tests/fixtures/expected/blocks/code-blocks/terminal.html +++ b/tests/fixtures/expected/blocks/code-blocks/terminal.html @@ -1,20 +1,11 @@ - - - - - - - - - -
+
1
-
git clone git@github.com:symfony/symfony.git
+        
git clone git@github.com:symfony/symfony.git
 
-
1
@@ -43,6 +34,3 @@
        
- - - diff --git a/tests/fixtures/expected/blocks/code-blocks/text.html b/tests/fixtures/expected/blocks/code-blocks/text.html index 8980981..85d5867 100644 --- a/tests/fixtures/expected/blocks/code-blocks/text.html +++ b/tests/fixtures/expected/blocks/code-blocks/text.html @@ -1,19 +1,7 @@ - - - - - - - - - -
+
1
some text
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/twig.html b/tests/fixtures/expected/blocks/code-blocks/twig.html index 2e42e64..88b5c1c 100644 --- a/tests/fixtures/expected/blocks/code-blocks/twig.html +++ b/tests/fixtures/expected/blocks/code-blocks/twig.html @@ -1,19 +1,7 @@ - - - - - - - - - -
+
1
{# some code #}
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/xml.html b/tests/fixtures/expected/blocks/code-blocks/xml.html index c1c05de..d0afb89 100644 --- a/tests/fixtures/expected/blocks/code-blocks/xml.html +++ b/tests/fixtures/expected/blocks/code-blocks/xml.html @@ -1,19 +1,7 @@ - - - - - - - - - -
+
1
<!-- some code -->
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/code-blocks/yaml.html b/tests/fixtures/expected/blocks/code-blocks/yaml.html index 13e8608..1b8a97b 100644 --- a/tests/fixtures/expected/blocks/code-blocks/yaml.html +++ b/tests/fixtures/expected/blocks/code-blocks/yaml.html @@ -1,19 +1,7 @@ - - - - - - - - - -
+
1
# some code
 
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/admonition.html b/tests/fixtures/expected/blocks/directives/admonition.html index 5c67841..9d7e971 100644 --- a/tests/fixtures/expected/blocks/directives/admonition.html +++ b/tests/fixtures/expected/blocks/directives/admonition.html @@ -1,17 +1,5 @@ - - - - - - - - - -
+

Screencast

Do you prefer video tutorials? Check out the the screencasts.

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/best-practice.html b/tests/fixtures/expected/blocks/directives/best-practice.html index 1ed1305..91a4e80 100644 --- a/tests/fixtures/expected/blocks/directives/best-practice.html +++ b/tests/fixtures/expected/blocks/directives/best-practice.html @@ -1,17 +1,5 @@ - - - - - - - - - -
+

Best Practice

Use the bcrypt encoder for hashing your users' passwords.

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/caution.html b/tests/fixtures/expected/blocks/directives/caution.html index 457b6b8..2c51d5b 100644 --- a/tests/fixtures/expected/blocks/directives/caution.html +++ b/tests/fixtures/expected/blocks/directives/caution.html @@ -1,18 +1,6 @@ - - - - - - - - - -
+

Caution

Using too many sidebars or caution directives can be distracting!

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/class.html b/tests/fixtures/expected/blocks/directives/class.html index 596dfda..22c1635 100644 --- a/tests/fixtures/expected/blocks/directives/class.html +++ b/tests/fixtures/expected/blocks/directives/class.html @@ -1,18 +1,6 @@ - - - - - - - - - -
  • list-item-1
  • +
    • list-item-1
    • list-item-2
    • list-item-3

    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 @@ - - - - - - - - - -
    +
    • YAML @@ -30,6 +21,3 @@
- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/note-code-block-nested.html b/tests/fixtures/expected/blocks/directives/note-code-block-nested.html index d3ff26e..29e5ba0 100644 --- a/tests/fixtures/expected/blocks/directives/note-code-block-nested.html +++ b/tests/fixtures/expected/blocks/directives/note-code-block-nested.html @@ -1,13 +1,4 @@ - - - - - - - - - -
+

Note @@ -20,6 +11,3 @@

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/note.html b/tests/fixtures/expected/blocks/directives/note.html index e056eaa..ca8ecf7 100644 --- a/tests/fixtures/expected/blocks/directives/note.html +++ b/tests/fixtures/expected/blocks/directives/note.html @@ -1,18 +1,6 @@ - - - - - - - - - -
+

Note

Sometimes we add notes. But not too often because they interrupt the flow.

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/seealso.html b/tests/fixtures/expected/blocks/directives/seealso.html index ae9f807..52be87b 100644 --- a/tests/fixtures/expected/blocks/directives/seealso.html +++ b/tests/fixtures/expected/blocks/directives/seealso.html @@ -1,20 +1,9 @@ - - - - - - - - - -
-

- - - - See also -

-

Also check out the homepage

-
- - +
+

+ + + + See also +

+

Also check out the homepage

+
diff --git a/tests/fixtures/expected/blocks/directives/sidebar-code-block-nested.html b/tests/fixtures/expected/blocks/directives/sidebar-code-block-nested.html index 8e67aaa..2d2f0f1 100644 --- a/tests/fixtures/expected/blocks/directives/sidebar-code-block-nested.html +++ b/tests/fixtures/expected/blocks/directives/sidebar-code-block-nested.html @@ -1,13 +1,4 @@ - - - - - - - - - -

some text before code block

+

some text before code block

1
@@ -17,6 +8,3 @@

some text after code block

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/sidebar.html b/tests/fixtures/expected/blocks/directives/sidebar.html index 2952441..62daa97 100644 --- a/tests/fixtures/expected/blocks/directives/sidebar.html +++ b/tests/fixtures/expected/blocks/directives/sidebar.html @@ -1,14 +1,2 @@ - - - - - - - - - -

some text inside sidebar

+

some text inside sidebar

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/tip.html b/tests/fixtures/expected/blocks/directives/tip.html index a26576b..6ef232b 100644 --- a/tests/fixtures/expected/blocks/directives/tip.html +++ b/tests/fixtures/expected/blocks/directives/tip.html @@ -1,18 +1,6 @@ - - - - - - - - - -
+

Tip

This is a little tip about something! We an also talk about specific

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/topic.html b/tests/fixtures/expected/blocks/directives/topic.html index 16c4447..48e35bc 100644 --- a/tests/fixtures/expected/blocks/directives/topic.html +++ b/tests/fixtures/expected/blocks/directives/topic.html @@ -1,15 +1,3 @@ - - - - - - - - - -
+

Example

Here is a sample comment for a bug report that could be reproduced.

- - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/directives/versionadded.html b/tests/fixtures/expected/blocks/directives/versionadded.html index 663039e..adfbbc8 100644 --- a/tests/fixtures/expected/blocks/directives/versionadded.html +++ b/tests/fixtures/expected/blocks/directives/versionadded.html @@ -1,21 +1,9 @@ - - - - +
+

+ + + + New in version 4.1 - - - - -

-

- - - - New in version 4.1 -

-

This option was introduced in Symfony 2.6 and replaces another option, which is available prior to 2.6.

-
- - - +

+

This option was introduced in Symfony 2.6 and replaces another option, which is available prior to 2.6.

diff --git a/tests/fixtures/expected/blocks/nodes/list.html b/tests/fixtures/expected/blocks/nodes/list.html index cc1fad6..74e46f6 100644 --- a/tests/fixtures/expected/blocks/nodes/list.html +++ b/tests/fixtures/expected/blocks/nodes/list.html @@ -1,18 +1,5 @@ - - - - - - - - - -
  • List item 1
  • +
    • List item 1
    • List item 2
    • List item 3
    • List item 4
    - - - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/nodes/literal.html b/tests/fixtures/expected/blocks/nodes/literal.html index f0eaec8..d5d2661 100644 --- a/tests/fixtures/expected/blocks/nodes/literal.html +++ b/tests/fixtures/expected/blocks/nodes/literal.html @@ -1,13 +1,4 @@ - - - - - - - - - -

    here is some php code from literal:

    +

    here is some php code from literal:

    1
    @@ -27,14 +18,6 @@
     
    - -

    - The CRUD controller of App\Entity\Example must implement -the - EasyCorp\Bundle\EasyAdminBundle\Contracts\Controller\CrudControllerInterface - , -but you can also extend from the AbstractCrudController class. -

    - - - +

    The CRUD controller of App\Entity\Example must implement +the EasyCorp\Bundle\EasyAdminBundle\Contracts\Controller\CrudControllerInterface, +but you can also extend from the AbstractCrudController class.

    diff --git a/tests/fixtures/expected/blocks/nodes/tables.html b/tests/fixtures/expected/blocks/nodes/tables.html index ad008ea..05142f4 100644 --- a/tests/fixtures/expected/blocks/nodes/tables.html +++ b/tests/fixtures/expected/blocks/nodes/tables.html @@ -1,13 +1,4 @@ - - - - - - - - - - +
    @@ -15,8 +6,7 @@ - - + @@ -30,8 +20,7 @@
    Route pathIf the requested URL is /foo/
    /foo It matches (200 status response)
    - - + @@ -54,8 +43,7 @@ - - + @@ -74,8 +62,7 @@ - - + @@ -95,6 +82,3 @@
    Cell 1 Cell 2Cell 2
    Cell 3 Cell 4Cell 2
    Cell 3 Cell 4
    - - - \ No newline at end of file diff --git a/tests/fixtures/expected/blocks/references/class.html b/tests/fixtures/expected/blocks/references/class.html index 74f2148..35afeec 100644 --- a/tests/fixtures/expected/blocks/references/class.html +++ b/tests/fixtures/expected/blocks/references/class.html @@ -1,13 +1 @@ - - - - - - - - - -

    ContainerAwareHttpKernel

    - - - \ No newline at end of file +

    ContainerAwareHttpKernel

    diff --git a/tests/fixtures/expected/blocks/references/method.html b/tests/fixtures/expected/blocks/references/method.html index 09ddab7..3b4d701 100644 --- a/tests/fixtures/expected/blocks/references/method.html +++ b/tests/fixtures/expected/blocks/references/method.html @@ -1,13 +1 @@ - - - - - - - - - -

    getCurrentRequest()

    - - - \ No newline at end of file +

    getCurrentRequest()

    diff --git a/tests/fixtures/expected/blocks/references/namespace.html b/tests/fixtures/expected/blocks/references/namespace.html index 69b820c..3dfb39f 100644 --- a/tests/fixtures/expected/blocks/references/namespace.html +++ b/tests/fixtures/expected/blocks/references/namespace.html @@ -1,13 +1 @@ - - - - - - - - - -

    HttpFoundation

    - - - \ No newline at end of file +

    HttpFoundation

    diff --git a/tests/fixtures/expected/blocks/references/php-class.html b/tests/fixtures/expected/blocks/references/php-class.html index dc8c36f..271b968 100644 --- a/tests/fixtures/expected/blocks/references/php-class.html +++ b/tests/fixtures/expected/blocks/references/php-class.html @@ -1,13 +1 @@ - - - - - - - - - -

    ArrayAccess

    - - - +

    ArrayAccess

    diff --git a/tests/fixtures/expected/blocks/references/php-function.html b/tests/fixtures/expected/blocks/references/php-function.html index 0a17f0a..0c9b85a 100644 --- a/tests/fixtures/expected/blocks/references/php-function.html +++ b/tests/fixtures/expected/blocks/references/php-function.html @@ -1,13 +1 @@ - - - - - - - - - -

    trigger_error

    - - - +

    trigger_error

    diff --git a/tests/fixtures/expected/blocks/references/php-method.html b/tests/fixtures/expected/blocks/references/php-method.html index 073efb9..e86c571 100644 --- a/tests/fixtures/expected/blocks/references/php-method.html +++ b/tests/fixtures/expected/blocks/references/php-method.html @@ -1,13 +1 @@ - - - - - - - - - -

    Locale::getDefault()

    - - - +

    Locale::getDefault()

    diff --git a/tests/fixtures/expected/blocks/references/reference-and-code.html b/tests/fixtures/expected/blocks/references/reference-and-code.html new file mode 100644 index 0000000..474be7e --- /dev/null +++ b/tests/fixtures/expected/blocks/references/reference-and-code.html @@ -0,0 +1,3 @@ +

    Next, create the template used to render the field in the index and detail +CRUD pages.

    +

    More about CRUD pages.

    diff --git a/tests/fixtures/expected/main/datetime.html b/tests/fixtures/expected/main/datetime.html index add9467..c4b798e 100644 --- a/tests/fixtures/expected/main/datetime.html +++ b/tests/fixtures/expected/main/datetime.html @@ -57,7 +57,7 @@

    Field Options

    The date_format Option

    -

    type: integer or stringdefault: IntlDateFormatter::MEDIUM

    +

    type: integer or string default: IntlDateFormatter::MEDIUM

    Defines the format option that will be passed down to the date field. for more details.

    @@ -134,7 +134,7 @@

    format

    -

    type: stringdefault: Symfony\Component\Form\Extension\Core\Type\DateTimeType::HTML5_FORMAT

    +

    type: string default: Symfony\Component\Form\Extension\Core\Type\DateTimeType::HTML5_FORMAT

    If the widget option is set to single_text, this option specifies the format of the input, i.e. how Symfony will interpret the given input as a datetime string. See Date/Time Format Syntax.

    @@ -154,12 +154,12 @@

    time_widget

    -

    type: stringdefault: choice

    +

    type: string default: choice

    Defines the widget option for the TimeType.

    widget

    -

    type: stringdefault: null

    +

    type: string default: null

    Defines the widget option for both the DateType. and TimeType. This can be overridden with the date_widget and time_widget options.

    diff --git a/tests/fixtures/source/blocks/references/reference-and-code.rst b/tests/fixtures/source/blocks/references/reference-and-code.rst new file mode 100644 index 0000000..b54e1f2 --- /dev/null +++ b/tests/fixtures/source/blocks/references/reference-and-code.rst @@ -0,0 +1,6 @@ +Next, create the template used to render the field in the ``index`` and ``detail`` +`CRUD pages`_. + +More about CRUD pages. + +.. _`CRUD pages`: https://symfony.com/doc/current/bundles/EasyAdminBundle/crud.html