File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ Yii Framework 2 apidoc extension Change Log
55-----------------------
66
77- Enh #38 : Fixed display of default values given as octal or hex notation (hiqsol)
8+ - Enh: Display TOC only if there is more than one headline (cebe)
89
910
10112.1.0 November 22, 2016
Original file line number Diff line number Diff line change @@ -70,11 +70,12 @@ public function parse($text)
7070 */
7171 protected function applyToc ($ content )
7272 {
73- // generate TOC
74- if (!empty ($ this ->headings )) {
73+ // generate TOC if there is more than one headline
74+ if (!empty ($ this ->headings ) && count ( $ this -> headings ) > 1 ) {
7575 $ toc = [];
76- foreach ($ this ->headings as $ heading )
76+ foreach ($ this ->headings as $ heading ) {
7777 $ toc [] = '<li> ' . Html::a (strip_tags ($ heading ['title ' ]), '# ' . $ heading ['id ' ]) . '</li> ' ;
78+ }
7879 $ toc = '<div class="toc"><ol> ' . implode ("\n" , $ toc ) . "</ol></div> \n" ;
7980 if (strpos ($ content , '</h1> ' ) !== false )
8081 $ content = str_replace ('</h1> ' , "</h1> \n" . $ toc , $ content );
You can’t perform that action at this time.
0 commit comments