@@ -233,7 +233,17 @@ function buildChm( $cpp = true )
233233 {
234234 if ( $ e ->hasAttribute ("src " ))
235235 {
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 );
237247 }
238248 }
239249 }
@@ -370,20 +380,25 @@ function buildChm( $cpp = true )
370380 echo ( "files: " .count ( $ arrFiles )."\n" );
371381 foreach ( $ arrFiles as $ file )
372382 {
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+ }
377392 }
378- else if ( endsWith ( $ file , '.png ' ))
393+ if ( endsWith ( $ name , '.css ' ))
379394 {
380395 copy ( $ file , $ targetDir .DIRECTORY_SEPARATOR .basename ( $ file ));
381396 echo ( "file copied: " .basename ( $ file )."\n" );
382397 }
383- else if ( endsWith ( $ file , '.svg ' ))
398+ else if ( endsWith ( $ name , '.png ' ) || endsWith ( $ name , ' . svg' ) || endsWith ( $ name , ' .gif ' ))
384399 {
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" );
387402 }
388403 gc_collect_cycles ();
389404 }
0 commit comments