File tree 5 files changed +55
-9
lines changed
packages/guides-restructured-text/src/RestructuredText/Directives
graphs/plantuml-server-error/expected
5 files changed +55
-9
lines changed Original file line number Diff line number Diff line change 22
22
use phpDocumentor \Guides \RestructuredText \Parser \InlineParser ;
23
23
use phpDocumentor \Guides \RestructuredText \Parser \Productions \Rule ;
24
24
use phpDocumentor \Guides \RestructuredText \TextRoles \GenericLinkProvider ;
25
+ use Psr \Log \LoggerInterface ;
25
26
26
27
use function boolval ;
27
28
use function in_array ;
29
+ use function trim ;
28
30
29
31
/**
30
32
* The confval directive configuration values.
@@ -41,6 +43,7 @@ public function __construct(
41
43
GenericLinkProvider $ genericLinkProvider ,
42
44
private readonly AnchorNormalizer $ anchorReducer ,
43
45
private readonly InlineParser $ inlineParser ,
46
+ private readonly LoggerInterface |null $ logger = null ,
44
47
) {
45
48
parent ::__construct ($ startingRule );
46
49
@@ -71,6 +74,12 @@ protected function processSub(
71
74
$ required = false ;
72
75
$ default = null ;
73
76
$ 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
+
74
83
if ($ directive ->hasOption ('type ' )) {
75
84
$ type = $ this ->inlineParser ->parse ($ directive ->getOption ('type ' )->toString (), $ blockContext );
76
85
}
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 1
1
<!-- 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 >
11
11
<!-- content end -->
You can’t perform that action at this time.
0 commit comments