This repository was archived by the owner on Jul 29, 2024. It is now read-only.
File tree 3 files changed +30
-3
lines changed
3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 153
153
154
154
// Add short description.
155
155
if ( item . description ) {
156
- item . shortDescription =
157
- item . description . substring ( 0. , item . description . indexOf ( '.' ) + 1 ) ;
156
+ // Find the correct portion of the description
157
+
158
+ // The following parsing is OK most of the time
159
+ var sentenceEnd = item . description . indexOf ( '.' ) + 1 || Infinity ;
160
+ var paragraphEnd = item . description . indexOf ( '</p>' ) + 4 ;
161
+ if ( paragraphEnd == 3 ) {
162
+ paragraphEnd = Infinity
163
+ }
164
+ var shortDescription = item . description . substring ( 0 , Math . min (
165
+ item . description . length , sentenceEnd , paragraphEnd ) ) . trim ( ) ;
166
+
167
+ // Remove <p> tags
168
+ if ( shortDescription . substr ( 0 , 3 ) == '<p>' ) {
169
+ shortDescription = shortDescription . substr ( 3 ) ;
170
+ if ( shortDescription . substr ( - 4 ) == '</p>' ) {
171
+ shortDescription = shortDescription . substr ( 0 , shortDescription . length - 4 ) ;
172
+ }
173
+ }
174
+ item . shortDescription = shortDescription ;
175
+
176
+ if ( shortDescription . substr ( 0 , 3 ) == 'See' ) {
177
+ console . log ( item . description + ' -> ' + shortDescription ) ;
178
+ console . log ( [ sentenceEnd , paragraphEnd , item . description . length ] ) ;
179
+ }
158
180
}
159
181
} ) ;
160
182
Original file line number Diff line number Diff line change 56
56
scope : {
57
57
list : '=ptorFunctionList'
58
58
} ,
59
+ controller : function ( $scope , $sce ) {
60
+ $scope . trust = function ( html ) {
61
+ return $sce . trustAsHtml ( html ) ;
62
+ } ;
63
+ } ,
59
64
templateUrl : 'partials/ptor-function-list.html'
60
65
} ;
61
66
} ) ;
Original file line number Diff line number Diff line change 14
14
ng-bind ="item.displayName ">
15
15
</ a >
16
16
</ td >
17
- < td ng-bind =" item.shortDescription "> </ td >
17
+ < td ng-bind-html =" trust( item.shortDescription) "> </ td >
18
18
</ tr >
19
19
</ tbody >
20
20
</ table >
You can’t perform that action at this time.
0 commit comments