@@ -233,7 +233,17 @@ function buildChm( $cpp = true )
233
233
{
234
234
if ( $ e ->hasAttribute ("src " ))
235
235
{
236
- $ e ->setAttribute ("src " , basename ( $ e ->getAttribute ("src " )));
236
+ $ src = basename ($ e ->getAttribute ("src " ));
237
+ if ($ src ) {
238
+ $ idx = strrpos ($ src , '. ' );
239
+ if ($ idx ) {
240
+ $ idx_at = strrpos ($ src , '@ ' );
241
+ if ($ idx_at && $ idx < $ idx_at ) {
242
+ $ src = substr ($ src , 0 , $ idx_at );
243
+ }
244
+ }
245
+ }
246
+ $ e ->setAttribute ("src " , $ src );
237
247
}
238
248
}
239
249
}
@@ -370,20 +380,25 @@ function buildChm( $cpp = true )
370
380
echo ( "files: " .count ( $ arrFiles )."\n" );
371
381
foreach ( $ arrFiles as $ file )
372
382
{
373
- if ( endsWith ( $ file , '.css ' ))
374
- {
375
- copy ( $ file , $ targetDir .DIRECTORY_SEPARATOR .basename ( $ file ));
376
- echo ( "file copied: " .basename ( $ file )."\n" );
383
+ $ name = basename ($ file );
384
+ if ($ name ) {
385
+ $ idx = strrpos ($ name , '. ' );
386
+ if ($ idx ) {
387
+ $ idx_at = strrpos ($ name , '@ ' );
388
+ if ($ idx_at && $ idx < $ idx_at ) {
389
+ $ name = substr ($ name , 0 , $ idx_at );
390
+ }
391
+ }
377
392
}
378
- else if ( endsWith ( $ file , '.png ' ))
393
+ if ( endsWith ( $ name , '.css ' ))
379
394
{
380
395
copy ( $ file , $ targetDir .DIRECTORY_SEPARATOR .basename ( $ file ));
381
396
echo ( "file copied: " .basename ( $ file )."\n" );
382
397
}
383
- else if ( endsWith ( $ file , '.svg ' ))
398
+ else if ( endsWith ( $ name , '.png ' ) || endsWith ( $ name , ' . svg' ) || endsWith ( $ name , ' .gif ' ))
384
399
{
385
- copy ( $ file , $ targetDir .DIRECTORY_SEPARATOR .basename ( $ file ));
386
- echo ( "file copied: " .basename ( $ file ) ."\n" );
400
+ copy ( $ file , $ targetDir .DIRECTORY_SEPARATOR .basename ( $ name ));
401
+ echo ( "file copied: " .$ name ."\n" );
387
402
}
388
403
gc_collect_cycles ();
389
404
}
0 commit comments