55namespace App \Web \Documentation ;
66
77use Tempest \Support \Arr \ImmutableArray ;
8+ use Tempest \Support \Str ;
89use Tempest \View \IsView ;
910use Tempest \View \View ;
1011
@@ -35,14 +36,14 @@ public function isCurrent(Chapter $other): bool
3536 public function getSubChapters (): array
3637 {
3738 // TODO(@innocenzi): clean up
38- preg_match_all ('/<h2.*>.*<a.*href="(?<uri>.*?)".*<\/span>(?<title>.*)<\/a><\/h2>/ ' , $ this ->currentChapter ->body , $ h2Matches );
39- preg_match_all ('/<h3.*>.*<a.*href="(?<h3uri>.*?)".*<\/span>(?<h3title>.*)<\/a><\/h3>/ ' , $ this ->currentChapter ->body , $ h3Matches );
39+ preg_match_all ('/<h2.*>.*<a.*href="(?<uri>.*?)".*? <\/span>(?<title>.*)<\/a><\/h2>/ ' , $ this ->currentChapter ->body , $ h2Matches );
40+ preg_match_all ('/<h3.*>.*<a.*href="(?<h3uri>.*?)".*? <\/span>(?<h3title>.*)<\/a><\/h3>/ ' , $ this ->currentChapter ->body , $ h3Matches );
4041
4142 $ subChapters = [];
4243
4344 foreach ($ h2Matches [0 ] as $ key => $ match ) {
4445 $ h2Uri = $ h2Matches ['uri ' ][$ key ];
45- $ h2Title = $ h2Matches ['title ' ][$ key ];
46+ $ h2Title = Str \strip_tags ( $ h2Matches ['title ' ][$ key ]) ;
4647 $ subChapters [$ h2Uri ] = [
4748 'title ' => $ h2Title ,
4849 'children ' => [],
@@ -51,7 +52,7 @@ public function getSubChapters(): array
5152
5253 foreach ($ h3Matches [0 ] as $ key => $ match ) {
5354 $ h3Uri = $ h3Matches ['h3uri ' ][$ key ];
54- $ h3Title = $ h3Matches ['h3title ' ][$ key ];
55+ $ h3Title = Str \strip_tags ( $ h3Matches ['h3title ' ][$ key ]) ;
5556 $ parentH2Uri = null ;
5657 $ h3Position = strpos ($ this ->currentChapter ->body , $ match );
5758
0 commit comments