File tree Expand file tree Collapse file tree 5 files changed +55
-9
lines changed
packages/guides-restructured-text/src/RestructuredText/Directives
graphs/plantuml-server-error/expected Expand file tree Collapse file tree 5 files changed +55
-9
lines changed Original file line number Diff line number Diff line change 2222use phpDocumentor \Guides \RestructuredText \Parser \InlineParser ;
2323use phpDocumentor \Guides \RestructuredText \Parser \Productions \Rule ;
2424use phpDocumentor \Guides \RestructuredText \TextRoles \GenericLinkProvider ;
25+ use Psr \Log \LoggerInterface ;
2526
2627use function boolval ;
2728use function in_array ;
29+ use function trim ;
2830
2931/**
3032 * The confval directive configuration values.
@@ -41,6 +43,7 @@ public function __construct(
4143 GenericLinkProvider $ genericLinkProvider ,
4244 private readonly AnchorNormalizer $ anchorReducer ,
4345 private readonly InlineParser $ inlineParser ,
46+ private readonly LoggerInterface |null $ logger = null ,
4447 ) {
4548 parent ::__construct ($ startingRule );
4649
@@ -71,6 +74,12 @@ protected function processSub(
7174 $ required = false ;
7275 $ default = null ;
7376 $ additionalOptions = [];
77+ if (trim ($ directive ->getData ()) === '' ) {
78+ if ($ this ->logger !== null ) {
79+ $ this ->logger ->warning ('A directive must have a title: .. confval:: [some_title] ' , $ blockContext ->getLoggerInformation ());
80+ }
81+ }
82+
7483 if ($ directive ->hasOption ('type ' )) {
7584 $ type = $ this ->inlineParser ->parse ($ directive ->getOption ('type ' )->toString (), $ blockContext );
7685 }
Original file line number Diff line number Diff line change 1+ <!-- content start -->
2+ < div class ="section " id ="confval-directive ">
3+ < h1 > Confval directive</ h1 >
4+ < dl class ="confval ">
5+ < dt id ="confval- ">
6+ < code class ="sig-name descname "> < span class ="pre "> </ span > </ code > </ dt >
7+ < dd >
8+ < div class ="line-block ">
9+ < div class ="line "> < strong > Type:</ strong > < code > "Hello World"</ code > </ div >
10+ < div class ="line "> < strong > Required:</ strong > true</ div >
11+ < div class ="line "> < strong > Custom Info:</ strong > < strong > custom</ strong > </ div >
12+
13+ </ div >
14+ < div class ="confval-description ">
15+
16+ < p > This is the confval < code > demo</ code > content!</ p >
17+
18+ < p > Another paragraph.</ p >
19+
20+ </ div >
21+ </ dd >
22+ </ dl >
23+ </ div >
24+ <!-- content end -->
Original file line number Diff line number Diff line change 1+ app.WARNING: A directive must have a title
Original file line number Diff line number Diff line change 1+ Confval directive
2+ =================
3+
4+ .. confval ::
5+ :type: :php: `string `
6+ :default: ``"Hello World" ``
7+ :required: true
8+ :Custom Info: **custom **
9+
10+ This is the confval ``demo `` content!
11+
12+ Another paragraph.
Original file line number Diff line number Diff line change 11<!-- content start -->
2- < div class ="section " id ="uml-directive ">
3- < h1 > Uml Directive</ h1 >
4- < figure
5- class ="uml-diagram "
6- style ="width: 1000 " > < figcaption > Figure 1-1: Application flow</ figcaption > </ figure >
7- < figure
8- class ="uml-diagram "
9- style ="width: 1000 " > < figcaption > Figure 1-1: Application flow</ figcaption > </ figure >
10- </ div >
2+ < div class ="section " id ="uml-directive ">
3+ < h1 > Uml Directive</ h1 >
4+ < figure
5+ class ="uml-diagram "
6+ style ="width: 1000 " > < figcaption > Figure 1-1: Application flow</ figcaption > </ figure >
7+ < figure
8+ class ="uml-diagram "
9+ style ="width: 1000 " > < figcaption > Figure 1-1: Application flow</ figcaption > </ figure >
10+ </ div >
1111<!-- content end -->
You can’t perform that action at this time.
0 commit comments