@@ -140,17 +140,22 @@ md.use(require('markdown-it-container'), 'php-client-availability', {
140
140
return params . trim ( ) . match ( / ^ p h p - c l i e n t - a v a i l a b i l i t y ( .* ) $ / ) ;
141
141
} ,
142
142
render : function ( tokens , idx ) {
143
- var versionsAndEditions = tokens [ idx ] . info . trim ( ) . match ( / ^ p h p - c l i e n t - a v a i l a b i l i t y \s v e r s i o n s = ( .* ) \s e d i t i o n s = ( .* ) $ / ) ;
144
- var html = '' ;
143
+ let html = '' ;
145
144
if ( tokens [ idx ] . nesting === 1 ) {
146
- var versions = versionsAndEditions [ 1 ] . split ( ',' ) ;
147
- html += _ . reduce ( versions , function ( res , version ) {
148
- return res + ' <span class="label label-version">' + version + '</span>' ;
149
- } , '<p><em class="small text-primary">Available in the client versions:</em>' ) ;
150
- var editions = versionsAndEditions [ 2 ] . split ( ',' ) ;
151
- html += _ . reduce ( editions , function ( res , edition ) {
152
- return res + ' <span class="label label-info">' + edition + '</span>' ;
153
- } , '<em class="small text-primary"> | Available in the client editions:</em>' ) ;
145
+ const matchedVersions = tokens [ idx ] . info . trim ( ) . match ( / ^ p h p - c l i e n t - a v a i l a b i l i t y .* v e r s i o n s = ( .* ?) ( \s | $ ) / ) ;
146
+ if ( matchedVersions !== null ) {
147
+ const versions = matchedVersions [ 1 ] . split ( ',' ) ;
148
+ html += _ . reduce ( versions , function ( res , version ) {
149
+ return res + ' <span class="label label-version">' + version + '</span>' ;
150
+ } , '<p><em class="small text-primary">Available since PIM version:</em>' ) ;
151
+ }
152
+ const matchedEditions = tokens [ idx ] . info . trim ( ) . match ( / ^ p h p - c l i e n t - a v a i l a b i l i t y .* e d i t i o n s = ( .* ?) ( \s | $ ) / ) ;
153
+ if ( matchedEditions !== null ) {
154
+ const editions = matchedEditions [ 1 ] . split ( ',' ) ;
155
+ html += _ . reduce ( editions , function ( res , edition ) {
156
+ return res + ' <span class="label label-info">' + edition + '</span>' ;
157
+ } , '<em class="small text-primary"> | Available only in PIM edition:</em>' ) ;
158
+ }
154
159
} else {
155
160
html = '</p>' ;
156
161
}
0 commit comments