diff --git a/packages/guides-restructured-text/resources/config/guides-restructured-text.php b/packages/guides-restructured-text/resources/config/guides-restructured-text.php index 0be3c6da6..1914be01d 100644 --- a/packages/guides-restructured-text/resources/config/guides-restructured-text.php +++ b/packages/guides-restructured-text/resources/config/guides-restructured-text.php @@ -12,6 +12,7 @@ use phpDocumentor\Guides\RestructuredText\Directives\CautionDirective; use phpDocumentor\Guides\RestructuredText\Directives\ClassDirective; use phpDocumentor\Guides\RestructuredText\Directives\CodeBlockDirective; +use phpDocumentor\Guides\RestructuredText\Directives\ConfvalDirective; use phpDocumentor\Guides\RestructuredText\Directives\ContainerDirective; use phpDocumentor\Guides\RestructuredText\Directives\ContentsDirective; use phpDocumentor\Guides\RestructuredText\Directives\CsvTableDirective; @@ -169,6 +170,7 @@ CodeNodeOptionMapper::class, ), ]) + ->set(ConfvalDirective::class) ->set(ContainerDirective::class) ->set(ContentsDirective::class) ->arg('$documentNameResolver', service(DocumentNameResolverInterface::class)) diff --git a/packages/guides-restructured-text/resources/template/html/body/directive/confval.html.twig b/packages/guides-restructured-text/resources/template/html/body/directive/confval.html.twig new file mode 100644 index 000000000..ab31c44a1 --- /dev/null +++ b/packages/guides-restructured-text/resources/template/html/body/directive/confval.html.twig @@ -0,0 +1,21 @@ +
+
+ {{ node.plainContent }}
+
+
+ {% if node.type != null %}
Type: {{ renderNode(node.type) }}
+ {% endif -%} + {%- if node.required %}
Required: true
+ {% endif -%} + {% if node.default != null %}
Type: {{ renderNode(node.default) }}
+ {% endif -%} + {%- for key, option in node.additionalOptions -%} +
{{ key }}: {{ renderNode(option) }}
+ + {% endfor -%} +
+
+ {{ renderNode(node.value) }} +
+
+
\ No newline at end of file diff --git a/packages/guides-restructured-text/src/RestructuredText/DependencyInjection/ReStructuredTextExtension.php b/packages/guides-restructured-text/src/RestructuredText/DependencyInjection/ReStructuredTextExtension.php index d8681aa13..34fc02fca 100644 --- a/packages/guides-restructured-text/src/RestructuredText/DependencyInjection/ReStructuredTextExtension.php +++ b/packages/guides-restructured-text/src/RestructuredText/DependencyInjection/ReStructuredTextExtension.php @@ -6,6 +6,7 @@ use phpDocumentor\Guides\NodeRenderers\TemplateNodeRenderer; use phpDocumentor\Guides\RestructuredText\DependencyInjection\Compiler\TextRolePass; +use phpDocumentor\Guides\RestructuredText\Nodes\ConfvalNode; use phpDocumentor\Guides\RestructuredText\Nodes\OptionNode; use phpDocumentor\Guides\RestructuredText\Nodes\VersionChangeNode; use phpDocumentor\Guides\TemplateRenderer; @@ -27,6 +28,7 @@ class ReStructuredTextExtension extends Extension implements PrependExtensionInt private const HTML = [ VersionChangeNode::class => 'body/version-change.html.twig', OptionNode::class => 'body/directive/option.html.twig', + ConfvalNode::class => 'body/directive/confval.html.twig', ]; /** @param mixed[] $configs */ diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractAdmonitionDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractAdmonitionDirective.php index dd0a80231..d4d36d35b 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractAdmonitionDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractAdmonitionDirective.php @@ -16,6 +16,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Nodes\AdmonitionNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use phpDocumentor\Guides\RestructuredText\Parser\Productions\Rule; @@ -31,6 +32,7 @@ public function __construct(protected Rule $startingRule, private readonly strin * @param Directive $directive */ final protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractVersionChangeDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractVersionChangeDirective.php index 926d474cb..be90f7e5b 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractVersionChangeDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/AbstractVersionChangeDirective.php @@ -16,6 +16,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Nodes\VersionChangeNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use phpDocumentor\Guides\RestructuredText\Parser\Productions\Rule; @@ -32,6 +33,7 @@ public function __construct(protected Rule $startingRule, private readonly strin * @param Directive $directive */ final protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/AdmonitionDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/AdmonitionDirective.php index c7018dce1..1ecdbef97 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/AdmonitionDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/AdmonitionDirective.php @@ -16,6 +16,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Nodes\AdmonitionNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use function preg_replace; @@ -45,6 +46,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/ClassDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/ClassDirective.php index 703ea8430..6a7e04a16 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/ClassDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/ClassDirective.php @@ -8,6 +8,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\DocumentNode; use phpDocumentor\Guides\Nodes\Node; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use Symfony\Component\String\Slugger\AsciiSlugger; @@ -39,6 +40,7 @@ public function getAliases(): array * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/ConfvalDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/ConfvalDirective.php new file mode 100644 index 000000000..b268a2d4e --- /dev/null +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/ConfvalDirective.php @@ -0,0 +1,82 @@ + $startingRule */ + public function __construct( + protected Rule $startingRule, + GenericLinkProvider $genericLinkProvider, + private readonly AnchorReducer $anchorReducer, + private readonly InlineParser $inlineParser, + ) { + parent::__construct($startingRule); + + $genericLinkProvider->addGenericLink(self::NAME, ConfvalNode::LINK_TYPE); + } + + public function getName(): string + { + return self::NAME; + } + + /** {@inheritDoc} + * + * @param Directive $directive + */ + protected function processSub( + BlockContext $blockContext, + CollectionNode $collectionNode, + Directive $directive, + ): Node|null { + $id = $this->anchorReducer->reduceAnchor($directive->getData()); + $type = null; + $required = false; + $default = null; + $additionalOptions = []; + if ($directive->hasOption('type')) { + $type = $this->inlineParser->parse($directive->getOption('type')->toString(), $blockContext); + } + + if ($directive->hasOption('required')) { + $required = boolval($directive->getOption('required')); + } + + if ($directive->hasOption('default')) { + $type = $this->inlineParser->parse($directive->getOption('default')->toString(), $blockContext); + } + + foreach ($directive->getOptions() as $option) { + if (in_array($option->getName(), ['type', 'required', 'default', 'noindex'], true)) { + continue; + } + + $additionalOptions[$option->getName()] = $this->inlineParser->parse($option->toString(), $blockContext); + } + + return new ConfvalNode($id, $directive->getData(), $type, $required, $default, $additionalOptions, $collectionNode->getChildren()); + } +} diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/ContainerDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/ContainerDirective.php index 94cd3822e..2b4ae37af 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/ContainerDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/ContainerDirective.php @@ -7,6 +7,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Nodes\ContainerNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; /** @@ -32,6 +33,7 @@ public function getAliases(): array * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/DocumentBlockDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/DocumentBlockDirective.php index 5a270d5d6..a3c8dd0a8 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/DocumentBlockDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/DocumentBlockDirective.php @@ -7,6 +7,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\DocumentBlockNode; use phpDocumentor\Guides\Nodes\Node; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; class DocumentBlockDirective extends SubDirective @@ -21,6 +22,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/EpigraphDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/EpigraphDirective.php index 1275b5d53..c6f581d3d 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/EpigraphDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/EpigraphDirective.php @@ -7,6 +7,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\Nodes\QuoteNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; /** @@ -28,6 +29,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/FigureDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/FigureDirective.php index 053c9831c..37ee37361 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/FigureDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/FigureDirective.php @@ -8,6 +8,7 @@ use phpDocumentor\Guides\Nodes\FigureNode; use phpDocumentor\Guides\Nodes\ImageNode; use phpDocumentor\Guides\Nodes\Node; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use phpDocumentor\Guides\RestructuredText\Parser\Productions\Rule; @@ -37,6 +38,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/GeneralDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/GeneralDirective.php index c10a5e7d0..8f5895f21 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/GeneralDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/GeneralDirective.php @@ -8,6 +8,7 @@ use phpDocumentor\Guides\Nodes\InlineCompoundNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Nodes\GeneralDirectiveNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; /** @@ -25,6 +26,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/HighlightsDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/HighlightsDirective.php index 40c948727..83d831a06 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/HighlightsDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/HighlightsDirective.php @@ -7,6 +7,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\Nodes\QuoteNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; /** @@ -27,6 +28,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/OptionDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/OptionDirective.php index 845fabd06..df20a5ea5 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/OptionDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/OptionDirective.php @@ -8,6 +8,7 @@ use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\ReferenceResolvers\AnchorReducer; use phpDocumentor\Guides\RestructuredText\Nodes\OptionNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use phpDocumentor\Guides\RestructuredText\Parser\Productions\Rule; use phpDocumentor\Guides\RestructuredText\TextRoles\GenericLinkProvider; @@ -47,6 +48,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/PullQuoteDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/PullQuoteDirective.php index 4a65c6510..a51c229f3 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/PullQuoteDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/PullQuoteDirective.php @@ -7,6 +7,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\Nodes\QuoteNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; /** @@ -28,6 +29,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/ReplaceDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/ReplaceDirective.php index 2bfff0fca..380d06fcc 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/ReplaceDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/ReplaceDirective.php @@ -9,6 +9,7 @@ use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\Nodes\ParagraphNode; use phpDocumentor\Guides\Nodes\ReplacementNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use function count; @@ -30,6 +31,7 @@ public function getName(): string * @param Directive $directive */ final protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/SidebarDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/SidebarDirective.php index 472ed4c78..3d57e2ed4 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/SidebarDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/SidebarDirective.php @@ -16,6 +16,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Nodes\SidebarNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; /** @@ -35,6 +36,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/SubDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/SubDirective.php index 795558ad7..9bf76c8d2 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/SubDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/SubDirective.php @@ -38,7 +38,7 @@ final public function process( return null; } - $node = $this->processSub($collectionNode, $directive); + $node = $this->processSub($blockContext, $collectionNode, $directive); if ($node === null) { return null; @@ -54,6 +54,7 @@ protected function getStartingRule(): Rule } protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/TableDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/TableDirective.php index 442d395d7..e01e10f00 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/TableDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/TableDirective.php @@ -7,6 +7,7 @@ use phpDocumentor\Guides\Nodes\CollectionNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\Nodes\TableNode; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use phpDocumentor\Guides\RestructuredText\Parser\Productions\Rule; use Psr\Log\LoggerInterface; @@ -49,6 +50,7 @@ public function getName(): string /** {@inheritDoc} */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-restructured-text/src/RestructuredText/Nodes/ConfvalNode.php b/packages/guides-restructured-text/src/RestructuredText/Nodes/ConfvalNode.php new file mode 100644 index 000000000..74eb54cc2 --- /dev/null +++ b/packages/guides-restructured-text/src/RestructuredText/Nodes/ConfvalNode.php @@ -0,0 +1,79 @@ + + */ +class ConfvalNode extends CompoundNode implements LinkTargetNode +{ + public const LINK_TYPE = 'std:confval'; + + /** + * @param list $value + * @param array $additionalOptions + */ + public function __construct( + private readonly string $id, + private readonly string $plainContent, + private readonly InlineCompoundNode|null $type = null, + private readonly bool $required = false, + private readonly InlineCompoundNode|null $default = null, + private readonly array $additionalOptions = [], + array $value = [], + ) { + parent::__construct($value); + } + + public function getPlainContent(): string + { + return $this->plainContent; + } + + public function getLinkType(): string + { + return self::LINK_TYPE; + } + + public function getId(): string + { + return $this->id; + } + + public function getLinkText(): string + { + return $this->plainContent; + } + + public function getType(): InlineCompoundNode|null + { + return $this->type; + } + + public function isRequired(): bool + { + return $this->required; + } + + public function getDefault(): InlineCompoundNode|null + { + return $this->default; + } + + /** @return array */ + public function getAdditionalOptions(): array + { + return $this->additionalOptions; + } +} diff --git a/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabDirective.php b/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabDirective.php index 35528e8d2..b516fc8f4 100644 --- a/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabDirective.php +++ b/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabDirective.php @@ -18,6 +18,7 @@ use phpDocumentor\Guides\Nodes\InlineCompoundNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Directives\SubDirective; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use function is_string; @@ -38,6 +39,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabsDirective.php b/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabsDirective.php index 467d6935a..6073b2e6d 100644 --- a/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabsDirective.php +++ b/packages/guides-theme-bootstrap/src/Bootstrap/Directives/TabsDirective.php @@ -19,6 +19,7 @@ use phpDocumentor\Guides\Nodes\InlineCompoundNode; use phpDocumentor\Guides\Nodes\Node; use phpDocumentor\Guides\RestructuredText\Directives\SubDirective; +use phpDocumentor\Guides\RestructuredText\Parser\BlockContext; use phpDocumentor\Guides\RestructuredText\Parser\Directive; use phpDocumentor\Guides\RestructuredText\Parser\Productions\Rule; use Psr\Log\LoggerInterface; @@ -48,6 +49,7 @@ public function getName(): string * @param Directive $directive */ protected function processSub( + BlockContext $blockContext, CollectionNode $collectionNode, Directive $directive, ): Node|null { diff --git a/tests/Integration/tests/confval/expected/index.html b/tests/Integration/tests/confval/expected/index.html new file mode 100644 index 000000000..bd87e2839 --- /dev/null +++ b/tests/Integration/tests/confval/expected/index.html @@ -0,0 +1,31 @@ + + + + Confval directive + + + +
+

Confval directive

+ +
+
+ demo
+
+
+
Type: "Hello World"
+
Required: true
+
Custom Info: custom
+ +
+
+

This is the confval demo content!

Another paragraph.

+
+
+
+

See option demo +.

+
+ + + diff --git a/tests/Integration/tests/confval/expected/objects.inv.json b/tests/Integration/tests/confval/expected/objects.inv.json new file mode 100644 index 000000000..c5bb3ffab --- /dev/null +++ b/tests/Integration/tests/confval/expected/objects.inv.json @@ -0,0 +1,26 @@ +{ + "std:doc": { + "index": [ + null, + null, + "index.html", + "Confval directive" + ] + }, + "std:label": { + "confval-directive": [ + null, + null, + "index.html#confval-directive", + "Confval directive" + ] + }, + "std:confval": { + "demo": [ + null, + null, + "index.html#demo", + "demo" + ] + } +} \ No newline at end of file diff --git a/tests/Integration/tests/confval/input/index.rst b/tests/Integration/tests/confval/input/index.rst new file mode 100644 index 000000000..b9eaf3664 --- /dev/null +++ b/tests/Integration/tests/confval/input/index.rst @@ -0,0 +1,14 @@ +Confval directive +================= + +.. confval:: demo + :type: :php:`string` + :default: ``"Hello World"`` + :required: true + :Custom Info: **custom** + + This is the confval ``demo`` content! + + Another paragraph. + +See option :confval:`demo`. \ No newline at end of file